@agile-team/mach-report 0.6.0 → 0.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/dist/ReportPreview-BQE0C_37.cjs +6 -0
- package/dist/ReportPreview-D8X75aLV.js +825 -0
- package/dist/format.d.ts +35 -0
- package/dist/grid-geometry-BXpOxznT.cjs +1 -0
- package/dist/grid-geometry-Bs8QXz1X.js +65 -0
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +811 -606
- package/dist/layout/paginate.d.ts +29 -0
- package/dist/pdf.cjs +46 -46
- package/dist/pdf.js +12 -11
- package/dist/plugin-7W2Zy3Xc.cjs +1 -0
- package/dist/plugin-Bc6Px9Lq.js +92 -0
- package/dist/style-6ihHKVCM.js +192 -0
- package/dist/style-Xq08-IsV.cjs +3 -0
- package/dist/style.css +1 -1
- package/dist/vue/ReportPreview.d.ts +40 -3
- package/dist/vue/ReportToolbar.d.ts +15 -0
- package/dist/vue/adapters.d.ts +3 -0
- package/dist/vue/async.d.cts +209 -64
- package/dist/vue/async.d.ts +209 -64
- package/dist/vue/composables/useHighlight.d.ts +8 -0
- package/dist/vue/composables/usePrintExport.d.ts +7 -0
- package/dist/vue/config.d.ts +9 -0
- 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 +278 -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 +39 -29
- package/dist/xlsx/render-xlsx.d.ts +20 -0
- package/dist/xlsx.cjs +30 -0
- package/dist/xlsx.d.cts +5 -0
- package/dist/xlsx.d.ts +5 -0
- package/dist/xlsx.js +22647 -0
- package/package.json +13 -2
- 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/style-B3vxGDZd.cjs +0 -3
- package/dist/style-B7Xfo5I-.js +0 -255
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
|
-
};
|
package/dist/style-B3vxGDZd.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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;
|
package/dist/style-B7Xfo5I-.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
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
|
-
};
|