@agile-team/mach-report 2.10.0 → 2.11.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 (111) hide show
  1. package/README.md +6 -2
  2. package/dist/ExcelBindingWizard-CjIiVox-.cjs +1 -0
  3. package/dist/ExcelBindingWizard-Dxm-K5HL.js +1240 -0
  4. package/dist/ParamEditor-D-Hf5xfO.cjs +1 -0
  5. package/dist/ParamEditor-DRGxzxeO.js +381 -0
  6. package/dist/ReportBatchPanel-BYgg0EDB.cjs +1 -0
  7. package/dist/ReportBatchPanel-Bby5yLzU.js +287 -0
  8. package/dist/ReportPreview-DWXROHBP.cjs +6 -0
  9. package/dist/ReportPreview-DiNXhQI0.js +4138 -0
  10. package/dist/ReportTemplateLibrary-C6CO7YCT.cjs +1 -0
  11. package/dist/ReportTemplateLibrary-DfzDXRvr.js +260 -0
  12. package/dist/RuleEditor-C2QsOHOs.cjs +1 -0
  13. package/dist/RuleEditor-D9wQHrkf.js +2024 -0
  14. package/dist/TemplateReviewPanel-BKofGrV9.js +222 -0
  15. package/dist/TemplateReviewPanel-DwtOcLue.cjs +1 -0
  16. package/dist/analytics.cjs +1 -1
  17. package/dist/analytics.d.cts +2 -0
  18. package/dist/analytics.d.ts +2 -0
  19. package/dist/analytics.js +29 -29
  20. package/dist/batch-Bt3Fd27Z.cjs +1 -0
  21. package/dist/batch-mRqhhhjt.js +364 -0
  22. package/dist/computed-Bvk0W15F.js +521 -0
  23. package/dist/computed-CGV2a809.cjs +1 -0
  24. package/dist/config-B612mw0x.js +525 -0
  25. package/dist/config-BRoLo2oj.cjs +1 -0
  26. package/dist/designer.cjs +2 -2
  27. package/dist/designer.d.cts +659 -9
  28. package/dist/designer.d.ts +659 -9
  29. package/dist/designer.js +2030 -1824
  30. package/dist/index.cjs +8 -8
  31. package/dist/index.d.cts +147 -3
  32. package/dist/index.d.ts +147 -3
  33. package/dist/index.js +639 -592
  34. package/dist/injection-keys-Db_DyLkm.cjs +1 -0
  35. package/dist/injection-keys-e85udZCp.js +7 -0
  36. package/dist/list-cell-BuYn4tGF.cjs +1 -0
  37. package/dist/{list-cell-Dxyi7DOw.js → list-cell-ClFra1zS.js} +54 -40
  38. package/dist/matrix-DVyWiYsd.cjs +1 -0
  39. package/dist/matrix-yZsGnldA.js +227 -0
  40. package/dist/param-validation-BlHHXs6u.js +153 -0
  41. package/dist/param-validation-DCK039V1.cjs +1 -0
  42. package/dist/pdf.cjs +25 -25
  43. package/dist/pdf.d.cts +3 -0
  44. package/dist/pdf.d.ts +3 -0
  45. package/dist/pdf.js +677 -677
  46. package/dist/plugin-BDTU4D94.cjs +1 -0
  47. package/dist/plugin-Cd5G2QQn.js +22 -0
  48. package/dist/region-binding-workflow-CXDmt9Bs.js +977 -0
  49. package/dist/region-binding-workflow-DhQvu1co.cjs +3 -0
  50. package/dist/{report-params-B_VCihAh.js → report-params-B44imUd4.js} +1 -1
  51. package/dist/{report-params-CjWrjPl6.cjs → report-params-SJfhKgaX.cjs} +1 -1
  52. package/dist/server/node.d.cts +5 -2
  53. package/dist/server/node.d.ts +5 -2
  54. package/dist/server-node.cjs +1 -1
  55. package/dist/server-node.js +87 -87
  56. package/dist/server.cjs +1 -1
  57. package/dist/server.d.cts +201 -2
  58. package/dist/server.d.ts +201 -2
  59. package/dist/server.js +557 -658
  60. package/dist/style.css +1 -1
  61. package/dist/template-registry-WNXdkiET.js +506 -0
  62. package/dist/template-registry-ukBGlm8N.cjs +1 -0
  63. package/dist/template-review-BXp2oyqg.cjs +1 -0
  64. package/dist/template-review-BdcXSYbx.js +1616 -0
  65. package/dist/tree-BX380Rr7.cjs +1 -0
  66. package/dist/tree-CqcQ99NM.js +172 -0
  67. package/dist/{validate-UUy9yP4K.js → validate-7s0yn6ii.js} +44 -44
  68. package/dist/validate-DsRiNw8h.cjs +1 -0
  69. package/dist/vue/async.d.cts +93 -4
  70. package/dist/vue/async.d.ts +93 -4
  71. package/dist/vue/index.d.cts +145 -7
  72. package/dist/vue/index.d.ts +145 -7
  73. package/dist/vue-async.cjs +1 -1
  74. package/dist/vue-async.js +5 -5
  75. package/dist/vue.cjs +1 -1
  76. package/dist/vue.js +116 -113
  77. package/dist/{workbook-session-B-bW5_yR.js → workbook-session-BKOTwcoq.js} +1 -1
  78. package/dist/{workbook-session-D7RtdNo0.cjs → workbook-session-CLYLhZWu.cjs} +1 -1
  79. package/dist/worker.cjs +1 -1
  80. package/dist/worker.d.cts +5 -2
  81. package/dist/worker.d.ts +5 -2
  82. package/dist/worker.js +1 -1
  83. package/dist/xlsx.cjs +3 -3
  84. package/dist/xlsx.d.cts +129 -2
  85. package/dist/xlsx.d.ts +129 -2
  86. package/dist/xlsx.js +336 -242
  87. package/package.json +1 -1
  88. package/dist/ExcelBindingWizard-CF7RplWm.cjs +0 -1
  89. package/dist/ExcelBindingWizard-qhwEderR.js +0 -842
  90. package/dist/ReportPreview-BE1tCHqE.js +0 -4604
  91. package/dist/ReportPreview-QKRKQOe3.cjs +0 -6
  92. package/dist/RuleEditor-BA36yIV6.js +0 -1723
  93. package/dist/RuleEditor-CczJ6mJm.cjs +0 -1
  94. package/dist/TemplateReviewPanel-CHi4Alqa.cjs +0 -1
  95. package/dist/TemplateReviewPanel-Dz0G5o83.js +0 -217
  96. package/dist/binding-preview-BWsdf_z2.cjs +0 -2
  97. package/dist/binding-preview-DILq0-0f.js +0 -649
  98. package/dist/decimal-CI1OAczk.js +0 -87
  99. package/dist/decimal-CQA0xJex.cjs +0 -1
  100. package/dist/list-cell-CyM1ZlRN.cjs +0 -1
  101. package/dist/matrix-BbXarwyk.js +0 -661
  102. package/dist/matrix-Cm65WLLP.cjs +0 -1
  103. package/dist/param-validation-BWNjLcN0.js +0 -116
  104. package/dist/param-validation-CiTxFeZ8.cjs +0 -1
  105. package/dist/plugin-CThk42vJ.cjs +0 -1
  106. package/dist/plugin-tGn7-5oF.js +0 -25
  107. package/dist/template-registry-CGWTLtIA.cjs +0 -1
  108. package/dist/template-registry-DzlQs3OF.js +0 -434
  109. package/dist/template-review-D1RoNCPw.cjs +0 -1
  110. package/dist/template-review-fnteXRng.js +0 -1473
  111. package/dist/validate-Bf6ccFr2.cjs +0 -1
