@agile-team/mach-report 2.25.2 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/dist/ExcelBindingWizard-B418l44t.js +1578 -0
- package/dist/ExcelBindingWizard-C4FGVsY_.cjs +1 -0
- package/dist/{ParamEditor-CGfaweYX.cjs → ParamEditor-BemJE8n8.cjs} +1 -1
- package/dist/{ParamEditor-B7YVD28E.js → ParamEditor-XvMtf_XQ.js} +2 -2
- package/dist/{ReportBatchPanel-BRJt0TXp.cjs → ReportBatchPanel-CbY4fvXD.cjs} +1 -1
- package/dist/{ReportBatchPanel-BTKHtLTW.js → ReportBatchPanel-Ds0R_uXn.js} +37 -37
- package/dist/{ReportLabelStudio-BvK_WBke.cjs → ReportLabelStudio-DuTwN5er.cjs} +1 -1
- package/dist/{ReportLabelStudio-CZwqyO3t.js → ReportLabelStudio-ZFy79eRv.js} +26 -26
- package/dist/ReportParamPanel-Chxu4MTx.cjs +1 -0
- package/dist/{ReportParamPanel-DGXzBzl2.js → ReportParamPanel-Czm3OPo_.js} +216 -205
- package/dist/{ReportPreview-D1ZC5kzz.js → ReportPreview-C9c0Rp7Y.js} +2938 -2875
- package/dist/ReportPreview-CIMR4ERo.cjs +6 -0
- package/dist/{ReportTemplateLibrary-ClwxhnC0.cjs → ReportTemplateLibrary-C6lByc69.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-C7sB0Jay.js → ReportTemplateLibrary-XJVoTDIz.js} +1 -1
- package/dist/{RuleEditor-CsDGFaWz.js → RuleEditor-CeNFPeOc.js} +5 -5
- package/dist/{RuleEditor-D-OdaGdR.cjs → RuleEditor-gggUkEwB.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-DAqR9zQi.cjs → TemplateOutlinePanel-B0e-umq2.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-CXOT7d1r.js → TemplateOutlinePanel-BWN4Y9iz.js} +2 -2
- package/dist/{TemplateReusePanel-Dcfx3Hba.js → TemplateReusePanel-CR-4OHoU.js} +2 -2
- package/dist/{TemplateReusePanel-ygIi-Ajz.cjs → TemplateReusePanel-Cthig1S1.cjs} +1 -1
- package/dist/{TemplateReviewPanel-COU8FqPq.js → TemplateReviewPanel-BkWzyNL4.js} +2 -2
- package/dist/{TemplateReviewPanel-DyGULVxr.cjs → TemplateReviewPanel-D8o2gDaK.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.js +5 -5
- package/dist/artifact-integrity.json +106 -102
- package/dist/{assets-C4MIvzQ4.js → assets-BFTP-0WR.js} +2 -2
- package/dist/{assets-BYdpkTIt.cjs → assets-CZiZhTf2.cjs} +1 -1
- package/dist/{auto-j7mr8Kvc.js → auto-C7udkeAa.js} +20 -19
- package/dist/auto-CXd2E2aZ.cjs +1 -0
- package/dist/capabilities-D8UU2clQ.cjs +1 -0
- package/dist/{capabilities-CN_kSVjO.js → capabilities-g0a2j9Yy.js} +50 -46
- package/dist/{charts-Cjw5AYkg.cjs → charts-D-Vg-ak9.cjs} +1 -1
- package/dist/{charts-CxJZ0XaY.js → charts-D48XCefN.js} +1 -1
- package/dist/computed-BQgBrma-.cjs +1 -0
- package/dist/{computed-f3pOqWLX.js → computed-CH3NYPOW.js} +198 -188
- package/dist/{data-bar-Bfh54sT4.js → data-bar-DjOgTLqu.js} +1 -1
- package/dist/{dataset-DL83majE.js → dataset-B8oTsC6o.js} +69 -66
- package/dist/dataset-D3OsyzG1.cjs +1 -0
- package/dist/designer-COuSUxZ1.cjs +2 -0
- package/dist/designer-CT4mlrr0.js +7997 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +83 -4
- package/dist/designer.d.ts +83 -4
- package/dist/designer.js +4 -4
- package/dist/{diagnostic-collector-gB07PHy2.js → diagnostic-collector-C-JBA016.js} +2 -2
- package/dist/dom-DgWc-DY1.js +452 -0
- package/dist/dom-Fk4NF-gN.cjs +1 -0
- package/dist/{encoding-BWEMdzFG.js → encoding-D480EM2r.js} +2 -2
- package/dist/{encoding-DVea2qIR.cjs → encoding-tWc2Wn89.cjs} +1 -1
- package/dist/execution-result-7sG_mdcD.cjs +1 -0
- package/dist/execution-result-Ba65gieT.js +39 -0
- package/dist/{font-loader-p_SyTvqt.cjs → font-loader-BIxme_9g.cjs} +1 -1
- package/dist/{font-loader-D4NLIKJL.js → font-loader-CHmEwkHl.js} +1 -1
- package/dist/{grid-strokes-DkZEZvcI.js → grid-strokes-DsoICRjZ.js} +1 -1
- package/dist/import-range-BwT86Z3j.cjs +1 -0
- package/dist/import-range-D9p_blcb.js +98 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +25 -25
- package/dist/{json-snapshot-DdzALe8q.js → json-snapshot-BZ0CIQln.js} +1041 -887
- package/dist/json-snapshot-DGFeI30h.cjs +2 -0
- package/dist/{matrix-b6T291xo.js → matrix-CB9TqTEy.js} +1 -1
- package/dist/{matrix-DUYPRL7t.cjs → matrix-CcqYOuq_.cjs} +1 -1
- package/dist/{pdf-DU8HelKd.js → pdf-DTR7fAIr.js} +3596 -3517
- package/dist/{pdf-C060D5UY.cjs → pdf-d9oJ6V0P.cjs} +49 -49
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-D5BRHlne.cjs → plugin-B7Bi-1te.cjs} +1 -1
- package/dist/{plugin-FWhTnjr0.js → plugin-OKDFQFS4.js} +1 -1
- package/dist/{prefill-m01IM1hl.js → prefill-C8fF91JB.js} +3 -3
- package/dist/{prefill-DZymomY6.cjs → prefill-C_Bf_AMo.cjs} +1 -1
- package/dist/{prepared-BHu8bIdj.cjs → prepared-BLhV7vdE.cjs} +1 -1
- package/dist/{prepared-DO5pe6Ed.js → prepared-DhgQ0d-h.js} +7 -7
- package/dist/protocol-CZ-BILne.cjs +1 -0
- package/dist/{protocol-CZddmu2n.js → protocol-DHO91-Jt.js} +3 -3
- package/dist/{record-bindings-Cv7lFiof.js → record-bindings-DBrCu6zO.js} +3 -3
- package/dist/{record-bindings-B7djSjNs.cjs → record-bindings-KEs-DKCS.cjs} +1 -1
- package/dist/region-binding-workflow-FSyIZge8.js +882 -0
- package/dist/region-binding-workflow-ikpY1Kbw.cjs +3 -0
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-BYbIc3eJ.cjs +3 -0
- package/dist/rich-text-layout-BtygMWZC.js +96 -0
- package/dist/runtime-B5HG8poy.cjs +1 -0
- package/dist/runtime-BsvAqz4a.js +204 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +2049 -1889
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +35 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.js +340 -328
- package/dist/style.css +1 -1
- package/dist/{template-catalog-DLu814zA.js → template-catalog-BbrN9dgu.js} +5 -5
- package/dist/{template-catalog-Lil5Ryt-.cjs → template-catalog-DDH-5J57.cjs} +1 -1
- package/dist/{template-fragments-BDxdCuMD.js → template-fragments-CUTE8-_I.js} +3 -3
- package/dist/{template-fragments-DbKdxI1z.cjs → template-fragments-cyAQu7aw.cjs} +1 -1
- package/dist/{template-registry-B-AK1oam.cjs → template-registry-D24Z8aQf.cjs} +1 -1
- package/dist/{template-registry-DeVgwEZj.js → template-registry-PSuLsnyq.js} +4 -4
- package/dist/{template-serialization-CqQY4zDg.cjs → template-serialization-BOUidUlh.cjs} +1 -1
- package/dist/{template-serialization-CWmHq7lX.js → template-serialization-BgGWYV_1.js} +1 -1
- package/dist/{textwrap-BywMBMXM.js → textwrap-Bt_tnI6V.js} +1 -1
- package/dist/vue/async.d.cts +46 -3
- package/dist/vue/async.d.ts +46 -3
- package/dist/vue/index.d.cts +215 -24
- package/dist/vue/index.d.ts +215 -24
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +433 -202
- package/dist/workbook-session-BJfZVp4q.cjs +29 -0
- package/dist/{workbook-session-B6hRjTyX.js → workbook-session-DRnMjIFK.js} +2377 -2350
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.d.cts +27 -2
- package/dist/xlsx.d.ts +27 -2
- package/dist/xlsx.js +15 -15
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-bs3F4dD8.js +0 -1486
- package/dist/ExcelBindingWizard-jSdjBtWw.cjs +0 -1
- package/dist/ReportParamPanel-B27IGJjk.cjs +0 -1
- package/dist/ReportPreview-DAU-V3Ov.cjs +0 -6
- package/dist/auto-DjmvmcX-.cjs +0 -1
- package/dist/capabilities-D4nfhcvB.cjs +0 -1
- package/dist/computed-DK6BruFz.cjs +0 -1
- package/dist/dataset-IrlXbUvh.cjs +0 -1
- package/dist/designer-B597ZdC0.js +0 -7595
- package/dist/designer-DFIdv_n7.cjs +0 -2
- package/dist/dom-CXWMmwh-.cjs +0 -1
- package/dist/dom-DxdCMLzs.js +0 -452
- package/dist/json-snapshot-L_gJ7KRS.cjs +0 -2
- package/dist/protocol-CymmHWmL.cjs +0 -1
- package/dist/region-binding-workflow-EYxvUYJ-.js +0 -977
- package/dist/region-binding-workflow-NdkMSFCh.cjs +0 -3
- package/dist/rich-text-layout-Ch_N0Ubu.js +0 -52
- package/dist/rich-text-layout-yJGuThtC.cjs +0 -3
- package/dist/runtime-D8AlfJ6S.js +0 -234
- package/dist/runtime-ywf3oLBR.cjs +0 -1
- package/dist/workbook-session-BclW7KKH.cjs +0 -29
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
function l(o) {
|
|
2
|
+
let t = "";
|
|
3
|
+
for (let e = o; e > 0; e = Math.floor((e - 1) / 26)) t = String.fromCharCode(65 + (e - 1) % 26) + t;
|
|
4
|
+
return t;
|
|
5
|
+
}
|
|
6
|
+
function h(o) {
|
|
7
|
+
return `${l(o.left)}${o.top}:${l(o.right)}${o.bottom}`;
|
|
8
|
+
}
|
|
9
|
+
function p(o) {
|
|
10
|
+
let t = 0;
|
|
11
|
+
for (const e of o.toUpperCase()) t = t * 26 + e.charCodeAt(0) - 64;
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function a(o) {
|
|
15
|
+
if (typeof o != "string") throw new Error("Excel 范围应为 A1:B20 格式的字符串");
|
|
16
|
+
const t = /^\$?([A-Z]{1,3})\$?([1-9]\d{0,6})(?::\$?([A-Z]{1,3})\$?([1-9]\d{0,6}))?$/i.exec(o.trim());
|
|
17
|
+
if (!t) throw new Error(`Excel 范围无效:${o}`);
|
|
18
|
+
const e = { left: p(t[1]), top: Number(t[2]), right: p(t[3] ?? t[1]), bottom: Number(t[4] ?? t[2]) };
|
|
19
|
+
if (e.right < e.left || e.bottom < e.top || e.right > 16384 || e.bottom > 1048576)
|
|
20
|
+
throw new Error(`Excel 范围超出边界或顺序无效:${o}`);
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
function g(o, t) {
|
|
24
|
+
if (t !== void 0) return a(t);
|
|
25
|
+
const e = o.model.rows ?? [];
|
|
26
|
+
if (!e.length) return { top: 1, left: 1, bottom: 1, right: 1 };
|
|
27
|
+
const n = { top: 1 / 0, left: 1 / 0, bottom: 1, right: 1 };
|
|
28
|
+
for (const r of e)
|
|
29
|
+
n.top = Math.min(n.top, r.number), n.bottom = Math.max(n.bottom, r.number), n.left = Math.min(n.left, r.min || 1), n.right = Math.max(n.right, r.max || 1);
|
|
30
|
+
return n;
|
|
31
|
+
}
|
|
32
|
+
function $(o, t, e) {
|
|
33
|
+
const n = o.bottom - o.top + 1, r = o.right - o.left + 1;
|
|
34
|
+
if (n > t.limits.maxRows || r > t.limits.maxColumns || n * r > e)
|
|
35
|
+
throw new Error(`Excel 范围 ${h(o)} 超过导入行、列或单元格上限;请用 sheets/range 缩小范围`);
|
|
36
|
+
return n * r;
|
|
37
|
+
}
|
|
38
|
+
function w(o, t) {
|
|
39
|
+
return o.top <= t.bottom && o.bottom >= t.top && o.left <= t.right && o.right >= t.left;
|
|
40
|
+
}
|
|
41
|
+
function d(o, t) {
|
|
42
|
+
const e = [];
|
|
43
|
+
for (const n of o.model.merges) {
|
|
44
|
+
const r = a(n);
|
|
45
|
+
if (w(t, r)) {
|
|
46
|
+
if (r.left < t.left || r.right > t.right || r.top < t.top || r.bottom > t.bottom)
|
|
47
|
+
throw new Error(`${o.name}: 范围 ${h(t)} 截断合并单元格 ${n},请包含完整合并区域`);
|
|
48
|
+
e.push(r);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return e;
|
|
52
|
+
}
|
|
53
|
+
function x(o, t) {
|
|
54
|
+
const e = /* @__PURE__ */ new Map();
|
|
55
|
+
for (const r of t) e.set(r.top, Math.max(e.get(r.top) ?? r.top, r.bottom));
|
|
56
|
+
const n = [];
|
|
57
|
+
for (let r = o.top; r <= o.bottom; ) {
|
|
58
|
+
let s = e.get(r) ?? r;
|
|
59
|
+
for (let f = r; f <= s; f++) s = Math.max(s, e.get(f) ?? f);
|
|
60
|
+
n.push({ top: r, bottom: s }), r = s + 1;
|
|
61
|
+
}
|
|
62
|
+
return n;
|
|
63
|
+
}
|
|
64
|
+
function E(o, t, e, n) {
|
|
65
|
+
const r = [];
|
|
66
|
+
let s, f = 0;
|
|
67
|
+
for (const m of o) {
|
|
68
|
+
const u = m.bottom - m.top + 1;
|
|
69
|
+
if (u > 200) throw new Error("合并单元格跨越超过 200 行,无法安全分段;请先缩小或拆分该合并区域");
|
|
70
|
+
let i = 0;
|
|
71
|
+
for (let c = m.top; c <= m.bottom; c++) i += n(c);
|
|
72
|
+
if (i > e && Number.isFinite(e)) throw new Error("合并区域或单行高度超过标准纸张可用高度;请使用 wide 或调整原模板行高");
|
|
73
|
+
const b = s ? m.bottom - s.top + 1 : u;
|
|
74
|
+
s && (b > t || f + i > e) && (r.push(s), s = void 0, f = 0), s ? s.bottom = m.bottom : s = { ...m }, f += i;
|
|
75
|
+
}
|
|
76
|
+
return s && r.push(s), r;
|
|
77
|
+
}
|
|
78
|
+
function M(o) {
|
|
79
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Set();
|
|
80
|
+
for (const n of o) {
|
|
81
|
+
t.set(`${n.top}:${n.left}`, n);
|
|
82
|
+
for (let r = n.top; r <= n.bottom; r++)
|
|
83
|
+
for (let s = n.left; s <= n.right; s++)
|
|
84
|
+
(r !== n.top || s !== n.left) && e.add(`${r}:${s}`);
|
|
85
|
+
}
|
|
86
|
+
return { masters: t, covered: e };
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
$ as a,
|
|
90
|
+
d as b,
|
|
91
|
+
l as c,
|
|
92
|
+
E as d,
|
|
93
|
+
M as e,
|
|
94
|
+
x as m,
|
|
95
|
+
a as p,
|
|
96
|
+
h as r,
|
|
97
|
+
g as s
|
|
98
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./diagnostic-collector-wASg6Fzs.cjs"),U=require("./record-bindings-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./diagnostic-collector-wASg6Fzs.cjs"),U=require("./record-bindings-KEs-DKCS.cjs"),v=require("./template-registry-D24Z8aQf.cjs"),ye=require("./dataset-D3OsyzG1.cjs"),j=require("./textwrap-LhJkHWb1.cjs"),w=require("./json-snapshot-DGFeI30h.cjs"),J=require("./dom-Fk4NF-gN.cjs"),ot=require("./data-bar-DzceAVeR.cjs"),it=require("./rich-text-layout-BYbIc3eJ.cjs"),_=require("./capabilities-D8UU2clQ.cjs"),ee=require("./assets-CZiZhTf2.cjs"),at=require("./grid-strokes-RFMR91jn.cjs"),B=require("./prefill-C_Bf_AMo.cjs"),A=require("./param-validation-C-8sRJLq.cjs"),te=require("./computed-BQgBrma-.cjs"),ne=require("./template-catalog-DDH-5J57.cjs"),me=require("./template-fragments-cyAQu7aw.cjs"),be=require("./template-serialization-BOUidUlh.cjs");function ve(e,t,n,r,o,i,c,s="top"){e.font=`${t.italic?"italic ":""}${t.bold?"bold ":""}${t.fontSizePx}px ${c}`,"letterSpacing"in e&&(e.letterSpacing="0px"),e.fillStyle=t.color,e.textBaseline="alphabetic";const a=t.fontSizePx*t.lineHeight,l=t.text===""?[""]:t.text.split(`
|
|
2
2
|
`),m=l.length*a;let p=r;s==="middle"?p=r+(i-m)/2:s==="bottom"&&(p=r+i-m),l.forEach((d,u)=>{const f=p+u*a+t.fontSizePx*.8;st(e,d,t,n,f,o),t.underline&&d&<(e,d,t,n,f,o)}),e.textAlign="left"}function st(e,t,n,r,o,i){const c=Array.from(t),s=n.letterSpacingPx??0;if(!s){e.textAlign=n.align==="center"?"center":n.align==="right"?"right":"left";const p=n.align==="center"?r+i/2:n.align==="right"?r+i:r;e.fillText(t,p,o);return}const a=e.measureText(t).width+Math.max(0,c.length-1)*s,l=n.align==="center"?r+(i-a)/2:n.align==="right"?r+i-a:r;e.textAlign="left";let m="";c.forEach((p,d)=>{e.fillText(p,l+e.measureText(m).width+d*s,o),m+=p})}function lt(e,t,n,r,o,i){const c=e.measureText(t).width+Math.max(0,Array.from(t).length-1)*(n.letterSpacingPx??0),s=n.align==="center"?r+(i-c)/2:n.align==="right"?r+i-c:r;e.strokeStyle=n.color,e.lineWidth=Math.max(.5,n.fontSizePx/20),e.beginPath(),e.moveTo(s,o+1),e.lineTo(s+c,o+1),e.stroke()}function _e(e,t,n,r,o){const i=r/72,c=s=>{e.font=`${s.italic?"italic ":""}${s.bold?"bold ":""}${g.resolveFontSize(s,r).fontSizePx}px ${s.fontFamily??o}`,"letterSpacing"in e&&(e.letterSpacing="0px")};it.drawRichText(t,{x:n.x/i,yTop:-n.y/i,width:n.width/i,height:n.height/i},{measure(s,a){return c(a),e.measureText(s).width/i+(a.letterSpacing??0)},draw(s,a,l,m,p){const d=g.resolveFontSize(a,r).fontSizePx,u=-m*i-d*.8;a.backgroundColor&&(e.fillStyle=a.backgroundColor,e.fillRect(l*i,u,p*i,d*g.resolveLineHeight(a))),ve(e,{text:s,fontSizePx:d,bold:!!a.bold,italic:a.italic,underline:a.underline,color:g.resolveTextColor(a),align:"left",lineHeight:g.resolveLineHeight(a),letterSpacingPx:(a.letterSpacing??0)*i},l*i,u,p*i,d,a.fontFamily??o)}})}function L(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}const ct=(e,t)=>(L(t),/^data:image\/(?:png|jpe?g|webp|gif|svg\+xml)[;,]/i.test(e)?new Promise((n,r)=>{const o=new Image,i=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},c=()=>{i(),o.src="",r(t?.reason??new DOMException("The operation was aborted.","AbortError"))};o.onload=()=>{i(),n(o)},o.onerror=()=>{i(),r(new Error("Image could not be decoded for Canvas output."))},t?.addEventListener("abort",c,{once:!0}),o.src=e}):Promise.reject(new TypeError("Canvas imageData must be an image data URL; provide imageLoader for other sources.")));function mt(e,t,n){return L(n),n?new Promise((r,o)=>{const i=()=>o(n.reason??new DOMException("The operation was aborted.","AbortError"));n.addEventListener("abort",i,{once:!0}),Promise.resolve().then(()=>e(t,n)).then(r,o).finally(()=>n.removeEventListener("abort",i))}):e(t)}function*Me(e){function*t(n,r,o,i){if(i.has(n))throw new TypeError("Cyclic grid children cannot be rendered.");g.isImageBackedComponent(n)&&(yield{component:n,componentIndex:r,componentPath:o});const c=new Set(i).add(n);for(const[s,a]of(n.grid?.cells??[]).entries())for(const[l,m]of a.entries())for(const[p,d]of(m?.children??[]).entries())yield*t(d,r,[...o,s,l,p],c)}for(const[n,r]of e.components.entries())yield*t(r,n,[],new Set)}async function dt(e,t,n){const r=new Map;for(const{component:o}of Me(e))!g.isImageBackedComponent(o)||r.has(o.imageData)||r.set(o.imageData,await mt(t,o.imageData,n));return L(n),r}function pt(e,t,n,r,o,i){const c=t,s=c.naturalWidth??c.width??o,a=c.naturalHeight??c.height??i;if(s<=0||a<=0)throw new RangeError("Decoded Canvas image dimensions must be positive.");const l=Math.min(o/s,i/a),m=s*l,p=a*l;e.drawImage(t,n+(o-m)/2,r+(i-p)/2,m,p)}function je(e){return B.createPageWindowIndex(e.pageHeightsPx,e.gapPx).window(e.viewportHeightPx,e.scrollTopPx,e.overscan)}const Re=96/25.4;function de(e,t=96){const n=t/96*Re;return{widthPx:Math.max(1,Math.round(e.pageWidthMm*n)),heightPx:Math.max(1,Math.round(e.pageHeightMm*n))}}function Be(e,t,n,r=64e6){if(!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)throw new RangeError("Canvas dpr and dpi must be positive finite numbers.");if(!Number.isFinite(r)||r<=0)throw new RangeError("maxCanvasPixels must be positive and finite.");const o=de(e,n),i=Math.round(o.widthPx*t),c=Math.round(o.heightPx*t);if(!Number.isSafeInteger(i)||!Number.isSafeInteger(c)||i*c>r)throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");return{width:i,height:c}}function ze(e,t,n,r){const o=document.createElement("canvas"),{widthPx:i,heightPx:c}=de(e,n),s=Be(e,t,n,r);o.width=s.width,o.height=s.height,o.style.width=`${i}px`,o.style.height=`${c}px`;const a=o.getContext("2d");if(!a)throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");return a.scale(t,t),a.fillStyle="#ffffff",a.fillRect(0,0,i,c),{canvas:o,ctx:a}}function gt(e,t=96){return g.resolveFontSize(e,t).fontSizePx}function ut(e,t,n,r,o,i,c){for(const s of at.resolveGridStrokes(t,n))e.strokeStyle=s.color,e.lineWidth=g.ptToPx(s.widthPt,c),e.beginPath(),s.kind==="v"?(e.moveTo(r+s.pos*i,o+s.from*i),e.lineTo(r+s.pos*i,o+s.to*i)):(e.moveTo(r+s.from*i,o+s.pos*i),e.lineTo(r+s.to*i,o+s.pos*i)),e.stroke()}function ft(e,t,n,r,o,i){e.beginPath(),t.top&&(e.moveTo(n,r),e.lineTo(n+o,r)),t.right&&(e.moveTo(n+o,r),e.lineTo(n+o,r+i)),t.bottom&&(e.moveTo(n+o,r+i),e.lineTo(n,r+i)),t.left&&(e.moveTo(n,r+i),e.lineTo(n,r)),e.stroke()}function ht(e,t,n,r,o,i,c,s,a,l,m,p){const d=g.resolveGridLayout(t,i/s,c/s);for(const u of d.cells){const f=u.cell.style?.backgroundColor??n.style?.backgroundColor;f&&(e.fillStyle=f,e.fillRect(r+u.xMm*s,o+u.yMm*s,u.widthMm*s,u.heightMm*s))}ut(e,d,n,r,o,s,a);for(const u of d.cells)wt(e,u,n,r,o,s,a,l,m,p)}function wt(e,t,n,r,o,i,c,s,a,l){const m=n.grid?.paddingMm??.5,p=t.cell.text??"",d=g.resolveGridCellStyle(n.style,t.cell),u=g.resolveFontSize(d,c),f=t.cell.indentMm??0,x=Math.max(0,t.widthMm-2*m-f),C=j.wrapText(p,x,{fontSizePt:u.fontSizePt,bold:d.bold,italic:d.italic,fontFamily:d.fontFamily??s,letterSpacingPt:d.letterSpacing},a).join(`
|
|
3
3
|
`),M={x:r+(t.xMm+m+f)*i,y:o+(t.yMm+m)*i,width:x*i,height:Math.max(0,t.heightMm-2*m)*i};e.save(),e.beginPath(),e.rect(M.x,M.y,M.width,M.height),e.clip(),t.cell.richParagraphs?.length?_e(e,{...n,richParagraphs:t.cell.richParagraphs,style:{verticalAlign:"middle",...d}},M,c,s):ve(e,{text:C,fontSizePx:u.fontSizePx,bold:d.bold??!1,italic:d.italic,underline:d.underline,color:g.resolveTextColor(d,g.DEFAULT_TEXT_COLOR),align:d.align??"left",lineHeight:g.resolveLineHeight(d),letterSpacingPx:g.ptToPx(d.letterSpacing??0,c)},r+(t.xMm+m+f)*i,o+(t.yMm+m)*i,x*i,Math.max(0,t.heightMm-2*m)*i,d.fontFamily??s,d.verticalAlign??"middle");for(const P of t.cell.children??[])pe(e,{...P,leftMm:P.leftMm+M.x/i,topMm:P.topMm+M.y/i},i,c,s,a,l);e.restore();const E=ot.dataBarBox(t.cell.dataBar,t.widthMm,t.heightMm,m);E&&(e.save(),e.globalAlpha*=.35,e.fillStyle=E.color,e.fillRect(r+(t.xMm+E.x)*i,o+(t.yMm+E.y)*i,E.width*i,E.height*i),e.restore())}function yt(e,t,n,r,o,i,c,s,a){const l=t.style??{},m=g.resolveFontSize(l,c);if(g.isRichText(t)){_e(e,t,{x:n,y:r,width:o,height:i},c,s);return}const p=t.lines?.length?t.lines.join(`
|
|
4
4
|
`):j.wrapText(t.text??"",t.widthMm,{fontSizePt:m.fontSizePt,bold:l.bold,italic:l.italic,fontFamily:l.fontFamily??s,letterSpacingPt:l.letterSpacing},a).join(`
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { a as V, c as Q, d as fe, i as he, D as ge, o as nt, e as le, p as _, f as rt, r as it, g as ot, b as at, h as st, P as ee, w as Pe } from "./diagnostic-collector-
|
|
2
|
-
import { C as lr, j as mr, k as dr, l as fr, L as hr, M as gr, R as ur, S as pr, m as wr, n as br, q as yr, s as Mr, t as vr } from "./diagnostic-collector-
|
|
3
|
-
import { P as Er, e as Sr, f as Rr, R as Cr, g as Tr, h as Pr, p as $r, b as Or, t as Ar, j as Ir } from "./record-bindings-
|
|
4
|
-
import { v as Fe, R as je, a as me, p as X, b as ct } from "./template-registry-
|
|
5
|
-
import { c as Lr, d as Nr, e as kr, i as Fr, s as jr, f as zr, g as Hr, h as Br } from "./template-registry-
|
|
6
|
-
import { v as lt } from "./dataset-
|
|
7
|
-
import { d as Wr } from "./dataset-
|
|
8
|
-
import { h as ue, w as ze } from "./textwrap-
|
|
9
|
-
import { c as qr, a as Vr, b as Jr, m as Gr } from "./textwrap-
|
|
10
|
-
import { R as pe, d as mt, s as He, a as dt, p as ft } from "./json-snapshot-
|
|
11
|
-
import { D as Yr, b as Xr, c as Zr, e as Qr, f as ei, g as ti, h as ni, i as ri, j as ii, k as oi, l as ai, m as si, n as ci, o as li, q as mi, r as di, t as fi, u as hi, v as gi, w as ui, x as pi, y as wi, z as bi, A as yi, B as Mi, C as vi, E as xi, F as Ei, G as Si } from "./json-snapshot-
|
|
12
|
-
import { c as Ci, a as Ti, b as Pi, i as $i, r as Oi, d as Ai, e as Ii, t as Di } from "./dom-
|
|
13
|
-
import { d as ht } from "./data-bar-
|
|
14
|
-
import { d as gt } from "./rich-text-layout-
|
|
15
|
-
import { r as re, n as Be, O as ut } from "./capabilities-
|
|
16
|
-
import { i as Ni, a as ki } from "./capabilities-
|
|
17
|
-
import { r as we } from "./assets-
|
|
18
|
-
import { O as ji } from "./assets-
|
|
19
|
-
import { r as pt } from "./grid-strokes-
|
|
20
|
-
import { c as wt } from "./prefill-
|
|
21
|
-
import { R as Hi, a as Bi, b as _i, d as Wi, e as Ui, m as qi, r as Vi, f as Ji, g as Gi, v as Ki } from "./prefill-
|
|
1
|
+
import { a as V, c as Q, d as fe, i as he, D as ge, o as nt, e as le, p as _, f as rt, r as it, g as ot, b as at, h as st, P as ee, w as Pe } from "./diagnostic-collector-C-JBA016.js";
|
|
2
|
+
import { C as lr, j as mr, k as dr, l as fr, L as hr, M as gr, R as ur, S as pr, m as wr, n as br, q as yr, s as Mr, t as vr } from "./diagnostic-collector-C-JBA016.js";
|
|
3
|
+
import { P as Er, e as Sr, f as Rr, R as Cr, g as Tr, h as Pr, p as $r, b as Or, t as Ar, j as Ir } from "./record-bindings-DBrCu6zO.js";
|
|
4
|
+
import { v as Fe, R as je, a as me, p as X, b as ct } from "./template-registry-PSuLsnyq.js";
|
|
5
|
+
import { c as Lr, d as Nr, e as kr, i as Fr, s as jr, f as zr, g as Hr, h as Br } from "./template-registry-PSuLsnyq.js";
|
|
6
|
+
import { v as lt } from "./dataset-B8oTsC6o.js";
|
|
7
|
+
import { d as Wr } from "./dataset-B8oTsC6o.js";
|
|
8
|
+
import { h as ue, w as ze } from "./textwrap-Bt_tnI6V.js";
|
|
9
|
+
import { c as qr, a as Vr, b as Jr, m as Gr } from "./textwrap-Bt_tnI6V.js";
|
|
10
|
+
import { R as pe, d as mt, s as He, a as dt, p as ft } from "./json-snapshot-BZ0CIQln.js";
|
|
11
|
+
import { D as Yr, b as Xr, c as Zr, e as Qr, f as ei, g as ti, h as ni, i as ri, j as ii, k as oi, l as ai, m as si, n as ci, o as li, q as mi, r as di, t as fi, u as hi, v as gi, w as ui, x as pi, y as wi, z as bi, A as yi, B as Mi, C as vi, E as xi, F as Ei, G as Si } from "./json-snapshot-BZ0CIQln.js";
|
|
12
|
+
import { c as Ci, a as Ti, b as Pi, i as $i, r as Oi, d as Ai, e as Ii, t as Di } from "./dom-DgWc-DY1.js";
|
|
13
|
+
import { d as ht } from "./data-bar-DjOgTLqu.js";
|
|
14
|
+
import { d as gt } from "./rich-text-layout-BtygMWZC.js";
|
|
15
|
+
import { r as re, n as Be, O as ut } from "./capabilities-g0a2j9Yy.js";
|
|
16
|
+
import { i as Ni, a as ki } from "./capabilities-g0a2j9Yy.js";
|
|
17
|
+
import { r as we } from "./assets-BFTP-0WR.js";
|
|
18
|
+
import { O as ji } from "./assets-BFTP-0WR.js";
|
|
19
|
+
import { r as pt } from "./grid-strokes-DsoICRjZ.js";
|
|
20
|
+
import { c as wt } from "./prefill-C8fF91JB.js";
|
|
21
|
+
import { R as Hi, a as Bi, b as _i, d as Wi, e as Ui, m as qi, r as Vi, f as Ji, g as Gi, v as Ki } from "./prefill-C8fF91JB.js";
|
|
22
22
|
import { R as Xi, a as Zi, f as Qi, b as eo, c as to, d as no, i as ro, e as io, g as oo, p as ao, h as so, j as co, k as lo, r as mo, v as fo, l as ho } from "./param-validation-CnDEd2l-.js";
|
|
23
|
-
import { n as uo, f as po, o as wo, r as bo, l as yo } from "./computed-
|
|
24
|
-
import { c as vo, a as xo, d as Eo, r as So, b as Ro } from "./template-catalog-
|
|
25
|
-
import { a as To, c as Po, i as $o, b as Oo } from "./template-fragments-
|
|
26
|
-
import { T as Io, c as Do, a as Lo } from "./template-serialization-
|
|
23
|
+
import { n as uo, f as po, o as wo, r as bo, l as yo } from "./computed-CH3NYPOW.js";
|
|
24
|
+
import { c as vo, a as xo, d as Eo, r as So, b as Ro } from "./template-catalog-BbrN9dgu.js";
|
|
25
|
+
import { a as To, c as Po, i as $o, b as Oo } from "./template-fragments-CUTE8-_I.js";
|
|
26
|
+
import { T as Io, c as Do, a as Lo } from "./template-serialization-BgGWYV_1.js";
|
|
27
27
|
function be(e, t, n, r, i, o, l, s = "top") {
|
|
28
28
|
e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSizePx}px ${l}`, "letterSpacing" in e && (e.letterSpacing = "0px"), e.fillStyle = t.color, e.textBaseline = "alphabetic";
|
|
29
29
|
const a = t.fontSizePx * t.lineHeight, c = t.text === "" ? [""] : t.text.split(`
|