@agile-team/mach-report 0.5.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/_commonjsHelpers-DKOUU3wS.cjs +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/builder/template-builder.d.ts +53 -0
- package/dist/compat/jh4j-template.d.ts +12 -0
- package/dist/defaults.d.ts +27 -0
- package/dist/index.cjs +6 -1663
- package/dist/index.d.cts +13 -344
- package/dist/index.d.ts +13 -344
- package/dist/index.js +744 -1415
- package/dist/layout/paginate.d.ts +51 -0
- package/dist/layout/textwrap.d.ts +36 -0
- package/dist/manager/api.d.ts +45 -0
- package/dist/manager/index.d.ts +2 -0
- package/dist/manager/types.d.ts +50 -0
- package/dist/manager.cjs +1 -122
- package/dist/manager.d.cts +5 -97
- package/dist/manager.d.ts +5 -97
- package/dist/manager.js +66 -81
- package/dist/pdf/font-loader.d.ts +5 -0
- package/dist/pdf/index.d.ts +2 -0
- package/dist/pdf/render-pdf.d.ts +25 -0
- package/dist/pdf.cjs +84 -52530
- package/dist/pdf.d.cts +4 -31
- package/dist/pdf.d.ts +4 -31
- package/dist/pdf.js +22843 -39218
- package/dist/plugin-Cl-IqCqx.cjs +1 -0
- package/dist/plugin-Dp3kKWiQ.js +92 -0
- package/dist/render/canvas.d.ts +61 -0
- package/dist/render/dom.d.ts +10 -0
- package/dist/render/grid-geometry.d.ts +41 -0
- package/dist/render/style.d.ts +33 -0
- package/dist/render/window.d.ts +23 -0
- package/dist/schema/render-plan.d.ts +96 -0
- package/dist/schema/validate.d.ts +15 -0
- package/dist/sql/ast-check.d.ts +14 -0
- package/dist/sql/compile.d.ts +31 -0
- package/dist/sql/expr.d.ts +21 -0
- package/dist/sql/index.d.ts +4 -0
- package/dist/sql/tokenizer.d.ts +25 -0
- package/dist/sql.cjs +68 -45207
- package/dist/sql.d.cts +3 -93
- package/dist/sql.d.ts +3 -93
- package/dist/sql.js +37213 -41613
- package/dist/style-B3vxGDZd.cjs +3 -0
- package/dist/style-B7Xfo5I-.js +255 -0
- package/dist/style.css +1 -0
- package/dist/units.d.ts +11 -0
- package/dist/vue/ReportPreview.d.ts +165 -0
- package/dist/vue/ReportToolbar.d.ts +25 -0
- package/dist/vue/adapters.d.ts +40 -0
- package/dist/vue/async.d.cts +275 -0
- package/dist/vue/async.d.ts +275 -0
- package/dist/vue/composables/usePageWindow.d.ts +28 -0
- package/dist/vue/composables/usePrintExport.d.ts +19 -0
- package/dist/vue/composables/useZoom.d.ts +15 -0
- package/dist/vue/config.d.ts +79 -0
- package/dist/vue/controller.d.ts +24 -0
- package/dist/vue/errors.d.ts +16 -0
- package/dist/vue/index.d.cts +13 -0
- package/dist/vue/index.d.ts +13 -0
- package/dist/vue/injection-keys.d.ts +14 -0
- package/dist/vue/local-adapter.d.ts +12 -0
- package/dist/vue/pdf-exporter.d.ts +13 -0
- package/dist/vue/plugin.d.ts +294 -0
- package/dist/vue-async.cjs +1 -0
- package/dist/vue-async.js +17 -0
- package/dist/vue.cjs +1 -0
- package/dist/vue.js +53 -0
- package/package.json +44 -6
- package/dist/textwrap-DWzM7pt1.d.cts +0 -135
- package/dist/textwrap-DWzM7pt1.d.ts +0 -135
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";const D="#333333",N="#000000",F="1.0.0-mach",y="mach-local",V="jh4j-compatible";function C(t=96){return t/25.4}function j(t,e=96){return(t||0)*C(e)}function $(t,e=96){return t/C(e)}function k(t,e=96){return t*e/72}function W(t,e){const i=10**e;return Math.round(t*i)/i}const G={a3:{widthMm:297,heightMm:420},a4:{widthMm:210,heightMm:297},a5:{widthMm:148,heightMm:210},b4:{widthMm:250,heightMm:353},b5:{widthMm:176,heightMm:250}},v=F;function J(t){if(t&&t.code!=null&&t.code!==200)throw new Error(String(t.message||"渲染计划加载失败"));const e=t?.data?.pages;return{schemaVersion:v,pages:Array.isArray(e)?e:[]}}function K(t){return(t.kind==="image"||t.kind==="barcode"||t.kind==="qrcode"||t.kind==="chart")&&!!t.imageData}function Z(t){return t.kind==="text"&&Array.isArray(t.richParagraphs)&&t.richParagraphs.length>0}const b=/[\u3000-\u9fff\uff00-\uffef]/,M=new Uint8Array(128);{for(const t of"iljtf.,:;'`|!()[]")M[t.charCodeAt(0)]=1;for(const t of"mwMW@")M[t.charCodeAt(0)]=2;for(let t=48;t<=57;t++)M[t]=3;for(let t=65;t<=90;t++)M[t]=4;M[32]=5}const X=[.54,.26,.95,.59,.67,.3];function z(t){const e=t.charCodeAt(0);return e<128?X[M[e]]:b.test(t)?1:/[A-Z]/.test(t)?.67:.54}const T={measureMm(t,e){const{fontSizePt:i,bold:s=!1,letterSpacingPt:f=0}=e,o=25.4/72;let a=0;for(const r of t)a+=z(r);return s&&(a*=1.04),(a*i+f*t.length)*o}};function q(){return T}function Q(t,e){return T.measureMm(t,e)}function Y(t){let e;return{measureMm(i,s){if(e===void 0&&(e=t()),!e)return T.measureMm(i,s);const f=s.fontSizePt*96/72;return e.font=`${s.bold?"bold ":""}${f}px sans-serif`,e.measureText(i).width*25.4/96}}}function tt(t,e,i){const s=[];let f="",o=0;const a=()=>{f&&(s.push({text:f,widthMm:o,cjk:!1}),f="",o=0)};for(const r of t){if(r===`
|
|
2
|
+
`){a(),s.push({text:`
|
|
3
|
+
`,widthMm:0,cjk:!1,br:!0});continue}if(r===" "){a(),s.push({text:r,widthMm:i.measureMm(r,e),cjk:!1,space:!0});continue}if(b.test(r)){a(),s.push({text:r,widthMm:i.measureMm(r,e),cjk:!0});continue}f+=r,o+=i.measureMm(r,e)}return a(),s}function et(t,e,i,s=T){if(!t)return[""];const f=[];let o="",a=0;const r=()=>{f.push(o),o="",a=0};for(const h of tt(t,i,s)){if(h.br){r();continue}if(a+h.widthMm<=e){o+=h.text,a+=h.widthMm;continue}if(h.space){r();continue}if(h.cjk){o.length>0&&r(),o=h.text,a=h.widthMm;continue}if(o.length>0&&r(),h.widthMm<=e){o=h.text,a=h.widthMm;continue}for(const _ of h.text){const E=s.measureMm(_,i);a+E>e&&o.length>0&&r(),o+=_,a+=E}}return r(),f}function O(t,e){const i=t.length;if(i===0)return[];const s=t.reduce((r,h)=>r+h,0),f=s>0&&e>0?e/s:1,o=[];let a=0;for(let r=0;r<i;r++){const h=Math.max(0,t[r]*f);o.push({pos:a,size:h}),a+=h}return o}function nt(t,e,i){const s=t.cells??[],f=Math.max(s.length,1),o=t.colWidthsMm?.length??Math.max(1,...s.map(n=>Array.isArray(n)?n.length:0)),a=t.colWidthsMm?.length?O(t.colWidthsMm,e):Array.from({length:o},(n,c)=>({pos:e*c/o,size:e/o})),r=n=>n<=0?0:n>=o?a[a.length-1].pos+a[a.length-1].size:a[n].pos,h=t.rowHeightsMm?.length?O(t.rowHeightsMm,i):Array.from({length:f},(n,c)=>({pos:i*c/f,size:i/f})),_=n=>n<=0?0:n>=f?h[h.length-1].pos+h[h.length-1].size:h[n].pos,E=new Set,g=(n,c)=>`${n}:${c}`,w=[],R=new Set,x=new Set,L=(n,c)=>`v${n}:${c}`,I=(n,c)=>`h${n}:${c}`;s.forEach((n,c)=>{if(!Array.isArray(n))return;let u=0;for(const m of n){for(;u<o&&E.has(g(c,u));)u++;if(u>=o)break;const B=Math.max(1,Math.min(m?.colSpan??1,o-u)),U=Math.max(1,m?.rowSpan??1),P=Math.min(f,c+U),S=Math.min(o,u+B);for(let l=c;l<P;l++)for(let d=u;d<S;d++)E.add(g(l,d));for(let l=u+1;l<S;l++)for(let d=c;d<P;d++)R.add(L(l,d));for(let l=c+1;l<P;l++)for(let d=u;d<S;d++)x.add(I(l,d));const p=r(u),H=_(c);w.push({ri:c,ci:u,cell:m??{},xMm:p,yMm:H,widthMm:r(S)-p,heightMm:_(P)-H}),u=S}});const A=[];for(let n=1;n<o;n++){let c=-1;for(let u=0;u<=f;u++){const m=u<f&&!R.has(L(n,u));m&&c<0&&(c=u),!m&&c>=0&&(A.push({kind:"v",pos:r(n),from:_(c),to:_(u)}),c=-1)}}for(let n=1;n<f;n++){let c=-1;for(let u=0;u<=o;u++){const m=u<o&&!x.has(I(n,u));m&&c<0&&(c=u),!m&&c>=0&&(A.push({kind:"h",pos:_(n),from:r(c),to:r(u)}),c=-1)}}return{columns:a,rows:h,cells:w,edges:A}}function ot(t,e=96,i=10.5){if(t?.fontSizePx!=null)return{fontSizePt:t.fontSizePx*72/e,fontSizePx:t.fontSizePx};const s=t?.fontSize??i;return{fontSizePt:s,fontSizePx:k(s,e)}}function rt(t,e=D){return{color:t?.borderColor??t?.lineColor??e,widthPt:t?.lineWidthPt??.75}}function ct(t,e=N){return t?.color??e}function st(t){return t?.lineHeight??1.35}function it(t){const e=t?.borderTop!==!1,i=t?.borderRight!==!1,s=t?.borderBottom!==!1,f=t?.borderLeft!==!1;return{top:e,right:i,bottom:s,left:f,inner:e||i||s||f}}exports.CSS_DPI=96;exports.DEFAULT_BORDER_PT=.75;exports.DEFAULT_FONT_PT=10.5;exports.DEFAULT_STROKE_COLOR=D;exports.DEFAULT_TEXT_COLOR=N;exports.LINE_HEIGHT=1.35;exports.MM_PER_INCH=25.4;exports.PAPER_SIZES=G;exports.RENDER_PLAN_SCHEMA_VERSION=v;exports.SCHEMA_VERSION_JH4J=V;exports.SCHEMA_VERSION_LOCAL=y;exports.SCHEMA_VERSION_MACH=F;exports.charWidthEm=z;exports.createCanvasMeasurer=Y;exports.createHeuristicMeasurer=q;exports.heuristicMeasurer=T;exports.isImageBackedComponent=K;exports.isRichText=Z;exports.measureTextMm=Q;exports.mmToPx=j;exports.mmToPxFactor=C;exports.ptToPx=k;exports.pxToMm=$;exports.resolveBoxBorders=it;exports.resolveFontSize=ot;exports.resolveGridLayout=nt;exports.resolveLineHeight=st;exports.resolveStroke=rt;exports.resolveTextColor=ct;exports.round=W;exports.toRenderPlan=J;exports.wrapText=et;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
const U = 1.35, W = 10.5, V = 0.75, N = "#333333", O = "#000000", v = "1.0.0-mach", K = "mach-local", G = "jh4j-compatible", J = 25.4, q = 96;
|
|
2
|
+
function b(t = 96) {
|
|
3
|
+
return t / 25.4;
|
|
4
|
+
}
|
|
5
|
+
function Z(t, n = 96) {
|
|
6
|
+
return (t || 0) * b(n);
|
|
7
|
+
}
|
|
8
|
+
function X(t, n = 96) {
|
|
9
|
+
return t / b(n);
|
|
10
|
+
}
|
|
11
|
+
function F(t, n = 96) {
|
|
12
|
+
return t * n / 72;
|
|
13
|
+
}
|
|
14
|
+
function Q(t, n) {
|
|
15
|
+
const a = 10 ** n;
|
|
16
|
+
return Math.round(t * a) / a;
|
|
17
|
+
}
|
|
18
|
+
const Y = {
|
|
19
|
+
a3: { widthMm: 297, heightMm: 420 },
|
|
20
|
+
a4: { widthMm: 210, heightMm: 297 },
|
|
21
|
+
a5: { widthMm: 148, heightMm: 210 },
|
|
22
|
+
b4: { widthMm: 250, heightMm: 353 },
|
|
23
|
+
b5: { widthMm: 176, heightMm: 250 }
|
|
24
|
+
}, j = v;
|
|
25
|
+
function tt(t) {
|
|
26
|
+
if (t && t.code != null && t.code !== 200)
|
|
27
|
+
throw new Error(String(t.message || "渲染计划加载失败"));
|
|
28
|
+
const n = t?.data?.pages;
|
|
29
|
+
return {
|
|
30
|
+
schemaVersion: j,
|
|
31
|
+
pages: Array.isArray(n) ? n : []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function nt(t) {
|
|
35
|
+
return (t.kind === "image" || t.kind === "barcode" || t.kind === "qrcode" || t.kind === "chart") && !!t.imageData;
|
|
36
|
+
}
|
|
37
|
+
function et(t) {
|
|
38
|
+
return t.kind === "text" && Array.isArray(t.richParagraphs) && t.richParagraphs.length > 0;
|
|
39
|
+
}
|
|
40
|
+
const D = /[\u3000-\u9fff\uff00-\uffef]/, S = new Uint8Array(128);
|
|
41
|
+
{
|
|
42
|
+
for (const t of "iljtf.,:;'`|!()[]") S[t.charCodeAt(0)] = 1;
|
|
43
|
+
for (const t of "mwMW@") S[t.charCodeAt(0)] = 2;
|
|
44
|
+
for (let t = 48; t <= 57; t++) S[t] = 3;
|
|
45
|
+
for (let t = 65; t <= 90; t++) S[t] = 4;
|
|
46
|
+
S[32] = 5;
|
|
47
|
+
}
|
|
48
|
+
const y = [0.54, 0.26, 0.95, 0.59, 0.67, 0.3];
|
|
49
|
+
function B(t) {
|
|
50
|
+
const n = t.charCodeAt(0);
|
|
51
|
+
return n < 128 ? y[S[n]] : D.test(t) ? 1 : /[A-Z]/.test(t) ? 0.67 : 0.54;
|
|
52
|
+
}
|
|
53
|
+
const P = {
|
|
54
|
+
measureMm(t, n) {
|
|
55
|
+
const { fontSizePt: a, bold: c = !1, letterSpacingPt: u = 0 } = n, o = 25.4 / 72;
|
|
56
|
+
let i = 0;
|
|
57
|
+
for (const r of t)
|
|
58
|
+
i += B(r);
|
|
59
|
+
return c && (i *= 1.04), (i * a + u * t.length) * o;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function ot() {
|
|
63
|
+
return P;
|
|
64
|
+
}
|
|
65
|
+
function rt(t, n) {
|
|
66
|
+
return P.measureMm(t, n);
|
|
67
|
+
}
|
|
68
|
+
function st(t) {
|
|
69
|
+
let n;
|
|
70
|
+
return {
|
|
71
|
+
measureMm(a, c) {
|
|
72
|
+
if (n === void 0 && (n = t()), !n) return P.measureMm(a, c);
|
|
73
|
+
const u = c.fontSizePt * 96 / 72;
|
|
74
|
+
return n.font = `${c.bold ? "bold " : ""}${u}px sans-serif`, n.measureText(a).width * 25.4 / 96;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function $(t, n, a) {
|
|
79
|
+
const c = [];
|
|
80
|
+
let u = "", o = 0;
|
|
81
|
+
const i = () => {
|
|
82
|
+
u && (c.push({ text: u, widthMm: o, cjk: !1 }), u = "", o = 0);
|
|
83
|
+
};
|
|
84
|
+
for (const r of t) {
|
|
85
|
+
if (r === `
|
|
86
|
+
`) {
|
|
87
|
+
i(), c.push({ text: `
|
|
88
|
+
`, widthMm: 0, cjk: !1, br: !0 });
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (r === " ") {
|
|
92
|
+
i(), c.push({ text: r, widthMm: a.measureMm(r, n), cjk: !1, space: !0 });
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (D.test(r)) {
|
|
96
|
+
i(), c.push({ text: r, widthMm: a.measureMm(r, n), cjk: !0 });
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
u += r, o += a.measureMm(r, n);
|
|
100
|
+
}
|
|
101
|
+
return i(), c;
|
|
102
|
+
}
|
|
103
|
+
function ct(t, n, a, c = P) {
|
|
104
|
+
if (!t) return [""];
|
|
105
|
+
const u = [];
|
|
106
|
+
let o = "", i = 0;
|
|
107
|
+
const r = () => {
|
|
108
|
+
u.push(o), o = "", i = 0;
|
|
109
|
+
};
|
|
110
|
+
for (const h of $(t, a, c)) {
|
|
111
|
+
if (h.br) {
|
|
112
|
+
r();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (i + h.widthMm <= n) {
|
|
116
|
+
o += h.text, i += h.widthMm;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (h.space) {
|
|
120
|
+
r();
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (h.cjk) {
|
|
124
|
+
o.length > 0 && r(), o = h.text, i = h.widthMm;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (o.length > 0 && r(), h.widthMm <= n) {
|
|
128
|
+
o = h.text, i = h.widthMm;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
for (const M of h.text) {
|
|
132
|
+
const w = c.measureMm(M, a);
|
|
133
|
+
i + w > n && o.length > 0 && r(), o += M, i += w;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return r(), u;
|
|
137
|
+
}
|
|
138
|
+
function k(t, n) {
|
|
139
|
+
const a = t.length;
|
|
140
|
+
if (a === 0) return [];
|
|
141
|
+
const c = t.reduce((r, h) => r + h, 0), u = c > 0 && n > 0 ? n / c : 1, o = [];
|
|
142
|
+
let i = 0;
|
|
143
|
+
for (let r = 0; r < a; r++) {
|
|
144
|
+
const h = Math.max(0, t[r] * u);
|
|
145
|
+
o.push({ pos: i, size: h }), i += h;
|
|
146
|
+
}
|
|
147
|
+
return o;
|
|
148
|
+
}
|
|
149
|
+
function at(t, n, a) {
|
|
150
|
+
const c = t.cells ?? [], u = Math.max(c.length, 1), o = t.colWidthsMm?.length ?? Math.max(1, ...c.map((e) => Array.isArray(e) ? e.length : 0)), i = t.colWidthsMm?.length ? k(t.colWidthsMm, n) : Array.from({ length: o }, (e, s) => ({
|
|
151
|
+
pos: n * s / o,
|
|
152
|
+
size: n / o
|
|
153
|
+
})), r = (e) => e <= 0 ? 0 : e >= o ? i[i.length - 1].pos + i[i.length - 1].size : i[e].pos, h = t.rowHeightsMm?.length ? k(t.rowHeightsMm, a) : Array.from({ length: u }, (e, s) => ({
|
|
154
|
+
pos: a * s / u,
|
|
155
|
+
size: a / u
|
|
156
|
+
})), M = (e) => e <= 0 ? 0 : e >= u ? h[h.length - 1].pos + h[h.length - 1].size : h[e].pos, w = /* @__PURE__ */ new Set(), A = (e, s) => `${e}:${s}`, T = [], x = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), C = (e, s) => `v${e}:${s}`, R = (e, s) => `h${e}:${s}`;
|
|
157
|
+
c.forEach((e, s) => {
|
|
158
|
+
if (!Array.isArray(e)) return;
|
|
159
|
+
let f = 0;
|
|
160
|
+
for (const m of e) {
|
|
161
|
+
for (; f < o && w.has(A(s, f)); ) f++;
|
|
162
|
+
if (f >= o) break;
|
|
163
|
+
const H = Math.max(1, Math.min(m?.colSpan ?? 1, o - f)), z = Math.max(1, m?.rowSpan ?? 1), _ = Math.min(u, s + z), g = Math.min(o, f + H);
|
|
164
|
+
for (let l = s; l < _; l++)
|
|
165
|
+
for (let d = f; d < g; d++)
|
|
166
|
+
w.add(A(l, d));
|
|
167
|
+
for (let l = f + 1; l < g; l++)
|
|
168
|
+
for (let d = s; d < _; d++) x.add(C(l, d));
|
|
169
|
+
for (let l = s + 1; l < _; l++)
|
|
170
|
+
for (let d = f; d < g; d++) p.add(R(l, d));
|
|
171
|
+
const L = r(f), I = M(s);
|
|
172
|
+
T.push({
|
|
173
|
+
ri: s,
|
|
174
|
+
ci: f,
|
|
175
|
+
cell: m ?? {},
|
|
176
|
+
xMm: L,
|
|
177
|
+
yMm: I,
|
|
178
|
+
widthMm: r(g) - L,
|
|
179
|
+
heightMm: M(_) - I
|
|
180
|
+
}), f = g;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
const E = [];
|
|
184
|
+
for (let e = 1; e < o; e++) {
|
|
185
|
+
let s = -1;
|
|
186
|
+
for (let f = 0; f <= u; f++) {
|
|
187
|
+
const m = f < u && !x.has(C(e, f));
|
|
188
|
+
m && s < 0 && (s = f), !m && s >= 0 && (E.push({ kind: "v", pos: r(e), from: M(s), to: M(f) }), s = -1);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
for (let e = 1; e < u; e++) {
|
|
192
|
+
let s = -1;
|
|
193
|
+
for (let f = 0; f <= o; f++) {
|
|
194
|
+
const m = f < o && !p.has(R(e, f));
|
|
195
|
+
m && s < 0 && (s = f), !m && s >= 0 && (E.push({ kind: "h", pos: M(e), from: r(s), to: r(f) }), s = -1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return { columns: i, rows: h, cells: T, edges: E };
|
|
199
|
+
}
|
|
200
|
+
function it(t, n = 96, a = 10.5) {
|
|
201
|
+
if (t?.fontSizePx != null)
|
|
202
|
+
return { fontSizePt: t.fontSizePx * 72 / n, fontSizePx: t.fontSizePx };
|
|
203
|
+
const c = t?.fontSize ?? a;
|
|
204
|
+
return { fontSizePt: c, fontSizePx: F(c, n) };
|
|
205
|
+
}
|
|
206
|
+
function ft(t, n = N) {
|
|
207
|
+
return {
|
|
208
|
+
color: t?.borderColor ?? t?.lineColor ?? n,
|
|
209
|
+
widthPt: t?.lineWidthPt ?? 0.75
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function ut(t, n = O) {
|
|
213
|
+
return t?.color ?? n;
|
|
214
|
+
}
|
|
215
|
+
function ht(t) {
|
|
216
|
+
return t?.lineHeight ?? 1.35;
|
|
217
|
+
}
|
|
218
|
+
function lt(t) {
|
|
219
|
+
const n = t?.borderTop !== !1, a = t?.borderRight !== !1, c = t?.borderBottom !== !1, u = t?.borderLeft !== !1;
|
|
220
|
+
return { top: n, right: a, bottom: c, left: u, inner: n || a || c || u };
|
|
221
|
+
}
|
|
222
|
+
export {
|
|
223
|
+
q as C,
|
|
224
|
+
W as D,
|
|
225
|
+
U as L,
|
|
226
|
+
J as M,
|
|
227
|
+
Y as P,
|
|
228
|
+
j as R,
|
|
229
|
+
G as S,
|
|
230
|
+
it as a,
|
|
231
|
+
et as b,
|
|
232
|
+
ft as c,
|
|
233
|
+
lt as d,
|
|
234
|
+
ht as e,
|
|
235
|
+
ut as f,
|
|
236
|
+
at as g,
|
|
237
|
+
P as h,
|
|
238
|
+
nt as i,
|
|
239
|
+
O as j,
|
|
240
|
+
V as k,
|
|
241
|
+
N as l,
|
|
242
|
+
Z as m,
|
|
243
|
+
K as n,
|
|
244
|
+
v as o,
|
|
245
|
+
F as p,
|
|
246
|
+
B as q,
|
|
247
|
+
Q as r,
|
|
248
|
+
st as s,
|
|
249
|
+
ot as t,
|
|
250
|
+
rt as u,
|
|
251
|
+
b as v,
|
|
252
|
+
ct as w,
|
|
253
|
+
X as x,
|
|
254
|
+
tt as y
|
|
255
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mrp-toolbar[data-v-2bfb2c61]{display:flex;align-items:center;gap:8px;padding:6px 12px;background:var(--mrp-toolbar-bg, #323639);border-bottom:1px solid var(--mrp-toolbar-border, #22252a);flex:none}.mrp-title[data-v-2bfb2c61]{font-size:13px;font-weight:600;margin-right:8px;color:var(--mrp-toolbar-fg, #e8e8e8)}.mrp-nav[data-v-2bfb2c61]{background:transparent;color:var(--mrp-btn-fg, #cfcfcf);border:1px solid var(--mrp-btn-border, #4a4d52);border-radius:4px;padding:2px 8px;font-size:12px;cursor:pointer;white-space:nowrap}.mrp-nav[data-v-2bfb2c61]:hover:not(:disabled){background:var(--mrp-btn-hover-bg, #414549);color:var(--mrp-btn-hover-fg, #fff)}.mrp-nav[data-v-2bfb2c61]:disabled{opacity:.4;cursor:not-allowed}.mrp-active[data-v-2bfb2c61]{background:var(--mrp-btn-active-bg, #2d5fb8);border-color:var(--mrp-btn-active-bg, #2d5fb8);color:#fff}.mrp-pageinfo[data-v-2bfb2c61]{font-size:12px;min-width:56px;text-align:center;color:var(--mrp-toolbar-fg, #e8e8e8)}.mrp-spacer[data-v-2bfb2c61]{flex:1}.mach-report-preview[data-v-6e07f84a]{--mrp-shell-bg: #525659;--mrp-shell-fg: #e8e8e8;position:relative;--mrp-toolbar-bg: #323639;--mrp-toolbar-border: #22252a;--mrp-toolbar-fg: #e8e8e8;--mrp-btn-fg: #cfcfcf;--mrp-btn-border: #4a4d52;--mrp-btn-hover-bg: #414549;--mrp-btn-hover-fg: #ffffff;--mrp-btn-active-bg: #2d5fb8;display:flex;flex-direction:column;background:var(--mrp-shell-bg);color:var(--mrp-shell-fg);overflow:hidden}.mrp-body[data-v-6e07f84a]{flex:1;overflow:auto;padding:24px}.mrp-scale[data-v-6e07f84a]{margin:0 auto}.mrp-scale-inner[data-v-6e07f84a]{display:flex;flex-direction:column;align-items:center}.mrp-page-holder[data-v-6e07f84a]{background:#fff;box-shadow:0 2px 8px #00000059;margin-bottom:var(--v8289d092);flex:none}.mrp-state[data-v-6e07f84a]{padding:40px;text-align:center;color:#bfbfbf;font-size:13px}.mrp-overlay[data-v-6e07f84a]{position:absolute;inset:0;pointer-events:none}.mrp-error[data-v-6e07f84a]{color:#ff9d9d}.mrp-retry[data-v-6e07f84a]{margin-left:12px;background:transparent;color:#8fb7ff;border:1px solid #5a7fbf;border-radius:4px;padding:1px 10px;cursor:pointer}
|
package/dist/units.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const MM_PER_INCH = 25.4;
|
|
2
|
+
export declare const CSS_DPI = 96;
|
|
3
|
+
export declare function mmToPxFactor(dpi?: number): number;
|
|
4
|
+
export declare function mmToPx(value: number, dpi?: number): number;
|
|
5
|
+
export declare function pxToMm(value: number, dpi?: number): number;
|
|
6
|
+
export declare function ptToPx(pt: number, dpi?: number): number;
|
|
7
|
+
export declare function round(value: number, digits: number): number;
|
|
8
|
+
export declare const PAPER_SIZES: Record<string, {
|
|
9
|
+
widthMm: number;
|
|
10
|
+
heightMm: number;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { PlanFetcher } from './adapters';
|
|
3
|
+
import { MachReportMessages } from './config';
|
|
4
|
+
declare function reload(): Promise<void>;
|
|
5
|
+
declare function gotoPage(n: number): void;
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: {
|
|
9
|
+
default?(_: {}): any;
|
|
10
|
+
};
|
|
11
|
+
refs: {
|
|
12
|
+
viewportRef: HTMLDivElement;
|
|
13
|
+
containerRef: HTMLDivElement;
|
|
14
|
+
};
|
|
15
|
+
rootEl: HTMLDivElement;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
19
|
+
tempId: {
|
|
20
|
+
type: PropType<string | string[] | null>;
|
|
21
|
+
default: null;
|
|
22
|
+
};
|
|
23
|
+
furnitureTempId: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
params: {
|
|
28
|
+
type: PropType<Record<string, string>>;
|
|
29
|
+
default: () => {};
|
|
30
|
+
};
|
|
31
|
+
height: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
autoLoad: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
/** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
|
|
40
|
+
showExport: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
showPrint: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
showPdfWindow: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
/** 页间距(px);不传走配置中心 */
|
|
53
|
+
gapPx: {
|
|
54
|
+
type: NumberConstructor;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
/** 工具栏/状态文案覆写(不传走配置中心 messages) */
|
|
58
|
+
messages: {
|
|
59
|
+
type: PropType<Partial<MachReportMessages>>;
|
|
60
|
+
default: undefined;
|
|
61
|
+
};
|
|
62
|
+
/** 启用的 preset 名(不传用配置中心 defaultPreset) */
|
|
63
|
+
preset: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
fetcher: {
|
|
68
|
+
type: PropType<PlanFetcher | null>;
|
|
69
|
+
default: null;
|
|
70
|
+
};
|
|
71
|
+
}>, {
|
|
72
|
+
reload: typeof reload;
|
|
73
|
+
print: () => Promise<void>;
|
|
74
|
+
exportAs: (format: string) => void;
|
|
75
|
+
openPdfWindow: () => void;
|
|
76
|
+
gotoPage: typeof gotoPage;
|
|
77
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
78
|
+
error: (message: string, detail?: {
|
|
79
|
+
code: string;
|
|
80
|
+
cause?: unknown;
|
|
81
|
+
} | undefined) => any;
|
|
82
|
+
loaded: (pageCount: number) => any;
|
|
83
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
84
|
+
tempId: {
|
|
85
|
+
type: PropType<string | string[] | null>;
|
|
86
|
+
default: null;
|
|
87
|
+
};
|
|
88
|
+
furnitureTempId: {
|
|
89
|
+
type: StringConstructor;
|
|
90
|
+
default: string;
|
|
91
|
+
};
|
|
92
|
+
params: {
|
|
93
|
+
type: PropType<Record<string, string>>;
|
|
94
|
+
default: () => {};
|
|
95
|
+
};
|
|
96
|
+
height: {
|
|
97
|
+
type: StringConstructor;
|
|
98
|
+
default: string;
|
|
99
|
+
};
|
|
100
|
+
autoLoad: {
|
|
101
|
+
type: BooleanConstructor;
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
104
|
+
/** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
|
|
105
|
+
showExport: {
|
|
106
|
+
type: BooleanConstructor;
|
|
107
|
+
default: undefined;
|
|
108
|
+
};
|
|
109
|
+
showPrint: {
|
|
110
|
+
type: BooleanConstructor;
|
|
111
|
+
default: undefined;
|
|
112
|
+
};
|
|
113
|
+
showPdfWindow: {
|
|
114
|
+
type: BooleanConstructor;
|
|
115
|
+
default: undefined;
|
|
116
|
+
};
|
|
117
|
+
/** 页间距(px);不传走配置中心 */
|
|
118
|
+
gapPx: {
|
|
119
|
+
type: NumberConstructor;
|
|
120
|
+
default: undefined;
|
|
121
|
+
};
|
|
122
|
+
/** 工具栏/状态文案覆写(不传走配置中心 messages) */
|
|
123
|
+
messages: {
|
|
124
|
+
type: PropType<Partial<MachReportMessages>>;
|
|
125
|
+
default: undefined;
|
|
126
|
+
};
|
|
127
|
+
/** 启用的 preset 名(不传用配置中心 defaultPreset) */
|
|
128
|
+
preset: {
|
|
129
|
+
type: StringConstructor;
|
|
130
|
+
default: undefined;
|
|
131
|
+
};
|
|
132
|
+
fetcher: {
|
|
133
|
+
type: PropType<PlanFetcher | null>;
|
|
134
|
+
default: null;
|
|
135
|
+
};
|
|
136
|
+
}>> & Readonly<{
|
|
137
|
+
onError?: ((message: string, detail?: {
|
|
138
|
+
code: string;
|
|
139
|
+
cause?: unknown;
|
|
140
|
+
} | undefined) => any) | undefined;
|
|
141
|
+
onLoaded?: ((pageCount: number) => any) | undefined;
|
|
142
|
+
}>, {
|
|
143
|
+
height: string;
|
|
144
|
+
gapPx: number;
|
|
145
|
+
params: Record<string, string>;
|
|
146
|
+
furnitureTempId: string;
|
|
147
|
+
tempId: string | string[] | null;
|
|
148
|
+
showExport: boolean;
|
|
149
|
+
showPrint: boolean;
|
|
150
|
+
showPdfWindow: boolean;
|
|
151
|
+
messages: Partial<MachReportMessages>;
|
|
152
|
+
autoLoad: boolean;
|
|
153
|
+
preset: string;
|
|
154
|
+
fetcher: PlanFetcher | null;
|
|
155
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
156
|
+
viewportRef: HTMLDivElement;
|
|
157
|
+
containerRef: HTMLDivElement;
|
|
158
|
+
}, HTMLDivElement>;
|
|
159
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
160
|
+
export default _default;
|
|
161
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
162
|
+
new (): {
|
|
163
|
+
$slots: S;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MachReportMessages } from './config';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
pageCount: number;
|
|
4
|
+
currentPage: number;
|
|
5
|
+
zoomMode: "fit" | "raw";
|
|
6
|
+
zoom: number;
|
|
7
|
+
showExport: boolean;
|
|
8
|
+
showPrint: boolean;
|
|
9
|
+
showPdfWindow: boolean;
|
|
10
|
+
messages: MachReportMessages;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
13
|
+
print: () => any;
|
|
14
|
+
zoom: (mode: number | "fit") => any;
|
|
15
|
+
goto: (page: number) => any;
|
|
16
|
+
export: (format: "html" | "pdf") => any;
|
|
17
|
+
"pdf-window": () => any;
|
|
18
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onPrint?: (() => any) | undefined;
|
|
20
|
+
onZoom?: ((mode: number | "fit") => any) | undefined;
|
|
21
|
+
onGoto?: ((page: number) => any) | undefined;
|
|
22
|
+
onExport?: ((format: "html" | "pdf") => any) | undefined;
|
|
23
|
+
"onPdf-window"?: (() => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RenderPlan } from '@agile-team/mach-report';
|
|
2
|
+
export type TempIdInput = string | string[] | null | undefined;
|
|
3
|
+
export interface PlanFetcher {
|
|
4
|
+
(input: {
|
|
5
|
+
tempIds: string[];
|
|
6
|
+
furnitureTempId?: string;
|
|
7
|
+
params: Record<string, string>;
|
|
8
|
+
}): Promise<RenderPlan>;
|
|
9
|
+
}
|
|
10
|
+
export declare function normalizeTempIds(tempId: TempIdInput): string[];
|
|
11
|
+
export declare function joinTempIds(tempId: TempIdInput): string;
|
|
12
|
+
export declare class PlanLoadError extends Error {
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
15
|
+
/** 宿主请求函数签名(axios 风格;createJh4jGridPlanFetcher 消费) */
|
|
16
|
+
export type HostRequest = (config: {
|
|
17
|
+
url: string;
|
|
18
|
+
method: string;
|
|
19
|
+
params?: Record<string, string>;
|
|
20
|
+
}) => Promise<unknown>;
|
|
21
|
+
export interface FetchRequestOptions {
|
|
22
|
+
/** 网关前缀(默认空 = 同源) */
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
/** 附加请求头(如鉴权 token) */
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
credentials?: RequestCredentials;
|
|
27
|
+
/** 超时毫秒(默认 30000;超时抛 PlanLoadError) */
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 零依赖请求适配器:用全局 fetch 实现 HostRequest 签名,
|
|
32
|
+
* 让宿主无需引入 axios 或手写胶水代码即可接上 jh4j 数据面。
|
|
33
|
+
* 内置超时(AbortController)与网络/HTTP 错误语义。
|
|
34
|
+
*/
|
|
35
|
+
export declare function createFetchRequest(options?: FetchRequestOptions): HostRequest;
|
|
36
|
+
export declare function createJh4jGridPlanFetcher(options: {
|
|
37
|
+
request: HostRequest;
|
|
38
|
+
/** 网关前缀,默认空(同域) */
|
|
39
|
+
baseUrl?: string;
|
|
40
|
+
}): PlanFetcher;
|