@@ -1,4604 +0,0 @@
1
- import { computed as z, unref as d, ref as V, onScopeDispose as Ke, watch as le, getCurrentScope as Fa, shallowRef as fe, nextTick as He, onMounted as Pt, onBeforeUnmount as Oa, defineComponent as Ie, openBlock as E, createElementBlock as P, createElementVNode as h, createVNode as te, createTextVNode as ue, toDisplayString as x, Fragment as he, renderList as be, createCommentVNode as N, withModifiers as ft, withDirectives as on, withKeys as Qt, vModelText as rn, createBlock as Ae, normalizeClass as ke, renderSlot as mt, getCurrentInstance as ln, onUnmounted as un, createStaticVNode as La, isRef as Kn, inject as kt, provide as Wn, watchEffect as za, normalizeStyle as Ne, createSlots as qa, withCtx as Ut } from "vue";
2
- import { renderPage as Un, renderPlanToImages as Ba, calculateReportSelection as Na, ReportCalculationError as ja, ReportParamValidationError as Ha, ReportSourceError as Ka, inspectOutputCapabilities as Wa, validateReportParams as Vn, createReportCellResolver as Et, getReportEditSession as cn, ReportCellEditError as Fe, reportCellEditKey as Ue, summarizeReportCellEdits as An, createReportCellEditBatch as _t, parseReportCellFieldInput as Ua, applyReportEditResult as Va, applyReportCellEditBatch as Ga, getReportCellContext as tt, validateReportCellFieldDefinition as Ja, parseReportClipboard as Za, formatReportClipboard as Ya, resolvePlanAssets as Xa, paginateTemplate as Qa, validateRenderPlan as _a, renderPlanToCanvas as es } from "@agile-team/mach-report";
3
- import { c as Gn } from "./page-window-index-CIuT4BAv.js";
4
- import { a as je, n as Fn, w as at, f as ts } from "./progress-7OSZbFok.js";
5
- import { i as ns, a as as } from "./render-plan-Ck6koX9L.js";
6
- import { a as ae, _ as $e } from "./_plugin-vue_export-helper-8SL1F89S.js";
7
- import { r as dn } from "./grid-geometry-BNptEcMm.js";
8
- import { b as en, c as ss, d as os, a as rs } from "./plugin-tGn7-5oF.js";
9
- function Jn(e) {
10
- return e == null ? [] : Array.isArray(e) ? e.map(String).filter((t) => t !== "") : String(e).split(",").map((t) => t.trim()).filter((t) => t !== "");
11
- }
12
- function Hi(e) {
13
- return Jn(e).join(",");
14
- }
15
- class Vt extends Error {
16
- constructor(t) {
17
- super(t), this.name = "PlanLoadError";
18
- }
19
- }
20
- function Ki(e = {}) {
21
- const { baseUrl: t = "", headers: n, credentials: a, timeoutMs: s = 3e4 } = e, o = t.replace(/\/+$/, "");
22
- return async ({ url: r, method: l, params: u, signal: p }) => {
23
- let v = `${o}${r}`;
24
- if (u && Object.keys(u).length > 0) {
25
- const i = v.indexOf("#"), R = i >= 0 ? v.slice(i) : "", b = i >= 0 ? v.slice(0, i) : v, S = b.indexOf("?"), F = S >= 0 ? b.slice(0, S) : b, q = new URLSearchParams(S >= 0 ? b.slice(S + 1) : "");
26
- for (const [j, Z] of Object.entries(u)) q.set(j, Z);
27
- v = `${F}?${q}${R}`;
28
- }
29
- const g = (i, R) => {
30
- const b = new Vt(i);
31
- return Object.defineProperty(b, "cause", { value: R, configurable: !0, writable: !0 }), b;
32
- };
33
- if (p?.aborted)
34
- throw g(`请求已取消: ${r}`, p.reason);
35
- const m = new AbortController();
36
- let w;
37
- const y = () => {
38
- m.signal.aborted || (w = "external", m.abort(p?.reason));
39
- };
40
- p?.addEventListener("abort", y, { once: !0 });
41
- const c = setTimeout(() => {
42
- m.signal.aborted || (w = "timeout", m.abort());
43
- }, s);
44
- try {
45
- const i = await fetch(v, {
46
- method: l.toUpperCase(),
47
- headers: { Accept: "application/json", ...n },
48
- credentials: a,
49
- signal: m.signal
50
- });
51
- if (!i.ok)
52
- throw new Vt(`HTTP ${i.status} ${r}`);
53
- return await i.json();
54
- } catch (i) {
55
- throw w === "timeout" ? g(`请求超时(${s}ms): ${r}`, i) : w === "external" ? g(`请求已取消: ${r}`, i) : i instanceof Vt ? i : g(`请求失败(${r}): ${i instanceof Error ? i.message : String(i)}`, i);
56
- } finally {
57
- clearTimeout(c), p?.removeEventListener("abort", y);
58
- }
59
- };
60
- }
61
- function ls(e, t, n = {}) {
62
- const a = n.pxPerMm ?? 3.7795275590551185, s = z(() => Math.max(0, d(n.gapPx) ?? 18)), o = V(0), r = V(800), l = z(() => {
63
- const i = e.value?.pages ?? [];
64
- return Gn(i.map((R) => R.pageHeightMm * a), s.value);
65
- }), u = z(() => {
66
- let i = 0;
67
- for (const R of e.value?.pages ?? []) i = Math.max(i, R.pageWidthMm * a);
68
- return { w: i, h: l.value.totalHeightPx };
69
- }), p = z(() => l.value.window(
70
- r.value / t.value,
71
- o.value / t.value,
72
- d(n.overscan) ?? 1
73
- )), v = z(() => {
74
- const i = e.value;
75
- if (!i) return [];
76
- const { start: R, end: b } = p.value;
77
- return i.pages.slice(R, b + 1).map((S, F) => ({ page: S, index: R + F }));
78
- });
79
- let g = 0, m = !1;
80
- function w(i) {
81
- i && (o.value = i.scrollTop, r.value = i.clientHeight || 800);
82
- }
83
- function y(i, R) {
84
- return (b) => {
85
- g || m || (g = requestAnimationFrame(() => {
86
- if (g = 0, m || (w(b), R.value <= 0)) return;
87
- const S = Math.max(0, b.scrollTop + 32) / t.value;
88
- i.value = Math.min(R.value, l.value.pageAt(S) + 1);
89
- }));
90
- };
91
- }
92
- function c() {
93
- m = !0, g && cancelAnimationFrame(g), g = 0;
94
- }
95
- return Ke(c), {
96
- contentSize: u,
97
- windowRange: p,
98
- visiblePages: v,
99
- makeScrollHandler: y,
100
- refreshViewport: w,
101
- pageOffsetPx: (i) => l.value.offsetAt(i),
102
- destroy: c
103
- };
104
- }
105
- const On = 96 / 25.4;
106
- function is(e) {
107
- const t = /* @__PURE__ */ new WeakMap(), n = V(0);
108
- let a, s = 0, o = 0, r = !1;
109
- function l() {
110
- s++, o && cancelAnimationFrame(o), o = 0;
111
- }
112
- function u(c, i, R, b) {
113
- return !r && i === s && e.plan.value === R && e.root.value === b && b.contains(c.holder) && Number(c.holder.dataset.page) === c.index + 1;
114
- }
115
- function p(c) {
116
- const { holder: i, page: R } = c;
117
- t.delete(i), i.style.width = `${R.pageWidthMm * On}px`, i.style.height = `${R.pageHeightMm * On}px`, i.setAttribute("aria-busy", "true");
118
- const b = i.ownerDocument.createElement("div");
119
- b.className = "mrp-page-loading";
120
- const S = i.ownerDocument.createElement("span");
121
- S.textContent = e.loading(), S.style.transform = `scale(${1 / Math.max(1e-4, e.zoom())})`, b.append(S), i.replaceChildren(b);
122
- }
123
- function v(c) {
124
- const i = t.get(c.holder);
125
- return !i || i.page !== c.page || i.element.parentElement !== c.holder ? !1 : (i.query !== e.query() && (e.clear(i.element), e.highlight(i.element), i.query = e.query()), !0);
126
- }
127
- function g(c, i, R, b) {
128
- if (u(c, i, R, b))
129
- try {
130
- const S = Un(c.page, 96, {}, c.holder.ownerDocument);
131
- if (e.highlight(S), !u(c, i, R, b)) return;
132
- c.holder.replaceChildren(S), c.holder.removeAttribute("aria-busy"), t.set(c.holder, { page: c.page, element: S, query: e.query() }), e.mounted(c.holder), e.ready();
133
- } catch (S) {
134
- if (!u(c, i, R, b)) return;
135
- c.holder.removeAttribute("aria-busy");
136
- const F = c.holder.ownerDocument.createElement("div");
137
- F.className = "mrp-page-render-error", F.setAttribute("role", "alert"), F.textContent = S instanceof Error ? S.message : String(S), c.holder.replaceChildren(F), e.error(S);
138
- }
139
- }
140
- function m(c, i, R, b) {
141
- c.length && (o = requestAnimationFrame(() => {
142
- if (i !== s || r) return;
143
- o = 0;
144
- const S = c.shift();
145
- S && g(S, i, R, b), i === s && e.plan.value === R && e.root.value === b && m(c, i, R, b);
146
- }));
147
- }
148
- function w() {
149
- l();
150
- const c = e.plan.value, i = e.root.value;
151
- if (r || !c || !i) {
152
- a = void 0;
153
- return;
154
- }
155
- const R = s, b = a?.plan === c ? a.index : e.priority();
156
- a = void 0;
157
- const S = [];
158
- i.querySelectorAll(".mrp-page-holder").forEach((j) => {
159
- const Z = Number(j.dataset.page) - 1, _ = c.pages[Z];
160
- if (!_) return;
161
- const Y = { holder: j, page: _, index: Z };
162
- v(Y) || (p(Y), S.push(Y));
163
- });
164
- const F = S.findIndex((j) => j.index === b), q = F < 0 ? void 0 : S.splice(F, 1)[0];
165
- q && g(q, R, c, i), e.ready(), m(S, R, c, i);
166
- }
167
- function y(c) {
168
- r || !e.plan.value || (a = { plan: e.plan.value, index: c }, n.value++);
169
- }
170
- return le([e.plan, e.root, e.pages, e.priority, e.focusToken, e.query, e.zoom, e.loading, n], w, { flush: "post", immediate: !0 }), Ke(() => {
171
- r = !0, a = void 0, l();
172
- }), { prioritize: y, cancel: l };
173
- }
174
- function us(e) {
175
- const t = V(1), n = V("fit");
176
- let a = 0;
177
- function s() {
178
- a && cancelAnimationFrame(a), a = 0;
179
- }
180
- function o() {
181
- s(), a = requestAnimationFrame(() => {
182
- if (a = 0, n.value !== "fit") return;
183
- const l = e();
184
- !l?.viewport || l.viewport.clientWidth <= 48 || !Number.isFinite(l.pageWidthPx) || (t.value = Math.min(1, (l.viewport.clientWidth - 48) / Math.max(1, l.pageWidthPx)));
185
- });
186
- }
187
- function r(l) {
188
- if (l === "fit")
189
- n.value = "fit", o();
190
- else {
191
- if (!Number.isFinite(l)) return;
192
- s(), n.value = "raw", t.value = Math.min(3, Math.max(0.3, l / 100));
193
- }
194
- }
195
- return Fa() && Ke(s), { zoom: t, zoomMode: n, applyFitZoom: o, setZoom: r };
196
- }
197
- let cs = 0;
198
- function Ln(e, t) {
199
- const n = new AbortController();
200
- let a = { taskId: `mr-output-${Date.now().toString(36)}-${++cs}`, kind: e, stage: e === "print" ? "print" : "encode", status: "running", cancellable: !0 };
201
- function s() {
202
- try {
203
- t?.(Object.freeze({ ...a }));
204
- } catch {
205
- }
206
- }
207
- return {
208
- controller: n,
209
- get task() {
210
- return a;
211
- },
212
- start: s,
213
- update(o, r, l) {
214
- n.signal.aborted || a.status !== "running" || (a = { ...a, stage: o, completed: r, total: l }, s());
215
- },
216
- finish(o = "completed") {
217
- a.status === "running" && (a = { ...a, status: o, cancellable: !1 }, s(), o === "cancelled" && n.abort());
218
- }
219
- };
220
- }
221
- const nt = 8;
222
- function dt() {
223
- return new Promise((e) => setTimeout(e, 0));
224
- }
225
- function yt(e) {
226
- return `p${e.pageWidthMm}x${e.pageHeightMm}`.replace(/[.+]/g, "_");
227
- }
228
- function Ct(e) {
229
- const t = /* @__PURE__ */ new Map();
230
- return e.pages.forEach((s) => {
231
- t.has(yt(s)) || t.set(yt(s), s);
232
- }), `<!doctype html><html><head><meta charset="utf-8"><style>${`.mr-page{margin:0 auto;page-break-after:always;}
233
- .mr-page tr{break-inside:avoid;page-break-inside:avoid;}
234
- .mr-comp{break-inside:avoid;page-break-inside:avoid;}
235
- ${[...t.values()].map(
236
- (s) => `@page ${yt(s)}{size:${s.pageWidthMm}mm ${s.pageHeightMm}mm;margin:0;}`
237
- ).join(`
238
- `)}
239
- body{margin:0;background:#fff;}`}</style></head><body>`;
240
- }
241
- function It(e) {
242
- const t = Un(e, 96, {}, document);
243
- return t.style.page = yt(e), t.outerHTML;
244
- }
245
- function ds(e) {
246
- return { head: Ct(e), pageChunks: e.pages.map(It) };
247
- }
248
- async function Wi(e, t = {}) {
249
- const n = {
250
- schemaVersion: "mach-report-batch-print",
251
- pages: e.flatMap((r) => r.pages)
252
- };
253
- if (n.pages.length === 0) return;
254
- const a = Ct(n), s = document.createElement("iframe");
255
- s.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(s);
256
- let o = !1;
257
- try {
258
- const r = s.contentDocument;
259
- r.open(), r.write(a);
260
- for (let l = 0; l < n.pages.length; l++)
261
- je(t.signal), r.write(It(n.pages[l])), l % nt === nt - 1 && (Fn(t, l + 1, n.pages.length), await dt());
262
- r.write("</body></html>"), r.close(), await dt(), Fn(t, n.pages.length, n.pages.length), o = !0, s.contentWindow?.focus(), s.contentWindow?.print();
263
- } catch (r) {
264
- if (t.signal?.aborted) throw r;
265
- t.onError?.(r instanceof Error ? `批量打印失败: ${r.message}` : "批量打印失败");
266
- } finally {
267
- o ? setTimeout(() => s.remove(), 6e4) : s.remove();
268
- }
269
- }
270
- function Zn(e) {
271
- return `<!doctype html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="utf-8"><!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View><w:Zoom>100</w:Zoom></w:WordDocument></xml><![endif]-->${e.replace(/^<!doctype html><html><head>/, "")}`;
272
- }
273
- function Ui(e) {
274
- const { head: t, pageChunks: n } = ds(e);
275
- return {
276
- html: `${Zn(t)}${n.join("")}</body></html>`,
277
- filename: "mach-report.doc"
278
- };
279
- }
280
- function fs(e, t) {
281
- let n = null, a = !1, s = !1, o = 0, r = 0;
282
- const l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
283
- let p = null;
284
- const v = /* @__PURE__ */ new Map();
285
- let g = null, m = null, w = null, y = null, c = null;
286
- function i(I, T) {
287
- return !s && e.value === I && o === T;
288
- }
289
- function R() {
290
- if (s) return;
291
- const I = [...u.values()].reverse().find((T) => i(T.plan, T.epoch))?.format ?? null;
292
- I !== g && (g = I, t.onBusy?.(I));
293
- }
294
- function b(I, T, H) {
295
- const K = {};
296
- return u.set(K, { plan: I, epoch: T, format: H, run: Ln("export", t.onTask) }), u.get(K).run.start(), R(), K;
297
- }
298
- function S(I) {
299
- u.get(I)?.run.finish(), u.delete(I), R();
300
- }
301
- function F() {
302
- for (const [I, T] of v)
303
- i(T.plan, T.epoch) || (I.close(), v.delete(I));
304
- }
305
- function q(I = !0) {
306
- if (I) {
307
- r++;
308
- for (const T of l) T.close();
309
- l.clear();
310
- }
311
- for (const T of u.values()) T.run.finish("cancelled");
312
- p?.finish("cancelled"), o++, Z(), R(), F();
313
- }
314
- const j = le(e, () => q(!1), { flush: "sync" });
315
- function Z() {
316
- n?.remove(), n = null;
317
- }
318
- function _() {
319
- q(), s = !0, o++, j(), Z(), F(), u.clear(), t.onPrinting?.(!1);
320
- }
321
- function Y(I, T) {
322
- const H = URL.createObjectURL(I);
323
- setTimeout(() => URL.revokeObjectURL(H), 1e4);
324
- const K = document.createElement("a");
325
- K.href = H, K.download = T, K.click();
326
- }
327
- function ee(I, T, H, K, Q) {
328
- H.update("download"), i(I, T) && !H.controller.signal.aborted && Y(K, Q);
329
- }
330
- async function ie(I, T, H, K) {
331
- const Q = I.contentDocument;
332
- Q.open(), Q.write(Ct(T));
333
- for (let X = 0; X < T.pages.length; X++)
334
- if (K.controller.signal.aborted || (Q.write(It(T.pages[X])), K.update("print", X + 1, T.pages.length), X % nt === nt - 1 && await dt(), I !== n)) return !1;
335
- return Q.write("</body></html>"), Q.close(), await dt(), !(!i(T, H) || I !== n);
336
- }
337
- function ye() {
338
- const I = r, T = (K) => K && !s && I === r, H = (K) => (!s && I === r && t.onError(K instanceof Error ? K.message : "报表修改尚未完成", "export"), !1);
339
- try {
340
- const K = t.beforeOutput?.() ?? !0;
341
- return typeof K == "boolean" ? T(K) : K.then(T, H);
342
- } catch (K) {
343
- return H(K);
344
- }
345
- }
346
- function ce(I) {
347
- const T = ye();
348
- return typeof T == "boolean" ? T ? I() : Promise.resolve() : T.then((H) => H ? I() : void 0);
349
- }
350
- async function C() {
351
- if (a) return;
352
- const I = e.value;
353
- if (s || !I || I.pages.length === 0) return;
354
- const T = o;
355
- a = !0;
356
- const H = Ln("print", t.onTask);
357
- p = H, H.start(), t.onPrinting?.(!0), Z(), n = document.createElement("iframe"), n.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(n);
358
- const K = n;
359
- try {
360
- if (!i(I, T) || H.controller.signal.aborted) {
361
- Z();
362
- return;
363
- }
364
- if (!await ie(K, I, T, H)) return;
365
- K.contentWindow?.focus(), K.contentWindow?.print();
366
- } catch {
367
- H.finish("failed"), K === n && Z(), i(I, T) && t.onError("调用打印失败,请改用导出 PDF", "print");
368
- } finally {
369
- H.finish(), p === H && (p = null), a = !1, s || t.onPrinting?.(!1);
370
- }
371
- }
372
- function A(I, T, H) {
373
- return {
374
- signal: H.controller.signal,
375
- onDiagnostic: (K) => {
376
- i(I, T) && !H.controller.signal.aborted && t.onDiagnostic?.(K);
377
- },
378
- onProgress: (K, Q) => H.update("encode", K, Q)
379
- };
380
- }
381
- function k(I, T, H) {
382
- if (m?.plan === I && m.epoch === T) return m.promise;
383
- const K = Promise.resolve().then(() => {
384
- if (!i(I, T)) throw new Error("报表已切换或卸载");
385
- return at(t.getPdfExporter()(I, (Q) => {
386
- i(I, T) && t.onWarning?.(Q);
387
- }, H ? A(I, T, H) : void 0), H?.controller.signal);
388
- }).finally(() => {
389
- m?.promise === K && (m = null);
390
- });
391
- return m = { plan: I, epoch: T, promise: K }, K;
392
- }
393
- async function M() {
394
- const I = e.value;
395
- if (s || !I || I.pages.length === 0) return;
396
- const T = o;
397
- if (w?.plan === I && w.epoch === T) return w.promise;
398
- const H = b(I, T, "PDF"), K = (async () => {
399
- try {
400
- const Q = u.get(H).run, X = await k(I, T, Q);
401
- if (!i(I, T)) return;
402
- ee(I, T, Q, new Blob([X], { type: "application/pdf" }), "mach-report.pdf");
403
- } catch (Q) {
404
- u.get(H)?.run.finish("failed"), i(I, T) && t.onError(Q instanceof Error ? `PDF 导出失败: ${Q.message}` : "PDF 导出失败", "pdf");
405
- } finally {
406
- S(H), w?.token === H && (w = null);
407
- }
408
- })();
409
- return w = { plan: I, epoch: T, promise: K, token: H }, K;
410
- }
411
- async function O() {
412
- const I = e.value;
413
- if (s || !I || I.pages.length === 0) return;
414
- const T = o;
415
- if (y?.plan === I && y.epoch === T) return y.promise;
416
- const H = { ...t.getXlsxOptions?.() }, K = b(I, T, "Excel"), Q = (async () => {
417
- try {
418
- const { renderPlanToXlsx: X } = await import("@agile-team/mach-report/xlsx");
419
- if (!i(I, T)) return;
420
- const we = u.get(K).run, { buffer: xe, warnings: Te } = await at(X(I, { ...H, ...A(I, T, we) }), we.controller.signal);
421
- if (!i(I, T) || (Te.length > 0 && t.onWarning?.(`Excel 导出有 ${Te.length} 条提示:${Te.slice(0, 2).join(";")}`), !i(I, T))) return;
422
- ee(I, T, we, new Blob([xe], {
423
- type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
424
- }), "mach-report.xlsx");
425
- } catch (X) {
426
- u.get(K)?.run.finish("failed"), i(I, T) && t.onError(X instanceof Error ? `Excel 导出失败: ${X.message}` : "Excel 导出失败", "export");
427
- } finally {
428
- S(K), y?.token === K && (y = null);
429
- }
430
- })();
431
- return y = { plan: I, epoch: T, promise: Q, token: K }, Q;
432
- }
433
- async function D() {
434
- const I = e.value;
435
- if (s || !I || I.pages.length === 0) return;
436
- const T = o;
437
- if (c?.plan === I && c.epoch === T) return c.promise;
438
- const H = b(I, T, "图片"), K = (async () => {
439
- try {
440
- const Q = u.get(H).run, { blobs: X } = await at(Ba(I, {
441
- ...A(I, T, Q),
442
- dpr: Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1)
443
- }), Q.controller.signal);
444
- if (!i(I, T)) return;
445
- X.forEach((we, xe) => {
446
- ee(I, T, Q, we, X.length > 1 ? `mach-report-page-${xe + 1}.png` : "mach-report.png");
447
- });
448
- } catch (Q) {
449
- u.get(H)?.run.finish("failed"), i(I, T) && t.onError(
450
- Q instanceof Error ? `图片导出失败: ${Q.message}` : "图片导出失败",
451
- "export"
452
- );
453
- } finally {
454
- S(H), c?.token === H && (c = null);
455
- }
456
- })();
457
- return c = { plan: I, epoch: T, promise: K, token: H }, K;
458
- }
459
- async function W(I) {
460
- const T = e.value;
461
- if (s || !T || !T.pages.length) return;
462
- const H = o, K = b(T, H, I === "word" ? "Word" : "HTML"), Q = u.get(K).run;
463
- try {
464
- const X = [];
465
- for (const [Te, gt] of T.pages.entries()) {
466
- if (!i(T, H)) return;
467
- X.push(It(gt)), Q.update("encode", Te + 1, T.pages.length), Te % nt === nt - 1 && await dt();
468
- }
469
- if (!i(T, H)) return;
470
- const we = Ct(T), xe = `${I === "word" ? Zn(we) : we}${X.join("")}</body></html>`;
471
- ee(T, H, Q, new Blob([xe], { type: I === "word" ? "application/msword;charset=utf-8" : "text/html;charset=utf-8" }), I === "word" ? "mach-report.doc" : "mach-report.html");
472
- } catch (X) {
473
- Q.finish("failed"), i(T, H) && t.onError(X instanceof Error ? `导出失败: ${X.message}` : "导出失败", "export");
474
- } finally {
475
- S(K);
476
- }
477
- }
478
- async function G() {
479
- await W("word");
480
- }
481
- function J() {
482
- return ce(C);
483
- }
484
- function L() {
485
- return ce(D);
486
- }
487
- function de() {
488
- return ce(G);
489
- }
490
- async function se(I) {
491
- const T = e.value;
492
- if (!(s || !T || T.pages.length === 0)) {
493
- if (I === "pdf") {
494
- await M();
495
- return;
496
- }
497
- if (I === "xlsx" || I === "excel") {
498
- await O();
499
- return;
500
- }
501
- if (I === "png" || I === "image") {
502
- await D();
503
- return;
504
- }
505
- if (I === "word" || I === "doc") {
506
- await G();
507
- return;
508
- }
509
- if (I !== "html") {
510
- t.onError(`不支持的导出格式:${I}`, "export");
511
- return;
512
- }
513
- await W("html");
514
- }
515
- }
516
- function ge(I) {
517
- return ce(() => se(I));
518
- }
519
- function Ve(I) {
520
- const T = e.value;
521
- if (s || !T || !T.pages.length) {
522
- I.close();
523
- return;
524
- }
525
- const H = o;
526
- v.set(I, { plan: T, epoch: H });
527
- const K = b(T, H, "PDF");
528
- k(T, H, u.get(K).run).then((Q) => {
529
- if (!i(T, H) || I.closed) {
530
- v.delete(I) && I.close();
531
- return;
532
- }
533
- const X = URL.createObjectURL(new Blob([Q], { type: "application/pdf" }));
534
- setTimeout(() => URL.revokeObjectURL(X), 6e4);
535
- const we = I.document;
536
- we.title = "PDF 预览", we.documentElement.style.height = "100%", we.body.style.cssText = "margin:0;height:100%;";
537
- const xe = we.createElement("iframe");
538
- xe.title = "PDF 预览", xe.style.cssText = "display:block;width:100%;height:100%;border:0;", xe.src = X, we.body.replaceChildren(xe), v.delete(I);
539
- }).catch((Q) => {
540
- u.get(K)?.run.finish("failed"), I.close(), v.delete(I), i(T, H) && t.onError(Q instanceof Error ? `PDF 预览失败: ${Q.message}` : "PDF 预览失败", "pdf");
541
- }).finally(() => S(K));
542
- }
543
- function Me() {
544
- if (s || !e.value?.pages.length) return;
545
- const I = globalThis.window.open("", "_blank");
546
- if (!I) {
547
- t.onError("浏览器拦截了弹窗,请允许弹窗后重试", "pdf");
548
- return;
549
- }
550
- const T = ye();
551
- if (typeof T == "boolean") {
552
- T ? Ve(I) : I.close();
553
- return;
554
- }
555
- l.add(I), T.then((H) => {
556
- const K = l.delete(I);
557
- if (!H || !K || I.closed) {
558
- I.close();
559
- return;
560
- }
561
- Ve(I);
562
- });
563
- }
564
- return {
565
- print: J,
566
- exportAs: ge,
567
- exportImages: L,
568
- exportWord: de,
569
- openPdfWindow: Me,
570
- invalidatePending: q,
571
- cancel: q,
572
- releasePrintFrame: Z,
573
- dispose: _
574
- };
575
- }
576
- const Yn = "mrp-hit";
577
- function ms(e) {
578
- e.querySelectorAll(`mark.${Yn}`).forEach((n) => {
579
- const a = n.parentNode;
580
- if (a) {
581
- for (; n.firstChild; ) a.insertBefore(n.firstChild, n);
582
- n.remove(), a.normalize();
583
- }
584
- });
585
- }
586
- function gs(e, t) {
587
- const n = t.trim();
588
- if (!n) return 0;
589
- const a = n.toLowerCase(), s = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, {
590
- acceptNode(l) {
591
- const u = l.parentElement;
592
- return !u || u.closest("mark") || /^(SCRIPT|STYLE)$/.test(u.tagName) ? NodeFilter.FILTER_REJECT : (l.nodeValue ?? "").toLowerCase().includes(a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
593
- }
594
- }), o = [];
595
- for (let l = s.nextNode(); l; l = s.nextNode()) o.push(l);
596
- let r = 0;
597
- for (const l of o) {
598
- const u = l.nodeValue ?? "", p = u.toLowerCase(), v = l.parentElement;
599
- if (!v) continue;
600
- const g = document.createDocumentFragment();
601
- let m = 0, w = p.indexOf(a);
602
- for (; w >= 0; ) {
603
- w > m && g.appendChild(document.createTextNode(u.slice(m, w)));
604
- const y = document.createElement("mark");
605
- y.className = Yn, y.textContent = u.slice(w, w + n.length), g.appendChild(y), r++, m = w + n.length, w = p.indexOf(a, m);
606
- }
607
- m < u.length && g.appendChild(document.createTextNode(u.slice(m))), v.replaceChild(g, l);
608
- }
609
- return r;
610
- }
611
- const ps = /* @__PURE__ */ new Set(["line", "rect", "ellipse", "chart"]);
612
- function* vs(e) {
613
- for (const t of e.cells ?? [])
614
- for (const n of t ?? [])
615
- yield n?.text ?? "", yield* n?.children ?? [];
616
- }
617
- function* hs(e) {
618
- if (as(e))
619
- for (const t of e.richParagraphs)
620
- for (const n of t.segments ?? [])
621
- yield (n.kind === "field" ? n.field : n.text) ?? "";
622
- else e.lines?.length ? yield* e.lines : yield e.text ?? "";
623
- }
624
- function* bs(e) {
625
- const t = [e.values()];
626
- for (; t.length > 0; ) {
627
- const n = t[t.length - 1].next();
628
- if (n.done) {
629
- t.pop();
630
- continue;
631
- }
632
- const a = n.value;
633
- if (typeof a == "string") {
634
- yield a;
635
- continue;
636
- }
637
- yield "", !ns(a) && (a.kind === "text" ? t.push(hs(a)) : a.grid ? t.push(vs(a.grid)) : ps.has(a.kind) || (yield a.fallbackText ?? ""));
638
- }
639
- }
640
- function* ys(e) {
641
- for (let t = 0; t < e.pages.length; t++) {
642
- for (const n of bs(e.pages[t].components)) yield { text: n, pageIndex: t };
643
- yield { text: "", pageIndex: t };
644
- }
645
- }
646
- function ws(e, t) {
647
- const n = e.toLowerCase();
648
- let a = 0;
649
- for (let s = n.indexOf(t); s >= 0; s = n.indexOf(t, s + t.length)) a++;
650
- return a;
651
- }
652
- function xs(e) {
653
- const { plan: t, gotoPage: n, highlight: a, clearHighlights: s } = e, o = V(!1), r = V(""), l = V(0), u = V(0), p = V(!1);
654
- let v = [];
655
- const g = z(() => {
656
- if (u.value === 0) return null;
657
- const F = l.value;
658
- let q = 0, j = v.length - 1;
659
- for (; q < j; ) {
660
- const _ = q + j >>> 1;
661
- v[_].cumulative <= F ? q = _ + 1 : j = _;
662
- }
663
- const Z = v[q];
664
- return Z ? { pageIndex: Z.pageIndex, occurrence: F - (v[q - 1]?.cumulative ?? 0) } : null;
665
- });
666
- let m = null, w = null, y = 0;
667
- function c() {
668
- y++, m && clearTimeout(m), w && clearTimeout(w), m = w = null, p.value = !1;
669
- }
670
- function i(F) {
671
- r.value = F, l.value = 0, u.value = 0, v = [], p.value = !1;
672
- const q = F.trim().toLowerCase(), j = t.value;
673
- if (!q || !j) return;
674
- p.value = !0;
675
- const Z = y, _ = ys(j), Y = [];
676
- let ee = 0;
677
- function ie() {
678
- if (w = null, Z !== y || j !== t.value) return;
679
- const ye = performance.now();
680
- let ce = 0;
681
- for (; ce < 5e3 && performance.now() - ye < 4; ) {
682
- const C = _.next();
683
- if (C.done) {
684
- v = Y, u.value = ee, p.value = !1, v[0] && n(v[0].pageIndex + 1);
685
- return;
686
- }
687
- const A = ws(C.value.text, q);
688
- if (A > 0) {
689
- ee += A;
690
- const k = Y[Y.length - 1];
691
- k?.pageIndex === C.value.pageIndex ? k.cumulative = ee : Y.push({ pageIndex: C.value.pageIndex, cumulative: ee });
692
- }
693
- ce++;
694
- }
695
- w = setTimeout(ie, 0);
696
- }
697
- ie();
698
- }
699
- function R(F) {
700
- if (c(), r.value = F, l.value = u.value = 0, v = [], !F.trim()) {
701
- i("");
702
- return;
703
- }
704
- p.value = !0, m = setTimeout(() => {
705
- m = null, i(F);
706
- }, Math.max(0, d(e.debounceMs) ?? 200));
707
- }
708
- function b(F) {
709
- const q = u.value;
710
- if (q === 0 || p.value) return;
711
- l.value = (l.value + F + q) % q;
712
- const j = g.value;
713
- j && n(j.pageIndex + 1);
714
- }
715
- function S() {
716
- c(), r.value = "", l.value = u.value = 0, v = [];
717
- }
718
- return le(t, S, { flush: "sync" }), Ke(S), {
719
- visible: o,
720
- query: r,
721
- matchIndex: l,
722
- matchCount: u,
723
- activeMatch: g,
724
- searching: p,
725
- toggle: () => {
726
- o.value = !o.value;
727
- },
728
- onInput: R,
729
- onNav: b,
730
- apply: (F) => {
731
- r.value.trim() && a(F, r.value.trim());
732
- },
733
- clear: (F) => {
734
- s(F);
735
- },
736
- reset: S
737
- };
738
- }
739
- function ks(e, t) {
740
- const n = z(() => {
741
- if (e.value) return !0;
742
- if (typeof location > "u") return !1;
743
- try {
744
- return new URLSearchParams(location.search).get("mrp-debug") === "1";
745
- } catch {
746
- return !1;
747
- }
748
- }), a = z(() => !n.value || !t.plan.value ? 0 : Math.round(JSON.stringify(t.plan.value).length / 1024)), s = z(() => !n.value || !t.plan.value ? null : {
749
- pages: t.pageCount.value,
750
- window: `${t.windowRange.value.start}-${t.windowRange.value.end}`,
751
- zoom: `${Math.round(t.zoom.value * 100)}%`,
752
- loadMs: `${t.loadMs.value}ms`,
753
- planKB: a.value
754
- });
755
- return { enabled: n, debugStats: s };
756
- }
757
- function Es(e, t) {
758
- const { thumbsRoot: n, visible: a, renderThumbCanvas: s } = t, o = V(0), r = V(800), l = z(() => (e.value?.pages ?? []).map(
759
- (b) => Math.round(b.pageHeightMm / b.pageWidthMm * 116)
760
- )), u = z(() => Gn(l.value.map((b) => b + 20), 8)), p = z(() => u.value.window(r.value, o.value, 1)), v = z(() => {
761
- if (!a.value) return [];
762
- const { start: b, end: S } = p.value;
763
- return l.value.slice(b, S + 1).map((F, q) => ({ index: b + q, height: F }));
764
- });
765
- let g = 0, m = 0, w = !1;
766
- function y() {
767
- const b = n.value;
768
- b && (o.value = b.scrollTop, r.value = b.clientHeight || 800);
769
- }
770
- function c() {
771
- w || m || (m = requestAnimationFrame(() => {
772
- m = 0, y();
773
- }));
774
- }
775
- function i() {
776
- if (v.value, g && cancelAnimationFrame(g), g = 0, w || !a.value || !e.value || !n.value) return;
777
- y();
778
- const b = v.value, S = e.value, F = n.value;
779
- let q = 0;
780
- function j() {
781
- if (g = 0, !(w || !a.value || e.value !== S || n.value !== F)) {
782
- for (let Z = 0; q < b.length && Z < 2; Z++, q++) {
783
- const _ = b[q].index, Y = F.querySelector(`[data-thumb="${_ + 1}"]`);
784
- if (!Y || Y.childElementCount > 0) continue;
785
- const ee = s(_);
786
- ee && (ee.style.width = "100%", ee.style.height = "100%", ee.style.display = "block", Y.appendChild(ee));
787
- }
788
- q < b.length && (g = requestAnimationFrame(j));
789
- }
790
- }
791
- g = requestAnimationFrame(j);
792
- }
793
- function R() {
794
- w = !0, g && cancelAnimationFrame(g), m && cancelAnimationFrame(m), g = m = 0;
795
- }
796
- return Ke(R), { schedule: i, destroy: R, onScroll: c, windowRange: p, visibleThumbs: v };
797
- }
798
- function Cs() {
799
- const e = fe(0);
800
- return {
801
- loadMs: e,
802
- start() {
803
- return typeof performance < "u" ? performance.now() : 0;
804
- },
805
- end(t) {
806
- e.value = t ? Math.round(performance.now() - t) : 0;
807
- }
808
- };
809
- }
810
- function Is(e) {
811
- const t = V(null), n = V(null);
812
- function a() {
813
- t.value?.focus(), t.value?.select();
814
- }
815
- le(e.visible, (r) => {
816
- r && He(a);
817
- });
818
- function s() {
819
- e.close(), He(() => n.value?.focus());
820
- }
821
- function o(r) {
822
- r.isComposing || r.keyCode === 229 || r.key !== "Enter" && r.key !== "Escape" || (r.preventDefault(), r.stopPropagation(), r.key === "Escape" ? s() : e.navigate(r.shiftKey ? -1 : 1));
823
- }
824
- return { input: t, toggle: n, focus: a, close: s, onKeydown: o };
825
- }
826
- function Xn() {
827
- const e = V(!1), t = V(null), n = V(null), a = V(null);
828
- function s(l = !1) {
829
- e.value = !1, l && He(() => n.value?.focus());
830
- }
831
- function o(l) {
832
- l.target instanceof Node && !t.value?.contains(l.target) && s();
833
- }
834
- function r(l) {
835
- l.key !== "Escape" || !e.value || l.isComposing || (l.preventDefault(), l.stopPropagation(), s(!0));
836
- }
837
- return le(e, (l) => {
838
- l && He(() => (a.value?.querySelector("input") ?? a.value?.querySelector("button:not(:disabled)"))?.focus());
839
- }), Pt(() => {
840
- document.addEventListener("pointerdown", o), document.addEventListener("focusin", o);
841
- }), Oa(() => {
842
- document.removeEventListener("pointerdown", o), document.removeEventListener("focusin", o);
843
- }), { opened: e, root: t, trigger: n, panel: a, close: s, onKeydown: r };
844
- }
845
- const $s = ["disabled", "aria-expanded"], Ps = ["aria-label"], Ss = ["aria-label", "disabled", "onClick"], Rs = { "aria-hidden": "true" }, Ms = /* @__PURE__ */ Ie({
846
- __name: "ReportExportMenu",
847
- props: {
848
- messages: {},
849
- formats: {},
850
- busy: { type: Boolean }
851
- },
852
- emits: ["export"],
853
- setup(e, { emit: t }) {
854
- const n = e, a = t, { opened: s, root: o, trigger: r, panel: l, close: u, onKeydown: p } = Xn(), v = z(() => [
855
- { format: "xlsx", label: n.messages.exportExcel, extension: ".xlsx" },
856
- { format: "pdf", label: n.messages.exportPdf, extension: ".pdf" },
857
- { format: "png", label: n.messages.exportImage, extension: ".png" },
858
- { format: "word", label: n.messages.exportWord, extension: ".doc" },
859
- { format: "html", label: n.messages.exportHtml, extension: ".html" }
860
- ].filter((y) => !n.formats || n.formats.includes(y.format)));
861
- le(() => n.busy, (y) => {
862
- y && u();
863
- });
864
- function g(y) {
865
- n.busy || (a("export", y), u(!0));
866
- }
867
- function m(y) {
868
- y.key !== "ArrowDown" && y.key !== "ArrowUp" || (y.preventDefault(), s.value = !0, y.key === "ArrowUp" && He(() => l.value?.querySelector("button:last-child")?.focus()));
869
- }
870
- function w(y) {
871
- if (y.key === "Tab") {
872
- u();
873
- return;
874
- }
875
- if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(y.key)) return;
876
- y.preventDefault(), y.stopPropagation();
877
- const i = [...l.value?.querySelectorAll("button:not(:disabled)") ?? []], R = i.indexOf(document.activeElement), b = y.key === "Home" ? 0 : y.key === "End" ? i.length - 1 : (R + (y.key === "ArrowDown" ? 1 : -1) + i.length) % i.length;
878
- i[b]?.focus();
879
- }
880
- return (y, c) => v.value.length ? (E(), P("div", {
881
- key: 0,
882
- ref_key: "root",
883
- ref: o,
884
- class: "mrp-export-menu",
885
- onKeydown: c[1] || (c[1] = //@ts-ignore
886
- (...i) => d(p) && d(p)(...i))
887
- }, [
888
- h("button", {
889
- ref_key: "trigger",
890
- ref: r,
891
- type: "button",
892
- class: "mrp-nav mrp-export-trigger",
893
- disabled: e.busy,
894
- "aria-haspopup": "menu",
895
- "aria-expanded": d(s),
896
- onClick: c[0] || (c[0] = (i) => s.value = !d(s)),
897
- onKeydown: m
898
- }, [
899
- te(ae, { name: "download" }),
900
- ue(x(e.messages.exportMenu ?? "导出"), 1),
901
- te(ae, {
902
- name: "chevron-down",
903
- size: 12
904
- })
905
- ], 40, $s),
906
- d(s) ? (E(), P("div", {
907
- key: 0,
908
- ref_key: "panel",
909
- ref: l,
910
- class: "mrp-export-panel",
911
- role: "menu",
912
- "aria-label": e.messages.exportMenu ?? "导出",
913
- onKeydown: w
914
- }, [
915
- h("p", null, x(e.messages.exportMenuDescription ?? "选择文件格式"), 1),
916
- (E(!0), P(he, null, be(v.value, (i) => (E(), P("button", {
917
- key: i.format,
918
- type: "button",
919
- role: "menuitem",
920
- tabindex: "-1",
921
- "aria-label": i.label,
922
- disabled: e.busy,
923
- onClick: (R) => g(i.format)
924
- }, [
925
- te(ae, { name: "file" }),
926
- h("span", null, x(i.label), 1),
927
- h("small", Rs, x(i.extension), 1)
928
- ], 8, Ss))), 128))
929
- ], 40, Ps)) : N("", !0)
930
- ], 544)) : N("", !0);
931
- }
932
- }), Ts = /* @__PURE__ */ $e(Ms, [["__scopeId", "data-v-83a57a3c"]]), Ds = ["aria-label"], As = {
933
- class: "mrp-pageinfo",
934
- "aria-live": "polite"
935
- }, Fs = { class: "mrp-page-buttons" }, Os = ["aria-label", "title", "disabled"], Ls = ["aria-label", "title", "disabled"], zs = ["aria-label", "title", "aria-invalid", "disabled"], qs = ["aria-label", "disabled"], Bs = {
936
- key: 1,
937
- class: "mrp-page-error",
938
- role: "alert"
939
- }, Ns = /* @__PURE__ */ Ie({
940
- __name: "ReportPagination",
941
- props: {
942
- pageCount: {},
943
- currentPage: {},
944
- messages: {},
945
- busy: { type: Boolean }
946
- },
947
- emits: ["goto"],
948
- setup(e, { emit: t }) {
949
- const n = e, a = t, s = V(String(n.currentPage)), o = V(!1), r = z(() => n.messages.pageInfo.replace("{cur}", String(n.currentPage)).replace("{total}", String(n.pageCount)));
950
- le(() => [n.currentPage, n.pageCount], () => {
951
- s.value = String(n.currentPage), o.value = !1;
952
- });
953
- function l() {
954
- if (n.busy) return;
955
- const u = s.value.trim(), p = Number(u);
956
- o.value = !/^\d+$/.test(u) || !Number.isSafeInteger(p) || p < 1 || p > n.pageCount, !o.value && p !== n.currentPage && a("goto", p);
957
- }
958
- return (u, p) => e.pageCount > 0 ? (E(), P("nav", {
959
- key: 0,
960
- class: "mrp-pagination",
961
- role: "navigation",
962
- "aria-label": e.messages.pagination ?? "报表分页"
963
- }, [
964
- h("span", As, x(r.value), 1),
965
- h("div", Fs, [
966
- h("button", {
967
- class: "mrp-nav",
968
- type: "button",
969
- "aria-label": e.messages.prevPage,
970
- title: e.messages.prevPage,
971
- disabled: e.busy || e.currentPage <= 1,
972
- onClick: p[0] || (p[0] = (v) => a("goto", e.currentPage - 1))
973
- }, [
974
- te(ae, { name: "chevron-left" })
975
- ], 8, Os),
976
- h("button", {
977
- class: "mrp-nav",
978
- type: "button",
979
- "aria-label": e.messages.nextPage,
980
- title: e.messages.nextPage,
981
- disabled: e.busy || e.currentPage >= e.pageCount,
982
- onClick: p[1] || (p[1] = (v) => a("goto", e.currentPage + 1))
983
- }, [
984
- te(ae, { name: "chevron-right" })
985
- ], 8, Ls)
986
- ]),
987
- e.pageCount > 1 ? (E(), P("form", {
988
- key: 0,
989
- class: "mrp-page-jump",
990
- onSubmit: ft(l, ["prevent"])
991
- }, [
992
- h("label", null, [
993
- h("span", null, x(e.messages.pageJump ?? "跳至页"), 1),
994
- on(h("input", {
995
- "onUpdate:modelValue": p[2] || (p[2] = (v) => s.value = v),
996
- type: "text",
997
- inputmode: "numeric",
998
- autocomplete: "off",
999
- "aria-label": e.messages.pageJump ?? "跳至页",
1000
- title: e.messages.pageJumpHint ?? "Enter 跳转",
1001
- "aria-invalid": o.value,
1002
- disabled: e.busy,
1003
- onInput: p[3] || (p[3] = (v) => o.value = !1),
1004
- onKeydown: p[4] || (p[4] = Qt((v) => {
1005
- s.value = String(e.currentPage), o.value = !1;
1006
- }, ["esc"]))
1007
- }, null, 40, zs), [
1008
- [rn, s.value]
1009
- ])
1010
- ]),
1011
- h("button", {
1012
- class: "mrp-nav",
1013
- type: "submit",
1014
- "aria-label": e.messages.pageJump ?? "跳至页",
1015
- disabled: e.busy
1016
- }, [
1017
- te(ae, {
1018
- name: "arrow-right",
1019
- size: 14
1020
- })
1021
- ], 8, qs)
1022
- ], 32)) : N("", !0),
1023
- o.value ? (E(), P("span", Bs, x(e.messages.pageJumpInvalid ?? "请输入有效页码"), 1)) : N("", !0)
1024
- ], 8, Ds)) : N("", !0);
1025
- }
1026
- }), Qn = /* @__PURE__ */ $e(Ns, [["__scopeId", "data-v-0db4fbd3"]]), js = ["aria-label"], Hs = { class: "mrp-title" }, Ks = ["aria-label"], Ws = ["aria-label", "aria-pressed"], Us = ["aria-pressed"], Vs = ["aria-pressed"], Gs = ["aria-label"], Js = ["aria-pressed"], Zs = ["aria-pressed", "onClick"], Ys = ["aria-label"], Xs = ["disabled"], Qs = ["disabled"], _s = ["disabled"], eo = ["aria-label", "aria-expanded"], to = ["aria-label"], no = ["placeholder", "aria-label", "value"], ao = ["aria-label"], so = {
1027
- key: 1,
1028
- class: "mrp-search-count",
1029
- role: "status",
1030
- "aria-live": "polite"
1031
- }, oo = ["disabled", "aria-label"], ro = ["disabled", "aria-label"], lo = ["aria-label"], io = {
1032
- class: "mrp-search-hint",
1033
- role: "status"
1034
- }, uo = /* @__PURE__ */ Ie({
1035
- __name: "ReportToolbar",
1036
- props: {
1037
- pageCount: {},
1038
- currentPage: {},
1039
- zoomMode: {},
1040
- zoom: {},
1041
- showExport: { type: Boolean },
1042
- showPrint: { type: Boolean },
1043
- showPdfWindow: { type: Boolean },
1044
- messages: {},
1045
- search: {},
1046
- thumbsVisible: { type: Boolean },
1047
- showImport: { type: Boolean },
1048
- showSearch: { type: Boolean, default: !0 },
1049
- showThumbnails: { type: Boolean, default: !0 },
1050
- showZoom: { type: Boolean, default: !0 },
1051
- exportFormats: { default: void 0 },
1052
- showSettings: { type: Boolean },
1053
- settingsOpen: { type: Boolean },
1054
- busy: { type: Boolean },
1055
- showPagination: { type: Boolean }
1056
- },
1057
- emits: ["goto", "zoom", "export", "print", "pdf-window", "search-input", "search-nav", "search-toggle", "thumbs-toggle", "import-excel", "settings-toggle"],
1058
- setup(e, { expose: t, emit: n }) {
1059
- const a = e, s = n, o = Is({
1060
- visible: () => a.search.visible,
1061
- navigate: (v) => {
1062
- !a.search.searching && a.search.matchCount > 0 && s("search-nav", v);
1063
- },
1064
- close: () => {
1065
- a.search.visible && s("search-toggle");
1066
- }
1067
- }), { input: r, toggle: l } = o;
1068
- t({ focusSearch: o.focus });
1069
- function u() {
1070
- const v = a.search.matchCount > 0 ? a.search.matchIndex + 1 : 0;
1071
- return a.messages.matchInfo.replace("{cur}", String(v)).replace("{total}", String(a.search.matchCount));
1072
- }
1073
- function p() {
1074
- s("search-input", ""), o.focus();
1075
- }
1076
- return (v, g) => (E(), P("div", {
1077
- class: "mrp-toolbar",
1078
- role: "toolbar",
1079
- "aria-label": e.messages.title
1080
- }, [
1081
- h("span", Hs, [
1082
- te(ae, { name: "file" }),
1083
- ue(x(e.messages.title), 1)
1084
- ]),
1085
- e.showPagination ? (E(), Ae(Qn, {
1086
- key: 0,
1087
- "page-count": e.pageCount,
1088
- "current-page": e.currentPage,
1089
- messages: e.messages,
1090
- busy: e.busy,
1091
- onGoto: g[0] || (g[0] = (m) => s("goto", m))
1092
- }, null, 8, ["page-count", "current-page", "messages", "busy"])) : N("", !0),
1093
- g[15] || (g[15] = h("span", { class: "mrp-spacer" }, null, -1)),
1094
- e.showSearch !== !1 ? (E(), P("div", {
1095
- key: 1,
1096
- class: "mrp-read-tools",
1097
- role: "group",
1098
- "aria-label": e.messages.search ?? "内容搜索"
1099
- }, [
1100
- h("button", {
1101
- ref_key: "searchToggleRef",
1102
- ref: l,
1103
- class: ke(["mrp-nav mrp-search-toggle mrp-icon-button", { "mrp-active": e.search.visible }]),
1104
- type: "button",
1105
- title: "Ctrl+F",
1106
- "aria-label": e.messages.search ?? e.messages.searchPlaceholder,
1107
- "aria-pressed": e.search.visible,
1108
- onClick: g[1] || (g[1] = (m) => s("search-toggle"))
1109
- }, [
1110
- te(ae, { name: "search" })
1111
- ], 10, Ws),
1112
- e.showThumbnails !== !1 ? (E(), P("button", {
1113
- key: 0,
1114
- class: ke(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
1115
- type: "button",
1116
- "aria-pressed": e.thumbsVisible,
1117
- onClick: g[2] || (g[2] = (m) => s("thumbs-toggle"))
1118
- }, [
1119
- te(ae, { name: "grid" }),
1120
- ue(x(e.messages.thumbnails), 1)
1121
- ], 10, Us)) : N("", !0)
1122
- ], 8, Ks)) : e.showThumbnails !== !1 ? (E(), P("button", {
1123
- key: 2,
1124
- class: ke(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
1125
- type: "button",
1126
- "aria-pressed": e.thumbsVisible,
1127
- onClick: g[3] || (g[3] = (m) => s("thumbs-toggle"))
1128
- }, [
1129
- te(ae, { name: "grid" }),
1130
- ue(x(e.messages.thumbnails), 1)
1131
- ], 10, Vs)) : N("", !0),
1132
- mt(v.$slots, "navigation", {}, void 0, !0),
1133
- e.showZoom !== !1 ? (E(), P("div", {
1134
- key: 3,
1135
- class: "mrp-zoom-tools",
1136
- role: "group",
1137
- "aria-label": e.messages.zoom ?? "缩放工具"
1138
- }, [
1139
- h("button", {
1140
- class: ke(["mrp-nav", { "mrp-active": e.zoomMode === "fit" }]),
1141
- "aria-pressed": e.zoomMode === "fit",
1142
- type: "button",
1143
- onClick: g[4] || (g[4] = (m) => s("zoom", "fit"))
1144
- }, [
1145
- te(ae, { name: "fit" }),
1146
- ue(x(e.messages.fitWidth), 1)
1147
- ], 10, Js),
1148
- (E(), P(he, null, be([100, 150], (m) => h("button", {
1149
- key: m,
1150
- class: ke(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === m }]),
1151
- "aria-pressed": e.zoomMode === "raw" && Math.round(e.zoom * 100) === m,
1152
- type: "button",
1153
- onClick: (w) => s("zoom", m)
1154
- }, x(m) + "%", 11, Zs)), 64))
1155
- ], 8, Gs)) : N("", !0),
1156
- e.showImport || e.showExport || e.showPrint || e.showPdfWindow ? (E(), P("div", {
1157
- key: 4,
1158
- class: "mrp-output-tools",
1159
- role: "group",
1160
- "aria-label": e.messages.settingsExport ?? "导出与打印"
1161
- }, [
1162
- e.showImport ? (E(), P("button", {
1163
- key: 0,
1164
- class: "mrp-nav mrp-import-excel",
1165
- type: "button",
1166
- disabled: e.busy,
1167
- onClick: g[5] || (g[5] = (m) => s("import-excel"))
1168
- }, [
1169
- te(ae, { name: "upload" }),
1170
- ue(x(e.messages.importExcel ?? "导入 Excel 模板"), 1)
1171
- ], 8, Xs)) : N("", !0),
1172
- e.showExport ? (E(), Ae(Ts, {
1173
- key: 1,
1174
- messages: e.messages,
1175
- formats: e.exportFormats,
1176
- busy: e.busy,
1177
- onExport: g[6] || (g[6] = (m) => s("export", m))
1178
- }, null, 8, ["messages", "formats", "busy"])) : N("", !0),
1179
- e.showPrint ? (E(), P("button", {
1180
- key: 2,
1181
- class: "mrp-nav",
1182
- type: "button",
1183
- disabled: e.busy,
1184
- onClick: g[7] || (g[7] = (m) => s("print"))
1185
- }, [
1186
- te(ae, { name: "print" }),
1187
- ue(x(e.messages.print), 1)
1188
- ], 8, Qs)) : N("", !0),
1189
- e.showPdfWindow ? (E(), P("button", {
1190
- key: 3,
1191
- class: "mrp-nav",
1192
- type: "button",
1193
- disabled: e.busy,
1194
- onClick: g[8] || (g[8] = (m) => s("pdf-window"))
1195
- }, [
1196
- te(ae, { name: "external" }),
1197
- ue(x(e.messages.pdfWindow), 1)
1198
- ], 8, _s)) : N("", !0)
1199
- ], 8, Ys)) : N("", !0),
1200
- e.showSettings ? (E(), P("button", {
1201
- key: 5,
1202
- class: ke(["mrp-nav mrp-settings-toggle", { "mrp-active": e.settingsOpen }]),
1203
- type: "button",
1204
- "aria-label": e.messages.settings ?? "设置",
1205
- "aria-haspopup": "dialog",
1206
- "aria-expanded": !!e.settingsOpen,
1207
- onClick: g[9] || (g[9] = (m) => s("settings-toggle"))
1208
- }, [
1209
- te(ae, { name: "settings" }),
1210
- ue(x(e.messages.settings ?? "设置"), 1)
1211
- ], 10, eo)) : N("", !0),
1212
- e.showSearch !== !1 && e.search.visible ? (E(), P("div", {
1213
- key: 6,
1214
- class: "mrp-search-panel",
1215
- role: "search",
1216
- "aria-label": e.messages.search ?? "内容搜索"
1217
- }, [
1218
- h("div", {
1219
- class: ke(["mrp-search", { "mrp-search-no-results": e.search.query && !e.search.searching && !e.search.matchCount }])
1220
- }, [
1221
- te(ae, { name: "search" }),
1222
- h("input", {
1223
- ref_key: "searchInputRef",
1224
- ref: r,
1225
- class: "mrp-search-input",
1226
- type: "text",
1227
- autocomplete: "off",
1228
- spellcheck: "false",
1229
- placeholder: e.messages.searchPlaceholder,
1230
- "aria-label": e.messages.search ?? e.messages.searchPlaceholder,
1231
- value: e.search.query,
1232
- onInput: g[10] || (g[10] = (m) => s("search-input", m.target.value)),
1233
- onKeydown: g[11] || (g[11] = //@ts-ignore
1234
- (...m) => d(o).onKeydown && d(o).onKeydown(...m))
1235
- }, null, 40, no),
1236
- e.search.query ? (E(), P("button", {
1237
- key: 0,
1238
- class: "mrp-nav mrp-search-clear mrp-icon-button",
1239
- type: "button",
1240
- "aria-label": e.messages.clearSearch ?? "清除搜索",
1241
- onClick: p
1242
- }, [
1243
- te(ae, {
1244
- name: "close",
1245
- size: 13
1246
- })
1247
- ], 8, ao)) : N("", !0),
1248
- e.search.query ? (E(), P("span", so, x(e.search.searching ? e.messages.searching ?? "搜索中…" : u()), 1)) : N("", !0),
1249
- h("button", {
1250
- class: "mrp-nav mrp-icon-button",
1251
- type: "button",
1252
- disabled: e.search.matchCount === 0 || e.search.searching,
1253
- "aria-label": e.messages.prevSearchMatch ?? "上一个匹配",
1254
- onClick: g[12] || (g[12] = (m) => s("search-nav", -1))
1255
- }, [
1256
- te(ae, {
1257
- name: "chevron-up",
1258
- size: 14
1259
- })
1260
- ], 8, oo),
1261
- h("button", {
1262
- class: "mrp-nav mrp-icon-button",
1263
- type: "button",
1264
- disabled: e.search.matchCount === 0 || e.search.searching,
1265
- "aria-label": e.messages.nextSearchMatch ?? "下一个匹配",
1266
- onClick: g[13] || (g[13] = (m) => s("search-nav", 1))
1267
- }, [
1268
- te(ae, {
1269
- name: "chevron-down",
1270
- size: 14
1271
- })
1272
- ], 8, ro),
1273
- h("button", {
1274
- class: "mrp-nav mrp-search-close mrp-icon-button",
1275
- type: "button",
1276
- "aria-label": e.messages.closeSearch ?? "关闭搜索",
1277
- onClick: g[14] || (g[14] = //@ts-ignore
1278
- (...m) => d(o).close && d(o).close(...m))
1279
- }, [
1280
- te(ae, {
1281
- name: "close",
1282
- size: 14
1283
- })
1284
- ], 8, lo)
1285
- ], 2),
1286
- h("span", io, x(e.search.query && !e.search.searching && !e.search.matchCount ? e.messages.searchNoMatches ?? "没有匹配内容" : e.messages.searchHint ?? "Enter 下一个 · Shift+Enter 上一个"), 1)
1287
- ], 8, to)) : N("", !0)
1288
- ], 8, js));
1289
- }
1290
- }), co = /* @__PURE__ */ $e(uo, [["__scopeId", "data-v-5f4b04d8"]]), fo = ["aria-label", "aria-busy"], mo = { class: "mrp-calculation-heading" }, go = { class: "mrp-calculation-controls" }, po = ["aria-label", "value", "disabled"], vo = ["value"], ho = { class: "mrp-calculation-precision" }, bo = ["aria-label", "value", "disabled"], yo = {
1291
- key: 0,
1292
- class: "mrp-calculation-expression"
1293
- }, wo = ["aria-label", "value", "disabled"], xo = { class: "mrp-calculation-actions" }, ko = {
1294
- key: 1,
1295
- class: "mrp-calculation-diagnostic",
1296
- role: "alert"
1297
- }, Eo = {
1298
- key: 2,
1299
- class: "mrp-calculation-result",
1300
- role: "status",
1301
- "aria-live": "polite"
1302
- }, Co = { key: 0 }, Io = {
1303
- key: 3,
1304
- class: "mrp-calculation-empty"
1305
- }, $o = { class: "mrp-calculation-local" }, Po = /* @__PURE__ */ Ie({
1306
- __name: "ReportCalculationPanel",
1307
- props: {
1308
- state: {},
1309
- messages: {}
1310
- },
1311
- setup(e) {
1312
- const t = e, n = `mrp-calculation-expression-hint-${ln()?.uid ?? 0}`, a = z(() => [
1313
- ["sum", t.messages.calculationSum],
1314
- ["average", t.messages.calculationAverage],
1315
- ["min", t.messages.calculationMin],
1316
- ["max", t.messages.calculationMax],
1317
- ["count", t.messages.calculationCount],
1318
- ["median", t.messages.calculationMedian],
1319
- ["expression", t.messages.calculationCustom]
1320
- ]), s = z(() => {
1321
- const o = t.state.error.value;
1322
- if (!o) return "";
1323
- const r = t.messages;
1324
- return { selection: r.calculationErrorSelection, limit: r.calculationErrorLimit, expression: r.calculationErrorExpression, division: r.calculationErrorDivision, overflow: r.calculationErrorOverflow, precision: r.calculationErrorPrecision }[o];
1325
- });
1326
- return (o, r) => (E(), P("section", {
1327
- class: "mrp-calculation",
1328
- "aria-label": e.messages.calculationTitle,
1329
- "aria-busy": e.state.busy.value
1330
- }, [
1331
- h("header", mo, [
1332
- r[5] || (r[5] = h("span", {
1333
- class: "mrp-calculation-symbol",
1334
- "aria-hidden": "true"
1335
- }, "∑", -1)),
1336
- h("div", null, [
1337
- h("strong", null, x(e.messages.calculationTitle), 1),
1338
- h("p", null, x(e.messages.calculationHint), 1)
1339
- ])
1340
- ]),
1341
- h("div", go, [
1342
- h("label", null, [
1343
- h("span", null, x(e.messages.calculationFormula), 1),
1344
- h("select", {
1345
- "aria-label": e.messages.calculationFormula,
1346
- value: e.state.operation.value,
1347
- onChange: r[0] || (r[0] = (l) => e.state.setOperation(l.target.value)),
1348
- disabled: e.state.busy.value
1349
- }, [
1350
- (E(!0), P(he, null, be(a.value, ([l, u]) => (E(), P("option", {
1351
- key: l,
1352
- value: l
1353
- }, x(u), 9, vo))), 128))
1354
- ], 40, po)
1355
- ]),
1356
- h("label", ho, [
1357
- h("span", null, x(e.messages.calculationPrecision), 1),
1358
- h("input", {
1359
- "aria-label": e.messages.calculationPrecision,
1360
- value: e.state.precision.value,
1361
- onChange: r[1] || (r[1] = (l) => e.state.setPrecision(Number(l.target.value))),
1362
- type: "number",
1363
- min: "0",
1364
- max: "12",
1365
- step: "1",
1366
- disabled: e.state.busy.value
1367
- }, null, 40, bo)
1368
- ])
1369
- ]),
1370
- e.state.operation.value === "expression" ? (E(), P("label", yo, [
1371
- h("span", null, x(e.messages.calculationExpression), 1),
1372
- h("input", {
1373
- "aria-label": e.messages.calculationExpression,
1374
- "aria-describedby": n,
1375
- value: e.state.expression.value,
1376
- onInput: r[2] || (r[2] = (l) => e.state.setExpression(l.target.value)),
1377
- type: "text",
1378
- maxlength: "256",
1379
- spellcheck: "false",
1380
- disabled: e.state.busy.value,
1381
- placeholder: "SUM / COUNT"
1382
- }, null, 40, wo),
1383
- h("small", { id: n }, x(e.messages.calculationExpressionHint), 1)
1384
- ])) : N("", !0),
1385
- h("div", xo, [
1386
- e.state.busy.value ? (E(), P("button", {
1387
- key: 0,
1388
- type: "button",
1389
- onClick: r[3] || (r[3] = (l) => e.state.cancel())
1390
- }, x(e.messages.calculationCancel), 1)) : (E(), P("button", {
1391
- key: 1,
1392
- class: "mrp-calculation-run",
1393
- type: "button",
1394
- onClick: r[4] || (r[4] = (l) => e.state.run())
1395
- }, x(e.messages.calculationRun), 1))
1396
- ]),
1397
- s.value ? (E(), P("p", ko, x(s.value), 1)) : e.state.result.value ? (E(), P("div", Eo, [
1398
- h("span", null, x(e.messages.calculationResult), 1),
1399
- h("output", null, x(e.state.result.value.formatted), 1),
1400
- h("small", null, [
1401
- h("span", null, x(e.messages.calculationIncluded) + " " + x(e.state.result.value.numericCells), 1),
1402
- h("span", null, x(e.messages.calculationExcluded) + " " + x(e.state.result.value.excludedCells), 1)
1403
- ]),
1404
- e.state.result.value.numericCells === 0 ? (E(), P("p", Co, x(e.messages.calculationEmpty), 1)) : N("", !0)
1405
- ])) : (E(), P("p", Io, x(e.messages.calculationNoSelection), 1)),
1406
- h("p", $o, x(e.messages.calculationLocal), 1)
1407
- ], 8, fo));
1408
- }
1409
- }), So = /* @__PURE__ */ $e(Po, [["__scopeId", "data-v-ee359251"]]);
1410
- function Ro(e) {
1411
- const t = V("sum"), n = V("SUM / COUNT"), a = V(2), s = V(!1), o = fe(null), r = V(null);
1412
- let l = null, u = 0;
1413
- function p() {
1414
- u++, l?.abort(), l = null, s.value = !1;
1415
- }
1416
- function v() {
1417
- p(), o.value = null, r.value = null;
1418
- }
1419
- async function g() {
1420
- if (v(), !e.enabled()) return;
1421
- const c = e.plan.value, i = e.selection.value;
1422
- if (!c || !i) {
1423
- r.value = "selection";
1424
- return;
1425
- }
1426
- const R = ++u, b = new AbortController();
1427
- l = b, s.value = !0;
1428
- try {
1429
- const S = await Na(c, i, { operation: t.value, expression: n.value, precision: a.value, signal: b.signal });
1430
- R === u && e.plan.value === c && e.selection.value === i && e.enabled() && (o.value = S);
1431
- } catch (S) {
1432
- R === u && !b.signal.aborted && (r.value = S instanceof ja ? S.code : "expression");
1433
- } finally {
1434
- R === u && (s.value = !1, l = null);
1435
- }
1436
- }
1437
- le([e.plan, e.selection, () => e.enabled(), t, n, a], v, { flush: "sync" }), Ke(v);
1438
- function m(c) {
1439
- t.value = c;
1440
- }
1441
- function w(c) {
1442
- n.value = c;
1443
- }
1444
- function y(c) {
1445
- a.value = c;
1446
- }
1447
- return { operation: t, expression: n, precision: a, busy: s, result: o, error: r, run: g, cancel: p, clear: v, setOperation: m, setExpression: w, setPrecision: y };
1448
- }
1449
- const Mo = ["aria-label"], To = { class: "mrp-settings-header" }, Do = ["aria-label"], Ao = ["aria-label"], Fo = ["id", "aria-selected", "aria-controls", "tabindex", "onClick", "onKeydown"], Oo = { class: "mrp-settings-content" }, Lo = ["id", "aria-labelledby", "hidden"], zo = { key: 0 }, qo = { class: "mrp-settings-option" }, Bo = ["checked", "disabled"], No = { class: "mrp-settings-option" }, jo = ["value", "disabled"], Ho = ["id", "aria-labelledby", "hidden"], Ko = { key: 0 }, Wo = ["checked", "disabled", "onChange"], Uo = {
1450
- key: 0,
1451
- class: "mrp-settings-note"
1452
- }, Vo = {
1453
- key: 1,
1454
- class: "mrp-settings-note"
1455
- }, Go = ["id", "aria-labelledby", "hidden"], Jo = { class: "mrp-settings-intro" }, Zo = { class: "mrp-settings-option mrp-settings-feature" }, Yo = ["id"], Xo = ["aria-label", "aria-describedby", "checked", "disabled"], Qo = ["disabled"], _o = /* @__PURE__ */ Ie({
1456
- __name: "ReportSettings",
1457
- props: {
1458
- available: {},
1459
- enabled: {},
1460
- messages: {},
1461
- persistedEditing: { type: Boolean },
1462
- busy: { type: Boolean },
1463
- interaction: {},
1464
- section: {}
1465
- },
1466
- emits: ["change", "reset", "close", "interaction", "section"],
1467
- setup(e, { emit: t }) {
1468
- const n = e, a = t, s = V(null), o = z(() => n.section ?? "general"), r = "mrp-settings-" + ln()?.uid, l = z(() => [
1469
- { key: "general", label: n.messages.settingsGeneral ?? "常规" },
1470
- { key: "tools", label: n.messages.settingsTools ?? "工具" },
1471
- { key: "advanced", label: n.messages.settingsAdvanced ?? "高级" }
1472
- ]);
1473
- function u(c, i) {
1474
- const b = { ArrowRight: (i + 1) % 3, ArrowLeft: (i + 2) % 3, Home: 0, End: 2 }[c.key];
1475
- b !== void 0 && (c.preventDefault(), a("section", l.value[b].key), s.value?.querySelector("#" + r + "-tab-" + l.value[b].key)?.focus());
1476
- }
1477
- const p = V(null);
1478
- let v = null;
1479
- const g = z(() => [
1480
- { label: n.messages.settingsDisplay, tools: [
1481
- ["search", n.messages.search],
1482
- ["thumbnails", n.messages.thumbnails],
1483
- ["zoom", n.messages.zoom]
1484
- ] },
1485
- { label: n.messages.settingsExport, tools: [
1486
- ["html", n.messages.exportHtml],
1487
- ["pdf", n.messages.exportPdf],
1488
- ["xlsx", n.messages.exportExcel],
1489
- ["png", n.messages.exportImage],
1490
- ["word", n.messages.exportWord],
1491
- ["print", n.messages.print],
1492
- ["pdfWindow", n.messages.pdfWindow]
1493
- ] },
1494
- { label: n.messages.settingsData, tools: [
1495
- ["editing", n.messages.editCell],
1496
- ["import", n.messages.importExcel]
1497
- ] }
1498
- ].map((c) => ({ ...c, tools: c.tools.map(([i, R]) => ({ key: i, label: R })) })));
1499
- function m(c, i) {
1500
- const R = c.target, b = R.checked;
1501
- R.checked = n.enabled[i], a("change", i, b);
1502
- }
1503
- function w(c) {
1504
- return !s.value || c.defaultPrevented ? !1 : c.target instanceof Node && s.value.contains(c.target) ? !0 : c.target instanceof Element && c.target.closest('[role="dialog"],dialog[open]') ? !1 : !Array.from(document.querySelectorAll('[aria-modal="true"],dialog[open]')).some((i) => i !== s.value && !s.value.contains(i));
1505
- }
1506
- function y(c) {
1507
- if (!w(c)) return;
1508
- if (c.key === "Escape") {
1509
- c.preventDefault(), c.stopPropagation(), a("close");
1510
- return;
1511
- }
1512
- if (c.key !== "Tab") return;
1513
- const i = Array.from(s.value?.querySelectorAll("a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex='0']") ?? []).filter((F) => !F.closest("[hidden]") && F.tabIndex !== -1), R = i?.[0], b = i?.[i.length - 1];
1514
- (!s.value?.contains(document.activeElement) || c.shiftKey && document.activeElement === R || !c.shiftKey && document.activeElement === b) && (c.preventDefault(), c.stopPropagation(), (c.shiftKey ? b : R)?.focus());
1515
- }
1516
- return Pt(() => {
1517
- const c = s.value?.closest(".mach-report-preview")?.querySelector(".mrp-settings-toggle"), i = document.activeElement;
1518
- v = i instanceof HTMLElement && i !== document.body && !s.value?.contains(i) ? i : c ?? null, p.value?.focus(), document.addEventListener("keydown", y);
1519
- }), un(() => {
1520
- document.removeEventListener("keydown", y), v?.isConnected && v.focus();
1521
- }), (c, i) => (E(), P("div", {
1522
- class: "mrp-settings-backdrop",
1523
- onClick: i[5] || (i[5] = ft((R) => c.$emit("close"), ["self"]))
1524
- }, [
1525
- h("section", {
1526
- ref_key: "panel",
1527
- ref: s,
1528
- class: "mrp-settings-panel",
1529
- role: "dialog",
1530
- "aria-modal": "true",
1531
- "aria-label": e.messages.settings
1532
- }, [
1533
- h("header", To, [
1534
- h("div", null, [
1535
- i[6] || (i[6] = h("span", { class: "mrp-settings-eyebrow" }, "MACH REPORT", -1)),
1536
- h("strong", null, x(e.messages.settings), 1),
1537
- h("p", null, x(e.messages.settingsLocal), 1)
1538
- ]),
1539
- h("button", {
1540
- ref_key: "closeButton",
1541
- ref: p,
1542
- class: "mrp-settings-close",
1543
- type: "button",
1544
- "aria-label": e.messages.settingsClose,
1545
- onClick: i[0] || (i[0] = (R) => c.$emit("close"))
1546
- }, [...i[7] || (i[7] = [
1547
- h("svg", {
1548
- width: "16",
1549
- height: "16",
1550
- viewBox: "0 0 20 20",
1551
- fill: "none",
1552
- "aria-hidden": "true"
1553
- }, [
1554
- h("path", {
1555
- d: "m5 5 10 10M15 5 5 15",
1556
- stroke: "currentColor",
1557
- "stroke-width": "1.6",
1558
- "stroke-linecap": "round"
1559
- })
1560
- ], -1)
1561
- ])], 8, Do)
1562
- ]),
1563
- h("div", {
1564
- class: "mrp-settings-tabs",
1565
- role: "tablist",
1566
- "aria-label": e.messages.settings
1567
- }, [
1568
- (E(!0), P(he, null, be(l.value, (R, b) => (E(), P("button", {
1569
- id: r + "-tab-" + R.key,
1570
- key: R.key,
1571
- type: "button",
1572
- role: "tab",
1573
- "aria-selected": o.value === R.key,
1574
- "aria-controls": r + "-panel-" + R.key,
1575
- tabindex: o.value === R.key ? 0 : -1,
1576
- onClick: (S) => c.$emit("section", R.key),
1577
- onKeydown: (S) => u(S, b)
1578
- }, x(R.label), 41, Fo))), 128))
1579
- ], 8, Ao),
1580
- h("div", Oo, [
1581
- h("section", {
1582
- id: r + "-panel-general",
1583
- role: "tabpanel",
1584
- "aria-labelledby": r + "-tab-general",
1585
- hidden: o.value !== "general"
1586
- }, [
1587
- mt(c.$slots, "default", {}, void 0, !0),
1588
- e.interaction ? (E(), P("fieldset", zo, [
1589
- h("legend", null, x(e.messages.settingsPanes), 1),
1590
- h("label", qo, [
1591
- h("span", null, x(e.messages.freezeHeaders), 1),
1592
- h("input", {
1593
- type: "checkbox",
1594
- checked: e.interaction.freezeHeaders,
1595
- disabled: e.busy,
1596
- onChange: i[1] || (i[1] = (R) => c.$emit("interaction", { freezeHeaders: R.target.checked }))
1597
- }, null, 40, Bo)
1598
- ]),
1599
- h("label", No, [
1600
- h("span", null, x(e.messages.frozenColumns), 1),
1601
- h("input", {
1602
- class: "mrp-frozen-count",
1603
- type: "number",
1604
- min: "0",
1605
- max: "20",
1606
- value: e.interaction.frozenColumns ?? 0,
1607
- disabled: e.busy,
1608
- onChange: i[2] || (i[2] = (R) => c.$emit("interaction", { frozenColumns: Math.max(0, Math.min(20, Number(R.target.value) || 0)) }))
1609
- }, null, 40, jo)
1610
- ])
1611
- ])) : N("", !0)
1612
- ], 8, Lo),
1613
- h("section", {
1614
- id: r + "-panel-tools",
1615
- role: "tabpanel",
1616
- "aria-labelledby": r + "-tab-tools",
1617
- hidden: o.value !== "tools"
1618
- }, [
1619
- (E(!0), P(he, null, be(g.value, (R) => (E(), P("fieldset", {
1620
- key: R.label
1621
- }, [
1622
- h("legend", null, x(R.label), 1),
1623
- (E(!0), P(he, null, be(R.tools, (b) => (E(), P("label", {
1624
- key: b.key,
1625
- class: ke(["mrp-settings-option", { "mrp-settings-unavailable": !e.available[b.key] }])
1626
- }, [
1627
- h("span", null, [
1628
- ue(x(b.label), 1),
1629
- e.available[b.key] ? N("", !0) : (E(), P("small", Ko, x(e.messages.settingsUnavailable), 1))
1630
- ]),
1631
- h("input", {
1632
- type: "checkbox",
1633
- checked: e.enabled[b.key],
1634
- disabled: e.busy || !e.available[b.key],
1635
- onChange: (S) => m(S, b.key)
1636
- }, null, 40, Wo)
1637
- ], 2))), 128))
1638
- ]))), 128)),
1639
- e.available.editing ? (E(), P("p", Uo, x(e.persistedEditing ? e.messages.editingSaved : e.messages.editingLocal), 1)) : N("", !0),
1640
- e.available.import ? (E(), P("p", Vo, x(e.messages.importLocal), 1)) : N("", !0)
1641
- ], 8, Ho),
1642
- h("section", {
1643
- id: r + "-panel-advanced",
1644
- role: "tabpanel",
1645
- "aria-labelledby": r + "-tab-advanced",
1646
- hidden: o.value !== "advanced"
1647
- }, [
1648
- h("p", Jo, x(e.messages.settingsAdvancedDescription), 1),
1649
- h("label", Zo, [
1650
- h("span", null, [
1651
- ue(x(e.messages.settingsCalculations), 1),
1652
- h("small", {
1653
- id: r + "-calculation-description"
1654
- }, x(e.messages.settingsCalculationsDescription), 9, Yo)
1655
- ]),
1656
- h("input", {
1657
- type: "checkbox",
1658
- "aria-label": e.messages.settingsCalculations,
1659
- "aria-describedby": r + "-calculation-description",
1660
- checked: e.interaction?.calculations === !0,
1661
- disabled: e.busy,
1662
- onChange: i[3] || (i[3] = (R) => c.$emit("interaction", { calculations: R.target.checked }))
1663
- }, null, 40, Xo)
1664
- ]),
1665
- e.interaction?.calculations ? mt(c.$slots, "advanced", {}, void 0, !0, 0) : N("", !0)
1666
- ], 8, Go)
1667
- ]),
1668
- h("footer", null, [
1669
- h("button", {
1670
- type: "button",
1671
- disabled: e.busy,
1672
- onClick: i[4] || (i[4] = (R) => c.$emit("reset"))
1673
- }, x(e.messages.settingsReset), 9, Qo),
1674
- h("span", null, x(e.messages.settingsLocal), 1)
1675
- ])
1676
- ], 8, Mo)
1677
- ]));
1678
- }
1679
- }), er = /* @__PURE__ */ $e(_o, [["__scopeId", "data-v-36723612"]]), tr = {
1680
- class: "mrp-empty",
1681
- role: "status"
1682
- }, nr = { key: 0 }, ar = /* @__PURE__ */ Ie({
1683
- __name: "ReportEmpty",
1684
- props: {
1685
- title: {},
1686
- description: {}
1687
- },
1688
- setup(e) {
1689
- return (t, n) => (E(), P("div", tr, [
1690
- n[0] || (n[0] = La('<svg class="mrp-empty-art" viewBox="0 0 160 112" fill="none" aria-hidden="true" data-v-3e16b87e><ellipse cx="80" cy="100" rx="54" ry="7" fill="currentColor" opacity=".05" data-v-3e16b87e></ellipse><rect x="34" y="15" width="92" height="78" rx="9" fill="currentColor" opacity=".10" data-v-3e16b87e></rect><rect x="42" y="9" width="76" height="78" rx="7" fill="var(--mrp-toolbar-bg, #fff)" stroke="currentColor" stroke-opacity=".2" stroke-width="1.5" data-v-3e16b87e></rect><path d="M55 27H105M55 42H105M55 57H85M55 72H76M71 27V72M89 27V57" stroke="currentColor" stroke-opacity=".4" stroke-width="1.5" stroke-linecap="round" data-v-3e16b87e></path><circle cx="112" cy="76" r="16" fill="var(--mrp-toolbar-bg, #fff)" stroke="currentColor" stroke-opacity=".35" stroke-width="2" data-v-3e16b87e></circle><path d="M124 88L137 101M106 76H118" stroke="currentColor" stroke-opacity=".45" stroke-width="3" stroke-linecap="round" data-v-3e16b87e></path><circle cx="27" cy="38" r="3" fill="currentColor" opacity=".12" data-v-3e16b87e></circle><circle cx="132" cy="24" r="2" fill="currentColor" opacity=".2" data-v-3e16b87e></circle></svg>', 1)),
1691
- h("strong", null, x(e.title), 1),
1692
- e.description ? (E(), P("p", nr, x(e.description), 1)) : N("", !0)
1693
- ]));
1694
- }
1695
- }), zn = /* @__PURE__ */ $e(ar, [["__scopeId", "data-v-3e16b87e"]]), sr = ["aria-label"], or = /* @__PURE__ */ Ie({
1696
- __name: "ReportDiscardDialog",
1697
- props: {
1698
- messages: {}
1699
- },
1700
- emits: ["answer"],
1701
- setup(e, { emit: t }) {
1702
- const n = t, a = V(null), s = V(null);
1703
- let o = null;
1704
- function r(l) {
1705
- l.key === "Escape" && (l.preventDefault(), n("answer", !1)), l.key === "Tab" && (l.preventDefault(), document.activeElement === a.value ? s.value?.focus() : a.value?.focus());
1706
- }
1707
- return Pt(() => {
1708
- o = document.activeElement instanceof HTMLElement ? document.activeElement : null, a.value?.focus();
1709
- }), un(() => {
1710
- o?.isConnected && o.focus();
1711
- }), (l, u) => (E(), P("div", {
1712
- class: "mrp-discard-backdrop",
1713
- onKeydown: r,
1714
- onClick: u[2] || (u[2] = ft((p) => n("answer", !1), ["self"]))
1715
- }, [
1716
- h("section", {
1717
- class: "mrp-discard-dialog",
1718
- role: "alertdialog",
1719
- "aria-modal": "true",
1720
- "aria-label": e.messages.discardTitle
1721
- }, [
1722
- h("strong", null, x(e.messages.discardTitle), 1),
1723
- h("p", null, x(e.messages.discardDescription), 1),
1724
- h("footer", null, [
1725
- h("button", {
1726
- ref_key: "keep",
1727
- ref: a,
1728
- type: "button",
1729
- onClick: u[0] || (u[0] = (p) => n("answer", !1))
1730
- }, x(e.messages.discardKeep), 513),
1731
- h("button", {
1732
- ref_key: "discard",
1733
- ref: s,
1734
- type: "button",
1735
- onClick: u[1] || (u[1] = (p) => n("answer", !0))
1736
- }, x(e.messages.discardProceed), 513)
1737
- ])
1738
- ], 8, sr)
1739
- ], 32));
1740
- }
1741
- }), rr = /* @__PURE__ */ $e(or, [["__scopeId", "data-v-f7590294"]]), lr = {
1742
- key: 0,
1743
- class: "mrp-task-status",
1744
- role: "status",
1745
- "aria-live": "polite"
1746
- }, ir = { key: 0 }, ur = ["value", "max", "aria-label"], cr = /* @__PURE__ */ Ie({
1747
- __name: "ReportTaskStatus",
1748
- props: {
1749
- task: {},
1750
- messages: {}
1751
- },
1752
- emits: ["cancel"],
1753
- setup(e) {
1754
- const t = e, n = z(() => ({ query: t.messages.taskQuery, validate: t.messages.taskValidate, layout: t.messages.taskLayout, assets: t.messages.taskAssets, import: t.messages.importing, encode: t.messages.taskEncode, download: t.messages.taskDownload, print: t.messages.taskPrint })), a = z(() => t.task?.total === void 0 ? "" : `${t.task.completed ?? 0} / ${t.task.total}`);
1755
- return (s, o) => e.task && (e.task.status === "running" || e.task.status === "cancelled") ? (E(), P("div", lr, [
1756
- h("span", null, [
1757
- ue(x(e.task.status === "cancelled" ? e.messages.taskCancelled : n.value[e.task.stage]) + " ", 1),
1758
- e.task.status === "running" ? (E(), P("small", ir, x(a.value), 1)) : N("", !0)
1759
- ]),
1760
- e.task.status === "running" && e.task.total !== void 0 ? (E(), P("progress", {
1761
- key: 0,
1762
- value: e.task.completed ?? 0,
1763
- max: e.task.total,
1764
- "aria-label": n.value[e.task.stage]
1765
- }, null, 8, ur)) : N("", !0),
1766
- e.task.status === "running" && e.task.cancellable ? (E(), P("button", {
1767
- key: 1,
1768
- type: "button",
1769
- onClick: o[0] || (o[0] = (r) => s.$emit("cancel"))
1770
- }, x(e.messages.taskCancel), 1)) : N("", !0)
1771
- ])) : N("", !0);
1772
- }
1773
- }), dr = /* @__PURE__ */ $e(cr, [["__scopeId", "data-v-657ac599"]]), fr = {
1774
- key: 0,
1775
- class: "mrp-diagnostics"
1776
- }, mr = ["aria-label", "placeholder"], gr = { key: 0 }, pr = ["onClick"], vr = { key: 0 }, hr = /* @__PURE__ */ Ie({
1777
- __name: "ReportDiagnostics",
1778
- props: {
1779
- entries: {},
1780
- messages: {}
1781
- },
1782
- emits: ["locate"],
1783
- setup(e) {
1784
- const t = e, n = V(""), a = z(() => ({
1785
- "unsupported-style": t.messages.diagnosticUnsupportedStyle,
1786
- "missing-image": t.messages.diagnosticMissingImage,
1787
- "unsupported-component": t.messages.diagnosticUnsupported,
1788
- "unsupported-image-format": t.messages.diagnosticImageFormat,
1789
- "rich-text-flattened": t.messages.diagnosticRichText,
1790
- "nested-components-omitted": t.messages.diagnosticNested,
1791
- "async-image-required": t.messages.diagnosticImageAsync,
1792
- "image-decode-failed": t.messages.diagnosticImageDecode,
1793
- "asset-render-failed": t.messages.diagnosticAssetFailed,
1794
- "asset-budget-exceeded": t.messages.diagnosticAssetBudget
1795
- })), s = z(() => {
1796
- const l = n.value.trim().toLocaleLowerCase();
1797
- return l ? t.entries.filter((u) => `${u.code} ${u.message} ${a.value[u.code] ?? ""} ${u.path ?? ""} ${r(u)} ${u.format ?? ""}`.toLocaleLowerCase().includes(l)) : t.entries;
1798
- }), o = z(() => s.value.slice(0, 100));
1799
- function r(l) {
1800
- return l.pageIndex === void 0 ? l.path ?? "" : (t.messages.diagnosticsLocation ?? "").replace("{page}", String(l.pageIndex + 1)).replace("{component}", String((l.componentIndex ?? 0) + 1));
1801
- }
1802
- return (l, u) => e.entries.length ? (E(), P("details", fr, [
1803
- h("summary", null, [
1804
- ue(x(e.messages.diagnosticsTitle) + " ", 1),
1805
- h("span", null, x(e.entries.length), 1)
1806
- ]),
1807
- on(h("input", {
1808
- "onUpdate:modelValue": u[0] || (u[0] = (p) => n.value = p),
1809
- type: "search",
1810
- "aria-label": e.messages.diagnosticsSearch,
1811
- placeholder: e.messages.diagnosticsSearch
1812
- }, null, 8, mr), [
1813
- [rn, n.value]
1814
- ]),
1815
- h("ol", null, [
1816
- (E(!0), P(he, null, be(o.value, (p, v) => (E(), P("li", { key: v }, [
1817
- h("div", null, [
1818
- h("b", null, x(p.format?.toUpperCase() ?? p.severity) + " · " + x(p.code), 1),
1819
- h("p", null, x(a.value[p.code] ?? p.message), 1),
1820
- a.value[p.code] ? (E(), P("details", gr, [
1821
- h("summary", null, x(e.messages.diagnosticsDetails), 1),
1822
- ue(x(p.message), 1)
1823
- ])) : N("", !0),
1824
- h("small", null, x(r(p)), 1)
1825
- ]),
1826
- p.pageIndex !== void 0 ? (E(), P("button", {
1827
- key: 0,
1828
- type: "button",
1829
- onClick: (g) => l.$emit("locate", p)
1830
- }, x(e.messages.diagnosticsLocate), 9, pr)) : N("", !0)
1831
- ]))), 128))
1832
- ]),
1833
- s.value.length > o.value.length ? (E(), P("small", vr, x((e.messages.diagnosticsMore ?? "").replace("{count}", String(s.value.length))), 1)) : N("", !0)
1834
- ])) : N("", !0);
1835
- }
1836
- }), br = /* @__PURE__ */ $e(hr, [["__scopeId", "data-v-3b7804ce"]]);
1837
- class Se extends Error {
1838
- constructor(t, n, a) {
1839
- super(n), this.name = "MachReportError", this.code = t, this.cause = a;
1840
- }
1841
- }
1842
- function yr(e) {
1843
- return e instanceof Se ? { code: e.code, cause: e.cause } : { code: "render", cause: e };
1844
- }
1845
- function wr(e) {
1846
- if (e instanceof Se) return e;
1847
- if (e instanceof Ha) return new Se("param", e.message, e);
1848
- if (e instanceof Ka) return new Se(e.code, e.message, e.cause);
1849
- if (e instanceof Error) {
1850
- const t = { params: "param", config: "config", validate: "validate", fetch: "fetch" }, n = e.code;
1851
- if (typeof n == "string" && Object.prototype.hasOwnProperty.call(t, n)) return new Se(t[n], e.message, e);
1852
- }
1853
- return new Se("fetch", e instanceof Error ? e.message : "预览加载失败", e);
1854
- }
1855
- const qn = /* @__PURE__ */ new Map(), et = /* @__PURE__ */ new Map(), xr = 15e3;
1856
- function tn(e, t) {
1857
- return Object.assign(new Error(e), { cause: t });
1858
- }
1859
- function ct(e, t) {
1860
- return `PDF 字体 ${JSON.stringify(e)}:${t}。请部署支持报表文字的字体文件,并将 pdfFontUrl 配置为可访问的字体 URL;西文报表可设为空串`;
1861
- }
1862
- function $t(e) {
1863
- if (e?.reason instanceof Error && e.reason.name === "AbortError") return e.reason;
1864
- const t = tn("PDF 字体检查已取消", e?.reason);
1865
- return t.name = "AbortError", t;
1866
- }
1867
- async function kr(e, t) {
1868
- let n = !1;
1869
- const a = setTimeout(() => {
1870
- n = !0, t.abort();
1871
- }, xr);
1872
- try {
1873
- const s = await fetch(e, { method: "HEAD", signal: t.signal });
1874
- if (t.signal.aborted) throw $t(t.signal);
1875
- if (s.status === 405 || s.status === 501 || s.type === "opaque")
1876
- return {
1877
- status: "unverified",
1878
- fontUrl: e,
1879
- message: `PDF 字体 ${JSON.stringify(e)} 无法通过 HEAD 检查验证;仍可尝试导出,届时会加载并校验字体`
1880
- };
1881
- if (!s.ok) {
1882
- const r = new Error(`字体请求返回 HTTP ${s.status}`);
1883
- return { status: "error", fontUrl: e, message: ct(e, r.message), cause: r };
1884
- }
1885
- const o = s.headers.get("content-type") ?? "";
1886
- if (/text\/html|application\/xhtml\+xml/i.test(o)) {
1887
- const r = new Error("字体 URL 返回 HTML 页面(可能是 SPA 路由回退),不是字体文件");
1888
- return { status: "error", fontUrl: e, message: ct(e, r.message), cause: r };
1889
- }
1890
- if (/^text\//i.test(o) || /(?:\/|\+)json(?:\s*;|$)/i.test(o)) {
1891
- const r = new Error(`字体 URL 返回 ${o} 文本响应,不是字体文件`);
1892
- return { status: "error", fontUrl: e, message: ct(e, r.message), cause: r };
1893
- }
1894
- return {
1895
- status: "available",
1896
- fontUrl: e,
1897
- message: "PDF 字体资源可达;文字覆盖范围将在实际导出时校验"
1898
- };
1899
- } catch (s) {
1900
- if (t.signal.aborted && !n) throw $t(t.signal);
1901
- return {
1902
- status: "error",
1903
- fontUrl: e,
1904
- message: ct(e, n ? "字体检查超时,请检查网络或字体服务" : "字体检查失败,请检查网络、字体服务或跨域访问配置"),
1905
- cause: s
1906
- };
1907
- } finally {
1908
- clearTimeout(a);
1909
- }
1910
- }
1911
- function Er(e, t) {
1912
- if (t?.aborted) return Promise.reject($t(t));
1913
- if (!e)
1914
- return Promise.resolve({ status: "disabled", fontUrl: e, message: "已停用自定义 PDF 字体;内置字体用于西文,其他文字会在导出时校验" });
1915
- const n = qn.get(e);
1916
- if (n) return Promise.resolve(n);
1917
- let a = et.get(e);
1918
- if (!a) {
1919
- const o = new AbortController();
1920
- a = { controller: o, promise: kr(e, o), subscribers: 0 };
1921
- const r = a;
1922
- et.set(e, r), r.promise = r.promise.then((l) => (!o.signal.aborted && l.status === "available" && qn.set(e, l), l)).finally(() => {
1923
- et.get(e) === r && et.delete(e);
1924
- });
1925
- }
1926
- const s = a;
1927
- return s.subscribers++, new Promise((o, r) => {
1928
- let l = !1;
1929
- const u = () => l ? !1 : (l = !0, s.subscribers--, t?.removeEventListener("abort", p), !0), p = () => {
1930
- u() && (s.subscribers === 0 && (et.get(e) === s && et.delete(e), s.controller.abort()), r($t(t)));
1931
- };
1932
- t?.addEventListener("abort", p, { once: !0 }), s.promise.then(
1933
- (v) => {
1934
- u() && o(v);
1935
- },
1936
- (v) => {
1937
- u() && r(v);
1938
- }
1939
- ), t?.aborted && p();
1940
- });
1941
- }
1942
- function Cr(e = { fontUrl: "/simhei.ttf" }) {
1943
- let t = null;
1944
- const n = async (a, s, o = {}) => {
1945
- je(o.signal), t || (t = await import("@agile-team/mach-report/pdf")), je(o.signal);
1946
- let r = null;
1947
- if (e.fontUrl)
1948
- try {
1949
- if (r = await at(t.loadFontWithCache(e.fontUrl, { strict: !0, signal: o.signal }), o.signal), !r?.byteLength) throw new Error("字体文件为空或加载失败");
1950
- } catch (m) {
1951
- const w = m instanceof Error ? m.message : String(m);
1952
- throw tn(ct(e.fontUrl, w), m);
1953
- }
1954
- let l;
1955
- try {
1956
- je(o.signal), l = await t.renderPlanToPdf(a, { ...o, ...r ? { customFontBytes: r } : {} });
1957
- } catch (m) {
1958
- if (!r) throw m;
1959
- const w = m instanceof Error ? m.message : String(m);
1960
- throw tn(`PDF 生成失败:${w}。当前字体 URL 为 ${JSON.stringify(e.fontUrl)};请确认该文件是有效字体,或重新配置 pdfFontUrl`, m);
1961
- }
1962
- je(o.signal), l.diagnostics?.forEach((m) => {
1963
- try {
1964
- o.onDiagnostic?.(m);
1965
- } catch {
1966
- }
1967
- });
1968
- const { bytes: u, unsupportedTextCount: p, pageErrors: v, fidelityWarnings: g } = l;
1969
- if (p > 0)
1970
- throw new Error(`PDF 中有 ${p} 行文字无法编码;请部署支持所用文字的字体并配置 pdfFontUrl`);
1971
- if (v.length > 0)
1972
- throw new Error(`PDF 有 ${v.length} 页渲染失败:${v[0]}`);
1973
- return g.length > 0 && s?.(`PDF 有 ${g.length} 处版式降级:${g.slice(0, 2).join(";")}`), u;
1974
- };
1975
- return n.checkFont = (a) => Er(e.fontUrl, a), n;
1976
- }
1977
- function Ir(e) {
1978
- const t = fe(Object.freeze({ status: "unchecked", fontUrl: "" }));
1979
- let n = null, a = null, s = 0, o = null;
1980
- function r() {
1981
- if (e.injectedExporter) return e.injectedExporter;
1982
- const v = e.fontUrl();
1983
- return (!a || n !== v) && (n = v, a = Cr({ fontUrl: v })), a;
1984
- }
1985
- function l() {
1986
- s++, o?.abort(), o = null;
1987
- }
1988
- async function u() {
1989
- if (e.destroyed()) throw new Se("config", "报表预览已卸载");
1990
- l();
1991
- const v = s, g = new AbortController();
1992
- o = g;
1993
- const m = e.fontUrl();
1994
- t.value = Object.freeze({ status: "checking", fontUrl: m });
1995
- try {
1996
- const w = r(), y = w.checkFont ? await w.checkFont(g.signal) : { status: "unverified", fontUrl: "", message: "自定义 PDF 导出器未提供字体预检查;字体由宿主确认" };
1997
- return !e.destroyed() && v === s && !g.signal.aborted && (t.value = Object.freeze({ ...y })), y;
1998
- } catch (w) {
1999
- if (g.signal.aborted) throw w;
2000
- const y = { status: "error", fontUrl: m, message: w instanceof Error ? w.message : "PDF 字体检查失败", cause: w };
2001
- return !e.destroyed() && v === s && (t.value = Object.freeze(y)), y;
2002
- } finally {
2003
- o === g && (o = null);
2004
- }
2005
- }
2006
- function p() {
2007
- u().catch(() => {
2008
- });
2009
- }
2010
- return le([e.plan, z(e.fontUrl), z(e.enabled)], () => {
2011
- const v = t.value.fontUrl === e.fontUrl();
2012
- v && t.value.status === "available" || (l(), (!v || t.value.status === "checking") && (t.value = Object.freeze({ status: "unchecked", fontUrl: e.fontUrl() })), !e.destroyed() && e.plan.value?.pages.length && e.enabled() && p());
2013
- }, { immediate: !0 }), { pdfFont: t, getPdfExporter: r, checkPdfFont: u, retryPdfFont: p, cancelFontCheck: l };
2014
- }
2015
- function $r(e) {
2016
- const t = fe(null), n = fe(!1);
2017
- let a = 0, s = null;
2018
- function o(u) {
2019
- const p = s;
2020
- s = null, t.value = null, n.value = !1, p?.(u);
2021
- }
2022
- function r() {
2023
- a++, o(!1);
2024
- }
2025
- async function l(u) {
2026
- if (r(), !e.enabled() || !e.pending()) return !0;
2027
- const p = a, v = [...e.snapshot?.() ?? []];
2028
- n.value = !0;
2029
- const g = Object.freeze({ reason: u, reportIds: Object.freeze([...e.reportIds()]), pendingLocalChanges: !0 });
2030
- try {
2031
- const m = e.hook(), w = await new Promise((c) => {
2032
- if (s = c, !m) {
2033
- t.value = g;
2034
- return;
2035
- }
2036
- Promise.resolve().then(() => m(g)).then((i) => {
2037
- p === a && o(i === !0);
2038
- }, (i) => {
2039
- if (p === a) {
2040
- try {
2041
- e.error(i);
2042
- } catch {
2043
- }
2044
- o(!1);
2045
- }
2046
- });
2047
- }), y = e.snapshot?.() ?? [];
2048
- return p === a && w === !0 && y.length === v.length && v.every((c, i) => Object.is(c, y[i]));
2049
- } catch (m) {
2050
- if (p === a) {
2051
- try {
2052
- e.error(m);
2053
- } catch {
2054
- }
2055
- o(!1);
2056
- }
2057
- return !1;
2058
- }
2059
- }
2060
- return { request: t, pending: n, check: l, settle: o, cancel: r };
2061
- }
2062
- let Pr = 0;
2063
- function Sr(e) {
2064
- const t = fe(null), n = /* @__PURE__ */ new Set();
2065
- let a = null;
2066
- function s(u) {
2067
- t.value = Object.freeze(u);
2068
- try {
2069
- e(t.value);
2070
- } catch {
2071
- }
2072
- }
2073
- function o(u, p, v) {
2074
- const g = `mr-task-${Date.now().toString(36)}-${++Pr}`;
2075
- n.add(g), a = v, s({ taskId: g, kind: u, stage: p, status: "running", cancellable: !0 });
2076
- function m(y, c, i) {
2077
- t.value?.taskId !== g || t.value.status !== "running" || s({ ...t.value, stage: y, completed: c, total: i });
2078
- }
2079
- function w(y = "completed") {
2080
- t.value?.taskId !== g || t.value.status !== "running" || (a = null, s({ ...t.value, status: y, cancellable: !1 }));
2081
- }
2082
- return { taskId: g, update: m, finish: w };
2083
- }
2084
- function r() {
2085
- if (t.value?.status !== "running") return;
2086
- const u = a;
2087
- a = null, s({ ...t.value, status: "cancelled", cancellable: !1 }), u?.();
2088
- }
2089
- function l(u, p) {
2090
- t.value?.taskId !== u.taskId && (u.status !== "running" || n.has(u.taskId)) || (n.add(u.taskId), n.size > 100 && n.delete(n.values().next().value), a = u.status === "running" ? p : null, s({ ...u }));
2091
- }
2092
- return { state: t, start: o, cancel: r, receive: l };
2093
- }
2094
- function Rr(e) {
2095
- const t = fe(Object.freeze([])), n = /* @__PURE__ */ new Set();
2096
- let a = 0;
2097
- function s() {
2098
- a++, t.value = Object.freeze([]), n.clear();
2099
- }
2100
- function o(u) {
2101
- const p = a, v = [];
2102
- for (const g of u) {
2103
- const m = JSON.stringify([g.code, g.format, g.pageIndex, g.componentIndex, g.componentPath, g.path, g.message]);
2104
- if (n.has(m)) continue;
2105
- n.add(m);
2106
- const w = Object.freeze({ ...g, ...g.componentPath ? { componentPath: Object.freeze([...g.componentPath]) } : {} });
2107
- v.push(w);
2108
- }
2109
- v.length && (t.value = Object.freeze([...t.value, ...v]));
2110
- for (const g of v) {
2111
- if (p !== a) break;
2112
- try {
2113
- e(g);
2114
- } catch {
2115
- }
2116
- }
2117
- }
2118
- function r(u) {
2119
- o([u]);
2120
- }
2121
- function l(u, p) {
2122
- const v = Wa(u, p);
2123
- return o(v), v;
2124
- }
2125
- return { entries: t, reset: s, add: r, addMany: o, inspect: l };
2126
- }
2127
- let Mr = 0;
2128
- function Tr() {
2129
- return `mrp-params-${++Mr}`;
2130
- }
2131
- function _n(e, t, n) {
2132
- const a = (Array.isArray(t) ? t.find((s) => s?.field === e.field)?.label : void 0) ?? e.field;
2133
- return e.code === "required" ? n.paramRequired.replace("{label}", a) : (n.paramInvalid ?? "{label}:{message}").replace("{label}", a).replace("{message}", e.message);
2134
- }
2135
- function Dr(e) {
2136
- const t = V({}), n = V(!1);
2137
- function a() {
2138
- const l = {};
2139
- for (const u of Array.isArray(e.defs.value) ? e.defs.value : [])
2140
- typeof u?.field == "string" && Object.defineProperty(l, u.field, { value: e.params()[u.field] ?? u.defaultValue ?? "", writable: !0, enumerable: !0, configurable: !0 });
2141
- t.value = l, n.value = !1;
2142
- }
2143
- a(), le(e.defs, a), le(e.reportIds, a), le(() => JSON.stringify(e.params()), a);
2144
- const s = z(() => Vn(e.defs.value, { ...e.params(), ...t.value })), o = z(() => !n.value && s.value.issues.length > 0 && s.value.issues.every((l) => l.code === "required"));
2145
- function r() {
2146
- const l = s.value;
2147
- if (!l.ok) {
2148
- const v = l.issues[0];
2149
- return { quiet: o.value, error: new Se(v.code === "definition" ? "config" : "param", _n(v, e.defs.value, e.messages()), { issues: l.issues }) };
2150
- }
2151
- const u = { ...l.values }, p = new Set(e.defs.value.filter((v) => v.defaultValue !== void 0).map((v) => v.field));
2152
- for (const [v, g] of Object.entries(u)) g === "" && !p.has(v) && delete u[v];
2153
- return { params: u, quiet: !1 };
2154
- }
2155
- return { values: t, attempted: n, validation: s, pendingRequired: o, reset: a, query: r };
2156
- }
2157
- const Ar = { class: "mrp-params-title" }, Fr = { class: "mrp-params-grid" }, Or = ["id"], Lr = {
2158
- key: 0,
2159
- class: "mrp-param-star"
2160
- }, zr = ["value", "aria-labelledby", "aria-invalid", "aria-describedby", "aria-required", "onChange"], qr = ["disabled", "hidden"], Br = ["value"], Nr = ["type", "placeholder", "value", "min", "max", "step", "aria-labelledby", "aria-invalid", "aria-describedby", "aria-required", "onInput"], jr = ["id"], Hr = { class: "mrp-params-actions" }, Kr = /* @__PURE__ */ Ie({
2161
- __name: "ReportParamPanel",
2162
- props: {
2163
- defs: {},
2164
- modelValue: {},
2165
- messages: {},
2166
- attempted: { type: Boolean },
2167
- issues: {}
2168
- },
2169
- emits: ["update:modelValue", "query", "reset"],
2170
- setup(e, { expose: t, emit: n }) {
2171
- const a = e, s = n, o = V({ ...a.modelValue }), r = V(null), l = Tr();
2172
- le(
2173
- () => a.modelValue,
2174
- (w) => {
2175
- o.value = { ...w };
2176
- }
2177
- );
2178
- const u = z(() => a.issues ?? Vn(a.defs, o.value).issues), p = z(
2179
- () => (Array.isArray(a.defs) ? a.defs : []).filter((w) => w && typeof w.field == "string").map((w, y) => ({
2180
- def: w,
2181
- id: `${l}-${y}`,
2182
- label: w.label ?? w.field,
2183
- value: o.value[w.field] ?? "",
2184
- error: a.attempted ? u.value.find((c) => c.field === w.field) : void 0
2185
- }))
2186
- );
2187
- function v(w, y) {
2188
- o.value = { ...o.value, [w]: y }, s("update:modelValue", { ...o.value });
2189
- }
2190
- function g(w) {
2191
- w.isComposing || s("query");
2192
- }
2193
- function m() {
2194
- r.value?.querySelector('[aria-invalid="true"]')?.focus();
2195
- }
2196
- return t({ focusInvalid: m }), (w, y) => (E(), P("div", {
2197
- ref_key: "root",
2198
- ref: r,
2199
- class: "mrp-params"
2200
- }, [
2201
- h("span", Ar, x(e.messages.paramsTitle), 1),
2202
- h("div", Fr, [
2203
- (E(!0), P(he, null, be(p.value, (c) => (E(), P("label", {
2204
- key: c.id,
2205
- class: ke(["mrp-param", { "mrp-param-missing": !!c.error }])
2206
- }, [
2207
- h("span", {
2208
- id: `${c.id}-label`,
2209
- class: "mrp-param-label"
2210
- }, [
2211
- ue(x(c.label), 1),
2212
- c.def.required ? (E(), P("i", Lr, "*")) : N("", !0)
2213
- ], 8, Or),
2214
- (c.def.type ?? "text") === "select" ? (E(), P("select", {
2215
- key: 0,
2216
- class: "mrp-param-input",
2217
- value: c.value,
2218
- "aria-labelledby": `${c.id}-label`,
2219
- "aria-invalid": c.error ? !0 : void 0,
2220
- "aria-describedby": c.error ? `${c.id}-error` : void 0,
2221
- "aria-required": c.def.required || void 0,
2222
- onChange: (i) => v(c.def.field, i.target.value),
2223
- onKeydown: Qt(g, ["enter"])
2224
- }, [
2225
- h("option", {
2226
- value: "",
2227
- disabled: c.def.required,
2228
- hidden: c.def.required
2229
- }, x(c.def.placeholder ?? (e.messages.paramSelectPlaceholder ?? "请选择{label}").replace("{label}", c.label)), 9, qr),
2230
- (E(!0), P(he, null, be(c.def.options ?? [], (i) => (E(), P("option", {
2231
- key: i.value,
2232
- value: i.value
2233
- }, x(i.label), 9, Br))), 128))
2234
- ], 40, zr)) : (E(), P("input", {
2235
- key: 1,
2236
- class: "mrp-param-input",
2237
- type: c.def.type === "number" ? "number" : c.def.type === "date" ? "date" : "text",
2238
- placeholder: c.def.placeholder ?? (e.messages.paramTextPlaceholder ?? "请输入{label}").replace("{label}", c.label),
2239
- value: c.value,
2240
- min: c.def.min,
2241
- max: c.def.max,
2242
- step: c.def.type === "number" ? "any" : void 0,
2243
- "aria-labelledby": `${c.id}-label`,
2244
- "aria-invalid": c.error ? !0 : void 0,
2245
- "aria-describedby": c.error ? `${c.id}-error` : void 0,
2246
- "aria-required": c.def.required || void 0,
2247
- onInput: (i) => v(c.def.field, i.target.value),
2248
- onKeydown: Qt(g, ["enter"])
2249
- }, null, 40, Nr)),
2250
- c.error ? (E(), P("small", {
2251
- key: 2,
2252
- id: `${c.id}-error`,
2253
- class: "mrp-param-error",
2254
- role: "status"
2255
- }, x(d(_n)(c.error, e.defs, e.messages)), 9, jr)) : N("", !0)
2256
- ], 2))), 128))
2257
- ]),
2258
- h("div", Hr, [
2259
- h("button", {
2260
- class: "mrp-nav mrp-param-query",
2261
- type: "button",
2262
- onClick: y[0] || (y[0] = (c) => w.$emit("query"))
2263
- }, x(e.messages.query), 1),
2264
- h("button", {
2265
- class: "mrp-nav",
2266
- type: "button",
2267
- onClick: y[1] || (y[1] = (c) => w.$emit("reset"))
2268
- }, x(e.messages.reset), 1)
2269
- ])
2270
- ], 512));
2271
- }
2272
- }), Wr = /* @__PURE__ */ $e(Kr, [["__scopeId", "data-v-156737bc"]]), Ur = { class: "mrp-edit-bar" }, Vr = ["disabled"], Gr = ["disabled"], Jr = { class: "mrp-changes" }, Zr = ["aria-label"], Yr = { key: 0 }, Xr = { key: 1 }, Qr = ["onClick"], _r = ["title"], el = ["title"], tl = ["disabled"], nl = {
2273
- key: 0,
2274
- role: "status"
2275
- }, al = {
2276
- key: 1,
2277
- role: "status"
2278
- }, sl = {
2279
- key: 2,
2280
- class: "mrp-conflicts",
2281
- open: ""
2282
- }, ol = /* @__PURE__ */ Ie({
2283
- __name: "ReportEditBar",
2284
- props: {
2285
- differences: {},
2286
- conflicts: {},
2287
- messages: {},
2288
- saving: { type: Boolean },
2289
- canUndo: { type: Boolean },
2290
- canRedo: { type: Boolean },
2291
- busy: { type: Boolean },
2292
- persisted: { type: Boolean }
2293
- },
2294
- emits: ["undo", "redo", "restore", "locate"],
2295
- setup(e) {
2296
- function t(n) {
2297
- return n.source ? `${n.source.rowKey} · ${n.source.field}` : `${n.address.pageIndex + 1} / ${n.address.rowIndex + 1}:${n.address.columnIndex + 1}`;
2298
- }
2299
- return (n, a) => (E(), P("div", Ur, [
2300
- h("button", {
2301
- type: "button",
2302
- disabled: e.busy || e.saving || !e.canUndo,
2303
- onClick: a[0] || (a[0] = (s) => n.$emit("undo"))
2304
- }, x(e.messages.undo), 9, Vr),
2305
- h("button", {
2306
- type: "button",
2307
- disabled: e.busy || e.saving || !e.canRedo,
2308
- onClick: a[1] || (a[1] = (s) => n.$emit("redo"))
2309
- }, x(e.messages.redo), 9, Gr),
2310
- h("details", Jr, [
2311
- h("summary", null, x(e.messages.changes) + " · " + x(e.messages.changesCount?.replace("{count}", String(e.differences.length))), 1),
2312
- h("section", {
2313
- "aria-label": e.messages.changes
2314
- }, [
2315
- e.differences.length ? (E(), P("ol", Xr, [
2316
- (E(!0), P(he, null, be(e.differences, (s, o) => (E(), P("li", { key: o }, [
2317
- h("button", {
2318
- type: "button",
2319
- onClick: (r) => n.$emit("locate", s)
2320
- }, x(t(s)), 9, Qr),
2321
- h("span", null, [
2322
- h("s", {
2323
- title: e.messages.changesBefore
2324
- }, x(s.previousText || "∅"), 9, _r),
2325
- a[3] || (a[3] = ue(" → ", -1)),
2326
- h("strong", {
2327
- title: e.messages.changesAfter
2328
- }, x(s.text || "∅"), 9, el)
2329
- ])
2330
- ]))), 128))
2331
- ])) : (E(), P("p", Yr, x(e.messages.changesEmpty), 1))
2332
- ], 8, Zr)
2333
- ]),
2334
- h("button", {
2335
- type: "button",
2336
- disabled: e.busy || e.saving || !e.differences.length,
2337
- onClick: a[2] || (a[2] = (s) => n.$emit("restore"))
2338
- }, x(e.messages.restoreChanges), 9, tl),
2339
- e.saving ? (E(), P("span", nl, x(e.messages.saving), 1)) : e.differences.length && !e.conflicts.length ? (E(), P("span", al, x(e.persisted ? e.messages.editSaved : e.messages.editingLocal), 1)) : N("", !0),
2340
- e.conflicts.length ? (E(), P("details", sl, [
2341
- h("summary", null, x(e.messages.conflicts) + " · " + x(e.conflicts.length), 1),
2342
- h("ul", null, [
2343
- (E(!0), P(he, null, be(e.conflicts, (s, o) => (E(), P("li", { key: o }, x(s.message), 1))), 128))
2344
- ])
2345
- ])) : N("", !0)
2346
- ]));
2347
- }
2348
- }), rl = /* @__PURE__ */ $e(ol, [["__scopeId", "data-v-df1c7b86"]]);
2349
- function ll(e) {
2350
- const t = e.table?.columnKeys ?? [], n = t.map(() => []);
2351
- if (!e.grid) return t;
2352
- for (const { ci: a, cell: s } of dn(e.grid, e.widthMm, e.heightMm).cells) {
2353
- const o = (s.text ?? s.rawText ?? "").trim();
2354
- if (o)
2355
- for (let r = a; r < Math.min(t.length, a + (s.colSpan ?? 1)); r++)
2356
- n[r].includes(o) || n[r].push(o);
2357
- }
2358
- return t.map((a, s) => n[s].join(" / ") || a);
2359
- }
2360
- function il(e, t = []) {
2361
- const n = /* @__PURE__ */ new Set(), a = [];
2362
- for (const [s, o] of (e?.pages ?? []).entries())
2363
- for (const r of o.components) {
2364
- const l = r.table;
2365
- if (!l || l.role !== "header" || n.has(l.id)) continue;
2366
- n.add(l.id);
2367
- const u = ll(r), p = t.filter((w) => w.pageIndex <= s), v = p[p.length - 1]?.label, g = l.source?.datasetId, m = [...new Set([v, l.title, g].filter(Boolean))].join(" · ") || l.id;
2368
- l.columnKeys.forEach((w, y) => {
2369
- w && a.push({ key: JSON.stringify([l.id, y]), field: w, label: u[y], group: m, pageIndex: s, tableId: l.id, ...g ? { datasetId: g } : {} });
2370
- });
2371
- }
2372
- return a;
2373
- }
2374
- function ul(e, t) {
2375
- const n = t.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean);
2376
- return e.filter((a) => {
2377
- const s = `${a.label} ${a.field} ${a.group}`.toLocaleLowerCase();
2378
- return n.every((o) => s.includes(o));
2379
- });
2380
- }
2381
- function cl(e) {
2382
- const t = Xn(), n = V(""), a = V(0), s = `mrp-column-list-${ln()?.uid ?? 0}`, o = z(() => il(e.plan(), e.sections())), r = z(() => ul(o.value, n.value)), l = z(() => r.value.slice(0, 100)), u = z(() => [...new Set(l.value.map((y) => y.group))].map((y) => ({ label: y, items: l.value.filter((c) => c.group === y) })));
2383
- le(n, () => {
2384
- a.value = 0;
2385
- }), le(e.busy, (y) => {
2386
- y && t.close();
2387
- }), le(o, () => {
2388
- a.value = 0;
2389
- });
2390
- function p(y) {
2391
- e.busy() || (e.locate(y), t.close(!0));
2392
- }
2393
- function v() {
2394
- if (e.busy()) return;
2395
- const y = l.value[a.value];
2396
- y ? p(y) : n.value.trim() && (e.locateField(n.value.trim()), t.close(!0));
2397
- }
2398
- function g() {
2399
- n.value = "", t.panel.value?.querySelector("input")?.focus();
2400
- }
2401
- function m(y) {
2402
- if (!(y.isComposing || y.keyCode === 229 || !["ArrowDown", "ArrowUp", "Enter"].includes(y.key))) {
2403
- if (y.preventDefault(), y.stopPropagation(), y.key === "Enter") {
2404
- v();
2405
- return;
2406
- }
2407
- l.value.length && (a.value = (a.value + (y.key === "ArrowDown" ? 1 : -1) + l.value.length) % l.value.length, He(() => t.panel.value?.querySelector(`[id="${s}-${a.value}"]`)?.scrollIntoView?.({ block: "nearest" })));
2408
- }
2409
- }
2410
- function w(y) {
2411
- return l.value.findIndex((c) => c.key === y);
2412
- }
2413
- return { ...t, field: n, active: a, listId: s, directory: o, matches: r, candidates: l, groups: u, choose: p, submit: v, clear: g, onSearchKeydown: m, candidateIndex: w };
2414
- }
2415
- const dl = ["aria-label"], fl = {
2416
- key: 0,
2417
- class: "mrp-section-tabs"
2418
- }, ml = ["aria-current", "disabled", "onClick"], gl = ["aria-expanded", "disabled"], pl = {
2419
- key: 0,
2420
- class: "mrp-column-count"
2421
- }, vl = ["aria-label"], hl = { class: "mrp-column-heading" }, bl = ["aria-label"], yl = ["aria-label", "placeholder", "aria-controls", "aria-activedescendant", "disabled"], wl = ["aria-label"], xl = ["id", "aria-label"], kl = {
2422
- key: 0,
2423
- class: "mrp-column-empty",
2424
- role: "status"
2425
- }, El = ["aria-label"], Cl = ["id", "aria-selected", "disabled", "onPointermove", "onClick"], Il = ["title"], $l = {
2426
- class: "mrp-column-help",
2427
- role: "status"
2428
- }, Pl = /* @__PURE__ */ Ie({
2429
- __name: "ReportNavigation",
2430
- props: {
2431
- sections: {},
2432
- currentPage: {},
2433
- messages: {},
2434
- busy: { type: Boolean },
2435
- plan: {},
2436
- compact: { type: Boolean }
2437
- },
2438
- emits: ["goto", "locate", "locate-target"],
2439
- setup(e, { emit: t }) {
2440
- const n = e, a = t, s = cl({ plan: () => n.plan, sections: () => n.sections, busy: () => n.busy, locate: (S) => a("locate-target", S), locateField: (S) => a("locate", S) }), { root: o, trigger: r, panel: l, opened: u, field: p, active: v, directory: g, matches: m, candidates: w, groups: y, listId: c } = s, i = z(() => ({ columnDirectory: "字段目录", columnSearch: "搜索列名或字段", columnNoMatches: "未找到匹配字段", columnResults: "匹配字段", ...n.messages })), R = z(() => (n.messages.columnResultsMore ?? "{count} 个匹配字段,显示前 {limit} 个;继续输入可缩小范围").replace("{count}", String(m.value.length)).replace("{limit}", String(w.value.length)));
2441
- function b(S) {
2442
- const F = n.sections[S];
2443
- return !!F && n.currentPage >= F.pageIndex + 1 && (!n.sections[S + 1] || n.currentPage <= n.sections[S + 1].pageIndex);
2444
- }
2445
- return (S, F) => (E(), P("nav", {
2446
- class: ke(["mrp-section-nav", { "mrp-compact": e.compact }]),
2447
- "aria-label": e.messages.sections ?? "工作表与章节"
2448
- }, [
2449
- e.sections.length > 1 ? (E(), P("div", fl, [
2450
- (E(!0), P(he, null, be(e.sections, (q, j) => (E(), P("button", {
2451
- key: j,
2452
- type: "button",
2453
- class: ke({ active: b(j) }),
2454
- "aria-current": b(j) ? "page" : void 0,
2455
- disabled: e.busy,
2456
- onClick: (Z) => a("goto", q.pageIndex + 1)
2457
- }, x(q.label), 11, ml))), 128))
2458
- ])) : N("", !0),
2459
- h("div", {
2460
- ref_key: "root",
2461
- ref: o,
2462
- class: "mrp-column-locator",
2463
- onKeydown: F[7] || (F[7] = //@ts-ignore
2464
- (...q) => d(s).onKeydown && d(s).onKeydown(...q))
2465
- }, [
2466
- h("button", {
2467
- ref_key: "trigger",
2468
- ref: r,
2469
- type: "button",
2470
- class: ke(["mrp-directory-trigger", { active: d(u) }]),
2471
- "aria-expanded": d(u),
2472
- "aria-haspopup": "dialog",
2473
- disabled: e.busy,
2474
- onClick: F[0] || (F[0] = (q) => u.value = !d(u))
2475
- }, [
2476
- te(ae, { name: "columns" }),
2477
- h("span", null, x(i.value.columnDirectory), 1),
2478
- d(g).length ? (E(), P("span", pl, x(d(g).length), 1)) : N("", !0),
2479
- te(ae, {
2480
- name: "chevron-down",
2481
- size: 12
2482
- })
2483
- ], 10, gl),
2484
- d(u) ? (E(), P("div", {
2485
- key: 0,
2486
- ref_key: "panel",
2487
- ref: l,
2488
- class: "mrp-column-directory",
2489
- role: "dialog",
2490
- "aria-label": i.value.columnDirectory
2491
- }, [
2492
- h("div", hl, [
2493
- h("span", null, [
2494
- te(ae, { name: "columns" }),
2495
- ue(x(i.value.columnDirectory), 1)
2496
- ]),
2497
- h("button", {
2498
- type: "button",
2499
- class: "mrp-column-close",
2500
- "aria-label": e.messages.closeColumnDirectory ?? "关闭字段目录",
2501
- onClick: F[1] || (F[1] = (q) => d(s).close(!0))
2502
- }, [
2503
- te(ae, {
2504
- name: "close",
2505
- size: 15
2506
- })
2507
- ], 8, bl)
2508
- ]),
2509
- h("form", {
2510
- class: "mrp-column-search",
2511
- onSubmit: F[5] || (F[5] = ft(
2512
- //@ts-ignore
2513
- (...q) => d(s).submit && d(s).submit(...q),
2514
- ["prevent"]
2515
- ))
2516
- }, [
2517
- te(ae, { name: "search" }),
2518
- on(h("input", {
2519
- "onUpdate:modelValue": F[2] || (F[2] = (q) => Kn(p) ? p.value = q : null),
2520
- type: "search",
2521
- autocomplete: "off",
2522
- spellcheck: "false",
2523
- role: "combobox",
2524
- "aria-label": i.value.columnSearch,
2525
- placeholder: i.value.columnSearch,
2526
- "aria-autocomplete": "list",
2527
- "aria-expanded": "true",
2528
- "aria-controls": d(c),
2529
- "aria-activedescendant": d(w).length ? `${d(c)}-${d(v)}` : void 0,
2530
- disabled: e.busy,
2531
- onKeydown: F[3] || (F[3] = //@ts-ignore
2532
- (...q) => d(s).onSearchKeydown && d(s).onSearchKeydown(...q))
2533
- }, null, 40, yl), [
2534
- [rn, d(p)]
2535
- ]),
2536
- d(p) ? (E(), P("button", {
2537
- key: 0,
2538
- class: "mrp-column-clear",
2539
- type: "button",
2540
- "aria-label": e.messages.clearSearch ?? "清除搜索",
2541
- onClick: F[4] || (F[4] = //@ts-ignore
2542
- (...q) => d(s).clear && d(s).clear(...q))
2543
- }, [
2544
- te(ae, {
2545
- name: "close",
2546
- size: 13
2547
- })
2548
- ], 8, wl)) : N("", !0)
2549
- ], 32),
2550
- h("div", {
2551
- id: d(c),
2552
- class: "mrp-column-results",
2553
- role: "listbox",
2554
- "aria-label": i.value.columnResults
2555
- }, [
2556
- d(w).length ? N("", !0) : (E(), P("p", kl, [
2557
- te(ae, {
2558
- name: "search",
2559
- size: 22
2560
- }),
2561
- ue(x(i.value.columnNoMatches), 1)
2562
- ])),
2563
- (E(!0), P(he, null, be(d(y), (q) => (E(), P("section", {
2564
- key: q.label,
2565
- role: "group",
2566
- "aria-label": q.label
2567
- }, [
2568
- h("strong", null, x(q.label), 1),
2569
- (E(!0), P(he, null, be(q.items, (j) => (E(), P("button", {
2570
- id: `${d(c)}-${d(s).candidateIndex(j.key)}`,
2571
- key: j.key,
2572
- type: "button",
2573
- role: "option",
2574
- tabindex: "-1",
2575
- class: ke({ "mrp-column-active": d(s).candidateIndex(j.key) === d(v) }),
2576
- "aria-selected": d(s).candidateIndex(j.key) === d(v),
2577
- disabled: e.busy,
2578
- onPointermove: (Z) => v.value = d(s).candidateIndex(j.key),
2579
- onMousedown: F[6] || (F[6] = ft(() => {
2580
- }, ["prevent"])),
2581
- onClick: (Z) => d(s).choose(j)
2582
- }, [
2583
- h("span", null, [
2584
- ue(x(j.label), 1),
2585
- h("code", {
2586
- title: j.field
2587
- }, x(j.field), 9, Il)
2588
- ]),
2589
- te(ae, {
2590
- name: "arrow-right",
2591
- size: 14
2592
- })
2593
- ], 42, Cl))), 128))
2594
- ], 8, El))), 128))
2595
- ], 8, xl),
2596
- h("p", $l, x(d(m).length > d(w).length ? R.value : e.messages.columnSearchShortcut ?? "↑ ↓ 选择 · Enter 定位"), 1)
2597
- ], 8, vl)) : N("", !0)
2598
- ], 544)
2599
- ], 10, dl));
2600
- }
2601
- }), Bn = /* @__PURE__ */ $e(Pl, [["__scopeId", "data-v-b47639d9"]]), Sl = { class: "mrp-import-summary" }, Rl = { key: 0 }, Ml = { key: 0 }, Tl = /* @__PURE__ */ Ie({
2602
- __name: "ReportImportSummary",
2603
- props: {
2604
- result: {},
2605
- messages: {}
2606
- },
2607
- setup(e) {
2608
- return (t, n) => (E(), P("details", Sl, [
2609
- h("summary", null, [
2610
- ue(x(e.messages.importSummary) + " · " + x(e.messages.importPreserved?.replace("{sheets}", String(e.result.sheets.length))) + " ", 1),
2611
- e.result.warnings.length ? (E(), P("span", Rl, " · " + x(e.result.warnings.length) + " " + x(e.messages.importWarnings), 1)) : N("", !0)
2612
- ]),
2613
- h("p", null, x(e.messages.importReadOnly), 1),
2614
- h("ul", null, [
2615
- (E(!0), P(he, null, be(e.result.sheets, (a) => (E(), P("li", {
2616
- key: a.index
2617
- }, x(a.name) + " · " + x(a.range) + " · " + x(a.rowCount) + " × " + x(a.columnCount), 1))), 128))
2618
- ]),
2619
- e.result.warnings.length ? (E(), P("ul", Ml, [
2620
- (E(!0), P(he, null, be(e.result.warnings, (a, s) => (E(), P("li", { key: s }, x(a), 1))), 128))
2621
- ])) : N("", !0)
2622
- ]));
2623
- }
2624
- }), Dl = /* @__PURE__ */ $e(Tl, [["__scopeId", "data-v-54f275e8"]]), ea = {
2625
- calculationTitle: "选区计算",
2626
- calculationLocal: "仅本地分析,不写回实绩、不重算原公式。请选取同一单位与量纲的数值。",
2627
- calculationHint: "点击起点,Shift + 点击终点或方向键扩选。",
2628
- calculationFormula: "计算方式",
2629
- calculationExpression: "组合公式",
2630
- calculationExpressionHint: "支持 SUM、AVERAGE/AVG、MIN、MAX、COUNT、MEDIAN 及 + - * / 和括号,不执行 Excel 公式;采用浮点数,精度仅用于展示。",
2631
- calculationPrecision: "展示小数位",
2632
- calculationRun: "计算选区",
2633
- calculationCancel: "取消计算",
2634
- calculationResult: "计算结果",
2635
- calculationIncluded: "参与数值",
2636
- calculationExcluded: "排除单元格",
2637
- calculationEmpty: "选区没有可计算数值,计数为 0,其余结果为空。",
2638
- calculationNoSelection: "先关闭设置并选择数据,再从底部工具栏打开选区计算。",
2639
- calculationSum: "求和 SUM",
2640
- calculationAverage: "平均值 AVERAGE",
2641
- calculationMin: "最小值 MIN",
2642
- calculationMax: "最大值 MAX",
2643
- calculationCount: "数值计数 COUNT",
2644
- calculationMedian: "中位数 MEDIAN",
2645
- calculationCustom: "组合公式",
2646
- calculationErrorSelection: "请选择同一明细区域中的数据。",
2647
- calculationErrorLimit: "选区超过计算预算,请缩小范围后重试。",
2648
- calculationErrorExpression: "公式无效,请使用支持的摘要名称、运算符与括号。",
2649
- calculationErrorDivision: "除数不能为 0。",
2650
- calculationErrorOverflow: "结果超出有效数值范围。",
2651
- calculationErrorPrecision: "数值超出安全精度,或展示小数位不是 0 至 12 的整数。"
2652
- };
2653
- function Al(e) {
2654
- const t = { ...ea };
2655
- for (const n of Object.keys(t)) {
2656
- const a = e[n];
2657
- typeof a == "string" && (t[n] = a);
2658
- }
2659
- return t;
2660
- }
2661
- const Fl = {
2662
- ...ea,
2663
- exportMenu: "导出",
2664
- exportMenuDescription: "选择文件格式",
2665
- clearSearch: "清除搜索",
2666
- searchHint: "Enter 下一个 · Shift+Enter 上一个",
2667
- searchNoMatches: "没有匹配内容",
2668
- pageJump: "跳至页",
2669
- pageJumpInvalid: "请输入有效页码",
2670
- pageJumpHint: "Enter 跳转",
2671
- pagination: "报表分页",
2672
- columnSearchHint: "输入列名或字段标识",
2673
- columnSearchShortcut: "↑ ↓ 选择 · Enter 定位",
2674
- closeColumnDirectory: "关闭字段目录",
2675
- columnResultsMore: "{count} 个匹配字段,显示前 {limit} 个;继续输入可缩小范围",
2676
- columnCount: "{count} 个字段",
2677
- settingsGeneral: "常规",
2678
- settingsTools: "工具",
2679
- settingsAdvanced: "高级",
2680
- settingsAdvancedDescription: "按需开启分析能力,保持日常阅读简洁。",
2681
- settingsCalculations: "启用选区计算",
2682
- settingsCalculationsDescription: "选取数值后计算求和、平均值或组合公式,仅用于本地分析。",
2683
- title: "报表预览",
2684
- prevPage: "‹ 上一页",
2685
- nextPage: "下一页 ›",
2686
- pageInfo: "{cur} / {total}",
2687
- fitWidth: "适宽",
2688
- exportHtml: "导出 HTML",
2689
- exportPdf: "导出 PDF",
2690
- exportExcel: "导出 Excel",
2691
- exportImage: "导出图片",
2692
- exportWord: "导出 Word",
2693
- exporting: "正在生成 {format}…",
2694
- print: "打印",
2695
- pdfWindow: "PDF 窗口",
2696
- loading: "报表渲染中…",
2697
- empty: "暂无预览数据",
2698
- errorPrefix: "",
2699
- retry: "重试",
2700
- pdfFontUnavailable: "PDF 字体尚未就绪,请联系管理员检查字体配置;预览及其它导出仍可使用。",
2701
- searchPlaceholder: "搜索报表内容",
2702
- matchInfo: "{cur}/{total}",
2703
- prevMatch: "‹",
2704
- nextMatch: "›",
2705
- thumbnails: "缩略图",
2706
- paramsTitle: "查询条件",
2707
- query: "查 询",
2708
- reset: "重 置",
2709
- paramRequired: "请填写{label}",
2710
- paramInvalid: "{label}:{message}",
2711
- paramPrompt: "请先完善查询条件",
2712
- paramPromptDescription: "填写必填条件后点击查询,即可生成报表。",
2713
- paramSelectPlaceholder: "请选择{label}",
2714
- paramTextPlaceholder: "请输入{label}",
2715
- searching: "搜索中…",
2716
- importExcel: "导入 Excel 模板",
2717
- importing: "正在导入 Excel…",
2718
- editCell: "编辑单元格",
2719
- editingHint: "双击单元格编辑 · Enter 确认 · Esc 取消",
2720
- saving: "正在保存修改…",
2721
- editInvalidNumber: "请输入有效数字;清空表示无值",
2722
- editInvalidBoolean: "请输入 true / false、是 / 否或 1 / 0",
2723
- editConflict: "该单元格已变化,请重新打开编辑",
2724
- settings: "设置",
2725
- settingsDisplay: "阅读工具",
2726
- settingsExport: "导出与打印",
2727
- settingsData: "数据操作",
2728
- settingsUnavailable: "需由接入方配置启用",
2729
- settingsReset: "恢复默认",
2730
- settingsClose: "关闭设置",
2731
- search: "内容搜索",
2732
- closeSearch: "关闭搜索",
2733
- prevSearchMatch: "上一个匹配",
2734
- nextSearchMatch: "下一个匹配",
2735
- zoom: "缩放工具",
2736
- settingsLocal: "按需启用工具,仅作用于当前预览。",
2737
- editingLocal: "修改为本地草稿;不会自动写入业务数据库。",
2738
- editingSaved: "修改将通过接入方配置的保存回调提交。",
2739
- importLocal: "导入仅生成本地预览,不自动替换业务数据。",
2740
- emptyDescription: "当前查询没有明细,请调整查询条件后重试。",
2741
- undo: "撤销",
2742
- redo: "重做",
2743
- restoreChanges: "恢复来源值",
2744
- changes: "修改明细",
2745
- changesCount: "{count} 处修改",
2746
- changesEmpty: "尚无修改",
2747
- changesBefore: "来源值",
2748
- changesAfter: "当前值",
2749
- editAtomicRequired: "批量保存需要接入方提供原子 saveBatch 回调;本次未写入任何单元格。",
2750
- clipboardLimit: "单次最多粘贴 10000 个单元格,请分批处理。",
2751
- preferencesError: "偏好存储不可用,设置仍在当前预览中生效。",
2752
- freezeHeaders: "冻结表头",
2753
- frozenColumns: "冻结前列",
2754
- sections: "工作表与章节",
2755
- locateField: "定位字段",
2756
- locateFieldPlaceholder: "输入字段标识,Enter 定位",
2757
- locateFieldMissing: "未找到该字段,请核对字段标识。",
2758
- importSummary: "Excel 导入摘要",
2759
- importPreserved: "已导入 {sheets} 个工作表,保留内容、合并和样式。",
2760
- importWarnings: "兼容性提示",
2761
- importReadOnly: "公式、日期及受保护单元格保持只读;公式不重算。",
2762
- conflicts: "保存冲突",
2763
- editReadOnly: "选区包含只读或无权限单元格,本次修改未应用。",
2764
- editMissing: "选区超出报表范围或缺少业务来源,请重新选择。",
2765
- editRecalculationUnavailable: "此报表缺少重算会话或稳定数据来源,暂不支持编辑;请使用 reports/本地数据源重新加载。",
2766
- editDuplicate: "选区包含同一业务字段的重复单元格,请缩小选区。",
2767
- clipboardInvalid: "剪贴板内容无法识别,请使用矩形表格文本重新粘贴。",
2768
- editSaved: "修改已通过保存回调确认",
2769
- settingsPanes: "冻结窗格",
2770
- columnDirectory: "字段目录",
2771
- columnSearch: "搜索列名或字段",
2772
- columnNoMatches: "未找到匹配字段",
2773
- columnResults: "匹配字段",
2774
- columnGroup: "明细区域",
2775
- discardTitle: "保留当前修改?",
2776
- discardDescription: "当前报表有尚未保存的输入或本地草稿,继续操作将替换这些内容。",
2777
- discardKeep: "继续编辑",
2778
- discardProceed: "放弃修改并继续",
2779
- taskQuery: "正在获取数据…",
2780
- taskValidate: "正在校验数据…",
2781
- taskLayout: "正在生成版式…",
2782
- taskAssets: "正在准备图片和字体…",
2783
- taskEncode: "正在生成文件…",
2784
- taskDownload: "正在准备下载…",
2785
- taskPrint: "正在准备打印…",
2786
- taskCancel: "取消任务",
2787
- taskCancelled: "任务已取消,可重新操作。",
2788
- diagnosticsSearch: "搜索提示、错误码或位置",
2789
- diagnosticsMore: "共 {count} 条匹配,当前展示前 100 条;请搜索缩小范围。",
2790
- diagnosticsTitle: "输出兼容性提示",
2791
- diagnosticsLocate: "定位",
2792
- diagnosticsLocation: "第 {page} 页 · 组件 {component}",
2793
- diagnosticsStrict: "当前格式存在已知内容降级,请查看兼容性提示或选择其他输出格式。",
2794
- diagnosticsDetails: "查看技术详情",
2795
- diagnosticMissingImage: "图片或图表资源尚未准备完成,请重试或联系管理员。",
2796
- diagnosticUnsupported: "当前输出格式会省略此内容,建议选择 PDF 或图片格式。",
2797
- diagnosticUnsupportedStyle: "当前格式无法保留部分样式,请查看位置并选择适合的输出格式。",
2798
- diagnosticImageFormat: "当前图片格式无法直接导出,请转换资源后重试。",
2799
- diagnosticRichText: "文字内容会保留,部分字体与段落样式将简化。",
2800
- diagnosticNested: "单元格中的嵌套内容会省略,单元格文字会保留。",
2801
- diagnosticImageAsync: "图片需要完成加载后才能输出。",
2802
- diagnosticImageDecode: "图片加载失败,请检查资源后重试。",
2803
- diagnosticAssetFailed: "图表或图片生成失败,请重试或联系管理员。",
2804
- diagnosticAssetBudget: "图片资源超出处理范围,请减少资源或缩小报表范围。"
2805
- }, Ol = {
2806
- emptyAccent: "#79a7e8",
2807
- shellBg: "#f4f7fc",
2808
- shellFg: "#334155",
2809
- toolbarBg: "#ffffff",
2810
- toolbarBorder: "#e4eaf3",
2811
- toolbarFg: "#334155",
2812
- btnFg: "#526078",
2813
- btnBorder: "#dbe3ef",
2814
- btnHoverBg: "#edf3ff",
2815
- btnHoverFg: "#315fba",
2816
- btnActiveBg: "#3569d4"
2817
- };
2818
- function Ll(e = {}) {
2819
- return { ...e, defaults: e.defaults ?? {}, presets: e.presets ?? {} };
2820
- }
2821
- function Vi(e) {
2822
- return e;
2823
- }
2824
- const We = {
2825
- showExport: !0,
2826
- showPrint: !0,
2827
- showPdfWindow: !0,
2828
- showSettings: !0,
2829
- showParams: !0,
2830
- gapPx: 18,
2831
- pdfFontUrl: "/simhei.ttf",
2832
- logger: console
2833
- }, Gi = { warn: () => {
2834
- }, info: () => {
2835
- } };
2836
- function wt(e, t) {
2837
- return {
2838
- ...e,
2839
- ...t,
2840
- theme: { ...e?.theme, ...t?.theme },
2841
- messages: { ...e?.messages, ...t?.messages },
2842
- preview: { ...e?.preview, ...t?.preview },
2843
- xlsx: { ...e?.xlsx, ...t?.xlsx },
2844
- toolbar: { ...e?.toolbar, ...t?.toolbar },
2845
- interaction: { ...e?.interaction, ...t?.interaction },
2846
- output: { ...e?.output, ...t?.output }
2847
- };
2848
- }
2849
- function zl(e) {
2850
- return {
2851
- showExport: e.showExport ?? We.showExport,
2852
- showPrint: e.showPrint ?? We.showPrint,
2853
- showPdfWindow: e.showPdfWindow ?? We.showPdfWindow,
2854
- showSettings: e.showSettings ?? We.showSettings,
2855
- showParams: e.showParams ?? We.showParams,
2856
- gapPx: e.gapPx ?? We.gapPx
2857
- };
2858
- }
2859
- function ql(e, t) {
2860
- const n = t ? e?.presets?.[t] : e?.defaultPreset ? e?.presets?.[e.defaultPreset] : void 0, a = wt(e?.defaults, n);
2861
- return {
2862
- ...zl(a),
2863
- pdfFontUrl: a.pdfFontUrl ?? We.pdfFontUrl,
2864
- theme: { ...Ol, ...a.theme },
2865
- messages: { ...Fl, ...a.messages },
2866
- logger: a.logger ?? We.logger,
2867
- preview: {
2868
- overscanPages: Nn(a.preview?.overscanPages, 1, 10, !0),
2869
- searchDebounceMs: Nn(a.preview?.searchDebounceMs, 200, 2e3)
2870
- },
2871
- xlsx: { ...a.xlsx },
2872
- editable: a.editable ?? !1,
2873
- excelImport: a.excelImport ?? !1,
2874
- toolbar: { ...a.toolbar },
2875
- interaction: { ...a.interaction },
2876
- preferences: a.preferences,
2877
- assets: a.assets,
2878
- guardChanges: a.guardChanges ?? !0,
2879
- beforeDiscard: a.beforeDiscard,
2880
- output: { ...a.output }
2881
- };
2882
- }
2883
- function Nn(e, t, n, a = !1) {
2884
- if (e == null || !Number.isFinite(e)) return t;
2885
- const s = Math.max(0, Math.min(n, e));
2886
- return a ? Math.floor(s) : s;
2887
- }
2888
- function Bl(e) {
2889
- const t = {};
2890
- return e.emptyAccent != null && (t["--mrp-empty-accent"] = e.emptyAccent), e.shellBg != null && (t["--mrp-shell-bg"] = e.shellBg), e.shellFg != null && (t["--mrp-shell-fg"] = e.shellFg), e.toolbarBg != null && (t["--mrp-toolbar-bg"] = e.toolbarBg), e.toolbarBorder != null && (t["--mrp-toolbar-border"] = e.toolbarBorder), e.toolbarFg != null && (t["--mrp-toolbar-fg"] = e.toolbarFg), e.btnFg != null && (t["--mrp-btn-fg"] = e.btnFg), e.btnBorder != null && (t["--mrp-btn-border"] = e.btnBorder), e.btnHoverBg != null && (t["--mrp-btn-hover-bg"] = e.btnHoverBg), e.btnHoverFg != null && (t["--mrp-btn-hover-fg"] = e.btnHoverFg), e.btnActiveBg != null && (t["--mrp-btn-active-bg"] = e.btnActiveBg), t;
2891
- }
2892
- function Ji(e) {
2893
- const t = kt(en, null), n = z(() => {
2894
- const a = t?.value ?? null, s = "defaults" in e || "presets" in e || "defaultPreset" in e ? Ll(e) : { defaults: e, presets: {} };
2895
- if (!a) return s;
2896
- const o = { ...a.presets, ...s.presets };
2897
- for (const r of Object.keys(o))
2898
- o[r] = wt(
2899
- wt(a.presets[r], s.defaults),
2900
- s.presets[r]
2901
- );
2902
- return {
2903
- defaults: wt(a.defaults, s.defaults),
2904
- presets: o,
2905
- defaultPreset: s.defaultPreset ?? a.defaultPreset
2906
- };
2907
- });
2908
- Wn(en, n);
2909
- }
2910
- function Nl() {
2911
- return kt(en, z(() => null));
2912
- }
2913
- function Re(e) {
2914
- return JSON.parse(JSON.stringify(e));
2915
- }
2916
- function ta(e, t) {
2917
- const n = t.fields;
2918
- if (typeof n == "function") return n(e);
2919
- const a = e.source?.field ?? e.table?.columnKey;
2920
- return a === void 0 || !n || !Object.prototype.hasOwnProperty.call(n, a) ? void 0 : n[a];
2921
- }
2922
- function St(e, t) {
2923
- if (e.requiresRecalculation && (!t || !cn(e))) throw new Fe("recalculation");
2924
- }
2925
- async function jl(e, t, n, a) {
2926
- const s = t.edits.every((l) => !!l.source);
2927
- St(e, s);
2928
- const o = cn(e);
2929
- if (o && s) return o.prepareHistory(e, t.edits, t.value, n, { signal: a });
2930
- const r = st(e);
2931
- return t.edits.map((l) => {
2932
- const u = r(l);
2933
- if (!u) throw new Fe("missing");
2934
- return { address: u, value: l[t.value] };
2935
- });
2936
- }
2937
- function Hl(e, t, n) {
2938
- const a = t.edits.every((s) => !!s.source);
2939
- return St(e, a), a ? cn(e)?.prepare(e, t, { signal: n }) : void 0;
2940
- }
2941
- function Kl(e, t) {
2942
- const n = /* @__PURE__ */ new Map();
2943
- return e.pages.forEach((a, s) => a.components.forEach((o, r) => {
2944
- if (o.grid)
2945
- for (const l of dn(o.grid, o.widthMm, o.heightMm).cells) {
2946
- const u = t({ pageIndex: s, componentIndex: r, rowIndex: l.ri, columnIndex: l.ci });
2947
- if (!u?.source) continue;
2948
- const p = Ue(u), v = n.get(p) ?? [];
2949
- v.push(u), n.set(p, v);
2950
- }
2951
- })), n;
2952
- }
2953
- function st(e) {
2954
- const t = Et(e), n = Kl(e, t);
2955
- function a(o) {
2956
- if (o.source) return n.get(Ue(o)) ?? [];
2957
- const r = t(o.address);
2958
- return r ? !o.table || Ue(r) === Ue(o) ? [r] : [] : [];
2959
- }
2960
- const s = (o) => {
2961
- const r = a(o), l = r.find((u) => u.table?.id === o.table?.id) ?? r[0];
2962
- return l ? { ...l.address } : null;
2963
- };
2964
- return s.all = (o) => a(o).map((r) => ({ ...r.address })), s;
2965
- }
2966
- class Wl extends Error {
2967
- constructor(t) {
2968
- super(t.map((n) => n.message).join(";")), this.conflicts = t, this.name = "ReportEditConflictError";
2969
- }
2970
- }
2971
- function Ul() {
2972
- return globalThis.crypto?.randomUUID?.() ?? `mr-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
2973
- }
2974
- function Vl(e, t, n, a) {
2975
- return Array.isArray(t) ? { batch: _t(e, t, n) } : jl(e, t, n, a).then((s) => Array.isArray(s) ? { batch: _t(e, s, n) } : s);
2976
- }
2977
- function Gl(e) {
2978
- const t = fe([]), n = fe([]), a = fe([]), s = fe([]), o = fe(!1), r = fe(null), l = fe([]), u = z(() => l.value.length > 0), p = z(() => {
2979
- const k = An(t.value), M = e.plan.value;
2980
- if (!M || !k.length) return k;
2981
- const O = st(M);
2982
- return k.map((D) => {
2983
- const W = O(D);
2984
- return W ? { ...D, address: W } : D;
2985
- });
2986
- }), v = z(() => !!e.options.value && !o.value && !e.blocked() && n.value.length > 0), g = z(() => !!e.options.value && !o.value && !e.blocked() && a.value.length > 0);
2987
- let m = null, w = null, y = 0, c = null;
2988
- function i() {
2989
- m?.abort(), m = null, o.value = !1, w = null;
2990
- }
2991
- function R() {
2992
- y++, i(), c = null, t.value = [], n.value = [], a.value = [], s.value = [], l.value = [], r.value = null;
2993
- }
2994
- function b() {
2995
- const k = e.options.value;
2996
- return k ? typeof k == "object" ? k : {} : null;
2997
- }
2998
- function S(k, M, O, D) {
2999
- if (!e.options.value || e.blocked()) throw new Fe("readonly");
3000
- St(k, M.edits.every((J) => !!J.source));
3001
- const W = Et(k), G = new Map(D?.map((J) => [Ue(J), J]));
3002
- for (const J of M.edits) {
3003
- const L = D ? G.get(Ue(J)) : W(J.address);
3004
- if (!L?.editable || O.canEdit?.(L) === !1) throw new Fe("readonly");
3005
- if (O.requireSource && !L.source) throw new Fe("missing");
3006
- const de = ta(L, O);
3007
- de && Ua(L, J.value, de);
3008
- }
3009
- }
3010
- async function F(k, M, O) {
3011
- if (M.saveBatch) return M.saveBatch(Re(k), O);
3012
- if (M.save && k.edits.length > 1) throw new Fe("atomic");
3013
- if (k.edits[0]) return M.save?.(Re(k.edits[0]), O);
3014
- }
3015
- async function q(k, M, O) {
3016
- for (const D of k.edits) {
3017
- const W = await M.validate?.(Re(D), O);
3018
- if (W) throw new Error(W);
3019
- if (O.signal.aborted) return;
3020
- }
3021
- }
3022
- function j(k, M, O, D, W, G) {
3023
- if (e.plan.value = G ? G.commit(O) : Va(Ga(k, M), M, O), t.value = [...t.value, ...M.edits], W) {
3024
- const L = new Set(M.edits.map(Ue));
3025
- l.value = l.value.filter((de) => !L.has(Ue(de)));
3026
- } else l.value = An([...l.value, ...M.edits]);
3027
- D === "edit" && (n.value = [...n.value, M.edits], a.value = []), s.value = [], c = null;
3028
- const J = y;
3029
- for (const L of M.edits) {
3030
- if (y !== J) break;
3031
- e.onChange(Re(L));
3032
- }
3033
- }
3034
- function Z(k, M, O) {
3035
- const D = JSON.stringify([O, M.edits]);
3036
- c?.plan === k && c.signature === D ? M.requestId = c.requestId : c = { plan: k, signature: D, requestId: M.requestId };
3037
- }
3038
- function _(k) {
3039
- r.value = e.errorMessage?.(k) ?? (k instanceof Error ? k.message : "Cell edit failed"), e.onError(r.value, k);
3040
- }
3041
- async function Y(k, M) {
3042
- const O = e.plan.value, D = b();
3043
- if (!O || !D || e.blocked()) return !1;
3044
- const W = new AbortController(), G = y;
3045
- m = W, o.value = !0, r.value = null;
3046
- const J = () => m === W && !W.signal.aborted && e.plan.value === O && e.options.value !== !1;
3047
- try {
3048
- const L = Vl(O, k, Ul(), W.signal), de = L instanceof Promise ? await L : L;
3049
- if (!J()) return !1;
3050
- const { batch: se, contexts: ge } = de;
3051
- if (S(O, se, D, ge), se.edits = se.edits.filter((T) => !Object.is(T.previousValue, T.value)), !se.edits.length) return !0;
3052
- Z(O, se, M), S(O, se, D, ge);
3053
- const Ve = { signal: W.signal, requestId: se.requestId, action: M };
3054
- if (await q(se, D, Ve), !J()) return !1;
3055
- S(O, se, D, ge);
3056
- const Me = de.prepared ? void 0 : Hl(O, se, W.signal);
3057
- if (Me && (de.prepared = await Me), !J()) return !1;
3058
- S(O, se, D, ge);
3059
- const I = await F(se, D, Ve);
3060
- if (!J()) return !1;
3061
- if (I?.conflicts?.length)
3062
- throw s.value = Re(I.conflicts), new Wl(I.conflicts);
3063
- return S(O, se, D, ge), j(O, se, I, M, !!(D.save || D.saveBatch), de.prepared), G === y;
3064
- } catch (L) {
3065
- return J() && _(L), !1;
3066
- } finally {
3067
- m === W && (m = null, o.value = !1);
3068
- }
3069
- }
3070
- async function ee(k, M = "edit") {
3071
- if (w) return w;
3072
- const O = Y(k, M);
3073
- w = O;
3074
- const D = await O;
3075
- return w === O && (w = null), D;
3076
- }
3077
- async function ie() {
3078
- const k = y, M = n.value[n.value.length - 1];
3079
- return !M || o.value || !await ee({ edits: M, value: "previousValue" }, "undo") || k !== y ? !1 : (n.value = n.value.slice(0, -1), a.value = [...a.value, M], !0);
3080
- }
3081
- async function ye() {
3082
- const k = y, M = a.value[a.value.length - 1];
3083
- return !M || o.value || !await ee({ edits: M, value: "value" }, "redo") || k !== y ? !1 : (a.value = a.value.slice(0, -1), n.value = [...n.value, M], !0);
3084
- }
3085
- async function ce() {
3086
- const k = y;
3087
- return !p.value.length || o.value || !await ee({ edits: p.value, value: "previousValue" }, "restore") || k !== y ? !1 : (n.value = [], a.value = [], !0);
3088
- }
3089
- function C() {
3090
- if (!w) return !o.value;
3091
- const k = y;
3092
- return w.then((M) => M && k === y && !o.value);
3093
- }
3094
- function A(k) {
3095
- return e.plan.value ? st(e.plan.value)(k) : null;
3096
- }
3097
- return { settle: C, resolveAddress: A, changes: t, differences: p, localDifferences: l, hasLocalDrafts: u, lastError: r, conflicts: s, saving: o, canUndo: v, canRedo: g, apply: ee, undo: ie, redo: ye, restore: ce, cancel: i, reset: R };
3098
- }
3099
- let Jl = 0;
3100
- const Zl = "position:absolute;inset:0;width:100%;height:100%;min-height:20px;box-sizing:border-box;z-index:10;resize:none;margin:0;padding:2px 4px;border:2px solid var(--mrp-btn-active-bg,#2563eb);outline:none;background:var(--mrp-toolbar-bg,#fff);color:var(--mrp-toolbar-fg,#111);font:inherit;line-height:1.25;white-space:pre-wrap;";
3101
- function Yl(e) {
3102
- return e.type === "boolean" ? [{ value: !0, label: e.trueLabel ?? "是" }, { value: !1, label: e.falseLabel ?? "否" }] : e.type === "enum" ? e.options.map((t) => ({ value: t.value, label: t.label ?? String(t.value) })) : [];
3103
- }
3104
- function Xl(e, t, n) {
3105
- const a = e.createElement("select"), s = [{ value: null, label: "—" }, ...Yl(t)];
3106
- if (s.forEach((o, r) => {
3107
- const l = e.createElement("option");
3108
- l.value = String(r), l.textContent = o.label, (Object.is(n.value, o.value) || n.value === "" && o.value === null) && (l.selected = !0), a.append(l);
3109
- }), !s.some((o) => Object.is(n.value, o.value) || n.value === "" && o.value === null)) {
3110
- const o = e.createElement("option");
3111
- o.value = "unknown", o.textContent = n.cell.text ?? String(n.value), o.selected = !0, a.append(o);
3112
- }
3113
- return { input: a, value: () => a.value === "unknown" ? n.value : s[Number(a.value)]?.value ?? null };
3114
- }
3115
- function Ql(e, t, n) {
3116
- const a = t?.type === "number" || t?.type === "date" ? e.createElement("input") : e.createElement("textarea");
3117
- return a.value = n.value == null ? "" : String(n.value), a instanceof HTMLInputElement && (a.type = t?.type === "date" ? "date" : "text", t?.type === "number" && (a.inputMode = "decimal"), t?.type === "date" && (t.min && (a.min = t.min), t.max && (a.max = t.max))), { input: a, value: () => t?.type === "date" && a instanceof HTMLInputElement && a.validity.badInput ? "invalid-date" : a.value };
3118
- }
3119
- function _l(e) {
3120
- if (!e) return "";
3121
- const t = [e.hint, e.unit];
3122
- return (e.type === "number" || e.type === "date") && (e.min !== void 0 && t.push(`≥ ${e.min}`), e.max !== void 0 && t.push(`≤ ${e.max}`)), e.type === "number" && e.precision !== void 0 && t.push(`最多 ${e.precision} 位小数`), e.type === "text" && e.maxLength !== void 0 && t.push(`最多 ${e.maxLength} 字符`), t.filter(Boolean).join(" · ");
3123
- }
3124
- function ei(e, t, n, a) {
3125
- const s = e.ownerDocument, o = a?.type === "boolean" || a?.type === "enum" ? Xl(s, a, n) : Ql(s, a, n), r = o.input, l = s.createElement("span");
3126
- l.className = "mrp-cell-editor-host", l.style.cssText = "position:absolute;inset:0;z-index:10;", r.className = "mrp-cell-editor", r.style.cssText = Zl, r.setAttribute("aria-label", a?.label ?? t), a?.required && r.setAttribute("aria-required", "true");
3127
- const u = s.createElement("span");
3128
- u.id = `mrp-cell-hint-${++Jl}`, u.className = "mrp-cell-editor-hint", u.style.cssText = "position:absolute;top:100%;left:0;min-width:100%;width:max-content;max-width:320px;box-sizing:border-box;padding:4px 8px;white-space:normal;border:1px solid var(--mrp-toolbar-border,#ddd);background:var(--mrp-toolbar-bg,#fff);color:var(--mrp-toolbar-fg,#111);font-size:12px;line-height:1.4;box-shadow:0 3px 10px #0002;z-index:11;";
3129
- const p = _l(a);
3130
- return u.textContent = p, u.hidden = !p, r.setAttribute("aria-describedby", u.id), l.append(r, u), e.append(l), {
3131
- input: r,
3132
- root: l,
3133
- initialInput: r.value,
3134
- value: o.value,
3135
- focus: () => {
3136
- r.focus(), (r instanceof HTMLTextAreaElement || r instanceof HTMLInputElement && r.type !== "date") && r.select();
3137
- },
3138
- feedback: (v) => {
3139
- u.textContent = v ?? p, u.hidden = !u.textContent, r.setAttribute("aria-invalid", v ? "true" : "false");
3140
- }
3141
- };
3142
- }
3143
- function nn(e) {
3144
- const t = e.closest(".mrp-page-holder"), n = e.closest("[data-mr-component-index]");
3145
- if (!t || !n) return null;
3146
- const a = {
3147
- pageIndex: Number(t.dataset.page) - 1,
3148
- componentIndex: Number(n.dataset.mrComponentIndex),
3149
- rowIndex: Number(e.dataset.mrRowIndex),
3150
- columnIndex: Number(e.dataset.mrColumnIndex)
3151
- };
3152
- return Object.values(a).every((s) => Number.isInteger(s) && s >= 0) ? a : null;
3153
- }
3154
- function ti(e) {
3155
- const t = fe(null), n = Gl(e), { saving: a, changes: s } = n, o = fe(!1), r = z(() => o.value || n.hasLocalDrafts.value);
3156
- let l = null;
3157
- function u() {
3158
- const b = t.value;
3159
- t.value = null, o.value = !1, n.cancel(), l = null, b?.editor.root.remove();
3160
- }
3161
- function p() {
3162
- u(), n.reset();
3163
- }
3164
- function v(b) {
3165
- return t.value === b && e.plan.value === b.plan;
3166
- }
3167
- async function g(b) {
3168
- return await n.apply([{ address: b.address, value: b.editor.value() }]) ? (t.value = null, o.value = !1, b.editor.root.remove(), !0) : (t.value === b && (b.editor.input.disabled = !1, b.editor.feedback(n.lastError.value ?? void 0), b.editor.input.focus()), !1);
3169
- }
3170
- async function m() {
3171
- if (l) return l;
3172
- const b = t.value;
3173
- if (!b) return n.settle();
3174
- if (!v(b))
3175
- return u(), !1;
3176
- o.value = b.editor.input.value !== b.editor.initialInput, b.editor.input.disabled = !0;
3177
- const S = g(b);
3178
- l = S;
3179
- const F = await S;
3180
- return l === S && (l = null), F;
3181
- }
3182
- function w() {
3183
- return t.value || l ? m() : n.settle();
3184
- }
3185
- function y(b) {
3186
- if (b.stopPropagation(), !b.isComposing && (b.key === "Escape" && (b.preventDefault(), u()), b.key === "Enter" && !b.shiftKey || b.key === "Tab")) {
3187
- b.preventDefault();
3188
- const S = t.value, F = S && tt(S.plan, S.address), q = S && F ? _t(S.plan, [{ address: S.address, value: F.value }], "navigation").edits[0] : void 0;
3189
- m().then((j) => {
3190
- if (!j || !S || !e.plan.value) return;
3191
- const Z = e.plan.value === S.plan ? S.address : q && st(e.plan.value)(q);
3192
- Z && e.onNavigate?.(Z, b.key, b.shiftKey);
3193
- });
3194
- }
3195
- }
3196
- function c(b) {
3197
- e.onError(e.errorMessage?.(b) ?? (b instanceof Error ? b.message : "无法编辑单元格"), b);
3198
- }
3199
- async function i(b) {
3200
- if (!e.options.value || e.blocked() || !await m() || !b.isConnected) return;
3201
- const S = e.plan.value, F = nn(b);
3202
- if (!S || !F || !e.options.value || e.blocked()) return;
3203
- const q = typeof e.options.value == "object" ? e.options.value : {};
3204
- try {
3205
- const j = tt(S, F);
3206
- if (!j?.editable || q.canEdit?.(j) === !1) return;
3207
- if (St(S, !!j.source), q.requireSource && !j.source) throw new Fe("missing");
3208
- const Z = ta(j, q);
3209
- Z && Ja(j, Z);
3210
- const _ = ei(b, e.label(), j, Z), Y = _.input;
3211
- t.value = { plan: S, address: F, editor: _ }, o.value = !1, Y.addEventListener("keydown", (ee) => y(ee)), Y.addEventListener("input", () => {
3212
- o.value = Y.value !== _.initialInput, _.feedback();
3213
- }), Y.addEventListener("change", () => {
3214
- o.value = Y.value !== _.initialInput;
3215
- }), Y.addEventListener("blur", () => {
3216
- !a.value && !e.suspendBlur?.() && m();
3217
- }), _.focus();
3218
- } catch (j) {
3219
- c(j);
3220
- }
3221
- }
3222
- async function R(b) {
3223
- const S = b.target;
3224
- if (!(S instanceof Element) || S.closest(".mrp-cell-editor")) return;
3225
- const F = S.closest("td[data-mr-row-index]");
3226
- F && await i(F);
3227
- }
3228
- return le(e.options, (b, S) => {
3229
- (!b || b !== S) && u();
3230
- }, { flush: "sync" }), le(e.plan, () => {
3231
- t.value && e.plan.value !== t.value.plan && (t.value.editor.root.remove(), t.value = null, o.value = !1);
3232
- }, { flush: "sync" }), Ke(p), {
3233
- ...n,
3234
- active: t,
3235
- saving: a,
3236
- changes: s,
3237
- pendingLocalChanges: r,
3238
- cancel: u,
3239
- reset: p,
3240
- commit: m,
3241
- settle: w,
3242
- onDoubleClick: R,
3243
- editCell: i,
3244
- getChanges: () => Re(s.value)
3245
- };
3246
- }
3247
- const an = ["html", "pdf", "xlsx", "png", "word"], jn = ["search", "thumbnails", "zoom", ...an, "print", "pdfWindow", "editing", "import"];
3248
- function Zi(e) {
3249
- return {
3250
- load: (t) => JSON.parse(e.getItem(t) ?? "null"),
3251
- save: (t, n) => e.setItem(t, JSON.stringify(n)),
3252
- remove: (t) => e.removeItem(t)
3253
- };
3254
- }
3255
- function ni(e, t, n, a) {
3256
- const s = V({});
3257
- let o = 0, r = 0, l = Promise.resolve();
3258
- const u = z(() => Object.fromEntries(jn.map((m) => [
3259
- m,
3260
- e.value[m] && (s.value[m] ?? t.value[m] ?? !0)
3261
- ])));
3262
- function p(m, w) {
3263
- e.value[m] && (r++, s.value = { ...s.value, [m]: w }, v());
3264
- }
3265
- function v() {
3266
- const m = n?.value;
3267
- if (!m) return;
3268
- const w = { ...s.value };
3269
- l = l.then(() => m.adapter.save(m.key, w)).catch((y) => {
3270
- a?.(y);
3271
- });
3272
- }
3273
- function g() {
3274
- r++, s.value = {}, v();
3275
- }
3276
- return n && le(n, async (m) => {
3277
- const w = ++o, y = r;
3278
- if (s.value = {}, !!m)
3279
- try {
3280
- const c = await m.adapter.load(m.key);
3281
- if (w !== o || y !== r || !c || typeof c != "object") return;
3282
- s.value = Object.fromEntries(jn.flatMap((i) => typeof c[i] == "boolean" ? [[i, c[i]]] : []));
3283
- } catch (c) {
3284
- w === o && a?.(c);
3285
- }
3286
- }, { immediate: !0 }), Ke(() => {
3287
- o++;
3288
- }), { enabled: u, setEnabled: p, reset: g };
3289
- }
3290
- function ai(e, t, n) {
3291
- const a = V({}), s = Nl(), o = z(() => ql(s.value, e.preset)), r = z(() => ({
3292
- ...o.value.messages,
3293
- ...e.messages
3294
- })), l = z(() => e.showExport ?? o.value.showExport), u = z(() => e.showPrint ?? o.value.showPrint), p = z(() => e.showPdfWindow ?? o.value.showPdfWindow), v = z(() => e.showSettings ?? o.value.showSettings), g = z(() => e.guardChanges ?? o.value.guardChanges), m = z(() => ({ ...o.value.output, ...e.output })), w = z(() => ({ ...o.value.toolbar, ...e.toolbar })), y = z(() => ({ ...o.value.interaction, ...e.interaction, ...a.value })), c = z(() => e.preferences ?? o.value.preferences), i = z(() => e.assets ?? o.value.assets), R = z(() => e.gapPx ?? (t.value ? 0 : o.value.gapPx)), b = z(() => e.showParams ?? o.value.showParams), S = z(() => e.editable ?? o.value.editable), F = z(() => e.excelImport ?? o.value.excelImport), q = z(() => ({
3295
- search: w.value.search !== !1,
3296
- thumbnails: w.value.thumbnails !== !1,
3297
- zoom: w.value.zoom !== !1,
3298
- ...Object.fromEntries(an.map((ce) => [
3299
- ce,
3300
- l.value && (w.value.exportFormats?.includes(ce) ?? !0)
3301
- ])),
3302
- print: u.value,
3303
- pdfWindow: p.value,
3304
- editing: !!S.value,
3305
- import: !!F.value
3306
- })), j = ni(q, z(() => ({
3307
- editing: w.value.editing,
3308
- import: w.value.excelImport
3309
- })), c, () => n(r.value.preferencesError ?? "Preferences storage unavailable")), Z = j.enabled, _ = z(() => an.filter((ce) => Z.value[ce])), Y = z(() => Z.value.editing ? S.value : !1), ee = z(() => Z.value.import ? F.value : !1), ie = z(() => typeof S.value == "object" && (typeof S.value.save == "function" || typeof S.value.saveBatch == "function")), ye = z(() => typeof e.emptyState == "object" ? e.emptyState : {});
3310
- return { resolved: o, resolvedMessages: r, effectiveShowExport: l, effectiveShowPrint: u, effectiveShowPdfWindow: p, effectiveShowSettings: v, effectiveGuardChanges: g, effectiveOutput: m, effectiveInteraction: y, effectiveAssets: i, effectiveGapPx: R, effectiveShowParams: b, availableTools: q, tools: j, toolState: Z, visibleExportFormats: _, effectiveEditable: Y, effectiveExcelImport: ee, persistedEditing: ie, emptyStateContent: ye, sessionInteraction: a };
3311
- }
3312
- function na(e) {
3313
- return e.table.role === "header" ? -Math.max(1, e.grid?.cells.length ?? 1) : e.table.rowIndex;
3314
- }
3315
- function qe(e, t, n = t) {
3316
- const a = e.pages[t.pageIndex]?.components[t.componentIndex], s = a?.table, o = e.pages[n.pageIndex]?.components[n.componentIndex]?.table;
3317
- return s && o && s.id === o.id ? {
3318
- grid: s.id,
3319
- row: na(a) + t.rowIndex,
3320
- column: o.columnKeys.indexOf(s.columnKeys[t.columnIndex] ?? "")
3321
- } : { grid: `${t.pageIndex}:${t.componentIndex}`, row: t.rowIndex, column: t.columnIndex };
3322
- }
3323
- function Hn(e, t) {
3324
- const n = e.pages[t.pageIndex]?.components[t.componentIndex]?.table;
3325
- if (!n) return (s, o) => ({ ...t, rowIndex: s, columnIndex: o });
3326
- const a = /* @__PURE__ */ new Map();
3327
- return e.pages.forEach((s, o) => s.components.forEach((r, l) => {
3328
- r.table?.id !== n.id || !r.grid || r.grid.cells.forEach((u, p) => {
3329
- const v = na(r) + p;
3330
- a.set(v, [...a.get(v) ?? [], { address: { pageIndex: o, componentIndex: l, rowIndex: p, columnIndex: 0 }, keys: r.table.columnKeys }]);
3331
- });
3332
- })), (s, o) => {
3333
- const r = n.columnKeys[o];
3334
- if (r === void 0) return null;
3335
- const l = a.get(s)?.find((u) => u.keys.includes(r));
3336
- return l ? { ...l.address, columnIndex: l.keys.indexOf(r) } : null;
3337
- };
3338
- }
3339
- function si(e, t) {
3340
- const n = [...e.ownerDocument.querySelectorAll("a[href],button,input,textarea,select,[tabindex]:not([tabindex='-1'])")].filter((o) => o.tabIndex >= 0 && !o.matches(":disabled,[hidden],input[type='hidden']") && !o.closest("[inert],[aria-hidden='true']") && o.getClientRects().length > 0).map((o, r) => ({ element: o, order: r })).sort((o, r) => (o.element.tabIndex || 1 / 0) - (r.element.tabIndex || 1 / 0) || o.order - r.order), a = n.findIndex(({ element: o }) => o === e);
3341
- if (a < 0) return !1;
3342
- const s = n[a + (t ? -1 : 1)]?.element;
3343
- return s ? (s.focus(), e.ownerDocument.activeElement === s) : !1;
3344
- }
3345
- function oi(e, t) {
3346
- const n = e?.source;
3347
- return !ri(e, t.field) || t.tableId !== void 0 && e?.table?.id !== t.tableId || t.datasetId !== void 0 && (n?.datasetId ?? e?.component.table?.source?.datasetId) !== t.datasetId ? !1 : t.rowKey === void 0 || n?.rowKey === t.rowKey;
3348
- }
3349
- function ri(e, t) {
3350
- if ((e?.source?.field ?? e?.table?.columnKey) === t) return !0;
3351
- if (!e || e.table?.role !== "header") return !1;
3352
- const n = e.address.columnIndex;
3353
- return e.component.table?.columnKeys.slice(n, n + (e.cell.colSpan ?? 1)).includes(t) ?? !1;
3354
- }
3355
- function li(e, t) {
3356
- return e.pageIndex === t.pageIndex && e.componentIndex === t.componentIndex;
3357
- }
3358
- function ii(e, t) {
3359
- return li(e, t) && e.rowIndex === t.rowIndex && e.columnIndex === t.columnIndex;
3360
- }
3361
- function Gt(e) {
3362
- return `[data-page="${e.pageIndex + 1}"] [data-mr-component-index="${e.componentIndex}"] td[data-mr-row-index="${e.rowIndex}"][data-mr-column-index="${e.columnIndex}"]`;
3363
- }
3364
- function sn(e) {
3365
- return `${e.pageIndex}:${e.componentIndex}:${e.rowIndex}:${e.columnIndex}`;
3366
- }
3367
- function ui(e, t) {
3368
- const n = qe(e, t.anchor), a = qe(e, t.focus, t.anchor);
3369
- return { grid: n.grid, minRow: Math.min(n.row, a.row), maxRow: Math.max(n.row, a.row), minColumn: Math.min(n.column, a.column), maxColumn: Math.max(n.column, a.column), focusKey: sn(t.focus), origin: e.pages[t.anchor.pageIndex]?.components[t.anchor.componentIndex]?.table };
3370
- }
3371
- function ci(e, t, n) {
3372
- const a = t?.table;
3373
- if (!a || !n.origin || a.id !== n.origin.id) return { grid: `${e.pageIndex}:${e.componentIndex}`, rowOffset: 0, missingColumn: -1 };
3374
- const s = /* @__PURE__ */ new Map();
3375
- return n.origin.columnKeys.forEach((o, r) => {
3376
- s.has(o) || s.set(o, r);
3377
- }), { grid: a.id, rowOffset: a.role === "header" ? -Math.max(1, t.grid?.cells.length ?? 1) : a.rowIndex, columns: a.columnKeys.map((o) => s.get(o) ?? -1), missingColumn: s.get("") ?? -1 };
3378
- }
3379
- function di(e, t, n) {
3380
- if (!n || !t || t.grid !== n.grid) return !1;
3381
- const a = t.rowOffset + e.row, s = t.columns ? t.columns[e.column] ?? t.missingColumn : e.column;
3382
- return a >= n.minRow && a <= n.maxRow && s >= n.minColumn && s <= n.maxColumn;
3383
- }
3384
- function xt(e, t, n) {
3385
- e.getAttribute(t) !== n && e.setAttribute(t, n);
3386
- }
3387
- function Jt(e, t, n) {
3388
- e.classList.contains(t) !== n && e.classList.toggle(t, n);
3389
- }
3390
- function fi(e, t, n, a, s, o) {
3391
- t.role !== n && (xt(e, "role", n), t.role = n), t.selected !== a && (Jt(e, "mrp-cell-selected", a), xt(e, "aria-selected", String(a)), t.selected = a), t.focused !== s && (Jt(e, "mrp-cell-focus", s), xt(e, "tabindex", s ? "0" : "-1"), t.focused = s), t.modified !== o && (Jt(e, "mrp-cell-modified", o), t.modified = o);
3392
- }
3393
- function mi(e) {
3394
- const t = () => e.editable?.() ?? e.enabled(), n = fe(null), a = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap();
3395
- let o = null, r = null, l = /* @__PURE__ */ new Set();
3396
- function u(C, A) {
3397
- const k = tt(C, A);
3398
- return !k || C.requiresRecalculation && !k.source ? null : { address: k.address, source: k.source, table: k.table, value: k.value, previousValue: k.value, text: k.cell.text ?? "", previousText: k.cell.text ?? "" };
3399
- }
3400
- le(e.plan, (C, A) => {
3401
- const k = n.value;
3402
- if (!k) return;
3403
- if (!C || !A) {
3404
- n.value = null;
3405
- return;
3406
- }
3407
- const M = u(A, k.anchor), O = u(A, k.focus), D = st(C), W = M && D(M), G = O && D(O);
3408
- n.value = W && G ? { anchor: W, focus: G } : null;
3409
- }, { flush: "sync" });
3410
- function p(C = e.root.value ?? void 0) {
3411
- if (!C) return;
3412
- const A = n.value, k = e.plan.value, M = e.differences();
3413
- if (M !== o || k !== r) {
3414
- o = M, r = k;
3415
- const D = k && M.length ? st(k) : null;
3416
- l = new Set(M.flatMap((W) => D ? D.all(W).map(sn) : []));
3417
- }
3418
- const O = A && k ? ui(k, A) : null;
3419
- C instanceof HTMLTableElement && m(C, k, O);
3420
- for (const D of C.querySelectorAll("table")) m(D, k, O);
3421
- }
3422
- function v(C) {
3423
- const A = a.get(C);
3424
- if (A) return A;
3425
- const k = C.closest("[data-mr-component-index]"), M = k?.closest(".mrp-page-holder"), O = { pageIndex: Number(M?.dataset.page) - 1, componentIndex: Number(k?.dataset.mrComponentIndex) };
3426
- return Object.values(O).every((D) => Number.isInteger(D) && D >= 0) ? (a.set(C, O), O) : null;
3427
- }
3428
- function g(C, A) {
3429
- const k = s.get(C);
3430
- if (k) return k;
3431
- const M = Number(C.dataset.mrRowIndex), O = Number(C.dataset.mrColumnIndex);
3432
- if (![M, O].every((W) => Number.isInteger(W) && W >= 0)) return null;
3433
- const D = { row: M, column: O, key: sn({ ...A, rowIndex: M, columnIndex: O }) };
3434
- return s.set(C, D), D;
3435
- }
3436
- function m(C, A, k) {
3437
- const M = v(C);
3438
- if (!M) return;
3439
- const O = A?.pages[M.pageIndex]?.components[M.componentIndex], D = O?.table?.role === "header" ? "columnheader" : "gridcell", W = k ? ci(M, O, k) : null;
3440
- xt(C, "role", "grid");
3441
- for (const G of C.rows) for (const J of G.cells) {
3442
- const L = g(J, M);
3443
- L && fi(J, L, D, di(L, W, k), k?.focusKey === L.key, l.size > 0 && l.has(L.key));
3444
- }
3445
- }
3446
- async function w(C, A = !1) {
3447
- if (!e.plan.value || !tt(e.plan.value, C)) return !1;
3448
- const k = n.value, M = A && k && qe(e.plan.value, k.anchor).grid === qe(e.plan.value, C, k.anchor).grid;
3449
- n.value = { anchor: M ? k.anchor : { ...C }, focus: { ...C } }, e.root.value?.querySelector(Gt(C)) || e.gotoPage(C.pageIndex + 1), await He(), p();
3450
- const O = e.root.value?.querySelector(Gt(C));
3451
- return O?.focus({ preventScroll: !0 }), O?.scrollIntoView?.({ block: "nearest", inline: "nearest" }), !!O;
3452
- }
3453
- function y(C) {
3454
- const A = C.target;
3455
- if (!(A instanceof Element) || A.closest("textarea,input,button,select")) return;
3456
- const k = A.closest("td[data-mr-row-index]"), M = k && nn(k);
3457
- if (!M || e.busy() || !e.plan.value || !tt(e.plan.value, M)) return;
3458
- const O = n.value, D = C.shiftKey && O && qe(e.plan.value, O.anchor).grid === qe(e.plan.value, M, O.anchor).grid;
3459
- n.value = { anchor: D ? O.anchor : { ...M }, focus: { ...M } }, p(), k.focus({ preventScroll: !0 });
3460
- }
3461
- function c(C) {
3462
- const A = e.plan.value?.pages[C.pageIndex]?.components[C.componentIndex];
3463
- return A?.grid ? dn(A.grid, A.widthMm, A.heightMm).cells.map((k) => ({ ...C, rowIndex: k.ri, columnIndex: k.ci })) : [];
3464
- }
3465
- function i(C, A, k) {
3466
- const M = c(C), O = k ? -1 : 1;
3467
- if (A === "Tab") return M[M.findIndex((G) => ii(G, C)) + O];
3468
- const D = A === "ArrowUp" || A === "ArrowDown" || A === "Enter", W = A === "ArrowUp" || A === "ArrowLeft" ? -1 : O;
3469
- return M.filter((G) => D ? G.columnIndex === C.columnIndex && (G.rowIndex - C.rowIndex) * W > 0 : G.rowIndex === C.rowIndex && (G.columnIndex - C.columnIndex) * W > 0).sort((G, J) => D ? (G.rowIndex - J.rowIndex) * W : (G.columnIndex - J.columnIndex) * W)[0];
3470
- }
3471
- function R(C, A, k) {
3472
- if (A === "ArrowLeft" || A === "ArrowRight") return;
3473
- const M = e.plan.value;
3474
- if (!M.pages[C.pageIndex]?.components[C.componentIndex]?.table) return;
3475
- const D = A === "ArrowUp" || k ? -1 : 1;
3476
- for (let W = C.pageIndex; W >= 0 && W < M.pages.length; W += D) {
3477
- const G = M.pages[W].components, J = W === C.pageIndex ? C.componentIndex + D : D === 1 ? 0 : G.length - 1;
3478
- for (let L = J; L >= 0 && L < G.length; L += D) {
3479
- const de = b(C, { ...C, pageIndex: W, componentIndex: L }, A, D);
3480
- if (de) return de;
3481
- }
3482
- }
3483
- }
3484
- function b(C, A, k, M) {
3485
- const O = e.plan.value, D = O.pages[C.pageIndex].components[C.componentIndex].table, W = O.pages[A.pageIndex].components[A.componentIndex]?.table;
3486
- if (W?.id !== D.id || W.role === "header" && D.role !== "header" && (M > 0 || D.rowIndex + C.rowIndex > 0)) return;
3487
- const G = c(A), J = k === "Tab" ? G : G.filter((L) => L.columnIndex === C.columnIndex);
3488
- return M === 1 ? J[0] : J[J.length - 1];
3489
- }
3490
- function S(C, A, k = !1, M = !1, O = !1) {
3491
- const D = i(C, A, k) ?? R(C, A, k);
3492
- return D ? (w(D, M), !0) : ((A !== "Tab" || !O) && w(C), !1);
3493
- }
3494
- function F(C) {
3495
- const A = n.value;
3496
- if (e.busy() || C.target instanceof Element && C.target.closest("textarea,input,select,button,a[href],[contenteditable]")) return !1;
3497
- if (!A) return Z(C);
3498
- const k = C.key;
3499
- if (q(C) || j(C, A.focus)) return !0;
3500
- if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Enter"].includes(k)) return !1;
3501
- const M = S(A.focus, k, k === "Tab" && C.shiftKey, C.shiftKey && k !== "Tab", !0);
3502
- if (k === "Tab" && !M) {
3503
- const O = e.root.value?.ownerDocument.activeElement;
3504
- if (!(O instanceof HTMLElement) || !si(O, C.shiftKey)) return !1;
3505
- }
3506
- return C.preventDefault(), !0;
3507
- }
3508
- function q(C) {
3509
- if (!t() || !(C.ctrlKey || C.metaKey)) return !1;
3510
- const A = C.key.toLowerCase();
3511
- return A !== "z" && A !== "y" ? !1 : (C.preventDefault(), A === "y" || C.shiftKey ? e.redo() : e.undo(), !0);
3512
- }
3513
- function j(C, A) {
3514
- if (!t() || !e.plan.value || C.key !== "F2" && !(C.key === "Enter" && tt(e.plan.value, A)?.editable)) return !1;
3515
- const k = e.root.value?.querySelector(Gt(A));
3516
- return k && (C.preventDefault(), e.edit(k)), !0;
3517
- }
3518
- function Z(C) {
3519
- if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft", "Enter"].includes(C.key)) return !1;
3520
- const A = e.root.value?.querySelector("td[data-mr-row-index]"), k = A && nn(A);
3521
- return k ? (C.preventDefault(), w(k), !0) : !1;
3522
- }
3523
- function _() {
3524
- const C = n.value, A = e.plan.value;
3525
- if (!C || !A) return "";
3526
- const k = [], M = qe(A, C.anchor), O = qe(A, C.focus, C.anchor), D = Hn(A, C.anchor), W = Et(A), G = Math.min(M.column, O.column), J = Math.max(M.column, O.column);
3527
- if ((Math.abs(M.row - O.row) + 1) * (J - G + 1) > 1e4)
3528
- return e.error(new Fe("limit")), "";
3529
- for (let L = Math.min(M.row, O.row); L <= Math.max(M.row, O.row); L++) {
3530
- const de = [];
3531
- for (let se = G; se <= J; se++) {
3532
- const ge = D(L, se);
3533
- de.push(ge ? W(ge)?.cell.text ?? "" : "");
3534
- }
3535
- k.push(de);
3536
- }
3537
- return Ya(k);
3538
- }
3539
- function Y(C) {
3540
- !n.value || C.target instanceof Element && C.target.closest("textarea,input,select") || (C.clipboardData?.setData("text/plain", _()), C.preventDefault());
3541
- }
3542
- async function ee(C) {
3543
- const A = n.value;
3544
- if (!A || !t() || e.busy()) return !1;
3545
- try {
3546
- let k;
3547
- try {
3548
- k = Za(C);
3549
- } catch (J) {
3550
- throw new Fe(J instanceof Error && J.message.includes("limit") ? "limit" : "clipboard");
3551
- }
3552
- const M = e.plan.value, O = qe(M, A.anchor), D = qe(M, A.focus, A.anchor), W = Hn(M, A.anchor), G = k.flatMap((J, L) => J.map((de, se) => {
3553
- const ge = W(Math.min(O.row, D.row) + L, Math.min(O.column, D.column) + se);
3554
- if (!ge) throw new Fe("missing");
3555
- return { address: ge, value: de };
3556
- }));
3557
- return await e.apply(G);
3558
- } catch (k) {
3559
- return e.error(k), !1;
3560
- }
3561
- }
3562
- function ie(C) {
3563
- if (!n.value || !t() || C.target instanceof Element && C.target.closest("textarea,input,select,button,a[href],[contenteditable]") || !C.clipboardData?.types.includes("text/plain")) return;
3564
- const A = C.clipboardData?.getData("text/plain");
3565
- A && (C.preventDefault(), ee(A));
3566
- }
3567
- async function ye(C) {
3568
- const A = e.plan.value;
3569
- if (!A) return !1;
3570
- const k = Et(A);
3571
- for (let M = 0; M < A.pages.length; M++) {
3572
- const O = A.pages[M];
3573
- for (let D = 0; D < O.components.length; D++)
3574
- for (const W of c({ pageIndex: M, componentIndex: D, rowIndex: 0, columnIndex: 0 })) {
3575
- const G = k(W);
3576
- if (oi(G, C))
3577
- return w(W);
3578
- }
3579
- }
3580
- return !1;
3581
- }
3582
- function ce() {
3583
- n.value = null, p();
3584
- }
3585
- return { selection: n, refresh: p, reset: ce, focusCell: w, focusField: ye, navigate: S, onClick: y, onKeydown: F, onCopy: Y, onPaste: ie, copySelection: _, pasteSelection: ee };
3586
- }
3587
- function gi(e) {
3588
- let t = 0, n = !1;
3589
- function a() {
3590
- const o = e.viewport.value, r = e.root.value, l = e.plan.value;
3591
- if (!o || !r || !l) return;
3592
- const u = e.options(), p = Math.max(0, Math.min(20, Math.floor(u.frozenColumns ?? 0)));
3593
- if (!u.freezeHeaders && p === 0 && !n) return;
3594
- const v = e.zoom.value || 1, g = o.getBoundingClientRect();
3595
- r.querySelectorAll("[data-mr-component-index]").forEach((m) => {
3596
- const w = m.closest("[data-page]"), y = Number(w?.dataset.page) - 1, c = l.pages[y]?.components[Number(m.dataset.mrComponentIndex)];
3597
- if (!c?.grid || !w) return;
3598
- m.style.transform = "", m.style.zIndex = "";
3599
- const i = m.getBoundingClientRect(), R = w.getBoundingClientRect().bottom, b = Math.max(0, (g.left - i.left) / v), S = u.freezeHeaders ? Math.max(0, Math.min((g.top - i.top) / v, (R - i.bottom) / v)) : 0;
3600
- b > 0 && p > 0 && (m.style.zIndex = "1"), c.table?.role === "header" && S > 0 && (m.style.transform = `translateY(${S}px)`, m.style.zIndex = "5"), m.querySelectorAll(".mrp-cell-frozen").forEach((q) => {
3601
- q.style.transform = "", q.style.zIndex = "", q.classList.remove("mrp-cell-frozen");
3602
- });
3603
- const F = Array.from({ length: p }, (q, j) => `td[data-mr-column-index="${j}"]`);
3604
- !c.table && u.freezeHeaders && F.push('td[data-mr-row-index="0"]'), F.length && m.querySelectorAll(F.join(",")).forEach((q) => {
3605
- const j = Number(q.dataset.mrColumnIndex) < p, Z = !c.table && Number(q.dataset.mrRowIndex) === 0 && !!u.freezeHeaders, _ = j ? b : 0, Y = Z ? S : 0;
3606
- q.style.transform = _ || Y ? `translate(${_}px, ${Y}px)` : "", q.classList.toggle("mrp-cell-frozen", !!(_ || Y)), q.style.zIndex = _ || Y ? Z ? "7" : "6" : "";
3607
- });
3608
- }), n = !!u.freezeHeaders || p > 0;
3609
- }
3610
- function s() {
3611
- t || (t = requestAnimationFrame(() => {
3612
- t = 0, a();
3613
- }));
3614
- }
3615
- return Ke(() => {
3616
- t && cancelAnimationFrame(t);
3617
- }), { refresh: a, schedule: s };
3618
- }
3619
- async function aa(e, t, n, a) {
3620
- if (!t?.assetRenderers || !Object.keys(t.assetRenderers).length) return e;
3621
- try {
3622
- return (await Xa(e, { ...t, signal: n, format: "dom", onDiagnostic: (o) => {
3623
- n.aborted || (t.onDiagnostic?.(o), a(o.message));
3624
- } })).plan;
3625
- } catch (s) {
3626
- throw n.aborted ? s : new Se("render", s instanceof Error ? s.message : "Report asset preparation failed", s);
3627
- }
3628
- }
3629
- function sa(e, t) {
3630
- const n = _a(e);
3631
- if (!n.ok) throw new Se("validate", `渲染计划校验失败(${n.errors.length} 处): ${n.errors.slice(0, 3).map((a) => `${a.path}: ${a.message}`).join("; ")}`);
3632
- n.warnings.forEach((a) => t(`${a.path}: ${a.message}`));
3633
- }
3634
- async function pi(e, t, n, a) {
3635
- const s = await at(e(t), t.signal);
3636
- return je(t.signal), a("validate"), sa(s, t.onWarning ?? (() => {
3637
- })), je(t.signal), a("assets"), aa(s, n, t.signal, t.onWarning ?? (() => {
3638
- }));
3639
- }
3640
- async function vi(e, t, n, a, s, o) {
3641
- const { importExcelTemplate: r } = await import("@agile-team/mach-report/xlsx");
3642
- je(a);
3643
- const l = await at(r(e, { ...t, signal: a }), a);
3644
- o("layout");
3645
- const u = Qa(Re(l.template), {}).plan;
3646
- sa(u, s), je(a), o("assets");
3647
- const p = await aa(u, n, a, s);
3648
- return { result: l, plan: p };
3649
- }
3650
- const hi = {
3651
- key: 7,
3652
- class: "mrp-edit-hint",
3653
- role: "status"
3654
- }, bi = {
3655
- key: 9,
3656
- class: "mrp-export-notice mrp-export-warning",
3657
- role: "status"
3658
- }, yi = { class: "mrp-main" }, wi = {
3659
- key: 0,
3660
- class: "mrp-state"
3661
- }, xi = {
3662
- key: 1,
3663
- class: "mrp-state mrp-error"
3664
- }, ki = ["data-page"], Ei = ["aria-label", "aria-current", "onClick"], Ci = ["data-thumb"], Ii = { class: "mrp-thumb-no" }, $i = {
3665
- key: 10,
3666
- class: "mrp-footer"
3667
- }, Pi = { class: "mrp-footer-context" }, Si = ["aria-label"], Ri = { key: 0 }, Mi = { class: "mrp-overlay" }, Ti = {
3668
- key: 11,
3669
- class: "mrp-debug",
3670
- "aria-hidden": "true"
3671
- }, Zt = 96 / 25.4, Yt = "mach-report:ui", Xt = "mach-report:ui:wide", Di = /* @__PURE__ */ Ie({
3672
- __name: "ReportPreview",
3673
- props: {
3674
- reportId: {
3675
- type: [String, Array],
3676
- default: null
3677
- },
3678
- params: {
3679
- type: Object,
3680
- default: () => ({})
3681
- },
3682
- height: { type: String, default: "100vh" },
3683
- autoLoad: { type: Boolean, default: !0 },
3684
- /** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
3685
- showExport: { type: Boolean, default: void 0 },
3686
- showPrint: { type: Boolean, default: void 0 },
3687
- showPdfWindow: { type: Boolean, default: void 0 },
3688
- showSettings: { type: Boolean, default: void 0 },
3689
- toolbar: { type: Object, default: void 0 },
3690
- interaction: { type: Object, default: void 0 },
3691
- preferences: { type: Object, default: void 0 },
3692
- guardChanges: { type: Boolean, default: void 0 },
3693
- beforeDiscard: { type: Function, default: void 0 },
3694
- output: { type: Object, default: void 0 },
3695
- assets: { type: Object, default: void 0 },
3696
- /** 保留表头的零行业务结果;不改变计划和导出内容。 */
3697
- emptyState: { type: [Boolean, Object], default: !1 },
3698
- /** 页间距(px);不传走配置中心 */
3699
- gapPx: { type: Number, default: void 0 },
3700
- /** 工具栏/状态文案覆写(不传走配置中心 messages) */
3701
- messages: { type: Object, default: void 0 },
3702
- /** 启用的 preset 名(不传用配置中心 defaultPreset) */
3703
- preset: { type: String, default: void 0 },
3704
- /** 调试面板(也可用 URL ?mrp-debug=1 开启) */
3705
- debug: { type: Boolean, default: !1 },
3706
- /** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
3707
- paramDefs: {
3708
- type: Array,
3709
- default: void 0
3710
- },
3711
- /** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
3712
- showParams: { type: Boolean, default: void 0 },
3713
- editable: { type: [Boolean, Object], default: void 0 },
3714
- excelImport: { type: [Boolean, Object], default: void 0 },
3715
- fetcher: {
3716
- type: Function,
3717
- default: null
3718
- }
3719
- },
3720
- emits: ["loaded", "task", "diagnostic", "error", "warning", "cell-edit", "template-import", "preferences-change"],
3721
- setup(e, { expose: t, emit: n }) {
3722
- const a = e, s = n, o = fe(null), r = V(!1), l = V(""), u = fe(null), p = V(null), v = V(!1), g = V(null), m = V(1), w = V(null), y = V(null), c = V(null), i = V(!1), R = V(!1), b = V(!1), S = V("general"), F = fe(null), q = V(null), j = V(null), Z = Cs();
3723
- let _ = null, Y = !1;
3724
- const ee = Sr((f) => s("task", f)), ie = Rr((f) => s("diagnostic", f)), ye = fe(null), ce = z(() => !!o.value?.pages.length && o.value.pages.every((f) => f.layout === "wide"));
3725
- let C = Yt;
3726
- const A = kt(ss, null), k = kt(os, null), M = z(() => Jn(a.reportId)), O = z(() => a.fetcher ?? A), D = z(() => o.value?.pages.length ?? 0), W = z(() => Object.freeze({
3727
- loading: r.value,
3728
- hasPlan: D.value > 0,
3729
- pageCount: D.value,
3730
- currentPage: m.value,
3731
- exporting: p.value,
3732
- printing: v.value,
3733
- canExport: !r.value && !R.value && !U.saving.value && D.value > 0 && p.value === null,
3734
- canPrint: !r.value && !R.value && !U.saving.value && D.value > 0 && !v.value,
3735
- error: u.value,
3736
- pdfFont: mn.value,
3737
- editing: U.active.value !== null,
3738
- saving: U.saving.value,
3739
- importing: R.value,
3740
- dirty: U.differences.value.length > 0,
3741
- pendingLocalChanges: U.pendingLocalChanges.value,
3742
- task: ee.state.value,
3743
- diagnostics: ie.entries.value,
3744
- reportIds: ye.value?.reportIds ?? [],
3745
- params: ye.value?.params ?? {},
3746
- canUndo: U.canUndo.value,
3747
- canRedo: U.canRedo.value,
3748
- changeCount: U.differences.value.length,
3749
- selection: oe.selection.value ? Re(oe.selection.value) : null
3750
- }));
3751
- function G(f, $, B) {
3752
- u.value = Object.freeze({ message: f, code: $, cause: B }), s("error", f, { code: $, cause: B });
3753
- }
3754
- const {
3755
- resolved: J,
3756
- resolvedMessages: L,
3757
- effectiveShowExport: de,
3758
- effectiveShowSettings: se,
3759
- effectiveGuardChanges: ge,
3760
- effectiveOutput: Ve,
3761
- effectiveInteraction: Me,
3762
- effectiveAssets: I,
3763
- effectiveGapPx: T,
3764
- effectiveShowParams: H,
3765
- availableTools: K,
3766
- tools: Q,
3767
- toolState: X,
3768
- visibleExportFormats: we,
3769
- effectiveEditable: xe,
3770
- effectiveExcelImport: Te,
3771
- persistedEditing: gt,
3772
- emptyStateContent: Rt,
3773
- sessionInteraction: Mt
3774
- } = ai(a, ce, (f) => s("warning", f)), fn = z(() => X.value.pdf || X.value.pdfWindow), Tt = z(() => Me.value.calculations === !0), Dt = z(() => Al(L.value)), { pdfFont: mn, getPdfExporter: oa, checkPdfFont: ra, retryPdfFont: gn, cancelFontCheck: la } = Ir({
3775
- plan: o,
3776
- fontUrl: () => J.value.pdfFontUrl,
3777
- enabled: () => fn.value,
3778
- injectedExporter: k,
3779
- destroyed: () => Y
3780
- });
3781
- async function ia(f, $) {
3782
- f === "editing" && !$ && !await U.settle() || (Q.setEnabled(f, $), s("preferences-change", Object.freeze({ ...X.value })));
3783
- }
3784
- async function ua() {
3785
- await U.settle() && (Q.reset(), Mt.value = {}, s("preferences-change", Object.freeze({ ...X.value })));
3786
- }
3787
- async function pn(f = "general") {
3788
- if (b.value) {
3789
- b.value = !1;
3790
- return;
3791
- }
3792
- const $ = U.settle();
3793
- !(typeof $ == "boolean" ? $ : await $) || Y || !se.value || (S.value = f, b.value = !0);
3794
- }
3795
- function vn(f) {
3796
- return f instanceof Fe ? {
3797
- number: L.value.editInvalidNumber,
3798
- boolean: L.value.editInvalidBoolean,
3799
- conflict: L.value.editConflict,
3800
- atomic: L.value.editAtomicRequired,
3801
- limit: L.value.clipboardLimit,
3802
- readonly: L.value.editReadOnly,
3803
- missing: L.value.editMissing,
3804
- recalculation: L.value.editRecalculationUnavailable,
3805
- duplicate: L.value.editDuplicate,
3806
- clipboard: L.value.clipboardInvalid
3807
- }[f.code] ?? f.message : f instanceof Error ? f.message : "单元格保存失败";
3808
- }
3809
- const U = ti({
3810
- plan: o,
3811
- options: xe,
3812
- blocked: () => r.value || R.value || p.value !== null || v.value || Oe.pending.value,
3813
- label: () => L.value.editCell ?? "编辑单元格",
3814
- errorMessage: vn,
3815
- suspendBlur: () => Oe.request.value !== null,
3816
- onChange: (f) => {
3817
- u.value = null, g.value = null, s("cell-edit", f);
3818
- },
3819
- onError: (f, $) => {
3820
- g.value = { kind: "error", message: f }, G(f, "edit", $);
3821
- },
3822
- onNavigate: (f, $, B) => oe.navigate(f, $, B)
3823
- }), oe = mi({
3824
- plan: o,
3825
- root: w,
3826
- enabled: () => !!xe.value || Tt.value,
3827
- editable: () => !!xe.value,
3828
- busy: () => r.value || R.value || U.saving.value || !!p.value || v.value || Oe.pending.value,
3829
- differences: () => U.differences.value,
3830
- gotoPage: Pe,
3831
- edit: U.editCell,
3832
- apply: U.apply,
3833
- undo: U.undo,
3834
- redo: U.redo,
3835
- error: (f) => {
3836
- const $ = vn(f);
3837
- g.value = { kind: "error", message: $ }, G($, "edit", f);
3838
- }
3839
- }), At = Ro({ plan: o, selection: oe.selection, enabled: () => Tt.value });
3840
- function ca() {
3841
- pn("advanced");
3842
- }
3843
- const Oe = $r({
3844
- pending: () => U.pendingLocalChanges.value,
3845
- reportIds: () => ye.value?.reportIds ?? M.value,
3846
- hook: () => a.beforeDiscard ?? J.value.beforeDiscard,
3847
- enabled: () => ge.value,
3848
- snapshot: () => [o.value, U.active.value?.editor.input.value],
3849
- error: (f) => G(f instanceof Error ? f.message : "修改保护回调失败", "config", f)
3850
- });
3851
- async function da(f = "leave") {
3852
- return Oe.check(f);
3853
- }
3854
- function hn(f) {
3855
- !ge.value || !U.pendingLocalChanges.value || (f.preventDefault(), f.returnValue = "");
3856
- }
3857
- function bn() {
3858
- ee.cancel();
3859
- }
3860
- function fa(f) {
3861
- const $ = U.resolveAddress(f);
3862
- $ && oe.focusCell($);
3863
- }
3864
- async function yn(f) {
3865
- await oe.focusField(f) || (g.value = { kind: "warning", message: L.value.locateFieldMissing ?? "Field not found" });
3866
- }
3867
- function ma(f) {
3868
- if (f.pageIndex === void 0) return;
3869
- Pe(f.pageIndex + 1);
3870
- const $ = f.componentPath;
3871
- f.componentIndex !== void 0 && $ && $.length === 2 && oe.focusCell({ pageIndex: f.pageIndex, componentIndex: f.componentIndex, rowIndex: $[0], columnIndex: $[1] });
3872
- }
3873
- function Ft(f) {
3874
- const $ = o.value;
3875
- if (!$) return !1;
3876
- const B = { excel: "xlsx", image: "png", doc: "word" }[f] ?? f, me = B === "pdf" ? "pdf" : B === "xlsx" ? "xlsx" : B === "png" ? "canvas" : "dom", ne = ie.inspect($, me);
3877
- return o.value !== $ ? !1 : ne.length && Ve.value.fidelity === "strict" ? (g.value = { kind: "error", message: L.value.diagnosticsStrict ?? "输出存在已知降级" }, G(g.value.message, "export", { diagnostics: ne }), !1) : !0;
3878
- }
3879
- function ga(f) {
3880
- return o.value ? ie.inspect(o.value, f) : [];
3881
- }
3882
- const pt = z(() => {
3883
- if (F.value) return F.value.sheets.map(($) => ({ label: $.name, pageIndex: $.pageStart }));
3884
- const f = /* @__PURE__ */ new Set();
3885
- return o.value?.pages.flatMap(($, B) => $.components.flatMap((me) => {
3886
- const ne = me.table;
3887
- return !ne?.title || f.has(ne.id) ? [] : (f.add(ne.id), [{ label: ne.title, pageIndex: B }]);
3888
- })) ?? [];
3889
- });
3890
- async function wn(f) {
3891
- f && !await oe.focusField({ field: f }) && (g.value = { kind: "warning", message: L.value.locateFieldMissing ?? "Field not found" });
3892
- }
3893
- const Ot = z(() => {
3894
- try {
3895
- return { defs: a.paramDefs ?? O.value?.getParamDefs?.(M.value) ?? [], error: null };
3896
- } catch (f) {
3897
- return { defs: [], error: new Se("config", f instanceof Error ? f.message : "查询参数配置无效", f) };
3898
- }
3899
- }), Lt = z(() => Ot.value.defs), ot = Dr({ defs: Lt, reportIds: M, params: () => a.params, messages: () => L.value }), { values: rt, attempted: vt, pendingRequired: xn } = ot, kn = V(null);
3900
- function pa() {
3901
- vt.value = !0, ot.validation.value.ok || He(() => kn.value?.focusInvalid()), Ze();
3902
- }
3903
- function va() {
3904
- ot.reset(), l.value = "", u.value = null;
3905
- }
3906
- const ha = z(() => ({
3907
- height: a.height,
3908
- "--mrp-page-gap": `${Math.max(0, T.value)}px`,
3909
- ...Bl(J.value.theme)
3910
- })), { zoom: Ee, zoomMode: lt, applyFitZoom: En, setZoom: it } = us(() => ({
3911
- viewport: y.value,
3912
- pageWidthPx: zt.contentSize.value.w || 210 * Zt
3913
- })), zt = ls(o, Ee, {
3914
- pxPerMm: Zt,
3915
- gapPx: T,
3916
- overscan: z(() => J.value.preview.overscanPages)
3917
- }), { contentSize: qt, windowRange: ut, visiblePages: Cn, makeScrollHandler: ba, refreshViewport: Bt } = zt, ya = ba(m, D), Nt = gi({ root: w, viewport: y, plan: o, zoom: Ee, options: () => Me.value });
3918
- le([Me, Ee], () => Nt.schedule(), { flush: "post" });
3919
- function jt(f) {
3920
- it(f * 100);
3921
- }
3922
- function Je() {
3923
- R.value = !1, U.reset(), oe.reset(), F.value = null, $n(), o.value = null, ye.value = null, ie.reset(), m.value = 1, re.reset();
3924
- }
3925
- let pe = 0, ve = null;
3926
- function ht(f, $) {
3927
- return f === pe && !$.signal.aborted && !Y;
3928
- }
3929
- function In() {
3930
- y.value && (y.value.scrollTop = 0, y.value.scrollLeft = 0);
3931
- }
3932
- function wa(f, $) {
3933
- for (const B of f) {
3934
- if ($ !== pe) return !1;
3935
- s("warning", B);
3936
- }
3937
- return $ === pe;
3938
- }
3939
- function xa() {
3940
- if (Ot.value.error) {
3941
- const $ = Ot.value.error;
3942
- return Je(), l.value = $.message, G($.message, $.code, $.cause), null;
3943
- }
3944
- const f = ot.query();
3945
- return f.params ? f.params : (Je(), l.value = f.quiet ? "" : f.error.message, f.quiet || (vt.value = !0, G(f.error.message, f.error.code, f.error.cause)), null);
3946
- }
3947
- async function Ze() {
3948
- if (Y || ge.value && U.pendingLocalChanges.value && !await Oe.check("reload") || Y) return;
3949
- const f = ++pe;
3950
- R.value = !1, ve?.abort(), ve = null;
3951
- const $ = O.value;
3952
- if (r.value = !1, u.value = null, M.value.length === 0) {
3953
- l.value = "缺少报表 ID", Je(), G(l.value, "param");
3954
- return;
3955
- }
3956
- if (!$) {
3957
- l.value = "未提供渲染数据源 fetcher", Je(), G(l.value, "config");
3958
- return;
3959
- }
3960
- const B = xa();
3961
- if (!B) return;
3962
- r.value = !0, l.value = "", g.value = null, Je();
3963
- const me = Z.start(), ne = new AbortController();
3964
- ve = ne;
3965
- const ze = ee.start("query", "query", () => {
3966
- ve === ne && (ne.abort(), pe++, ve = null, r.value = !1);
3967
- }), bt = [...M.value], De = Object.freeze({ ...B }), Be = /* @__PURE__ */ new Set();
3968
- function Qe(Ce) {
3969
- f !== pe || ne.signal.aborted || Be.has(Ce) || (Be.add(Ce), J.value.logger.warn("[mach-report] 报表告警:", Ce), ie.add({ code: "layout", severity: "warning", message: Ce }), s("warning", Ce));
3970
- }
3971
- try {
3972
- const Ce = await pi($, {
3973
- reportIds: bt,
3974
- params: B,
3975
- taskId: ze.taskId,
3976
- onEvent: (Ge) => {
3977
- f === pe && !ne.signal.aborted && ze.update(Ge.stage, Ge.completed, Ge.total);
3978
- },
3979
- onQueryResult: (Ge, Aa) => {
3980
- f === pe && !ne.signal.aborted && ie.addMany(Aa.diagnostics ?? []);
3981
- },
3982
- signal: ne.signal,
3983
- onWarning: Qe
3984
- }, I.value, ze.update);
3985
- if (!ht(f, ne) || (o.value = Ce, ye.value = Object.freeze({ reportIds: Object.freeze(bt), params: De }), ie.inspect(Ce, "dom"), !ht(f, ne))) return;
3986
- ze.finish(), m.value = 1, Z.end(me), In();
3987
- const _e = ce.value ? Xt : Yt;
3988
- _e !== C && (C = _e, Wt()), lt.value === "fit" && En(), s("loaded", Ce.pages.length);
3989
- } catch (Ce) {
3990
- if (f !== pe) return;
3991
- if (ne.signal.aborted) {
3992
- ze.finish("cancelled");
3993
- return;
3994
- }
3995
- ze.finish("failed");
3996
- const _e = wr(Ce);
3997
- l.value = _e.message;
3998
- const Ge = yr(_e);
3999
- G(_e.message, Ge.code, Ge.cause);
4000
- } finally {
4001
- f === pe && (r.value = !1), ve === ne && (ve = null);
4002
- }
4003
- }
4004
- function Pe(f) {
4005
- if (Y || D.value <= 0) return;
4006
- const $ = Math.max(1, Math.min(D.value, f));
4007
- m.value = $;
4008
- const B = y.value;
4009
- B && (B.scrollTop = zt.pageOffsetPx($ - 1) * Ee.value, Bt(B), Ta.prioritize($ - 1));
4010
- }
4011
- const Ye = fs(o, {
4012
- getPdfExporter: oa,
4013
- beforeOutput: () => U.settle(),
4014
- onTask: (f) => ee.receive(f, () => Ye.cancel()),
4015
- onDiagnostic: ie.add,
4016
- getXlsxOptions: () => J.value.xlsx,
4017
- onError: (f, $) => {
4018
- g.value = { kind: "error", message: f }, G(f, $ ?? "print");
4019
- },
4020
- onWarning: (f) => {
4021
- g.value = { kind: "warning", message: f }, ie.add({ code: "output", severity: "warning", message: f }), s("warning", f);
4022
- },
4023
- onBusy: (f) => {
4024
- p.value = f, f ? g.value = {
4025
- kind: "progress",
4026
- message: L.value.exporting.replace("{format}", f)
4027
- } : g.value?.kind === "progress" && (g.value = null);
4028
- },
4029
- onPrinting: (f) => {
4030
- v.value = f;
4031
- }
4032
- }), { releasePrintFrame: $n, dispose: ka } = Ye;
4033
- async function Pn() {
4034
- if (r.value || R.value) return;
4035
- const f = U.settle();
4036
- (typeof f == "boolean" ? f : await f) && (u.value = null, Ft("html") && await Ye.print());
4037
- }
4038
- async function Sn(f) {
4039
- if (r.value || R.value) return;
4040
- const $ = U.settle();
4041
- (typeof $ == "boolean" ? $ : await $) && (u.value = null, Ft(f) && await Ye.exportAs(f));
4042
- }
4043
- function Rn() {
4044
- if (r.value || R.value || U.active.value || U.saving.value) {
4045
- g.value = { kind: "warning", message: L.value.editingHint ?? "请先确认单元格修改" };
4046
- return;
4047
- }
4048
- u.value = null, Ft("pdf") && Ye.openPdfWindow();
4049
- }
4050
- async function Ea(f, $ = {}) {
4051
- Y || (rt.value = { ...rt.value, ...f }, $.reload !== !1 && (vt.value = !0, await Ze()));
4052
- }
4053
- const Mn = {
4054
- reload: Ze,
4055
- print: Pn,
4056
- exportAs: Sn,
4057
- openPdfWindow: Rn,
4058
- gotoPage: Pe,
4059
- setParams: Ea,
4060
- checkPdfFont: ra,
4061
- importExcel: Tn,
4062
- getPlan: Ca,
4063
- cancelTask: bn,
4064
- confirmDiscard: da,
4065
- getOutputDiagnostics: ga,
4066
- getChanges: U.getChanges,
4067
- undo: U.undo,
4068
- redo: U.redo,
4069
- restoreChanges: U.restore,
4070
- getDifferences: () => Re(U.differences.value),
4071
- getSelection: () => oe.selection.value ? Re(oe.selection.value) : null,
4072
- focusCell: oe.focusCell,
4073
- focusField: oe.focusField,
4074
- copySelection: oe.copySelection,
4075
- pasteSelection: oe.pasteSelection,
4076
- get state() {
4077
- return W.value;
4078
- }
4079
- };
4080
- Wn(rs, Mn);
4081
- function Ca() {
4082
- return o.value ? Re(o.value) : null;
4083
- }
4084
- function Ia(f) {
4085
- const $ = typeof Te.value == "object" ? Te.value : {};
4086
- return { ...$, ...f, limits: { ...$.limits, ...f?.limits } };
4087
- }
4088
- function $a(f, $) {
4089
- U.reset(), oe.reset(), $n(), re.reset(), o.value = f, ye.value = null, ie.reset(), F.value = { sheets: Re($.sheets), warnings: [...$.warnings] }, m.value = 1, l.value = "", g.value = $.warnings.length ? { kind: "warning", message: $.warnings.join(";") } : null, In(), C = ce.value ? Xt : Yt, Wt(), ie.addMany($.warnings.map((B) => ({ code: "excel-import", severity: "warning", message: B }))), o.value === f && ie.inspect(f, "dom");
4090
- }
4091
- async function Tn(f, $) {
4092
- if (Y) throw new Se("config", "报表预览已卸载");
4093
- if (ge.value && U.pendingLocalChanges.value && !await Oe.check("import") || Y) return null;
4094
- const B = ++pe;
4095
- ve?.abort(), ve = null, r.value = !1, U.cancel(), Ye.invalidatePending(), R.value = !0;
4096
- const me = new AbortController();
4097
- ve = me, u.value = null, g.value = { kind: "progress", message: L.value.importing ?? "正在导入 Excel…" };
4098
- const ne = ee.start("import", "import", () => {
4099
- ve === me && (me.abort(), pe++, ve = null, R.value = !1, g.value = null);
4100
- }), ze = Ia($), bt = ts(ze.signal, me);
4101
- try {
4102
- const { result: De, plan: Be } = await vi(f, {
4103
- ...ze,
4104
- onProgress: (Qe, Ce) => {
4105
- ne.update("import", Qe, Ce), ze.onProgress?.(Qe, Ce);
4106
- }
4107
- }, I.value, me.signal, (Qe) => {
4108
- B === pe && s("warning", Qe);
4109
- }, ne.update);
4110
- return !ht(B, me) || !wa(De.warnings, B) || ($a(Be, De), !ht(B, me)) ? null : (ne.finish(), s("template-import", De), B === pe && s("loaded", Be.pages.length), De);
4111
- } catch (De) {
4112
- if (B !== pe) return null;
4113
- if (me.signal.aborted)
4114
- return ne.finish("cancelled"), null;
4115
- ne.finish("failed");
4116
- const Be = new Se("import", De instanceof Error ? De.message : "Excel 模板导入失败", De);
4117
- throw g.value = { kind: "error", message: Be.message }, G(Be.message, "import", De), Be;
4118
- } finally {
4119
- bt(), B === pe && (R.value = !1), ve === me && (ve = null);
4120
- }
4121
- }
4122
- function Pa(f) {
4123
- const $ = f.target, B = $.files?.[0];
4124
- $.value = "", B && Tn(B).catch(() => {
4125
- });
4126
- }
4127
- const re = xs({
4128
- plan: o,
4129
- gotoPage: Pe,
4130
- debounceMs: z(() => J.value.preview.searchDebounceMs),
4131
- highlight: gs,
4132
- clearHighlights: ms
4133
- });
4134
- le(() => X.value.search, (f) => {
4135
- f || (re.reset(), re.visible.value = !1);
4136
- });
4137
- function Sa(f) {
4138
- !f.ctrlKey || !X.value.zoom || (f.preventDefault(), jt(Ee.value * (f.deltaY < 0 ? 1.1 : 1 / 1.1)));
4139
- }
4140
- function Ra(f) {
4141
- if (!oe.onKeydown(f) && !(f.target instanceof Element && f.target.closest("input,textarea,select,[contenteditable='true']"))) {
4142
- if (X.value.search && (f.ctrlKey || f.metaKey) && f.key.toLowerCase() === "f") {
4143
- f.preventDefault(), re.visible.value || re.toggle(), He(() => j.value?.focusSearch());
4144
- return;
4145
- }
4146
- switch (f.key) {
4147
- case "PageDown":
4148
- f.preventDefault(), Pe(m.value + 1);
4149
- break;
4150
- case "PageUp":
4151
- f.preventDefault(), Pe(m.value - 1);
4152
- break;
4153
- case "Home":
4154
- f.preventDefault(), Pe(1);
4155
- break;
4156
- case "End":
4157
- f.preventDefault(), Pe(D.value);
4158
- break;
4159
- case "+":
4160
- case "=":
4161
- f.preventDefault(), X.value.zoom && jt(Ee.value * 1.1);
4162
- break;
4163
- case "-":
4164
- f.preventDefault(), X.value.zoom && jt(Ee.value / 1.1);
4165
- break;
4166
- }
4167
- }
4168
- }
4169
- function Ma() {
4170
- try {
4171
- localStorage.setItem(
4172
- C,
4173
- JSON.stringify({ zoomMode: lt.value === "fit" ? "fit" : Math.round(Ee.value * 100) })
4174
- );
4175
- } catch {
4176
- }
4177
- }
4178
- le([lt, Ee], Ma);
4179
- let Ht = "";
4180
- function Dn(f = !1) {
4181
- const $ = re.activeMatch.value;
4182
- if (!ce.value || !$) return;
4183
- const B = `${re.query.value}:${re.matchIndex.value}:${$.pageIndex}`;
4184
- if (!f && B === Ht) return;
4185
- const ne = w.value?.querySelector(`[data-page="${$.pageIndex + 1}"]`)?.querySelectorAll("mark.mrp-hit")[$.occurrence];
4186
- ne && (ne.scrollIntoView?.({ block: "nearest", inline: "nearest" }), Ht = B);
4187
- }
4188
- const Ta = is({
4189
- plan: o,
4190
- root: w,
4191
- pages: () => Cn.value,
4192
- priority: () => re.activeMatch.value?.pageIndex ?? m.value - 1,
4193
- focusToken: () => re.activeMatch.value,
4194
- query: () => re.query.value,
4195
- zoom: () => Ee.value,
4196
- loading: () => L.value.loading,
4197
- clear: re.clear,
4198
- highlight: re.apply,
4199
- mounted: (f) => {
4200
- oe.refresh(f), Nt.schedule();
4201
- },
4202
- ready: () => {
4203
- re.activeMatch.value || (Ht = ""), Dn();
4204
- },
4205
- error: (f) => {
4206
- l.value = f instanceof Error ? f.message : String(f), G(l.value, "render", f);
4207
- }
4208
- });
4209
- le(() => oe.selection.value, () => {
4210
- oe.refresh();
4211
- }, { flush: "post" }), le(() => re.query.value, (f) => {
4212
- f || w.value?.querySelectorAll(".mrp-page-holder").forEach(($) => {
4213
- re.clear($);
4214
- });
4215
- });
4216
- const Le = Es(o, {
4217
- thumbsRoot: c,
4218
- visible: i,
4219
- renderThumbCanvas: (f) => {
4220
- try {
4221
- const $ = o.value.pages[f], B = Math.min(0.2, 116 / Math.max(1, $.pageWidthMm * Zt)), { canvases: me } = es(o.value, { start: f, end: f, dpr: B });
4222
- return me[0] ?? null;
4223
- } catch {
4224
- return null;
4225
- }
4226
- }
4227
- });
4228
- za(() => {
4229
- Le.schedule();
4230
- }, { flush: "post" });
4231
- const Da = z(() => a.debug), { debugStats: Xe } = ks(Da, {
4232
- plan: o,
4233
- pageCount: D,
4234
- windowRange: ut,
4235
- zoom: Ee,
4236
- loadMs: Z.loadMs
4237
- });
4238
- function Kt() {
4239
- Bt(y.value), Le.schedule(), lt.value === "fit" && En(), Dn(!0);
4240
- }
4241
- function Wt() {
4242
- it(C === Xt ? 100 : "fit");
4243
- try {
4244
- const f = JSON.parse(localStorage.getItem(C) ?? "{}");
4245
- f.zoomMode === "fit" ? it("fit") : typeof f.zoomMode == "number" && it(f.zoomMode);
4246
- } catch {
4247
- }
4248
- }
4249
- return Pt(() => {
4250
- window.addEventListener("resize", Kt), window.addEventListener("beforeunload", hn), typeof ResizeObserver < "u" && y.value && (_ = new ResizeObserver(Kt), _.observe(y.value)), Bt(y.value), Wt(), a.autoLoad && Ze();
4251
- }), un(() => {
4252
- Y = !0, Oe.cancel(), ee.cancel(), U.reset(), R.value = !1, la(), pe++, ve?.abort(), ve = null, window.removeEventListener("resize", Kt), window.removeEventListener("beforeunload", hn), _?.disconnect(), _ = null, Le.destroy(), re.reset(), ka();
4253
- }), le(
4254
- () => [JSON.stringify(M.value), JSON.stringify(a.params), O.value],
4255
- async () => {
4256
- if (a.autoLoad) {
4257
- Ze();
4258
- return;
4259
- }
4260
- !await Oe.check("replace") || Y || (pe++, ve?.abort(), ve = null, r.value = !1, l.value = "", u.value = null, g.value = null, Je());
4261
- }
4262
- ), t({ ...Mn, state: W }), (f, $) => (E(), P("div", {
4263
- class: ke(["mach-report-preview", { "mrp-wide-report": ce.value }]),
4264
- style: Ne(ha.value)
4265
- }, [
4266
- d(H) && Lt.value.length > 0 ? (E(), Ae(Wr, {
4267
- key: 0,
4268
- ref_key: "paramPanelRef",
4269
- ref: kn,
4270
- defs: Lt.value,
4271
- modelValue: d(rt),
4272
- "onUpdate:modelValue": $[0] || ($[0] = (B) => Kn(rt) ? rt.value = B : null),
4273
- messages: d(L),
4274
- attempted: d(vt),
4275
- issues: d(ot).validation.value.issues,
4276
- onQuery: pa,
4277
- onReset: va
4278
- }, null, 8, ["defs", "modelValue", "messages", "attempted", "issues"])) : N("", !0),
4279
- te(co, {
4280
- ref_key: "toolbarRef",
4281
- ref: j,
4282
- "page-count": D.value,
4283
- "current-page": m.value,
4284
- "zoom-mode": d(lt),
4285
- zoom: d(Ee),
4286
- "show-export": d(de),
4287
- "show-print": d(X).print,
4288
- "show-pdf-window": d(X).pdfWindow,
4289
- "show-search": d(X).search,
4290
- "show-thumbnails": d(X).thumbnails,
4291
- "show-zoom": d(X).zoom,
4292
- "export-formats": d(we),
4293
- "show-settings": d(se),
4294
- "settings-open": b.value,
4295
- messages: d(L),
4296
- search: { visible: d(re).visible.value, query: d(re).query.value, matchIndex: d(re).matchIndex.value, matchCount: d(re).matchCount.value, searching: d(re).searching.value },
4297
- "thumbs-visible": i.value,
4298
- "show-import": !!d(Te),
4299
- busy: r.value || R.value || d(U).saving.value,
4300
- onGoto: Pe,
4301
- onZoom: d(it),
4302
- onExport: $[1] || ($[1] = (B) => Sn(B)),
4303
- onPrint: Pn,
4304
- onPdfWindow: Rn,
4305
- onSearchInput: d(re).onInput,
4306
- onSearchNav: d(re).onNav,
4307
- onSearchToggle: d(re).toggle,
4308
- onThumbsToggle: $[2] || ($[2] = (B) => i.value = !i.value),
4309
- onImportExcel: $[3] || ($[3] = (B) => q.value?.click()),
4310
- onSettingsToggle: pn
4311
- }, qa({ _: 2 }, [
4312
- pt.value.length <= 1 ? {
4313
- name: "navigation",
4314
- fn: Ut(() => [
4315
- D.value > 0 && d(Me).navigation !== !1 ? (E(), Ae(Bn, {
4316
- key: 0,
4317
- plan: o.value,
4318
- compact: "",
4319
- sections: pt.value,
4320
- "current-page": m.value,
4321
- messages: d(L),
4322
- busy: r.value || R.value || d(U).saving.value,
4323
- onLocateTarget: yn,
4324
- onGoto: Pe,
4325
- onLocate: wn
4326
- }, null, 8, ["plan", "sections", "current-page", "messages", "busy"])) : N("", !0)
4327
- ]),
4328
- key: "0"
4329
- } : void 0
4330
- ]), 1032, ["page-count", "current-page", "zoom-mode", "zoom", "show-export", "show-print", "show-pdf-window", "show-search", "show-thumbnails", "show-zoom", "export-formats", "show-settings", "settings-open", "messages", "search", "thumbs-visible", "show-import", "busy", "onZoom", "onSearchInput", "onSearchNav", "onSearchToggle"]),
4331
- d(Oe).request.value ? (E(), Ae(rr, {
4332
- key: 1,
4333
- messages: d(L),
4334
- onAnswer: d(Oe).settle
4335
- }, null, 8, ["messages", "onAnswer"])) : N("", !0),
4336
- te(dr, {
4337
- task: d(ee).state.value,
4338
- messages: d(L),
4339
- onCancel: bn
4340
- }, null, 8, ["task", "messages"]),
4341
- te(br, {
4342
- entries: d(ie).entries.value,
4343
- messages: d(L),
4344
- onLocate: ma
4345
- }, null, 8, ["entries", "messages"]),
4346
- b.value && d(se) ? (E(), Ae(er, {
4347
- key: 2,
4348
- available: d(K),
4349
- enabled: d(X),
4350
- messages: d(L),
4351
- "persisted-editing": d(gt),
4352
- interaction: d(Me),
4353
- section: S.value,
4354
- busy: r.value || R.value || d(U).saving.value || !!p.value || v.value,
4355
- onSection: $[4] || ($[4] = (B) => S.value = B),
4356
- onInteraction: $[5] || ($[5] = (B) => Mt.value = { ...d(Mt), ...B }),
4357
- onChange: ia,
4358
- onReset: ua,
4359
- onClose: $[6] || ($[6] = (B) => b.value = !1)
4360
- }, {
4361
- advanced: Ut(() => [
4362
- te(So, {
4363
- state: d(At),
4364
- messages: Dt.value
4365
- }, null, 8, ["state", "messages"])
4366
- ]),
4367
- default: Ut(() => [
4368
- mt(f.$slots, "settings", {}, void 0, !0)
4369
- ]),
4370
- _: 3
4371
- }, 8, ["available", "enabled", "messages", "persisted-editing", "interaction", "section", "busy"])) : N("", !0),
4372
- pt.value.length > 1 && D.value > 0 && d(Me).navigation !== !1 ? (E(), Ae(Bn, {
4373
- key: 3,
4374
- plan: o.value,
4375
- onLocateTarget: yn,
4376
- sections: pt.value,
4377
- "current-page": m.value,
4378
- messages: d(L),
4379
- busy: r.value || R.value || d(U).saving.value,
4380
- onGoto: Pe,
4381
- onLocate: wn
4382
- }, null, 8, ["plan", "sections", "current-page", "messages", "busy"])) : N("", !0),
4383
- F.value ? (E(), Ae(Dl, {
4384
- key: 4,
4385
- result: F.value,
4386
- messages: d(L)
4387
- }, null, 8, ["result", "messages"])) : N("", !0),
4388
- d(xe) && D.value > 0 ? (E(), Ae(rl, {
4389
- key: 5,
4390
- differences: d(U).differences.value,
4391
- conflicts: d(U).conflicts.value,
4392
- messages: d(L),
4393
- saving: d(U).saving.value,
4394
- "can-undo": d(U).canUndo.value,
4395
- "can-redo": d(U).canRedo.value,
4396
- persisted: d(gt),
4397
- busy: !!p.value || v.value,
4398
- onUndo: d(U).undo,
4399
- onRedo: d(U).redo,
4400
- onRestore: d(U).restore,
4401
- onLocate: fa
4402
- }, null, 8, ["differences", "conflicts", "messages", "saving", "can-undo", "can-redo", "persisted", "busy", "onUndo", "onRedo", "onRestore"])) : N("", !0),
4403
- d(Te) ? (E(), P("input", {
4404
- key: 6,
4405
- ref_key: "importInputRef",
4406
- ref: q,
4407
- class: "mrp-import-input",
4408
- type: "file",
4409
- accept: ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
4410
- hidden: "",
4411
- onChange: Pa
4412
- }, null, 544)) : N("", !0),
4413
- d(xe) && D.value > 0 ? (E(), P("div", hi, x(d(U).saving.value ? d(L).saving : d(L).editingHint), 1)) : N("", !0),
4414
- g.value ? (E(), P("div", {
4415
- key: 8,
4416
- class: ke(["mrp-export-notice", `mrp-export-${g.value.kind}`]),
4417
- role: "alert"
4418
- }, x(g.value.message), 3)) : N("", !0),
4419
- d(mn).status === "error" && fn.value ? (E(), P("div", bi, [
4420
- ue(x(d(L).pdfFontUnavailable) + " ", 1),
4421
- h("button", {
4422
- type: "button",
4423
- onClick: $[7] || ($[7] = //@ts-ignore
4424
- (...B) => d(gn) && d(gn)(...B))
4425
- }, x(d(L).retry), 1)
4426
- ])) : N("", !0),
4427
- h("div", yi, [
4428
- h("div", {
4429
- ref_key: "viewportRef",
4430
- ref: y,
4431
- class: "mrp-body",
4432
- tabindex: "0",
4433
- onWheel: Sa,
4434
- onKeydown: Ra,
4435
- onDblclick: $[8] || ($[8] = //@ts-ignore
4436
- (...B) => d(U).onDoubleClick && d(U).onDoubleClick(...B)),
4437
- onClick: $[9] || ($[9] = //@ts-ignore
4438
- (...B) => d(oe).onClick && d(oe).onClick(...B)),
4439
- onCopy: $[10] || ($[10] = //@ts-ignore
4440
- (...B) => d(oe).onCopy && d(oe).onCopy(...B)),
4441
- onPaste: $[11] || ($[11] = //@ts-ignore
4442
- (...B) => d(oe).onPaste && d(oe).onPaste(...B)),
4443
- onScrollPassive: $[12] || ($[12] = (B) => {
4444
- d(ya)(B.target), d(Nt).schedule();
4445
- })
4446
- }, [
4447
- r.value ? (E(), P("div", wi, x(d(L).loading), 1)) : l.value ? (E(), P("div", xi, [
4448
- ue(x(l.value) + " ", 1),
4449
- h("button", {
4450
- class: "mrp-retry",
4451
- type: "button",
4452
- onClick: Ze
4453
- }, x(d(L).retry), 1)
4454
- ])) : !o.value || D.value === 0 ? (E(), Ae(zn, {
4455
- key: 2,
4456
- title: d(xn) ? d(L).paramPrompt ?? d(L).paramsTitle : d(L).empty,
4457
- description: d(xn) ? d(L).paramPromptDescription : d(Rt).description ?? d(L).emptyDescription
4458
- }, null, 8, ["title", "description"])) : (E(), P("div", {
4459
- key: 3,
4460
- class: "mrp-scale",
4461
- style: Ne({ width: `${d(qt).w * d(Ee)}px`, height: `${d(qt).h * d(Ee)}px` })
4462
- }, [
4463
- h("div", {
4464
- ref_key: "containerRef",
4465
- ref: w,
4466
- class: "mrp-scale-inner",
4467
- style: Ne({ transform: `scale(${d(Ee)})`, transformOrigin: "top left", width: `${d(qt).w}px` })
4468
- }, [
4469
- d(ut).padTopPx > 0 ? (E(), P("div", {
4470
- key: 0,
4471
- class: "mrp-spacer-top",
4472
- style: Ne({ height: `${d(ut).padTopPx}px` }),
4473
- "aria-hidden": "true"
4474
- }, null, 4)) : N("", !0),
4475
- (E(!0), P(he, null, be(d(Cn), (B) => (E(), P("div", {
4476
- key: B.index,
4477
- class: "mrp-page-holder",
4478
- "data-page": B.index + 1
4479
- }, null, 8, ki))), 128)),
4480
- d(ut).padBottomPx > 0 ? (E(), P("div", {
4481
- key: 1,
4482
- class: "mrp-spacer-bottom",
4483
- style: Ne({ height: `${d(ut).padBottomPx}px` }),
4484
- "aria-hidden": "true"
4485
- }, null, 4)) : N("", !0)
4486
- ], 4)
4487
- ], 4)),
4488
- !r.value && !l.value && o.value && D.value > 0 && e.emptyState ? (E(), Ae(zn, {
4489
- key: 4,
4490
- title: d(Rt).title ?? d(L).empty,
4491
- description: d(Rt).description ?? d(L).emptyDescription
4492
- }, null, 8, ["title", "description"])) : N("", !0)
4493
- ], 544),
4494
- d(X).thumbnails && i.value && D.value > 0 ? (E(), P("aside", {
4495
- key: 0,
4496
- ref_key: "thumbsRef",
4497
- ref: c,
4498
- class: "mrp-thumbs",
4499
- onScrollPassive: $[13] || ($[13] = //@ts-ignore
4500
- (...B) => d(Le).onScroll && d(Le).onScroll(...B))
4501
- }, [
4502
- d(Le).windowRange.value.padTopPx > 0 ? (E(), P("div", {
4503
- key: 0,
4504
- class: "mrp-thumb-spacer",
4505
- style: Ne({ height: `${d(Le).windowRange.value.padTopPx}px` }),
4506
- "aria-hidden": "true"
4507
- }, null, 4)) : N("", !0),
4508
- (E(!0), P(he, null, be(d(Le).visibleThumbs.value, (B) => (E(), P("button", {
4509
- key: B.index,
4510
- class: ke(["mrp-thumb", { "mrp-thumb-active": B.index + 1 === m.value }]),
4511
- type: "button",
4512
- "aria-label": `${d(L).thumbnails} · ${d(L).pageInfo.replace("{cur}", String(B.index + 1)).replace("{total}", String(D.value))}`,
4513
- "aria-current": B.index + 1 === m.value ? "page" : void 0,
4514
- style: Ne({ height: `${B.height + 20}px` }),
4515
- onClick: (me) => Pe(B.index + 1)
4516
- }, [
4517
- h("span", {
4518
- class: "mrp-thumb-box",
4519
- "data-thumb": B.index + 1,
4520
- style: Ne({ height: `${B.height}px` })
4521
- }, null, 12, Ci),
4522
- h("span", Ii, x(B.index + 1), 1)
4523
- ], 14, Ei))), 128)),
4524
- d(Le).windowRange.value.padBottomPx > 0 ? (E(), P("div", {
4525
- key: 1,
4526
- class: "mrp-thumb-spacer",
4527
- style: Ne({ height: `${d(Le).windowRange.value.padBottomPx}px` }),
4528
- "aria-hidden": "true"
4529
- }, null, 4)) : N("", !0)
4530
- ], 544)) : N("", !0)
4531
- ]),
4532
- D.value > 0 ? (E(), P("footer", $i, [
4533
- h("div", Pi, [
4534
- Tt.value && d(se) ? (E(), P("button", {
4535
- key: 0,
4536
- class: "mrp-calculation-toggle",
4537
- type: "button",
4538
- "aria-label": Dt.value.calculationTitle,
4539
- onClick: ca
4540
- }, [
4541
- $[14] || ($[14] = h("span", { "aria-hidden": "true" }, "∑", -1)),
4542
- ue(x(Dt.value.calculationTitle), 1),
4543
- d(At).result.value ? (E(), P("strong", Ri, x(d(At).result.value.formatted), 1)) : N("", !0)
4544
- ], 8, Si)) : N("", !0)
4545
- ]),
4546
- te(Qn, {
4547
- "page-count": D.value,
4548
- "current-page": m.value,
4549
- messages: d(L),
4550
- busy: r.value || R.value || d(U).saving.value,
4551
- onGoto: Pe
4552
- }, null, 8, ["page-count", "current-page", "messages", "busy"])
4553
- ])) : N("", !0),
4554
- h("div", Mi, [
4555
- mt(f.$slots, "default", {}, void 0, !0)
4556
- ]),
4557
- d(Xe) ? (E(), P("div", Ti, [
4558
- $[15] || ($[15] = h("div", null, "mach-report debug", -1)),
4559
- h("div", null, "pages: " + x(d(Xe).pages) + " | window: [" + x(d(Xe).window) + "]", 1),
4560
- h("div", null, "zoom: " + x(d(Xe).zoom) + " | load: " + x(d(Xe).loadMs), 1),
4561
- h("div", null, "plan: " + x(d(Xe).planKB) + "KB", 1)
4562
- ])) : N("", !0)
4563
- ], 6));
4564
- }
4565
- }), Ai = /* @__PURE__ */ $e(Di, [["__scopeId", "data-v-8490b9dc"]]), Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4566
- __proto__: null,
4567
- default: Ai
4568
- }, Symbol.toStringTag, { value: "Module" }));
4569
- export {
4570
- fs as A,
4571
- us as B,
4572
- Yi as C,
4573
- ea as D,
4574
- Se as M,
4575
- Vt as P,
4576
- an as R,
4577
- Gi as S,
4578
- Fl as a,
4579
- Ol as b,
4580
- Re as c,
4581
- jn as d,
4582
- Qn as e,
4583
- Wr as f,
4584
- Ai as g,
4585
- co as h,
4586
- ds as i,
4587
- Ui as j,
4588
- Cr as k,
4589
- Ki as l,
4590
- Zi as m,
4591
- Ll as n,
4592
- Vi as o,
4593
- Hi as p,
4594
- Jn as q,
4595
- wr as r,
4596
- Wi as s,
4597
- Ji as t,
4598
- Al as u,
4599
- ql as v,
4600
- Bl as w,
4601
- yr as x,
4602
- Nl as y,
4603
- ls as z
4604
- };