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