@agile-team/mach-report 0.10.0 → 1.0.1
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/dist/ReportPreview-B3auzZDn.cjs +6 -0
- package/dist/{ReportPreview-C6b5TOzz.js → ReportPreview-BZ0GyQHJ.js} +324 -321
- package/dist/{plugin-QjAiSBP6.js → plugin-D3QAPZ-7.js} +1 -1
- package/dist/{plugin-gftml2ST.cjs → plugin-qyCLVA7E.cjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/vue/ReportPreview.d.ts +6 -0
- package/dist/vue/async.d.cts +9 -0
- package/dist/vue/async.d.ts +9 -0
- package/dist/vue/composables/useReportSearch.d.ts +5 -4
- package/dist/vue/controller.d.ts +5 -1
- package/dist/vue/plugin.d.ts +9 -0
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +3 -3
- package/package.json +1 -1
- package/dist/ReportPreview--ElcAKoi.cjs +0 -6
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as k, computed as x, shallowRef as
|
|
2
|
-
import { computePageWindow as
|
|
3
|
-
import { a as Pe, b as
|
|
4
|
-
function
|
|
5
|
-
const n = r.pxPerMm ?? 3.7795275590551185, a = r.gapPx ?? 18, t = k(0),
|
|
1
|
+
import { ref as k, computed as x, shallowRef as Le, defineComponent as xe, watch as V, nextTick as et, openBlock as w, createElementBlock as y, createElementVNode as h, toDisplayString as P, Fragment as ee, createCommentVNode as B, normalizeClass as U, renderList as ie, createTextVNode as ze, withKeys as Se, inject as ue, provide as We, useCssVars as tt, watchEffect as Fe, onMounted as nt, onUnmounted as ot, normalizeStyle as Z, createBlock as at, createVNode as rt, unref as g, renderSlot as st } from "vue";
|
|
2
|
+
import { computePageWindow as lt, renderPage as Oe, validateRenderPlan as it, renderPlanToCanvas as ut } from "@agile-team/mach-report";
|
|
3
|
+
import { a as Pe, b as ct, c as dt, n as ft, M as pt, e as mt } from "./plugin-D3QAPZ-7.js";
|
|
4
|
+
function vt(e, o, r = {}) {
|
|
5
|
+
const n = r.pxPerMm ?? 3.7795275590551185, a = r.gapPx ?? 18, t = k(0), l = k(800), d = x(
|
|
6
6
|
() => (e.value?.pages ?? []).map((f) => f.pageHeightMm * n)
|
|
7
7
|
), u = x(() => {
|
|
8
8
|
const f = e.value?.pages ?? [];
|
|
@@ -11,9 +11,9 @@ function mt(e, o, r = {}) {
|
|
|
11
11
|
m += C.pageHeightMm * n + a, v = Math.max(v, C.pageWidthMm * n);
|
|
12
12
|
return { w: v, h: m };
|
|
13
13
|
}), p = x(
|
|
14
|
-
() =>
|
|
14
|
+
() => lt({
|
|
15
15
|
pageHeightsPx: d.value,
|
|
16
|
-
viewportHeightPx:
|
|
16
|
+
viewportHeightPx: l.value / o.value,
|
|
17
17
|
scrollTopPx: t.value / o.value,
|
|
18
18
|
overscan: 1,
|
|
19
19
|
gapPx: a
|
|
@@ -28,14 +28,14 @@ function mt(e, o, r = {}) {
|
|
|
28
28
|
let v = 0;
|
|
29
29
|
return (C) => {
|
|
30
30
|
v || (v = requestAnimationFrame(() => {
|
|
31
|
-
if (v = 0, t.value = C.scrollTop,
|
|
31
|
+
if (v = 0, t.value = C.scrollTop, l.value = C.clientHeight || 800, m.value <= 0) return;
|
|
32
32
|
const R = C.querySelectorAll(".mrp-page-holder");
|
|
33
33
|
if (!R.length) return;
|
|
34
34
|
const W = C.getBoundingClientRect().top + 56;
|
|
35
|
-
let
|
|
35
|
+
let N = 1;
|
|
36
36
|
R.forEach((M) => {
|
|
37
|
-
M.getBoundingClientRect().top <= W && (
|
|
38
|
-
}), f.value = Math.max(1, Math.min(m.value,
|
|
37
|
+
M.getBoundingClientRect().top <= W && (N = Number(M.dataset.page ?? 1));
|
|
38
|
+
}), f.value = Math.max(1, Math.min(m.value, N));
|
|
39
39
|
}));
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -45,11 +45,11 @@ function mt(e, o, r = {}) {
|
|
|
45
45
|
visiblePages: c,
|
|
46
46
|
makeScrollHandler: i,
|
|
47
47
|
refreshViewport(f) {
|
|
48
|
-
f && (
|
|
48
|
+
f && (l.value = f.clientHeight || 800);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function gt(e) {
|
|
53
53
|
const o = k(1), r = k("fit");
|
|
54
54
|
function n() {
|
|
55
55
|
requestAnimationFrame(() => {
|
|
@@ -74,48 +74,48 @@ function ae(e) {
|
|
|
74
74
|
}
|
|
75
75
|
function se(e) {
|
|
76
76
|
const o = /* @__PURE__ */ new Map();
|
|
77
|
-
e.pages.forEach((
|
|
78
|
-
o.has(ae(
|
|
77
|
+
e.pages.forEach((l) => {
|
|
78
|
+
o.has(ae(l)) || o.set(ae(l), l);
|
|
79
79
|
});
|
|
80
80
|
const a = `<!doctype html><html><head><meta charset="utf-8"><style>${`.mr-page{margin:0 auto;page-break-after:always;}
|
|
81
81
|
.mr-page tr{break-inside:avoid;page-break-inside:avoid;}
|
|
82
82
|
.mr-comp{break-inside:avoid;page-break-inside:avoid;}
|
|
83
83
|
${[...o.values()].map(
|
|
84
|
-
(
|
|
84
|
+
(l) => `@page ${ae(l)}{size:${Math.round(l.pageWidthMm)}mm ${Math.round(l.pageHeightMm)}mm;margin:0;}`
|
|
85
85
|
).join(`
|
|
86
86
|
`)}
|
|
87
|
-
body{margin:0;background:#fff;}`}</style></head><body>`, t = e.pages.map((
|
|
88
|
-
const d =
|
|
89
|
-
return d.style.page = ae(
|
|
87
|
+
body{margin:0;background:#fff;}`}</style></head><body>`, t = e.pages.map((l) => {
|
|
88
|
+
const d = Oe(l, 96, {}, document);
|
|
89
|
+
return d.style.page = ae(l), d.outerHTML;
|
|
90
90
|
});
|
|
91
91
|
return { head: a, pageChunks: t };
|
|
92
92
|
}
|
|
93
|
-
async function
|
|
93
|
+
async function hn(e, o = {}) {
|
|
94
94
|
const r = {
|
|
95
95
|
pages: e.flatMap((d) => d.pages)
|
|
96
96
|
};
|
|
97
97
|
if (r.pages.length === 0) return;
|
|
98
98
|
const { head: n, pageChunks: a } = se(r), t = document.createElement("iframe");
|
|
99
99
|
t.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(t);
|
|
100
|
-
let
|
|
100
|
+
let l = !1;
|
|
101
101
|
try {
|
|
102
102
|
const d = t.contentDocument;
|
|
103
103
|
d.open(), d.write(n);
|
|
104
104
|
for (let u = 0; u < a.length; u++)
|
|
105
105
|
d.write(a[u]), u % ce === ce - 1 && (o.onProgress?.(u + 1, a.length), await de());
|
|
106
|
-
d.write("</body></html>"), d.close(), await de(), o.onProgress?.(a.length, a.length),
|
|
106
|
+
d.write("</body></html>"), d.close(), await de(), o.onProgress?.(a.length, a.length), l = !0, t.contentWindow?.focus(), t.contentWindow?.print();
|
|
107
107
|
} catch (d) {
|
|
108
108
|
o.onError?.(d instanceof Error ? `批量打印失败: ${d.message}` : "批量打印失败");
|
|
109
109
|
} finally {
|
|
110
|
-
|
|
110
|
+
l ? setTimeout(() => t.remove(), 6e4) : t.remove();
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function ht(e, o) {
|
|
114
114
|
let r = null, n = !1, a = null;
|
|
115
115
|
function t() {
|
|
116
116
|
r?.remove(), r = null;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function l(i, f) {
|
|
119
119
|
const m = URL.createObjectURL(i), v = document.createElement("a");
|
|
120
120
|
v.href = m, v.download = f, v.click(), setTimeout(() => URL.revokeObjectURL(m), 1e4);
|
|
121
121
|
}
|
|
@@ -146,7 +146,7 @@ function gt(e, o) {
|
|
|
146
146
|
return a = (async () => {
|
|
147
147
|
try {
|
|
148
148
|
const f = await o.getPdfExporter()(i);
|
|
149
|
-
|
|
149
|
+
l(
|
|
150
150
|
new Blob([f], { type: "application/pdf" }),
|
|
151
151
|
"mach-report.pdf"
|
|
152
152
|
);
|
|
@@ -165,7 +165,7 @@ function gt(e, o) {
|
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
const { head: m, pageChunks: v } = se(f), C = `${m}${v.join("")}</body></html>`;
|
|
168
|
-
|
|
168
|
+
l(new Blob([C], { type: "text/html;charset=utf-8" }), `mach-report.${i === "html" ? "html" : i}`);
|
|
169
169
|
}
|
|
170
170
|
function c() {
|
|
171
171
|
const i = e.value;
|
|
@@ -184,9 +184,9 @@ function gt(e, o) {
|
|
|
184
184
|
releasePrintFrame: t
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
const
|
|
188
|
-
function
|
|
189
|
-
e.querySelectorAll(`mark.${
|
|
187
|
+
const He = "mrp-hit";
|
|
188
|
+
function bt(e) {
|
|
189
|
+
e.querySelectorAll(`mark.${He}`).forEach((r) => {
|
|
190
190
|
const n = r.parentNode;
|
|
191
191
|
if (n) {
|
|
192
192
|
for (; r.firstChild; ) n.insertBefore(r.firstChild, r);
|
|
@@ -194,7 +194,7 @@ function ht(e) {
|
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function wt(e, o) {
|
|
198
198
|
const r = o.trim();
|
|
199
199
|
if (!r) return 0;
|
|
200
200
|
const n = r.toLowerCase(), a = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, {
|
|
@@ -204,7 +204,7 @@ function bt(e, o) {
|
|
|
204
204
|
}
|
|
205
205
|
}), t = [];
|
|
206
206
|
for (let d = a.nextNode(); d; d = a.nextNode()) t.push(d);
|
|
207
|
-
let
|
|
207
|
+
let l = 0;
|
|
208
208
|
for (const d of t) {
|
|
209
209
|
const u = d.nodeValue ?? "", p = u.toLowerCase(), c = d.parentElement;
|
|
210
210
|
if (!c) continue;
|
|
@@ -213,34 +213,34 @@ function bt(e, o) {
|
|
|
213
213
|
for (; m >= 0; ) {
|
|
214
214
|
m > f && i.appendChild(document.createTextNode(u.slice(f, m)));
|
|
215
215
|
const v = document.createElement("mark");
|
|
216
|
-
v.className =
|
|
216
|
+
v.className = He, v.textContent = u.slice(m, m + r.length), i.appendChild(v), l++, f = m + r.length, m = p.indexOf(n, f);
|
|
217
217
|
}
|
|
218
218
|
f < u.length && i.appendChild(document.createTextNode(u.slice(f))), c.replaceChild(i, d);
|
|
219
219
|
}
|
|
220
|
-
return
|
|
220
|
+
return l;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Ie(e, o) {
|
|
223
223
|
let r = 0, n = e.toLowerCase().indexOf(o);
|
|
224
224
|
for (; n >= 0; )
|
|
225
225
|
r++, n = e.toLowerCase().indexOf(o, n + o.length);
|
|
226
226
|
return r;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
const { plan: o, gotoPage: r, highlight: n, clearHighlights: a } = e, t = e.debounceMs ?? 200,
|
|
228
|
+
function yt(e) {
|
|
229
|
+
const { plan: o, gotoPage: r, highlight: n, clearHighlights: a } = e, t = e.debounceMs ?? 200, l = k(!1), d = k(""), u = k(""), p = k(0);
|
|
230
230
|
let c = null;
|
|
231
231
|
const i = x(() => {
|
|
232
232
|
const M = d.value.trim().toLowerCase(), F = o.value;
|
|
233
233
|
if (!M || !F) return [];
|
|
234
234
|
const L = [];
|
|
235
235
|
return F.pages.forEach((O, te) => {
|
|
236
|
-
for (const
|
|
237
|
-
if (
|
|
238
|
-
for (const
|
|
239
|
-
for (const
|
|
240
|
-
if (typeof
|
|
241
|
-
for (let ne = 0; ne <
|
|
242
|
-
} else if (
|
|
243
|
-
for (let
|
|
236
|
+
for (const D of O.components)
|
|
237
|
+
if (D.grid) {
|
|
238
|
+
for (const j of D.grid.cells ?? [])
|
|
239
|
+
for (const J of j ?? [])
|
|
240
|
+
if (typeof J?.text == "string")
|
|
241
|
+
for (let ne = 0; ne < Ie(J.text, M); ne++) L.push(te);
|
|
242
|
+
} else if (D.kind === "text" && typeof D.text == "string")
|
|
243
|
+
for (let j = 0; j < Ie(D.text, M); j++) L.push(te);
|
|
244
244
|
}), L;
|
|
245
245
|
}), f = x(() => i.value.length);
|
|
246
246
|
function m(M) {
|
|
@@ -259,7 +259,7 @@ function wt(e) {
|
|
|
259
259
|
F !== 0 && (p.value = (p.value + M + F) % F, r(i.value[p.value] + 1));
|
|
260
260
|
}
|
|
261
261
|
function C() {
|
|
262
|
-
|
|
262
|
+
l.value = !l.value;
|
|
263
263
|
}
|
|
264
264
|
function R(M) {
|
|
265
265
|
const F = d.value.trim();
|
|
@@ -268,11 +268,11 @@ function wt(e) {
|
|
|
268
268
|
function W(M) {
|
|
269
269
|
a(M);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function N() {
|
|
272
272
|
u.value = "", d.value = "", p.value = 0, c && clearTimeout(c), c = null;
|
|
273
273
|
}
|
|
274
274
|
return {
|
|
275
|
-
visible:
|
|
275
|
+
visible: l,
|
|
276
276
|
query: d,
|
|
277
277
|
matchIndex: p,
|
|
278
278
|
matchCount: f,
|
|
@@ -281,10 +281,10 @@ function wt(e) {
|
|
|
281
281
|
onNav: v,
|
|
282
282
|
apply: R,
|
|
283
283
|
clear: W,
|
|
284
|
-
reset:
|
|
284
|
+
reset: N
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function Pt(e, o) {
|
|
288
288
|
const r = x(() => {
|
|
289
289
|
if (e.value) return !0;
|
|
290
290
|
if (typeof location > "u") return !1;
|
|
@@ -302,10 +302,10 @@ function yt(e, o) {
|
|
|
302
302
|
});
|
|
303
303
|
return { enabled: r, debugStats: a };
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function xt(e, o) {
|
|
306
306
|
const { thumbsRoot: r, visible: n, renderThumbCanvas: a } = o;
|
|
307
307
|
let t = null;
|
|
308
|
-
function
|
|
308
|
+
function l(p, c) {
|
|
309
309
|
if (!e.value || p.childElementCount > 0) return;
|
|
310
310
|
const i = a(c);
|
|
311
311
|
i && (i.style.width = "100%", i.style.height = "100%", i.style.display = "block", p.appendChild(i));
|
|
@@ -316,7 +316,7 @@ function Pt(e, o) {
|
|
|
316
316
|
for (const c of p) {
|
|
317
317
|
if (!c.isIntersecting) continue;
|
|
318
318
|
const i = c.target;
|
|
319
|
-
|
|
319
|
+
l(i, Number(i.dataset.thumb ?? 1) - 1), t?.unobserve(i);
|
|
320
320
|
}
|
|
321
321
|
},
|
|
322
322
|
{ root: r.value, rootMargin: "200px" }
|
|
@@ -327,8 +327,8 @@ function Pt(e, o) {
|
|
|
327
327
|
t?.disconnect(), t = null;
|
|
328
328
|
} };
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
const e =
|
|
330
|
+
function Et() {
|
|
331
|
+
const e = Le(0);
|
|
332
332
|
return {
|
|
333
333
|
loadMs: e,
|
|
334
334
|
start() {
|
|
@@ -339,13 +339,13 @@ function xt() {
|
|
|
339
339
|
}
|
|
340
340
|
};
|
|
341
341
|
}
|
|
342
|
-
const
|
|
342
|
+
const $t = { class: "mrp-toolbar" }, Ct = { class: "mrp-title" }, Mt = ["disabled"], kt = { class: "mrp-pageinfo" }, Rt = ["disabled"], Tt = {
|
|
343
343
|
key: 1,
|
|
344
344
|
class: "mrp-search"
|
|
345
|
-
},
|
|
345
|
+
}, St = ["placeholder", "value"], Ft = {
|
|
346
346
|
key: 0,
|
|
347
347
|
class: "mrp-search-count"
|
|
348
|
-
},
|
|
348
|
+
}, It = ["disabled"], Bt = ["disabled"], Lt = /* @__PURE__ */ xe({
|
|
349
349
|
__name: "ReportToolbar",
|
|
350
350
|
props: {
|
|
351
351
|
pageCount: {},
|
|
@@ -362,34 +362,34 @@ const Et = { class: "mrp-toolbar" }, $t = { class: "mrp-title" }, Ct = ["disable
|
|
|
362
362
|
emits: ["goto", "zoom", "export", "print", "pdf-window", "search-input", "search-nav", "search-toggle", "thumbs-toggle"],
|
|
363
363
|
setup(e) {
|
|
364
364
|
const o = e, r = k(null);
|
|
365
|
-
|
|
365
|
+
V(
|
|
366
366
|
() => o.search.visible,
|
|
367
367
|
(a) => {
|
|
368
|
-
a &&
|
|
368
|
+
a && et(() => r.value?.focus());
|
|
369
369
|
}
|
|
370
370
|
);
|
|
371
|
-
function n(a, t,
|
|
372
|
-
return a.replace("{cur}", String(t)).replace("{total}", String(
|
|
371
|
+
function n(a, t, l) {
|
|
372
|
+
return a.replace("{cur}", String(t)).replace("{total}", String(l));
|
|
373
373
|
}
|
|
374
|
-
return (a, t) => (
|
|
375
|
-
h("span",
|
|
376
|
-
e.pageCount > 0 ? (
|
|
374
|
+
return (a, t) => (w(), y("div", $t, [
|
|
375
|
+
h("span", Ct, P(e.messages.title), 1),
|
|
376
|
+
e.pageCount > 0 ? (w(), y(ee, { key: 0 }, [
|
|
377
377
|
h("button", {
|
|
378
378
|
class: "mrp-nav",
|
|
379
379
|
type: "button",
|
|
380
380
|
disabled: e.currentPage <= 1,
|
|
381
|
-
onClick: t[0] || (t[0] = (
|
|
382
|
-
},
|
|
383
|
-
h("span",
|
|
381
|
+
onClick: t[0] || (t[0] = (l) => a.$emit("goto", e.currentPage - 1))
|
|
382
|
+
}, P(e.messages.prevPage), 9, Mt),
|
|
383
|
+
h("span", kt, P(n(e.messages.pageInfo, e.currentPage, e.pageCount)), 1),
|
|
384
384
|
h("button", {
|
|
385
385
|
class: "mrp-nav",
|
|
386
386
|
type: "button",
|
|
387
387
|
disabled: e.currentPage >= e.pageCount,
|
|
388
|
-
onClick: t[1] || (t[1] = (
|
|
389
|
-
},
|
|
388
|
+
onClick: t[1] || (t[1] = (l) => a.$emit("goto", e.currentPage + 1))
|
|
389
|
+
}, P(e.messages.nextPage), 9, Rt)
|
|
390
390
|
], 64)) : B("", !0),
|
|
391
391
|
t[14] || (t[14] = h("span", { class: "mrp-spacer" }, null, -1)),
|
|
392
|
-
e.search.visible ? (
|
|
392
|
+
e.search.visible ? (w(), y("div", Tt, [
|
|
393
393
|
h("input", {
|
|
394
394
|
ref_key: "searchInputRef",
|
|
395
395
|
ref: r,
|
|
@@ -397,72 +397,72 @@ const Et = { class: "mrp-toolbar" }, $t = { class: "mrp-title" }, Ct = ["disable
|
|
|
397
397
|
type: "text",
|
|
398
398
|
placeholder: e.messages.searchPlaceholder,
|
|
399
399
|
value: e.search.query,
|
|
400
|
-
onInput: t[2] || (t[2] = (
|
|
401
|
-
}, null, 40,
|
|
402
|
-
e.search.query ? (
|
|
400
|
+
onInput: t[2] || (t[2] = (l) => a.$emit("search-input", l.target.value))
|
|
401
|
+
}, null, 40, St),
|
|
402
|
+
e.search.query ? (w(), y("span", Ft, P(n(e.messages.matchInfo, e.search.matchIndex + 1, e.search.matchCount)), 1)) : B("", !0),
|
|
403
403
|
h("button", {
|
|
404
404
|
class: "mrp-nav",
|
|
405
405
|
type: "button",
|
|
406
406
|
disabled: e.search.matchCount === 0,
|
|
407
|
-
onClick: t[3] || (t[3] = (
|
|
408
|
-
},
|
|
407
|
+
onClick: t[3] || (t[3] = (l) => a.$emit("search-nav", -1))
|
|
408
|
+
}, P(e.messages.prevMatch), 9, It),
|
|
409
409
|
h("button", {
|
|
410
410
|
class: "mrp-nav",
|
|
411
411
|
type: "button",
|
|
412
412
|
disabled: e.search.matchCount === 0,
|
|
413
|
-
onClick: t[4] || (t[4] = (
|
|
414
|
-
},
|
|
413
|
+
onClick: t[4] || (t[4] = (l) => a.$emit("search-nav", 1))
|
|
414
|
+
}, P(e.messages.nextMatch), 9, Bt)
|
|
415
415
|
])) : B("", !0),
|
|
416
416
|
h("button", {
|
|
417
|
-
class:
|
|
417
|
+
class: U(["mrp-nav", { "mrp-active": e.search.visible }]),
|
|
418
418
|
type: "button",
|
|
419
419
|
title: "Ctrl+F",
|
|
420
|
-
onClick: t[5] || (t[5] = (
|
|
420
|
+
onClick: t[5] || (t[5] = (l) => a.$emit("search-toggle"))
|
|
421
421
|
}, " 🔍 ", 2),
|
|
422
422
|
h("button", {
|
|
423
|
-
class:
|
|
423
|
+
class: U(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
|
|
424
424
|
type: "button",
|
|
425
|
-
onClick: t[6] || (t[6] = (
|
|
426
|
-
}, " ▦ " +
|
|
425
|
+
onClick: t[6] || (t[6] = (l) => a.$emit("thumbs-toggle"))
|
|
426
|
+
}, " ▦ " + P(e.messages.thumbnails), 3),
|
|
427
427
|
h("button", {
|
|
428
|
-
class:
|
|
428
|
+
class: U(["mrp-nav", { "mrp-active": e.zoomMode === "fit" }]),
|
|
429
429
|
type: "button",
|
|
430
|
-
onClick: t[7] || (t[7] = (
|
|
431
|
-
},
|
|
430
|
+
onClick: t[7] || (t[7] = (l) => a.$emit("zoom", "fit"))
|
|
431
|
+
}, P(e.messages.fitWidth), 3),
|
|
432
432
|
h("button", {
|
|
433
|
-
class:
|
|
433
|
+
class: U(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === 100 }]),
|
|
434
434
|
type: "button",
|
|
435
|
-
onClick: t[8] || (t[8] = (
|
|
435
|
+
onClick: t[8] || (t[8] = (l) => a.$emit("zoom", 100))
|
|
436
436
|
}, " 100% ", 2),
|
|
437
437
|
h("button", {
|
|
438
|
-
class:
|
|
438
|
+
class: U(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === 150 }]),
|
|
439
439
|
type: "button",
|
|
440
|
-
onClick: t[9] || (t[9] = (
|
|
440
|
+
onClick: t[9] || (t[9] = (l) => a.$emit("zoom", 150))
|
|
441
441
|
}, " 150% ", 2),
|
|
442
|
-
e.showExport ? (
|
|
442
|
+
e.showExport ? (w(), y("button", {
|
|
443
443
|
key: 2,
|
|
444
444
|
class: "mrp-nav",
|
|
445
445
|
type: "button",
|
|
446
|
-
onClick: t[10] || (t[10] = (
|
|
447
|
-
},
|
|
448
|
-
e.showExport ? (
|
|
446
|
+
onClick: t[10] || (t[10] = (l) => a.$emit("export", "html"))
|
|
447
|
+
}, P(e.messages.exportHtml), 1)) : B("", !0),
|
|
448
|
+
e.showExport ? (w(), y("button", {
|
|
449
449
|
key: 3,
|
|
450
450
|
class: "mrp-nav",
|
|
451
451
|
type: "button",
|
|
452
|
-
onClick: t[11] || (t[11] = (
|
|
453
|
-
},
|
|
454
|
-
e.showPrint ? (
|
|
452
|
+
onClick: t[11] || (t[11] = (l) => a.$emit("export", "pdf"))
|
|
453
|
+
}, P(e.messages.exportPdf), 1)) : B("", !0),
|
|
454
|
+
e.showPrint ? (w(), y("button", {
|
|
455
455
|
key: 4,
|
|
456
456
|
class: "mrp-nav",
|
|
457
457
|
type: "button",
|
|
458
|
-
onClick: t[12] || (t[12] = (
|
|
459
|
-
},
|
|
460
|
-
e.showPdfWindow ? (
|
|
458
|
+
onClick: t[12] || (t[12] = (l) => a.$emit("print"))
|
|
459
|
+
}, P(e.messages.print), 1)) : B("", !0),
|
|
460
|
+
e.showPdfWindow ? (w(), y("button", {
|
|
461
461
|
key: 5,
|
|
462
462
|
class: "mrp-nav",
|
|
463
463
|
type: "button",
|
|
464
|
-
onClick: t[13] || (t[13] = (
|
|
465
|
-
},
|
|
464
|
+
onClick: t[13] || (t[13] = (l) => a.$emit("pdf-window"))
|
|
465
|
+
}, P(e.messages.pdfWindow), 1)) : B("", !0)
|
|
466
466
|
]));
|
|
467
467
|
}
|
|
468
468
|
}), Ee = (e, o) => {
|
|
@@ -470,14 +470,14 @@ const Et = { class: "mrp-toolbar" }, $t = { class: "mrp-title" }, Ct = ["disable
|
|
|
470
470
|
for (const [n, a] of o)
|
|
471
471
|
r[n] = a;
|
|
472
472
|
return r;
|
|
473
|
-
},
|
|
473
|
+
}, zt = /* @__PURE__ */ Ee(Lt, [["__scopeId", "data-v-f50c26e8"]]), Wt = { class: "mrp-params" }, Ot = { class: "mrp-params-title" }, Ht = { class: "mrp-params-grid" }, Nt = { class: "mrp-param-label" }, Dt = {
|
|
474
474
|
key: 0,
|
|
475
475
|
class: "mrp-param-star"
|
|
476
|
-
},
|
|
476
|
+
}, qt = ["value", "onChange"], At = {
|
|
477
477
|
value: "",
|
|
478
478
|
disabled: "",
|
|
479
479
|
hidden: ""
|
|
480
|
-
},
|
|
480
|
+
}, Vt = ["value"], Ut = ["type", "placeholder", "value", "onInput"], jt = { class: "mrp-params-actions" }, Kt = /* @__PURE__ */ xe({
|
|
481
481
|
__name: "ReportParamPanel",
|
|
482
482
|
props: {
|
|
483
483
|
defs: {},
|
|
@@ -488,7 +488,7 @@ const Et = { class: "mrp-toolbar" }, $t = { class: "mrp-title" }, Ct = ["disable
|
|
|
488
488
|
emits: ["update:modelValue", "query", "reset"],
|
|
489
489
|
setup(e, { emit: o }) {
|
|
490
490
|
const r = e, n = o, a = k({ ...r.modelValue });
|
|
491
|
-
|
|
491
|
+
V(
|
|
492
492
|
() => r.modelValue,
|
|
493
493
|
(u) => {
|
|
494
494
|
a.value = { ...u };
|
|
@@ -501,62 +501,62 @@ const Et = { class: "mrp-toolbar" }, $t = { class: "mrp-title" }, Ct = ["disable
|
|
|
501
501
|
value: a.value[u.field] ?? ""
|
|
502
502
|
}))
|
|
503
503
|
);
|
|
504
|
-
function
|
|
504
|
+
function l(u, p) {
|
|
505
505
|
a.value = { ...a.value, [u]: p }, n("update:modelValue", { ...a.value });
|
|
506
506
|
}
|
|
507
507
|
function d(u) {
|
|
508
508
|
const p = r.defs.find((c) => c.field === u);
|
|
509
509
|
return r.attempted && p?.required === !0 && !(a.value[u] ?? "").trim();
|
|
510
510
|
}
|
|
511
|
-
return (u, p) => (
|
|
512
|
-
h("span",
|
|
513
|
-
h("div",
|
|
514
|
-
(
|
|
511
|
+
return (u, p) => (w(), y("div", Wt, [
|
|
512
|
+
h("span", Ot, P(e.messages.paramsTitle), 1),
|
|
513
|
+
h("div", Ht, [
|
|
514
|
+
(w(!0), y(ee, null, ie(t.value, (c) => (w(), y("label", {
|
|
515
515
|
key: c.def.field,
|
|
516
|
-
class:
|
|
516
|
+
class: U(["mrp-param", { "mrp-param-missing": d(c.def.field) }])
|
|
517
517
|
}, [
|
|
518
|
-
h("span",
|
|
519
|
-
|
|
520
|
-
c.def.required ? (
|
|
518
|
+
h("span", Nt, [
|
|
519
|
+
ze(P(c.label), 1),
|
|
520
|
+
c.def.required ? (w(), y("i", Dt, "*")) : B("", !0)
|
|
521
521
|
]),
|
|
522
|
-
(c.def.type ?? "text") === "select" ? (
|
|
522
|
+
(c.def.type ?? "text") === "select" ? (w(), y("select", {
|
|
523
523
|
key: 0,
|
|
524
524
|
class: "mrp-param-input",
|
|
525
525
|
value: c.value,
|
|
526
|
-
onChange: (i) =>
|
|
527
|
-
onKeydown: p[0] || (p[0] =
|
|
526
|
+
onChange: (i) => l(c.def.field, i.target.value),
|
|
527
|
+
onKeydown: p[0] || (p[0] = Se((i) => u.$emit("query"), ["enter"]))
|
|
528
528
|
}, [
|
|
529
|
-
h("option",
|
|
530
|
-
(
|
|
529
|
+
h("option", At, P(c.def.placeholder ?? `请选择${c.label}`), 1),
|
|
530
|
+
(w(!0), y(ee, null, ie(c.def.options ?? [], (i) => (w(), y("option", {
|
|
531
531
|
key: i.value,
|
|
532
532
|
value: i.value
|
|
533
|
-
},
|
|
534
|
-
], 40,
|
|
533
|
+
}, P(i.label), 9, Vt))), 128))
|
|
534
|
+
], 40, qt)) : (w(), y("input", {
|
|
535
535
|
key: 1,
|
|
536
536
|
class: "mrp-param-input",
|
|
537
537
|
type: c.def.type === "number" ? "number" : c.def.type === "date" ? "date" : "text",
|
|
538
538
|
placeholder: c.def.placeholder ?? `请输入${c.label}`,
|
|
539
539
|
value: c.value,
|
|
540
|
-
onInput: (i) =>
|
|
541
|
-
onKeydown: p[1] || (p[1] =
|
|
542
|
-
}, null, 40,
|
|
540
|
+
onInput: (i) => l(c.def.field, i.target.value),
|
|
541
|
+
onKeydown: p[1] || (p[1] = Se((i) => u.$emit("query"), ["enter"]))
|
|
542
|
+
}, null, 40, Ut))
|
|
543
543
|
], 2))), 128))
|
|
544
544
|
]),
|
|
545
|
-
h("div",
|
|
545
|
+
h("div", jt, [
|
|
546
546
|
h("button", {
|
|
547
547
|
class: "mrp-nav mrp-param-query",
|
|
548
548
|
type: "button",
|
|
549
549
|
onClick: p[2] || (p[2] = (c) => u.$emit("query"))
|
|
550
|
-
},
|
|
550
|
+
}, P(e.messages.query), 1),
|
|
551
551
|
h("button", {
|
|
552
552
|
class: "mrp-nav",
|
|
553
553
|
type: "button",
|
|
554
554
|
onClick: p[3] || (p[3] = (c) => u.$emit("reset"))
|
|
555
|
-
},
|
|
555
|
+
}, P(e.messages.reset), 1)
|
|
556
556
|
])
|
|
557
557
|
]));
|
|
558
558
|
}
|
|
559
|
-
}),
|
|
559
|
+
}), Gt = /* @__PURE__ */ Ee(Kt, [["__scopeId", "data-v-aafce92d"]]), Yt = {
|
|
560
560
|
title: "报表预览",
|
|
561
561
|
prevPage: "‹ 上一页",
|
|
562
562
|
nextPage: "下一页 ›",
|
|
@@ -579,7 +579,7 @@ const Et = { class: "mrp-toolbar" }, $t = { class: "mrp-title" }, Ct = ["disable
|
|
|
579
579
|
query: "查 询",
|
|
580
580
|
reset: "重 置",
|
|
581
581
|
paramRequired: "请填写{label}"
|
|
582
|
-
},
|
|
582
|
+
}, Zt = {
|
|
583
583
|
shellBg: "#525659",
|
|
584
584
|
shellFg: "#e8e8e8",
|
|
585
585
|
toolbarBg: "#323639",
|
|
@@ -591,13 +591,13 @@ const Et = { class: "mrp-toolbar" }, $t = { class: "mrp-title" }, Ct = ["disable
|
|
|
591
591
|
btnHoverFg: "#ffffff",
|
|
592
592
|
btnActiveBg: "#2d5fb8"
|
|
593
593
|
};
|
|
594
|
-
function
|
|
594
|
+
function bn(e) {
|
|
595
595
|
return e;
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function wn(e) {
|
|
598
598
|
return e;
|
|
599
599
|
}
|
|
600
|
-
const
|
|
600
|
+
const A = {
|
|
601
601
|
showExport: !0,
|
|
602
602
|
showPrint: !0,
|
|
603
603
|
showPdfWindow: !0,
|
|
@@ -605,28 +605,28 @@ const q = {
|
|
|
605
605
|
gapPx: 18,
|
|
606
606
|
pdfFontUrl: "/simhei.ttf",
|
|
607
607
|
logger: console
|
|
608
|
-
},
|
|
608
|
+
}, yn = { warn: () => {
|
|
609
609
|
}, info: () => {
|
|
610
610
|
} };
|
|
611
|
-
function
|
|
611
|
+
function Jt(e, o) {
|
|
612
612
|
const r = o ? e?.presets?.[o] : e?.defaultPreset ? e?.presets?.[e.defaultPreset] : void 0, n = { ...e?.defaults, ...r };
|
|
613
613
|
return {
|
|
614
|
-
showExport: n.showExport ??
|
|
615
|
-
showPrint: n.showPrint ??
|
|
616
|
-
showPdfWindow: n.showPdfWindow ??
|
|
617
|
-
showParams: n.showParams ??
|
|
618
|
-
gapPx: n.gapPx ??
|
|
619
|
-
pdfFontUrl: n.pdfFontUrl ??
|
|
620
|
-
theme: { ...
|
|
621
|
-
messages: { ...
|
|
622
|
-
logger: n.logger ??
|
|
614
|
+
showExport: n.showExport ?? A.showExport,
|
|
615
|
+
showPrint: n.showPrint ?? A.showPrint,
|
|
616
|
+
showPdfWindow: n.showPdfWindow ?? A.showPdfWindow,
|
|
617
|
+
showParams: n.showParams ?? A.showParams,
|
|
618
|
+
gapPx: n.gapPx ?? A.gapPx,
|
|
619
|
+
pdfFontUrl: n.pdfFontUrl ?? A.pdfFontUrl,
|
|
620
|
+
theme: { ...Zt, ...n.theme },
|
|
621
|
+
messages: { ...Yt, ...n.messages },
|
|
622
|
+
logger: n.logger ?? A.logger
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function Xt(e) {
|
|
626
626
|
const o = {};
|
|
627
627
|
return e.shellBg != null && (o["--mrp-shell-bg"] = e.shellBg), e.shellFg != null && (o["--mrp-shell-fg"] = e.shellFg), e.toolbarBg != null && (o["--mrp-toolbar-bg"] = e.toolbarBg), e.toolbarBorder != null && (o["--mrp-toolbar-border"] = e.toolbarBorder), e.toolbarFg != null && (o["--mrp-toolbar-fg"] = e.toolbarFg), e.btnFg != null && (o["--mrp-btn-fg"] = e.btnFg), e.btnBorder != null && (o["--mrp-btn-border"] = e.btnBorder), e.btnHoverBg != null && (o["--mrp-btn-hover-bg"] = e.btnHoverBg), e.btnHoverFg != null && (o["--mrp-btn-hover-fg"] = e.btnHoverFg), e.btnActiveBg != null && (o["--mrp-btn-active-bg"] = e.btnActiveBg), o;
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Pn(e) {
|
|
630
630
|
const o = ue(Pe, null), r = x(() => {
|
|
631
631
|
const n = o?.value ?? null, a = "defaults" in e && "presets" in e ? e : { defaults: e, presets: {} };
|
|
632
632
|
return n ? {
|
|
@@ -635,9 +635,9 @@ function yn(e) {
|
|
|
635
635
|
defaultPreset: a.defaultPreset ?? n.defaultPreset
|
|
636
636
|
} : a;
|
|
637
637
|
});
|
|
638
|
-
|
|
638
|
+
We(Pe, r);
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function Qt() {
|
|
641
641
|
return ue(Pe, x(() => null));
|
|
642
642
|
}
|
|
643
643
|
class le extends Error {
|
|
@@ -645,23 +645,23 @@ class le extends Error {
|
|
|
645
645
|
super(r), this.name = "MachReportError", this.code = o, this.cause = n;
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function _t(e) {
|
|
649
649
|
return e instanceof le ? { code: e.code, cause: e.cause } : { code: "render", cause: e };
|
|
650
650
|
}
|
|
651
|
-
const
|
|
651
|
+
const en = { class: "mrp-main" }, tn = {
|
|
652
652
|
key: 0,
|
|
653
653
|
class: "mrp-state"
|
|
654
|
-
},
|
|
654
|
+
}, nn = {
|
|
655
655
|
key: 1,
|
|
656
656
|
class: "mrp-state mrp-error"
|
|
657
|
-
},
|
|
657
|
+
}, on = {
|
|
658
658
|
key: 2,
|
|
659
659
|
class: "mrp-state"
|
|
660
|
-
},
|
|
660
|
+
}, an = ["data-page"], rn = ["onClick"], sn = ["data-thumb"], ln = { class: "mrp-thumb-no" }, un = { class: "mrp-overlay" }, cn = {
|
|
661
661
|
key: 1,
|
|
662
662
|
class: "mrp-debug",
|
|
663
663
|
"aria-hidden": "true"
|
|
664
|
-
}, re = 96 / 25.4,
|
|
664
|
+
}, re = 96 / 25.4, Be = "mach-report:ui", dn = /* @__PURE__ */ xe({
|
|
665
665
|
__name: "ReportPreview",
|
|
666
666
|
props: {
|
|
667
667
|
tempId: {
|
|
@@ -701,81 +701,81 @@ const _t = { class: "mrp-main" }, en = {
|
|
|
701
701
|
},
|
|
702
702
|
emits: ["loaded", "error"],
|
|
703
703
|
setup(e, { expose: o, emit: r }) {
|
|
704
|
-
|
|
705
|
-
|
|
704
|
+
tt((s) => ({
|
|
705
|
+
dce0aa90: v.value + "px"
|
|
706
706
|
}));
|
|
707
|
-
const n = e, a = r, t =
|
|
707
|
+
const n = e, a = r, t = Le(null), l = k(!1), d = k(""), u = k(1), p = k(null), c = k(null), i = k(null), f = k(!1), m = Et(), v = x(() => Math.max(0, J.value)), C = ue(ct, null), W = ue(dt, null) ?? mt({ fontUrl: "/simhei.ttf" }), N = x(() => ft(n.tempId)), M = x(() => t.value?.pages.length ?? 0), F = Qt(), L = x(() => Jt(F.value, n.preset)), O = x(() => ({
|
|
708
708
|
...L.value.messages,
|
|
709
709
|
...n.messages
|
|
710
|
-
})), te = x(() => n.showExport ?? L.value.showExport),
|
|
711
|
-
function pe(
|
|
712
|
-
const
|
|
713
|
-
for (const E of
|
|
714
|
-
|
|
715
|
-
|
|
710
|
+
})), te = x(() => n.showExport ?? L.value.showExport), D = x(() => n.showPrint ?? L.value.showPrint), j = x(() => n.showPdfWindow ?? L.value.showPdfWindow), J = x(() => n.gapPx ?? L.value.gapPx), ne = x(() => n.showParams ?? L.value.showParams), K = x(() => n.paramDefs ?? []), q = k({}), fe = k(!1);
|
|
711
|
+
function pe(s) {
|
|
712
|
+
const b = {};
|
|
713
|
+
for (const E of s)
|
|
714
|
+
b[E.field] = n.params[E.field] ?? E.defaultValue ?? "";
|
|
715
|
+
q.value = b, fe.value = !1;
|
|
716
716
|
}
|
|
717
|
-
pe(
|
|
718
|
-
const
|
|
717
|
+
pe(K.value), V(K, (s) => pe(s));
|
|
718
|
+
const Ne = x(() => ({
|
|
719
719
|
...n.params,
|
|
720
720
|
...Object.fromEntries(
|
|
721
|
-
Object.entries(
|
|
721
|
+
Object.entries(q.value).filter(([, s]) => s !== "")
|
|
722
722
|
)
|
|
723
723
|
}));
|
|
724
|
-
function
|
|
725
|
-
return
|
|
726
|
-
(
|
|
724
|
+
function De() {
|
|
725
|
+
return K.value.filter(
|
|
726
|
+
(s) => s.required === !0 && !(q.value[s.field] ?? "").trim()
|
|
727
727
|
);
|
|
728
728
|
}
|
|
729
|
-
function
|
|
729
|
+
function qe() {
|
|
730
730
|
fe.value = !0;
|
|
731
|
-
const
|
|
732
|
-
if (
|
|
733
|
-
const
|
|
731
|
+
const s = De();
|
|
732
|
+
if (s.length > 0) {
|
|
733
|
+
const b = s[0].label ?? s[0].field, E = O.value.paramRequired.replace("{label}", b);
|
|
734
734
|
d.value = E, a("error", E, { code: "param" });
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
|
-
|
|
737
|
+
H();
|
|
738
738
|
}
|
|
739
|
-
function
|
|
740
|
-
pe(
|
|
739
|
+
function Ae() {
|
|
740
|
+
pe(K.value);
|
|
741
741
|
}
|
|
742
|
-
const
|
|
742
|
+
const Ve = x(() => ({
|
|
743
743
|
height: n.height,
|
|
744
|
-
...
|
|
745
|
-
})), { zoom: I, zoomMode:
|
|
744
|
+
...Xt(L.value.theme)
|
|
745
|
+
})), { zoom: I, zoomMode: G, applyFitZoom: $e, setZoom: me } = gt(() => ({
|
|
746
746
|
viewport: c.value,
|
|
747
747
|
pageWidthPx: (t.value?.pages[0]?.pageWidthMm ?? 210) * re
|
|
748
|
-
})),
|
|
748
|
+
})), Ue = vt(t, I, {
|
|
749
749
|
pxPerMm: re,
|
|
750
|
-
gapPx:
|
|
751
|
-
}), { contentSize: ve, windowRange: X, visiblePages:
|
|
752
|
-
function ge(
|
|
753
|
-
|
|
750
|
+
gapPx: J.value
|
|
751
|
+
}), { contentSize: ve, windowRange: X, visiblePages: je, makeScrollHandler: Ke, refreshViewport: Ce } = Ue, Ge = Ke(u, M);
|
|
752
|
+
function ge(s) {
|
|
753
|
+
G.value = "raw", I.value = Math.min(3, Math.max(0.3, s));
|
|
754
754
|
}
|
|
755
755
|
function he() {
|
|
756
756
|
t.value = null, u.value = 1, T.reset();
|
|
757
757
|
}
|
|
758
758
|
let oe = 0;
|
|
759
|
-
async function
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
759
|
+
async function H() {
|
|
760
|
+
const s = ++oe, b = n.fetcher ?? C;
|
|
761
|
+
if (N.value.length === 0) {
|
|
762
762
|
d.value = "缺少报表模板 ID", he(), a("error", d.value, { code: "param" });
|
|
763
763
|
return;
|
|
764
764
|
}
|
|
765
|
-
if (!
|
|
765
|
+
if (!b) {
|
|
766
766
|
d.value = "未提供渲染数据源 fetcher", he(), a("error", d.value, { code: "config" });
|
|
767
767
|
return;
|
|
768
768
|
}
|
|
769
|
-
|
|
769
|
+
l.value = !0, d.value = "", he();
|
|
770
770
|
const E = m.start();
|
|
771
771
|
try {
|
|
772
|
-
const $ = await
|
|
773
|
-
tempIds:
|
|
772
|
+
const $ = await b({
|
|
773
|
+
tempIds: N.value,
|
|
774
774
|
furnitureTempId: n.furnitureTempId || void 0,
|
|
775
|
-
params: { ...
|
|
775
|
+
params: { ...Ne.value }
|
|
776
776
|
});
|
|
777
|
-
if (
|
|
778
|
-
const S =
|
|
777
|
+
if (s !== oe) return;
|
|
778
|
+
const S = it($);
|
|
779
779
|
if (!S.ok) {
|
|
780
780
|
const Q = S.errors.slice(0, 3).map((_) => `${_.path}: ${_.message}`).join("; ");
|
|
781
781
|
throw new le(
|
|
@@ -783,286 +783,289 @@ const _t = { class: "mrp-main" }, en = {
|
|
|
783
783
|
`渲染计划校验失败(${S.errors.length} 处): ${Q}`
|
|
784
784
|
);
|
|
785
785
|
}
|
|
786
|
-
S.warnings.length > 0 && L.value.logger.warn("[mach-report] 渲染计划告警:", S.warnings), t.value = $, u.value = 1, m.end(E), c.value && (c.value.scrollTop = 0),
|
|
786
|
+
S.warnings.length > 0 && L.value.logger.warn("[mach-report] 渲染计划告警:", S.warnings), t.value = $, u.value = 1, m.end(E), c.value && (c.value.scrollTop = 0), G.value === "fit" && $e(), a("loaded", $.pages.length);
|
|
787
787
|
} catch ($) {
|
|
788
|
-
if (
|
|
788
|
+
if (s !== oe) return;
|
|
789
789
|
const S = $ instanceof le ? $ : new le(
|
|
790
790
|
"fetch",
|
|
791
791
|
$ instanceof Error ? $.message : "预览加载失败",
|
|
792
792
|
$
|
|
793
793
|
);
|
|
794
|
-
d.value = S.message, a("error", S.message,
|
|
794
|
+
d.value = S.message, a("error", S.message, _t(S));
|
|
795
795
|
} finally {
|
|
796
|
-
|
|
796
|
+
s === oe && (l.value = !1);
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
|
-
function z(
|
|
799
|
+
function z(s) {
|
|
800
800
|
if (M.value <= 0) return;
|
|
801
|
-
const
|
|
802
|
-
u.value =
|
|
801
|
+
const b = Math.max(1, Math.min(M.value, s));
|
|
802
|
+
u.value = b;
|
|
803
803
|
const E = c.value;
|
|
804
804
|
if (!E) return;
|
|
805
805
|
let $ = 0;
|
|
806
|
-
for (let S = 0; S <
|
|
806
|
+
for (let S = 0; S < b - 1; S++)
|
|
807
807
|
$ += (t.value?.pages[S]?.pageHeightMm ?? 0) * re + v.value;
|
|
808
808
|
E.scrollTop = $ * I.value;
|
|
809
809
|
}
|
|
810
|
-
const { print: be, exportAs: we, openPdfWindow: ye, releasePrintFrame:
|
|
810
|
+
const { print: be, exportAs: we, openPdfWindow: ye, releasePrintFrame: Ye } = ht(t, {
|
|
811
811
|
getPdfExporter: () => W,
|
|
812
|
-
onError: (
|
|
812
|
+
onError: (s) => a("error", s, { code: "print" })
|
|
813
813
|
});
|
|
814
|
-
|
|
815
|
-
|
|
814
|
+
function Me(s, b = {}) {
|
|
815
|
+
q.value = { ...q.value, ...s }, b.reload !== !1 && H();
|
|
816
|
+
}
|
|
817
|
+
We(pt, { reload: H, print: be, exportAs: we, openPdfWindow: ye, gotoPage: z, setParams: Me });
|
|
818
|
+
const T = yt({
|
|
816
819
|
plan: t,
|
|
817
820
|
gotoPage: z,
|
|
818
|
-
highlight:
|
|
819
|
-
clearHighlights:
|
|
821
|
+
highlight: wt,
|
|
822
|
+
clearHighlights: bt
|
|
820
823
|
});
|
|
821
|
-
function
|
|
822
|
-
|
|
824
|
+
function Ze(s) {
|
|
825
|
+
s.ctrlKey && (s.preventDefault(), ge(I.value * (s.deltaY < 0 ? 1.1 : 1 / 1.1)));
|
|
823
826
|
}
|
|
824
|
-
function
|
|
825
|
-
if ((
|
|
826
|
-
|
|
827
|
+
function Je(s) {
|
|
828
|
+
if ((s.ctrlKey || s.metaKey) && s.key.toLowerCase() === "f") {
|
|
829
|
+
s.preventDefault(), T.visible.value || T.toggle();
|
|
827
830
|
return;
|
|
828
831
|
}
|
|
829
|
-
switch (
|
|
832
|
+
switch (s.key) {
|
|
830
833
|
case "PageDown":
|
|
831
|
-
|
|
834
|
+
s.preventDefault(), z(u.value + 1);
|
|
832
835
|
break;
|
|
833
836
|
case "PageUp":
|
|
834
|
-
|
|
837
|
+
s.preventDefault(), z(u.value - 1);
|
|
835
838
|
break;
|
|
836
839
|
case "Home":
|
|
837
|
-
|
|
840
|
+
s.preventDefault(), z(1);
|
|
838
841
|
break;
|
|
839
842
|
case "End":
|
|
840
|
-
|
|
843
|
+
s.preventDefault(), z(M.value);
|
|
841
844
|
break;
|
|
842
845
|
case "+":
|
|
843
846
|
case "=":
|
|
844
|
-
|
|
847
|
+
s.preventDefault(), ge(I.value * 1.1);
|
|
845
848
|
break;
|
|
846
849
|
case "-":
|
|
847
|
-
|
|
850
|
+
s.preventDefault(), ge(I.value / 1.1);
|
|
848
851
|
break;
|
|
849
852
|
}
|
|
850
853
|
}
|
|
851
|
-
function
|
|
854
|
+
function Xe() {
|
|
852
855
|
try {
|
|
853
856
|
localStorage.setItem(
|
|
854
|
-
|
|
855
|
-
JSON.stringify({ zoomMode:
|
|
857
|
+
Be,
|
|
858
|
+
JSON.stringify({ zoomMode: G.value === "fit" ? "fit" : Math.round(I.value * 100) })
|
|
856
859
|
);
|
|
857
860
|
} catch {
|
|
858
861
|
}
|
|
859
862
|
}
|
|
860
|
-
|
|
861
|
-
const
|
|
862
|
-
if (!
|
|
863
|
-
const
|
|
864
|
-
if (!
|
|
865
|
-
|
|
866
|
-
const S = Number($.dataset.page ?? 0) - 1, Q =
|
|
863
|
+
V([G, I], Xe), Fe(() => {
|
|
864
|
+
const s = t.value;
|
|
865
|
+
if (!s) return;
|
|
866
|
+
const b = p.value;
|
|
867
|
+
if (!b) return;
|
|
868
|
+
b.querySelectorAll(".mrp-page-holder").forEach(($) => {
|
|
869
|
+
const S = Number($.dataset.page ?? 0) - 1, Q = s.pages[S];
|
|
867
870
|
if (!Q || $.childElementCount > 0) {
|
|
868
871
|
if ($.firstElementChild) {
|
|
869
|
-
const
|
|
870
|
-
T.clear(
|
|
872
|
+
const Te = $.firstElementChild;
|
|
873
|
+
T.clear(Te), T.apply(Te);
|
|
871
874
|
}
|
|
872
875
|
return;
|
|
873
876
|
}
|
|
874
877
|
$.style.width = `${Q.pageWidthMm * re}px`;
|
|
875
|
-
const _ =
|
|
878
|
+
const _ = Oe(Q, 96, {}, document);
|
|
876
879
|
T.apply(_), $.appendChild(_);
|
|
877
880
|
});
|
|
878
|
-
}, { flush: "post" }),
|
|
879
|
-
|
|
880
|
-
T.clear(
|
|
881
|
+
}, { flush: "post" }), V(() => T.query.value, (s) => {
|
|
882
|
+
s || p.value?.querySelectorAll(".mrp-page-holder").forEach((b) => {
|
|
883
|
+
T.clear(b);
|
|
881
884
|
});
|
|
882
885
|
});
|
|
883
|
-
const
|
|
886
|
+
const ke = xt(t, {
|
|
884
887
|
thumbsRoot: i,
|
|
885
888
|
visible: f,
|
|
886
|
-
renderThumbCanvas: (
|
|
889
|
+
renderThumbCanvas: (s) => {
|
|
887
890
|
try {
|
|
888
|
-
const { canvases:
|
|
889
|
-
return
|
|
891
|
+
const { canvases: b } = ut(t.value, { start: s, end: s, dpr: 0.2 });
|
|
892
|
+
return b[0] ?? null;
|
|
890
893
|
} catch {
|
|
891
894
|
return null;
|
|
892
895
|
}
|
|
893
896
|
}
|
|
894
897
|
});
|
|
895
|
-
|
|
896
|
-
|
|
898
|
+
Fe(() => {
|
|
899
|
+
ke.schedule();
|
|
897
900
|
}, { flush: "post" });
|
|
898
|
-
const
|
|
901
|
+
const Qe = x(() => n.debug), { debugStats: Y } = Pt(Qe, {
|
|
899
902
|
plan: t,
|
|
900
903
|
pageCount: M,
|
|
901
904
|
windowRange: X,
|
|
902
905
|
zoom: I,
|
|
903
906
|
loadMs: m.loadMs
|
|
904
907
|
});
|
|
905
|
-
function
|
|
906
|
-
Ce(c.value),
|
|
908
|
+
function Re() {
|
|
909
|
+
Ce(c.value), G.value === "fit" && $e();
|
|
907
910
|
}
|
|
908
|
-
function
|
|
911
|
+
function _e() {
|
|
909
912
|
try {
|
|
910
|
-
const
|
|
911
|
-
|
|
913
|
+
const s = JSON.parse(localStorage.getItem(Be) ?? "{}");
|
|
914
|
+
s.zoomMode === "fit" ? me("fit") : typeof s.zoomMode == "number" && me(s.zoomMode);
|
|
912
915
|
} catch {
|
|
913
916
|
}
|
|
914
917
|
}
|
|
915
|
-
return
|
|
916
|
-
window.addEventListener("resize",
|
|
917
|
-
}),
|
|
918
|
-
window.removeEventListener("resize",
|
|
919
|
-
}),
|
|
918
|
+
return nt(() => {
|
|
919
|
+
window.addEventListener("resize", Re), Ce(c.value), _e(), n.autoLoad && H();
|
|
920
|
+
}), ot(() => {
|
|
921
|
+
window.removeEventListener("resize", Re), ke.destroy(), T.reset(), Ye();
|
|
922
|
+
}), V(
|
|
920
923
|
() => [n.tempId, n.furnitureTempId, JSON.stringify(n.params)],
|
|
921
924
|
() => {
|
|
922
|
-
n.autoLoad &&
|
|
925
|
+
n.autoLoad && H();
|
|
923
926
|
}
|
|
924
|
-
),
|
|
927
|
+
), V(
|
|
925
928
|
() => n.fetcher ?? C,
|
|
926
929
|
() => {
|
|
927
|
-
n.autoLoad &&
|
|
930
|
+
n.autoLoad && H();
|
|
928
931
|
}
|
|
929
|
-
), o({ reload:
|
|
932
|
+
), o({ reload: H, print: be, exportAs: we, openPdfWindow: ye, gotoPage: z, setParams: Me }), (s, b) => (w(), y("div", {
|
|
930
933
|
class: "mach-report-preview",
|
|
931
|
-
style:
|
|
934
|
+
style: Z(Ve.value)
|
|
932
935
|
}, [
|
|
933
|
-
ne.value &&
|
|
936
|
+
ne.value && K.value.length > 0 ? (w(), at(Gt, {
|
|
934
937
|
key: 0,
|
|
935
|
-
defs:
|
|
936
|
-
modelValue:
|
|
937
|
-
"onUpdate:modelValue":
|
|
938
|
+
defs: K.value,
|
|
939
|
+
modelValue: q.value,
|
|
940
|
+
"onUpdate:modelValue": b[0] || (b[0] = (E) => q.value = E),
|
|
938
941
|
messages: O.value,
|
|
939
942
|
attempted: fe.value,
|
|
940
|
-
onQuery:
|
|
941
|
-
onReset:
|
|
943
|
+
onQuery: qe,
|
|
944
|
+
onReset: Ae
|
|
942
945
|
}, null, 8, ["defs", "modelValue", "messages", "attempted"])) : B("", !0),
|
|
943
|
-
|
|
946
|
+
rt(zt, {
|
|
944
947
|
"page-count": M.value,
|
|
945
948
|
"current-page": u.value,
|
|
946
|
-
"zoom-mode": g(
|
|
949
|
+
"zoom-mode": g(G),
|
|
947
950
|
zoom: g(I),
|
|
948
951
|
"show-export": te.value,
|
|
949
|
-
"show-print":
|
|
950
|
-
"show-pdf-window":
|
|
952
|
+
"show-print": D.value,
|
|
953
|
+
"show-pdf-window": j.value,
|
|
951
954
|
messages: O.value,
|
|
952
955
|
search: { visible: g(T).visible.value, query: g(T).query.value, matchIndex: g(T).matchIndex.value, matchCount: g(T).matchCount.value },
|
|
953
956
|
"thumbs-visible": f.value,
|
|
954
957
|
onGoto: z,
|
|
955
958
|
onZoom: g(me),
|
|
956
|
-
onExport:
|
|
959
|
+
onExport: b[1] || (b[1] = (E) => g(we)(E)),
|
|
957
960
|
onPrint: g(be),
|
|
958
961
|
onPdfWindow: g(ye),
|
|
959
962
|
onSearchInput: g(T).onInput,
|
|
960
963
|
onSearchNav: g(T).onNav,
|
|
961
964
|
onSearchToggle: g(T).toggle,
|
|
962
|
-
onThumbsToggle:
|
|
965
|
+
onThumbsToggle: b[2] || (b[2] = (E) => f.value = !f.value)
|
|
963
966
|
}, null, 8, ["page-count", "current-page", "zoom-mode", "zoom", "show-export", "show-print", "show-pdf-window", "messages", "search", "thumbs-visible", "onZoom", "onPrint", "onPdfWindow", "onSearchInput", "onSearchNav", "onSearchToggle"]),
|
|
964
|
-
h("div",
|
|
967
|
+
h("div", en, [
|
|
965
968
|
h("div", {
|
|
966
969
|
ref_key: "viewportRef",
|
|
967
970
|
ref: c,
|
|
968
971
|
class: "mrp-body",
|
|
969
972
|
tabindex: "0",
|
|
970
|
-
onWheel:
|
|
971
|
-
onKeydown:
|
|
972
|
-
onScrollPassive:
|
|
973
|
+
onWheel: Ze,
|
|
974
|
+
onKeydown: Je,
|
|
975
|
+
onScrollPassive: b[3] || (b[3] = (E) => g(Ge)(E.target))
|
|
973
976
|
}, [
|
|
974
|
-
|
|
975
|
-
|
|
977
|
+
l.value ? (w(), y("div", tn, P(O.value.loading), 1)) : d.value ? (w(), y("div", nn, [
|
|
978
|
+
ze(P(d.value) + " ", 1),
|
|
976
979
|
h("button", {
|
|
977
980
|
class: "mrp-retry",
|
|
978
981
|
type: "button",
|
|
979
|
-
onClick:
|
|
980
|
-
},
|
|
981
|
-
])) : !t.value || M.value === 0 ? (
|
|
982
|
+
onClick: H
|
|
983
|
+
}, P(O.value.retry), 1)
|
|
984
|
+
])) : !t.value || M.value === 0 ? (w(), y("div", on, P(O.value.empty), 1)) : (w(), y("div", {
|
|
982
985
|
key: 3,
|
|
983
986
|
class: "mrp-scale",
|
|
984
|
-
style:
|
|
987
|
+
style: Z({ width: `${g(ve).w * g(I)}px`, height: `${g(ve).h * g(I)}px` })
|
|
985
988
|
}, [
|
|
986
989
|
h("div", {
|
|
987
990
|
ref_key: "containerRef",
|
|
988
991
|
ref: p,
|
|
989
992
|
class: "mrp-scale-inner",
|
|
990
|
-
style:
|
|
993
|
+
style: Z({ transform: `scale(${g(I)})`, transformOrigin: "top left", width: `${g(ve).w}px` })
|
|
991
994
|
}, [
|
|
992
|
-
g(X).padTopPx > 0 ? (
|
|
995
|
+
g(X).padTopPx > 0 ? (w(), y("div", {
|
|
993
996
|
key: 0,
|
|
994
997
|
class: "mrp-spacer-top",
|
|
995
|
-
style:
|
|
998
|
+
style: Z({ height: `${g(X).padTopPx}px` }),
|
|
996
999
|
"aria-hidden": "true"
|
|
997
1000
|
}, null, 4)) : B("", !0),
|
|
998
|
-
(
|
|
1001
|
+
(w(!0), y(ee, null, ie(g(je), (E) => (w(), y("div", {
|
|
999
1002
|
key: E.index,
|
|
1000
1003
|
class: "mrp-page-holder",
|
|
1001
1004
|
"data-page": E.index + 1
|
|
1002
|
-
}, null, 8,
|
|
1003
|
-
g(X).padBottomPx > 0 ? (
|
|
1005
|
+
}, null, 8, an))), 128)),
|
|
1006
|
+
g(X).padBottomPx > 0 ? (w(), y("div", {
|
|
1004
1007
|
key: 1,
|
|
1005
1008
|
class: "mrp-spacer-bottom",
|
|
1006
|
-
style:
|
|
1009
|
+
style: Z({ height: `${g(X).padBottomPx}px` }),
|
|
1007
1010
|
"aria-hidden": "true"
|
|
1008
1011
|
}, null, 4)) : B("", !0)
|
|
1009
1012
|
], 4)
|
|
1010
1013
|
], 4))
|
|
1011
1014
|
], 544),
|
|
1012
|
-
f.value && M.value > 0 ? (
|
|
1015
|
+
f.value && M.value > 0 ? (w(), y("aside", {
|
|
1013
1016
|
key: 0,
|
|
1014
1017
|
ref_key: "thumbsRef",
|
|
1015
1018
|
ref: i,
|
|
1016
1019
|
class: "mrp-thumbs"
|
|
1017
1020
|
}, [
|
|
1018
|
-
(
|
|
1021
|
+
(w(!0), y(ee, null, ie(t.value?.pages ?? [], (E, $) => (w(), y("div", {
|
|
1019
1022
|
key: $,
|
|
1020
|
-
class:
|
|
1023
|
+
class: U(["mrp-thumb", { "mrp-thumb-active": $ + 1 === u.value }]),
|
|
1021
1024
|
onClick: (S) => z($ + 1)
|
|
1022
1025
|
}, [
|
|
1023
1026
|
h("div", {
|
|
1024
1027
|
class: "mrp-thumb-box",
|
|
1025
1028
|
"data-thumb": $ + 1,
|
|
1026
|
-
style:
|
|
1027
|
-
}, null, 12,
|
|
1028
|
-
h("span",
|
|
1029
|
-
], 10,
|
|
1029
|
+
style: Z({ height: `${Math.round(E.pageHeightMm / E.pageWidthMm * 116)}px` })
|
|
1030
|
+
}, null, 12, sn),
|
|
1031
|
+
h("span", ln, P($ + 1), 1)
|
|
1032
|
+
], 10, rn))), 128))
|
|
1030
1033
|
], 512)) : B("", !0)
|
|
1031
1034
|
]),
|
|
1032
|
-
h("div",
|
|
1033
|
-
|
|
1035
|
+
h("div", un, [
|
|
1036
|
+
st(s.$slots, "default", {}, void 0, !0)
|
|
1034
1037
|
]),
|
|
1035
|
-
g(
|
|
1036
|
-
|
|
1037
|
-
h("div", null, "pages: " +
|
|
1038
|
-
h("div", null, "zoom: " +
|
|
1039
|
-
h("div", null, "plan: " +
|
|
1038
|
+
g(Y) ? (w(), y("div", cn, [
|
|
1039
|
+
b[4] || (b[4] = h("div", null, "mach-report debug", -1)),
|
|
1040
|
+
h("div", null, "pages: " + P(g(Y).pages) + " | window: [" + P(g(Y).window) + "]", 1),
|
|
1041
|
+
h("div", null, "zoom: " + P(g(Y).zoom) + " | load: " + P(g(Y).loadMs), 1),
|
|
1042
|
+
h("div", null, "plan: " + P(g(Y).planKB) + "KB", 1)
|
|
1040
1043
|
])) : B("", !0)
|
|
1041
1044
|
], 4));
|
|
1042
1045
|
}
|
|
1043
|
-
}),
|
|
1046
|
+
}), fn = /* @__PURE__ */ Ee(dn, [["__scopeId", "data-v-d49e06b6"]]), xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1044
1047
|
__proto__: null,
|
|
1045
|
-
default:
|
|
1048
|
+
default: fn
|
|
1046
1049
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1047
1050
|
export {
|
|
1048
|
-
|
|
1051
|
+
Yt as D,
|
|
1049
1052
|
le as M,
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1053
|
+
Gt as R,
|
|
1054
|
+
yn as S,
|
|
1055
|
+
Zt as a,
|
|
1056
|
+
fn as b,
|
|
1057
|
+
zt as c,
|
|
1055
1058
|
se as d,
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1059
|
+
bn as e,
|
|
1060
|
+
wn as f,
|
|
1061
|
+
Pn as g,
|
|
1062
|
+
_t as h,
|
|
1063
|
+
vt as i,
|
|
1064
|
+
ht as j,
|
|
1065
|
+
gt as k,
|
|
1066
|
+
xn as l,
|
|
1067
|
+
hn as p,
|
|
1068
|
+
Jt as r,
|
|
1069
|
+
Xt as t,
|
|
1070
|
+
Qt as u
|
|
1068
1071
|
};
|