@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
package/dist/worker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./protocol-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./protocol-CZ-BILne.cjs"),s=require("./auto-CXd2E2aZ.cjs"),R=require("./encoding-tWc2Wn89.cjs");function p(n,e=globalThis){const a=t=>{r.isReportWorkerRequest(t.data)&&r.runReportWorkerRequest(n,t.data,o=>e.postMessage({protocol:r.REPORT_WORKER_PROTOCOL,id:t.data.id,type:"event",event:o})).then(o=>e.postMessage(o,r.reportWorkerTransferList(o)))};return e.addEventListener("message",a),()=>e.removeEventListener("message",a)}exports.ReportWorkerError=r.ReportWorkerError;exports.ReportWorkerStartError=s.ReportWorkerStartError;exports.createAutoReportExporter=s.createAutoReportExporter;exports.createBrowserReportExecutor=s.createBrowserReportExecutor;exports.serveReportEncodingWorker=R.serveReportEncodingWorker;exports.serveReportWorker=p;
|
package/dist/worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as a, r as R, R as p, a as n } from "./protocol-
|
|
2
|
-
import { b as W } from "./protocol-
|
|
3
|
-
import { R as g, c as k, a as u } from "./auto-
|
|
4
|
-
import { s as x } from "./encoding-
|
|
1
|
+
import { i as a, r as R, R as p, a as n } from "./protocol-DHO91-Jt.js";
|
|
2
|
+
import { b as W } from "./protocol-DHO91-Jt.js";
|
|
3
|
+
import { R as g, c as k, a as u } from "./auto-C7udkeAa.js";
|
|
4
|
+
import { s as x } from "./encoding-D480EM2r.js";
|
|
5
5
|
function d(s, r = globalThis) {
|
|
6
6
|
const t = (o) => {
|
|
7
7
|
a(o.data) && R(s, o.data, (e) => r.postMessage({ protocol: p, id: o.data.id, type: "event", event: e })).then((e) => r.postMessage(e, n(e)));
|
package/dist/xlsx.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./diagnostic-collector-wASg6Fzs.cjs"),N=require("./index-CUNw7dL9.cjs"),G=require("./data-bar-DzceAVeR.cjs"),p=require("./workbook-session-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./diagnostic-collector-wASg6Fzs.cjs"),N=require("./index-CUNw7dL9.cjs"),G=require("./data-bar-DzceAVeR.cjs"),p=require("./workbook-session-BJfZVp4q.cjs"),j=require("./media-B7vnpD8k.cjs"),H=require("./capabilities-D8UU2clQ.cjs"),q=require("./assets-CZiZhTf2.cjs"),R=require("./workbook-sheets-CaPAulQ6.cjs"),w=require("./region-binding-workflow-ikpY1Kbw.cjs");function _(e){const t=N.encodePng({width:1,height:1,channels:4,depth:8,data:new Uint8Array([1,3,5].map(o=>parseInt(e.slice(o,o+2),16)).concat(89))});return`data:image/png;base64,${btoa(String.fromCharCode(...t))}`}function U(e,t,o){const n=new Map;let r=0;return(a,i,s,l)=>{const c=G.dataBarBox(i.cell.dataBar,i.widthMm,i.heightMm,l);if(!c)return;if(++r>t)throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);let d=n.get(c.color);d||(d=_(c.color),n.set(c.color,d)),r===1&&o.push("数据条为静态半透明视觉快照,保留原始单元格值;Excel 编辑不会重算条形,绘图叠加文字的混色与预览可能略有差异。"),e.write(a,{kind:"image",leftMm:0,topMm:0,widthMm:c.width,heightMm:c.height,imageData:d},s,{leftMm:i.xMm+c.x,offsetMm:c.y})}}async function X(e,t,o){const n=e.pages.flatMap(i=>i.components),r=h.createOutputScheduler(o);let a=0;for(;n.length;){const i=n.pop();for(const s of i.grid?.cells??[])for(const l of s){if(l?.dataBar&&l.dataBar.end>l.dataBar.start&&++a>t)throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);l?.children&&n.push(...l.children);const c=r();c&&await c}}}function A(e,t){return{richText:e.flatMap((o,n)=>[...n?[{text:`
|
|
2
2
|
`}]:[],...o.segments.map(r=>{const a=h.mergeComponentStyles(t,r.style),i=a.color?.replace(/^#/,"");return{text:r.kind==="field"?r.field??"":r.text??"",font:{name:a.fontFamily,bold:a.bold,italic:a.italic,underline:a.underline,size:h.resolveFontSize(a).fontSizePt,.../^[a-f\d]{6}$/i.test(i??"")?{color:{argb:`FF${i.toUpperCase()}`}}:{}}}})])}}function K(e,t){const o=e.children?.filter(a=>a.kind==="text"&&!a.grid)??[];if(!e.richParagraphs?.length&&!o.length)return;const n=h.mergeComponentStyles(t,e.style),r=e.richParagraphs?.length?[...e.richParagraphs]:e.text?[{segments:[{text:e.text}]}]:[];for(const a of o){const i=h.mergeComponentStyles(n,a.style),s=a.richParagraphs?.length?a.richParagraphs:[{segments:[{text:a.lines?.join(`
|
|
3
3
|
`)??a.text??""}]}];for(const l of s)r.push({...l,segments:l.segments.map(c=>({...c,style:h.mergeComponentStyles(i,c.style)}))})}return A(r,n)}function J(e,t,o){let n=o*72/25.4;if(!Number.isFinite(n)||t+Math.ceil(n/409)-1>1048576)throw new Error("Excel 图片占位超过工作表行数上限");for(;n>0;){if(t>1048576)throw new Error("Excel 图片占位超过工作表行数上限");const r=Math.min(409,n);e.getRow(t++).height=r,n-=r}return t}function V(e,t,o){let n=Math.round(t*36e3),r=0;if(!Number.isSafeInteger(n))throw new Error("Excel 图片锚点超出安全坐标范围");for(e.properties.defaultColWidth??=8.43;r<16384;){const a=e.getColumn(r+1).width??e.properties.defaultColWidth,i=Math.round(p.excelColumnWidthToMm(a)*36e3);if(!Number.isSafeInteger(i)||i<=0)throw new Error("Excel 图片锚点所在列宽无效");if(n<i)return{col:r+n/i,row:o-1,nativeCol:r,nativeColOff:n,nativeRow:o-1,nativeRowOff:0};n-=i,r++}throw new Error("Excel 图片锚点超过16384列上限")}function Q(e,t,o){let n=o*72/25.4;if(!Number.isFinite(n)||Math.abs(n)>1048576*409)throw new Error("Excel 图片纵向偏移超过工作表范围");const r=a=>{const i=e.getRow(a).height??e.properties.defaultRowHeight??15;if(!Number.isFinite(i)||i<=0)throw new Error("Excel 图片锚点所在行高无效");return i};for(;n<0&&t>1;)n+=r(--t);for(;t<=1048576&&n>=r(t);)n-=r(t++);if(t>1048576||n<0)throw new Error("Excel 图片移动到工作表边界之外");return{nativeRow:t-1,nativeRowOff:Math.round(n*25.4/72*36e3)}}function Y(e,t,o){const n=j.createImageMediaInspector(t),r=new Map;return{write(a,i,s,l){if(![i.widthMm,i.heightMm,i.leftMm].every(Number.isFinite)||i.widthMm<0||i.heightMm<0||i.leftMm<0)throw new Error("Excel 图片尺寸无效");if(!i.widthMm||!i.heightMm)return s;if(!i.imageData||!/^data:image\/(png|jpe?g);base64,/i.test(i.imageData))return o.push(`${i.nid??i.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`),s;const c=n(i.imageData);let d=r.get(c.dataUrl);d===void 0&&(d=e.addImage({base64:c.dataUrl,extension:c.extension}),r.set(c.dataUrl,d));const g=l?s:J(a,s,i.heightMm);return a.addImage(d,{tl:{...V(a,l?.leftMm??i.leftMm,s),...l?Q(a,s,l.offsetMm):{}},ext:{width:i.widthMm*96/25.4,height:i.heightMm*96/25.4},editAs:"oneCell"}),g}}}function P(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function T(e,t){const o=e.meta?.xlsxFlow;if(o===void 0)return;if(!P(o)||o.version!=="1.0"||!Number.isSafeInteger(o.columnStart)||Number(o.columnStart)<0)throw new Error("Excel 多区域几何标记无效,不能按列序猜测输出");if(!e.grid)throw new Error("Excel 多区域输出只接受显式网格组件");const n=o,r=e.grid.colWidthsMm;if(!r?.length||n.columnStart+r.length>t.length||r.some((a,i)=>Math.abs(a-t[n.columnStart+i])>.001))throw new Error("Excel 多区域列位置与网格列宽不一致");return n}function $(e){const t=e.meta?.xlsxFlow;if(t===void 0){if(e.components.some(n=>n.meta?.xlsxFlow!==void 0))throw new Error("Excel 多区域页面缺少完整列几何标记");return}const o=Z(t,e.meta?.reportScope);for(const n of e.components){const r=T(n,o.widths);if(!r)throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");const a=o.widths.slice(0,r.columnStart).reduce((s,l)=>s+l,e.marginLeftMm??0),i=n.grid.colWidthsMm.reduce((s,l)=>s+l,0);if(Math.abs(a-n.leftMm)>.01||Math.abs(i-n.widthMm)>.01)throw new Error("Excel 多区域标记与真实横向位置不一致")}return o}function Z(e,t){if(!P(e)||e.version!=="1.0"||typeof e.sheet!="string"||!e.sheet.trim()||typeof e.templateId!="string"||!e.templateId.trim())throw new Error("Excel 多区域工作表标识无效");if(!Array.isArray(e.fullWidthsMm)||!e.fullWidthsMm.length||e.fullWidthsMm.length>16384||e.fullWidthsMm.some(o=>typeof o!="number"||!Number.isFinite(o)||o<=0||o>2e3))throw new Error("Excel 多区域完整列宽无效");if(t!==void 0&&(typeof t!="string"||!t.trim()))throw new Error("Excel 多区域报表命名空间无效");return{key:JSON.stringify([t??e.templateId,e.sheet]),sheet:e.sheet,widths:e.fullWidthsMm}}function v(e){return Math.round(e*1e6)/1e6}function ee(e,t,o,n,r){return e.components.filter(a=>n?a.pageAnchor==="header"?t===0:a.pageAnchor==="footer"?t===o-1:a.table?.role!=="header"?!0:r.has(a.table.id)?!1:(r.add(a.table.id),!0):!0)}function te(e,t,o,n){const r=e.components.filter(i=>!t.includes(i)&&i.table?.role==="header"),a=t.filter(i=>!i.pageAnchor).reduce((i,s)=>Math.max(i,s.topMm+s.heightMm),e.marginTopMm??0);return t.map(i=>{let s=i.topMm;return o&&i.pageAnchor==="footer"&&(s=a),s-=r.filter(l=>l.topMm+l.heightMm<=s+.001).reduce((l,c)=>l+c.heightMm,0),{component:i,layout:h.resolveGridLayout(i.grid,i.widthMm,i.heightMm),top:s,column:T(i,n).columnStart}})}function ne(e,t,o){const n=t.length-1;if(n*o.length>1e6)throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");const r=new Map(t.map((s,l)=>[s,l])),a=new Map,i=new Map;for(const s of e)for(const l of s.layout.cells){if(!Object.keys(l.cell).length)continue;const c=r.get(v(s.top+l.yMm)),d=r.get(v(s.top+l.yMm+l.heightMm)),g=s.column+l.ci,m=g+(l.cell.colSpan??1),u=`${c}:${g}`;for(let f=c;f<d;f++)for(let E=g;E<m;E++){const M=`${f}:${E}`;if(i.has(M))throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");i.set(M,u)}a.set(u,{...l.cell,style:h.resolveGridCellStyle(s.component.style,l.cell),rowSpan:d-c,colSpan:m-g})}return Array.from({length:n},(s,l)=>{const c=[];for(let d=0;d<o.length;d++){const g=`${l}:${d}`,m=a.get(g);m?(c.push(m),d+=(m.colSpan??1)-1):i.has(g)||c.push(null)}return c})}function ie(e,t){const o=new Set,n=[];let r;for(const[a,{page:i}]of e.entries()){const s=$(i);if(r&&(s.key!==r.key||s.widths.length!==r.widths.length||s.widths.some((u,f)=>Math.abs(u-r.widths[f])>.001)))throw new Error("Excel 多区域分页的工作表或列结构不一致");r??=s;const l=ee(i,a,e.length,t,o),c=te(i,l,t,s.widths);if(!c.length)continue;const d=[...new Set(c.flatMap(u=>[...u.layout.rows.map(f=>v(u.top+f.pos)),v(u.top+u.component.heightMm)]))].sort((u,f)=>u-f),g=ne(c,d,s.widths),m=d.slice(1).map((u,f)=>u-d[f]);n.push({kind:"rect",leftMm:0,topMm:0,widthMm:s.widths.reduce((u,f)=>u+f,0),heightMm:m.reduce((u,f)=>u+f,0),grid:{cells:g,colWidthsMm:s.widths,rowHeightsMm:m}})}return n}const F=72/25.4,re=32767,oe=253;function b(e,t){if(typeof e!="string")return;if(e.length>re)throw new Error(`Excel 单元格 ${t} 最多支持 32767 个字符,无法无损导出;内容未裁剪`);let o=0;for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10&&++o>oe)throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`)}function y(e){if(!e)return;const t=e.replace("#","");return/^[0-9a-fA-F]{6}$/.test(t)?`FF${t.toUpperCase()}`:void 0}function I(e,t={}){e.font={name:t.fontFamily,bold:t.bold===!0,italic:t.italic===!0,underline:t.underline===!0,size:h.resolveFontSize(t).fontSizePt,color:y(t.color)?{argb:y(t.color)}:void 0}}const S={a3:{width:297,height:420,code:8},a4:{width:210,height:297,code:9},a5:{width:148,height:210,code:11}};function ae(e,t,o,n){if(t&&t!=="auto")return S[t].code;const r=Math.min(e.pageWidthMm,e.pageHeightMm),a=Math.max(e.pageWidthMm,e.pageHeightMm),i=Object.values(S).find(s=>Math.abs(r-s.width)<=1&&Math.abs(a-s.height)<=1);return i?i.code:(n.push(`page ${o+1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`),S.a4.code)}function se(e,t,o,n){const r=typeof t.text=="string"?t.text:"";if(o!=="raw"||!Object.prototype.hasOwnProperty.call(t,"value")){b(r,e.address),e.value=r;return}const a=t.value;if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"&&Number.isFinite(a)){b(a,e.address),e.value=a,t.numberFormat&&(e.numFmt=t.numberFormat);return}b(r,e.address),e.value=r,n.push(`原始单元格值无效,已保留显示文本:${e.address}`)}function le(e){const t=$(e);return t?{id:`xlsx-flow:${t.key}`,title:t.sheet,wide:!0,flow:!0}:ce(e)}function ce(e){const o=e.components.filter(n=>n.table!==void 0)[0]?.table;if(!(!o||typeof o.id!="string"||!o.id.trim()||!Array.isArray(o.columnKeys)||!o.columnKeys.length)){for(const n of e.components){if(n.table){if(!n.grid||n.table.id!==o.id)return;continue}if(n.grid||n.kind!=="text"&&!h.isImageBackedComponent(n))return}return{id:o.id,title:o.title,wide:o.layout==="wide"||e.layout==="wide"}}}function de(e,t){const o=new Set;for(const[n,r]of e.pages.entries())if(!t[n])for(const a of r.components)typeof a.table?.id=="string"&&o.add(a.table.id);return o}function C(e){return e.layout==="wide"||e.components.some(t=>t.table?.layout==="wide")}function he(e,t,o){const n=[],r=e.pages.map(le),a=de(e,r);for(const[i,s]of e.pages.entries()){const l=r[i],c=l&&!a.has(l.id),d=t==="pages"||!c?void 0:l;if(t==="continuous"&&!d)throw new Error(`page ${i+1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);const g=d!==void 0&&(t==="continuous"||d.wide);!g&&t!=="pages"&&C(s)&&o.push(`page ${i+1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);const m=n[n.length-1];g&&m?.continuous&&m.tableId===d.id?m.pages.push({page:s,index:i}):n.push({pages:[{page:s,index:i}],continuous:g,...g?{tableId:d.id,title:d.title}:{},...l?.flow?{flow:!0,title:l.title}:{}})}return n}function W(e,t,o){return!e||e.length===t.length&&e.every((n,r)=>o(n,t[r]))}function ge(e,t,o,n){const r=e.table,a=t.columns.map(l=>l.size),i=W(n.keys,r.columnKeys,(l,c)=>l===c),s=W(n.widths,a,(l,c)=>Math.abs(l-c)<=.001);if(r.columnKeys.length!==a.length||!i||!s)throw new Error(`page ${o+1}: 连续 Excel 逻辑表 ${r.id} 的列结构或列宽不一致`);if(n.keys??=r.columnKeys,n.widths??=a,r.role==="header"){if(r.rowIndex!==-1)throw new Error(`page ${o+1}: 连续 Excel 表头 rowIndex 必须为 -1`);n.headerSeen=!0}else{if(!["body","group-header","subtotal","grand-total"].includes(r.role)||r.rowIndex!==n.expectedRow)throw new Error(`page ${o+1}: 连续 Excel 逻辑行来源不连续或重复(期望 ${n.expectedRow})`);n.expectedRow+=t.rows.length}}function ue(e,t){const o={expectedRow:0,headerSeen:!1};for(const{page:n,index:r}of e.pages)for(const a of n.components){const i=t.get(a);a.table&&i&&ge(a,i,r,o)}if(!o.headerSeen)throw new Error("连续 Excel 逻辑表缺少明确表头来源")}function fe(e,t,o){let n=(e?.replace(/[\\/*?:[\]]/g," ").replace(/\s+/g," ").trim()||`Sheet${t+1}`).slice(0,31).replace(/^'+|'+$/g,"").trim()||`Sheet${t+1}`;n.toLowerCase()==="history"&&(n+=" 报表");let r=n,a=1;for(;o.has(r.toLowerCase());){const i=` (${++a})`;r=n.slice(0,31-i.length)+i}return o.add(r.toLowerCase()),r}function me(e){const t=new Set;function o(n,r,a,i){return n<=r?n:(t.has(a)||(e.push(i),t.add(a)),r)}return{column:n=>o(n,255,"column","Excel 单列宽度上限为 255 字符,超宽列已收敛至 255;单元格值完整保留,显示范围可能受限"),row:n=>o(n,409,"row","Excel 行高上限为 409pt,超高行已收敛至 409pt;单元格值完整保留,显示范围可能受限")}}async function we(e,t){const o=e.flow?ie(e.pages,e.continuous).map(i=>({comp:i,pageIndex:e.pages[0].index})):e.pages.flatMap(({page:i,index:s},l)=>i.components.filter(c=>!e.continuous||(c.pageAnchor!=="header"||l===0)&&(c.pageAnchor!=="footer"||l===e.pages.length-1)).map(c=>({comp:c,pageIndex:s}))),n=new Map;let r=1,a=0;for(const{comp:i}of o)if(i.grid){const s=h.resolveGridLayout(i.grid,i.widthMm,i.heightMm);n.set(i,s),r=Math.max(r,s.columns.length);const l=t(s.cells.length);l&&await l}else i.kind==="text"&&(a=Math.max(a,i.widthMm));if(r>16384)throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");return{components:o,grids:n,columnCount:r,textWidthMm:a}}function xe(e,t,o){const{page:n,index:r}=e.pages[0],a=t!==void 0&&t!=="auto";return(e.continuous||C(n))&&!a?{}:{pageSetup:{paperSize:ae(n,t,r,o),orientation:n.pageWidthMm>n.pageHeightMm?"landscape":"portrait",fitToPage:!0,...e.continuous?{fitToWidth:1,fitToHeight:0}:{}}}}function pe(e){const t=y(e.borderColor??e.lineColor),o={style:"thin",...t?{color:{argb:t}}:{}};return{...e.borderTop!==!1?{top:o}:{},...e.borderLeft!==!1?{left:o}:{},...e.borderBottom!==!1?{bottom:o}:{},...e.borderRight!==!1?{right:o}:{}}}function Me(e,t){e.alignment={horizontal:t.align??"left",vertical:t.verticalAlign??"middle",wrapText:!0};const o=y(t.backgroundColor);o&&(e.fill={type:"pattern",pattern:"solid",fgColor:{argb:o}}),e.border=pe(t),I(e,t)}function Ee(e,t){for(const[o,n]of t.columns.entries()){const r=e.sheet.getColumn(o+1),a=e.limits.column(p.mmToExcelColumnWidth(n.size));(r.width==null||r.width<a)&&(r.width=a)}}function be(e,t,o){for(const[n,r]of t.rows.entries()){const a=e.sheet.getRow(o+n),i=e.limits.row(r.size*F);(a.height==null||a.height<i)&&(a.height=i)}}function ye(e,t,o,n){const r=Math.max(1,Math.min(t.cell.colSpan??1,o.columns.length-t.ci)),a=Math.max(1,Math.min(t.cell.rowSpan??1,o.rows.length-t.ri));(r>1||a>1)&&e.mergeCells(n+t.ri,t.ci+1,n+t.ri+a-1,t.ci+r)}async function Se(e,t,o,n){if(n+o.rows.length-1>1048576)throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");be(e,o,n);for(const r of o.cells){const a=e.sheet.getCell(n+r.ri,r.ci+1);se(a,r.cell,e.valueMode,e.warnings);const i=K(r.cell,t.style);i&&(b(i.richText.map(c=>c.text).join(""),a.address),a.value=i);const s=t.grid?.paddingMm??.5;e.dataBars(e.sheet,r,n+r.ri,s);for(const c of r.cell.children??[])h.isImageBackedComponent(c)&&!c.grid&&e.images.write(e.sheet,c,n+r.ri,{leftMm:r.xMm+s+(r.cell.indentMm??0)+c.leftMm,offsetMm:s+c.topMm});Me(a,h.resolveGridCellStyle(t.style,r.cell)),r.cell.indentMm&&(a.alignment={...a.alignment,indent:Math.min(250,Math.max(1,Math.round(r.cell.indentMm/2.5)))}),ye(e.sheet,r,o,n);const l=e.schedule();l&&await l}return n+o.rows.length}function ve(e,t,o,n){const r=Array.isArray(t.lines)&&t.lines.length>0?t.lines.join(`
|
|
4
4
|
`):t.text??"",a=e.sheet.getRow(o),i=a.getCell(1);t.richParagraphs?.length||b(r,i.address),i.value=t.richParagraphs?.length?A(t.richParagraphs,t.style):r,typeof i.value=="object"&&i.value&&"richText"in i.value&&b(i.value.richText.map(l=>l.text).join(""),i.address),i.alignment={horizontal:t.style?.align??"left",vertical:t.style?.verticalAlign??"middle",wrapText:!0};const s=y(t.style?.backgroundColor);return s&&(i.fill={type:"pattern",pattern:"solid",fgColor:{argb:s}}),I(i,t.style),n>1&&e.sheet.mergeCells(o,1,o,n),a.height=e.limits.row(t.heightMm*F),o+1}function Ce(e,t,o){const n=t+o-1;e.views=[{state:"frozen",ySplit:n,xSplit:0}],e.pageSetup.printTitlesRow=`1:${n}`}async function ke(e,t,o,n){!t.grids.size&&t.textWidthMm>0&&(e.sheet.getColumn(1).width=e.limits.column(p.mmToExcelColumnWidth(t.textWidthMm)));for(const i of t.grids.values()){Ee(e,i);const s=e.schedule(i.columns.length);s&&await s}let r=1,a=!1;for(const{comp:i,pageIndex:s}of t.components){const l=o&&i.table?.role==="header";if(l&&a)continue;if(r>1048576)throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");const c=t.grids.get(i);if(c)l&&(Ce(e.sheet,r,c.rows.length),a=!0),r=await Se(e,i,c,r);else if(i.kind==="text")r=ve(e,i,r,t.columnCount);else if(h.isImageBackedComponent(i)){const d=p.importedImageOverlay(i,o),g=n.write(e.sheet,i,d?.row??r,d);d||(r=g)}else e.warnings.push(`page ${s+1} ${i.nid??i.kind}: 组件类型 ${i.kind} 暂不支持 xlsx 导出,已跳过`)}}function Be(e){if(e.maxDataBars!==void 0&&(!Number.isSafeInteger(e.maxDataBars)||e.maxDataBars<0||e.maxDataBars>1e5))throw new Error("xlsx maxDataBars 必须是 0–100000 的整数");if(e.valueMode!==void 0&&e.valueMode!=="text"&&e.valueMode!=="raw")throw new Error("xlsx valueMode 必须是 text 或 raw");if(e.paperSize!==void 0&&e.paperSize!=="auto"&&!Object.prototype.hasOwnProperty.call(S,e.paperSize))throw new Error("xlsx paperSize 必须是 auto、a3、a4 或 a5");if(e.sheetMode!==void 0&&!["auto","pages","continuous"].includes(e.sheetMode))throw new Error("xlsx sheetMode 必须是 auto、pages 或 continuous")}function Re(e,t,o){const n=H.collectOutputDiagnostics(e,"xlsx",t,o);return{diagnostics:n.entries,...t.diagnosticLimit===void 0?{}:{diagnosticSummary:n.snapshot()}}}function We(e,t,o,n,r){return{workbook:e,warnings:t.entries,...r===void 0?{}:{warningCount:t.total},...o,...n.length?{notes:n}:{}}}async function O(e,t={}){const o=R.snapshotAdditionalSheets(t.additionalSheets),n=R.snapshotSheetNames(t.sheetNames);Be(t),h.assertOutputActive(t.signal);const r=t.assetRegistry||t.assetRenderers?await q.resolvePlanAssets(e,{...t,format:"xlsx"}):{plan:e,diagnostics:[]};e=r.plan;const a=Re(e,t,r);await X(e,t.maxDataBars??1e4,t);const i=new p.ExcelJSRuntime.Workbook,s=h.createDiagnosticMessages(t.diagnosticLimit),l=Y(i,t,s),c=[],d=U(l,t.maxDataBars??1e4,c),g=me(s),m=he(e,t.sheetMode,s),u=m.length+(o?.length??0),f=new Set,E=h.createOutputScheduler(t);for(const[M,x]of m.entries()){const k=await we(x,E);x.continuous&&!x.flow&&ue(x,k.grids);const D=x.pages[0].page,B=n?.[M]??t.sheetName?.(M)??fe(x.title,M,f);f.add(B.toLowerCase());const z=i.addWorksheet(B,xe(x,t.paperSize,s)),L=t.valueMode??(C(D)||x.continuous||x.flow?"raw":"text");h.assertOutputActive(t.signal),await ke({sheet:z,warnings:s,limits:g,valueMode:L,schedule:E,images:l,dataBars:d},k,x.continuous,l),await h.outputCheckpoint(t,M+1,u)}return await Ae(i,o,t,m.length,u),We(i,s,a,c,t.diagnosticLimit)}async function Ae(e,t=[],o,n,r){const a=h.createOutputScheduler(o);for(const i of t){if(h.assertOutputActive(o.signal),e.worksheets.some(l=>l.name.toLowerCase()===i.name.toLowerCase()))throw new TypeError(`附加工作表名称已被报表使用 ${i.name}`);const s=e.addWorksheet(i.name);i.columnWidths&&(s.columns=i.columnWidths.map(l=>({width:l})));for(const l of i.rows){const c=s.addRow([...l]);c.alignment={vertical:"top",wrapText:!0};const d=a(l.length);d&&await d}await h.outputCheckpoint(o,++n,r)}h.assertOutputActive(o.signal)}async function Pe(e,t={}){let o=1;const n=t.onProgress?(i,s)=>{o=s+1,h.notifyOutputProgress(t,i,o)}:void 0,r=await O(e,{...t,onProgress:n});h.assertOutputActive(t.signal);const a=await r.workbook.xlsx.writeBuffer();return h.assertOutputActive(t.signal),h.notifyOutputProgress(t,o,o),{...r,buffer:a}}exports.importExcelTemplate=p.importExcelTemplate;exports.inspectExcelWorkbook=p.inspectExcelWorkbook;exports.openExcelWorkbook=p.openExcelWorkbook;exports.bindExcelTemplate=w.bindExcelTemplate;exports.createExcelBindingDocument=w.createExcelBindingDocument;exports.createExcelBindingSession=w.createExcelBindingSession;exports.createExcelRegionBindingDocument=w.createExcelRegionBindingDocument;exports.createExcelRegionBindingSession=w.createExcelRegionBindingSession;exports.excelBindingCellRange=w.excelBindingCellRange;exports.excelBindingRowRange=w.excelBindingRowRange;exports.getExcelSheetWindow=w.getExcelSheetWindow;exports.parseExcelBindingSession=w.parseExcelBindingSession;exports.parseExcelRegionBindingSession=w.parseExcelRegionBindingSession;exports.validateExcelBindingFields=w.validateExcelBindingFields;exports.validateExcelBindingRecipe=w.validateExcelBindingRecipe;exports.validateExcelBindingRegions=w.validateExcelBindingRegions;exports.validateExcelRegionBindings=w.validateExcelRegionBindings;exports.validateExcelRegionFields=w.validateExcelRegionFields;exports.validateExcelRegionGeometry=w.validateExcelRegionGeometry;exports.renderPlanToWorkbook=O;exports.renderPlanToXlsx=Pe;
|
package/dist/xlsx.d.cts
CHANGED
|
@@ -789,6 +789,31 @@ export declare interface ExcelBindingValidation {
|
|
|
789
789
|
total: number;
|
|
790
790
|
}
|
|
791
791
|
|
|
792
|
+
export declare interface ExcelImportDiagnostic extends ExcelImportDiagnosticLocation {
|
|
793
|
+
code: ExcelImportDiagnosticCode;
|
|
794
|
+
severity: "warning";
|
|
795
|
+
message: string;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
export declare type ExcelImportDiagnosticCode = "formula-shared" | "formula-cached" | "formula-result-missing" | "number-format" | "date-readonly" | "date-epoch" | "literal-placeholder" | "style-color" | "style-fill" | "style-border" | "style-alignment" | "font-decoration" | "rich-text-color" | "rich-text-decoration" | "hidden-column" | "hidden-row" | "paper-scale" | "hidden-sheet" | "protected-sheet" | "conditional-format" | "auto-filter" | "data-validation" | "image-omitted" | "image-segment" | "image-crop" | "image-transform" | "image-external" | "drawing-shape" | "chart" | "pivot" | "external-link" | "embedded-object";
|
|
799
|
+
|
|
800
|
+
/** Original workbook coordinates, independent of preview segmentation. Rows/columns are one-based. */
|
|
801
|
+
export declare interface ExcelImportDiagnosticLocation {
|
|
802
|
+
sheet?: string;
|
|
803
|
+
range?: string;
|
|
804
|
+
cell?: string;
|
|
805
|
+
row?: number;
|
|
806
|
+
column?: number;
|
|
807
|
+
/** OOXML part when a workbook feature cannot safely be attributed to a sheet. */
|
|
808
|
+
part?: string;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
export declare interface ExcelImportDiagnostics {
|
|
812
|
+
/** Bounded detail window (200); use summary counts for all feature occurrences. */
|
|
813
|
+
diagnostics?: readonly ExcelImportDiagnostic[];
|
|
814
|
+
diagnosticSummary?: DiagnosticSummary<ExcelImportDiagnostic>;
|
|
815
|
+
}
|
|
816
|
+
|
|
792
817
|
export declare interface ExcelImportedSheet {
|
|
793
818
|
name: string;
|
|
794
819
|
/** Original, one-based workbook position. */
|
|
@@ -832,7 +857,7 @@ export declare interface ExcelImportOptions extends OutputTaskOptions {
|
|
|
832
857
|
limits?: ExcelImportLimits;
|
|
833
858
|
}
|
|
834
859
|
|
|
835
|
-
export declare interface ExcelImportResult {
|
|
860
|
+
export declare interface ExcelImportResult extends ExcelImportDiagnostics {
|
|
836
861
|
template: ReportTemplate;
|
|
837
862
|
warnings: string[];
|
|
838
863
|
sheets: ExcelImportedSheet[];
|
|
@@ -1074,7 +1099,7 @@ export declare interface ExcelTemplateBindingResult {
|
|
|
1074
1099
|
warnings: string[];
|
|
1075
1100
|
}
|
|
1076
1101
|
|
|
1077
|
-
export declare interface ExcelWorkbookInspection {
|
|
1102
|
+
export declare interface ExcelWorkbookInspection extends ExcelImportDiagnostics {
|
|
1078
1103
|
sheets: ExcelWorkbookSheet[];
|
|
1079
1104
|
warnings: string[];
|
|
1080
1105
|
}
|
package/dist/xlsx.d.ts
CHANGED
|
@@ -789,6 +789,31 @@ export declare interface ExcelBindingValidation {
|
|
|
789
789
|
total: number;
|
|
790
790
|
}
|
|
791
791
|
|
|
792
|
+
export declare interface ExcelImportDiagnostic extends ExcelImportDiagnosticLocation {
|
|
793
|
+
code: ExcelImportDiagnosticCode;
|
|
794
|
+
severity: "warning";
|
|
795
|
+
message: string;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
export declare type ExcelImportDiagnosticCode = "formula-shared" | "formula-cached" | "formula-result-missing" | "number-format" | "date-readonly" | "date-epoch" | "literal-placeholder" | "style-color" | "style-fill" | "style-border" | "style-alignment" | "font-decoration" | "rich-text-color" | "rich-text-decoration" | "hidden-column" | "hidden-row" | "paper-scale" | "hidden-sheet" | "protected-sheet" | "conditional-format" | "auto-filter" | "data-validation" | "image-omitted" | "image-segment" | "image-crop" | "image-transform" | "image-external" | "drawing-shape" | "chart" | "pivot" | "external-link" | "embedded-object";
|
|
799
|
+
|
|
800
|
+
/** Original workbook coordinates, independent of preview segmentation. Rows/columns are one-based. */
|
|
801
|
+
export declare interface ExcelImportDiagnosticLocation {
|
|
802
|
+
sheet?: string;
|
|
803
|
+
range?: string;
|
|
804
|
+
cell?: string;
|
|
805
|
+
row?: number;
|
|
806
|
+
column?: number;
|
|
807
|
+
/** OOXML part when a workbook feature cannot safely be attributed to a sheet. */
|
|
808
|
+
part?: string;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
export declare interface ExcelImportDiagnostics {
|
|
812
|
+
/** Bounded detail window (200); use summary counts for all feature occurrences. */
|
|
813
|
+
diagnostics?: readonly ExcelImportDiagnostic[];
|
|
814
|
+
diagnosticSummary?: DiagnosticSummary<ExcelImportDiagnostic>;
|
|
815
|
+
}
|
|
816
|
+
|
|
792
817
|
export declare interface ExcelImportedSheet {
|
|
793
818
|
name: string;
|
|
794
819
|
/** Original, one-based workbook position. */
|
|
@@ -832,7 +857,7 @@ export declare interface ExcelImportOptions extends OutputTaskOptions {
|
|
|
832
857
|
limits?: ExcelImportLimits;
|
|
833
858
|
}
|
|
834
859
|
|
|
835
|
-
export declare interface ExcelImportResult {
|
|
860
|
+
export declare interface ExcelImportResult extends ExcelImportDiagnostics {
|
|
836
861
|
template: ReportTemplate;
|
|
837
862
|
warnings: string[];
|
|
838
863
|
sheets: ExcelImportedSheet[];
|
|
@@ -1074,7 +1099,7 @@ export declare interface ExcelTemplateBindingResult {
|
|
|
1074
1099
|
warnings: string[];
|
|
1075
1100
|
}
|
|
1076
1101
|
|
|
1077
|
-
export declare interface ExcelWorkbookInspection {
|
|
1102
|
+
export declare interface ExcelWorkbookInspection extends ExcelImportDiagnostics {
|
|
1078
1103
|
sheets: ExcelWorkbookSheet[];
|
|
1079
1104
|
warnings: string[];
|
|
1080
1105
|
}
|
package/dist/xlsx.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { y as v, m as b, a as W, r as R, b as T,
|
|
1
|
+
import { y as v, m as b, a as W, r as R, b as T, z as M, v as U, o as F, B as P, i as C } from "./diagnostic-collector-C-JBA016.js";
|
|
2
2
|
import { e as X } from "./index-CPh6tqge.js";
|
|
3
|
-
import { d as K } from "./data-bar-
|
|
4
|
-
import { e as J, E as V, m as I, i as q } from "./workbook-session-
|
|
5
|
-
import { a as et, b as tt, o as nt } from "./workbook-session-
|
|
3
|
+
import { d as K } from "./data-bar-DjOgTLqu.js";
|
|
4
|
+
import { e as J, E as V, m as I, i as q } from "./workbook-session-DRnMjIFK.js";
|
|
5
|
+
import { a as et, b as tt, o as nt } from "./workbook-session-DRnMjIFK.js";
|
|
6
6
|
import { c as Q } from "./media-Y90dHK9z.js";
|
|
7
|
-
import { c as Y } from "./capabilities-
|
|
8
|
-
import { r as Z } from "./assets-
|
|
7
|
+
import { c as Y } from "./capabilities-g0a2j9Yy.js";
|
|
8
|
+
import { r as Z } from "./assets-BFTP-0WR.js";
|
|
9
9
|
import { s as ee, a as te } from "./workbook-sheets-D4M7XXBh.js";
|
|
10
|
-
import { b as it, c as ot, a as at, d as st, e as lt, f as ct, g as dt, h as ht, p as ft, i as gt, v as ut, j as mt, k as wt, l as xt, m as pt, n as Mt } from "./region-binding-workflow-
|
|
10
|
+
import { b as it, c as ot, a as at, d as st, e as lt, f as ct, g as dt, h as ht, p as ft, i as gt, v as ut, j as mt, k as wt, l as xt, m as pt, n as Mt } from "./region-binding-workflow-FSyIZge8.js";
|
|
11
11
|
function ne(e) {
|
|
12
12
|
const t = X({ width: 1, height: 1, channels: 4, depth: 8, data: new Uint8Array([1, 3, 5].map((o) => parseInt(e.slice(o, o + 2), 16)).concat(89)) });
|
|
13
13
|
return `data:image/png;base64,${btoa(String.fromCharCode(...t))}`;
|
|
@@ -281,11 +281,11 @@ function ye(e, t, o) {
|
|
|
281
281
|
}
|
|
282
282
|
return n;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function A(e, t, o) {
|
|
285
285
|
return !e || e.length === t.length && e.every((n, i) => o(n, t[i]));
|
|
286
286
|
}
|
|
287
287
|
function Se(e, t, o, n) {
|
|
288
|
-
const i = e.table, a = t.columns.map((l) => l.size), r =
|
|
288
|
+
const i = e.table, a = t.columns.map((l) => l.size), r = A(n.keys, i.columnKeys, (l, c) => l === c), s = A(n.widths, a, (l, c) => Math.abs(l - c) <= 1e-3);
|
|
289
289
|
if (i.columnKeys.length !== a.length || !r || !s)
|
|
290
290
|
throw new Error(`page ${o + 1}: 连续 Excel 逻辑表 ${i.id} 的列结构或列宽不一致`);
|
|
291
291
|
if (n.keys ??= i.columnKeys, n.widths ??= a, i.role === "header") {
|
|
@@ -348,7 +348,7 @@ function $e(e, t, o) {
|
|
|
348
348
|
...e.continuous ? { fitToWidth: 1, fitToHeight: 0 } : {}
|
|
349
349
|
} };
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Pe(e) {
|
|
352
352
|
const t = E(e.borderColor ?? e.lineColor), o = { style: "thin", ...t ? { color: { argb: t } } : {} };
|
|
353
353
|
return {
|
|
354
354
|
...e.borderTop !== !1 ? { top: o } : {},
|
|
@@ -357,10 +357,10 @@ function Ae(e) {
|
|
|
357
357
|
...e.borderRight !== !1 ? { right: o } : {}
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function Ae(e, t) {
|
|
361
361
|
e.alignment = { horizontal: t.align ?? "left", vertical: t.verticalAlign ?? "middle", wrapText: !0 };
|
|
362
362
|
const o = E(t.backgroundColor);
|
|
363
|
-
o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border =
|
|
363
|
+
o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border = Pe(t), j(e, t);
|
|
364
364
|
}
|
|
365
365
|
function We(e, t) {
|
|
366
366
|
for (const [o, n] of t.columns.entries()) {
|
|
@@ -390,7 +390,7 @@ async function Fe(e, t, o, n) {
|
|
|
390
390
|
e.dataBars(e.sheet, i, n + i.ri, s);
|
|
391
391
|
for (const c of i.cell.children ?? [])
|
|
392
392
|
C(c) && !c.grid && e.images.write(e.sheet, c, n + i.ri, { leftMm: i.xMm + s + (i.cell.indentMm ?? 0) + c.leftMm, offsetMm: s + c.topMm });
|
|
393
|
-
|
|
393
|
+
Ae(a, T(t.style, i.cell)), i.cell.indentMm && (a.alignment = { ...a.alignment, indent: Math.min(250, Math.max(1, Math.round(i.cell.indentMm / 2.5))) }), Te(e.sheet, i, o, n);
|
|
394
394
|
const l = e.schedule();
|
|
395
395
|
l && await l;
|
|
396
396
|
}
|
|
@@ -484,11 +484,11 @@ async function Ge(e, t = [], o, n, i) {
|
|
|
484
484
|
async function Qe(e, t = {}) {
|
|
485
485
|
let o = 1;
|
|
486
486
|
const n = t.onProgress ? (r, s) => {
|
|
487
|
-
o = s + 1,
|
|
487
|
+
o = s + 1, P(t, r, o);
|
|
488
488
|
} : void 0, i = await je(e, { ...t, onProgress: n });
|
|
489
489
|
M(t.signal);
|
|
490
490
|
const a = await i.workbook.xlsx.writeBuffer();
|
|
491
|
-
return M(t.signal),
|
|
491
|
+
return M(t.signal), P(t, o, o), { ...i, buffer: a };
|
|
492
492
|
}
|
|
493
493
|
export {
|
|
494
494
|
it as bindExcelTemplate,
|