@agile-team/mach-report 0.6.0 → 0.7.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/dist/ReportPreview-CrVeTKu1.cjs +6 -0
- package/dist/ReportPreview-DgsOdO4y.js +559 -0
- package/dist/index.cjs +5 -5
- package/dist/index.js +531 -510
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +4 -4
- package/dist/plugin-Cl-IqCqx.cjs +1 -0
- package/dist/plugin-Dp3kKWiQ.js +92 -0
- package/dist/style.css +1 -1
- package/dist/vue/ReportPreview.d.ts +27 -3
- package/dist/vue/adapters.d.ts +3 -0
- package/dist/vue/async.d.cts +193 -64
- package/dist/vue/async.d.ts +193 -64
- package/dist/vue/controller.d.ts +24 -0
- package/dist/vue/errors.d.ts +16 -0
- package/dist/vue/index.d.cts +2 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/injection-keys.d.ts +2 -0
- package/dist/vue/plugin.d.ts +262 -2
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +41 -32
- package/package.json +1 -1
- package/dist/ReportPreview-DWLjYi_p.js +0 -527
- package/dist/ReportPreview-rBtmbu3W.cjs +0 -6
- package/dist/plugin-BIJxGHZX.cjs +0 -1
- package/dist/plugin-DrV67_VW.js +0 -89
package/dist/plugin-DrV67_VW.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { computed as d } from "vue";
|
|
2
|
-
function h(e) {
|
|
3
|
-
return e == null ? [] : Array.isArray(e) ? e.map(String).filter((r) => r !== "") : String(e).split(",").map((r) => r.trim()).filter((r) => r !== "");
|
|
4
|
-
}
|
|
5
|
-
function y(e) {
|
|
6
|
-
return h(e).join(",");
|
|
7
|
-
}
|
|
8
|
-
class l extends Error {
|
|
9
|
-
constructor(r) {
|
|
10
|
-
super(r), this.name = "PlanLoadError";
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
function m(e = {}) {
|
|
14
|
-
const { baseUrl: r = "", headers: a, credentials: t } = e;
|
|
15
|
-
return async ({ url: n, method: f, params: o }) => {
|
|
16
|
-
const s = o && Object.keys(o).length > 0 ? `?${new URLSearchParams(o)}` : "";
|
|
17
|
-
let c;
|
|
18
|
-
try {
|
|
19
|
-
c = await fetch(`${r}${n}${s}`, {
|
|
20
|
-
method: f.toUpperCase(),
|
|
21
|
-
headers: { Accept: "application/json", ...a },
|
|
22
|
-
credentials: t
|
|
23
|
-
});
|
|
24
|
-
} catch (i) {
|
|
25
|
-
throw new l(
|
|
26
|
-
`请求失败(${n}): ${i instanceof Error ? i.message : String(i)}`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
if (!c.ok)
|
|
30
|
-
throw new l(`HTTP ${c.status} ${n}`);
|
|
31
|
-
return c.json();
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function p(e) {
|
|
35
|
-
const { request: r, baseUrl: a = "" } = e;
|
|
36
|
-
return async ({ tempIds: t, furnitureTempId: n, params: f }) => {
|
|
37
|
-
if (t.length === 0) throw new l("缺少报表模板 ID");
|
|
38
|
-
const o = { tempId: t.join(",") };
|
|
39
|
-
n && (o.furnitureTempId = n);
|
|
40
|
-
for (const [i, u] of Object.entries(f || {}))
|
|
41
|
-
i && u != null && u !== "" && (o[i] = String(u));
|
|
42
|
-
const s = await r({
|
|
43
|
-
url: `${a}/report/codePrintReport/gridPlan`,
|
|
44
|
-
method: "get",
|
|
45
|
-
params: o
|
|
46
|
-
});
|
|
47
|
-
if (s && s.code != null && s.code !== 200)
|
|
48
|
-
throw new l(String(s.message || "预览加载失败"));
|
|
49
|
-
const c = s?.data?.pages;
|
|
50
|
-
return {
|
|
51
|
-
schemaVersion: "jh4j-compatible",
|
|
52
|
-
pages: Array.isArray(c) ? c : []
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function g(e = { fontUrl: "/simhei.ttf" }) {
|
|
57
|
-
let r = null;
|
|
58
|
-
return async (a) => {
|
|
59
|
-
r || (r = await import("@agile-team/mach-report/pdf"));
|
|
60
|
-
const t = e.fontUrl ? await r.loadFontWithCache(e.fontUrl) : null, { bytes: n } = await r.renderPlanToPdf(a, t ? { customFontBytes: t } : {});
|
|
61
|
-
return n;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
const P = "mach-report/fetcher", E = "mach-report/pdf-exporter", U = "mach-report/config", R = {
|
|
65
|
-
install(e, r = {}) {
|
|
66
|
-
const a = r.fetcher ?? p({
|
|
67
|
-
request: r.request ?? m({ baseUrl: r.baseUrl }),
|
|
68
|
-
baseUrl: r.baseUrl
|
|
69
|
-
});
|
|
70
|
-
e.provide(P, a);
|
|
71
|
-
const t = r.pdfFontUrl ?? r.config?.defaults?.pdfFontUrl ?? "/simhei.ttf";
|
|
72
|
-
e.provide(
|
|
73
|
-
E,
|
|
74
|
-
r.pdfExporter ?? g({ fontUrl: t })
|
|
75
|
-
), e.provide(U, d(() => r.config ?? null));
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
export {
|
|
79
|
-
U as M,
|
|
80
|
-
l as P,
|
|
81
|
-
P as a,
|
|
82
|
-
E as b,
|
|
83
|
-
g as c,
|
|
84
|
-
m as d,
|
|
85
|
-
p as e,
|
|
86
|
-
y as j,
|
|
87
|
-
R as m,
|
|
88
|
-
h as n
|
|
89
|
-
};
|