@agile-team/mach-report 2.26.1 → 2.27.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.
Files changed (155) hide show
  1. package/README.md +16 -5
  2. package/dist/ExcelBindingWizard-CnjjpYxD.cjs +1 -0
  3. package/dist/{ExcelBindingWizard-Bzndrp_z.js → ExcelBindingWizard-DAprCgn-.js} +4 -4
  4. package/dist/{ParamEditor-BrUrInJH.js → ParamEditor-CY9d8QZD.js} +3 -3
  5. package/dist/ParamEditor-CiVjpbc-.cjs +1 -0
  6. package/dist/ReportBatchPanel-0-Oymcdm.cjs +1 -0
  7. package/dist/{ReportBatchPanel-2mXS1uol.js → ReportBatchPanel-CDp7xRHp.js} +4 -4
  8. package/dist/ReportLabelStudio-CsyHqBco.cjs +1 -0
  9. package/dist/{ReportLabelStudio-BUKNmYUY.js → ReportLabelStudio-DtKxk9n0.js} +4 -4
  10. package/dist/ReportParamPanel-CoKcXzSy.cjs +1 -0
  11. package/dist/{ReportParamPanel-Czm3OPo_.js → ReportParamPanel-jKDJVar2.js} +2 -2
  12. package/dist/ReportPreview-D0UTiSpz.js +7507 -0
  13. package/dist/ReportPreview-ratPQxxZ.cjs +6 -0
  14. package/dist/ReportTemplateLibrary-CsUm6edm.cjs +1 -0
  15. package/dist/{ReportTemplateLibrary-ovj03u0F.js → ReportTemplateLibrary-qPQX0Dt_.js} +2 -2
  16. package/dist/RuleEditor-CJBibiLY.cjs +1 -0
  17. package/dist/{RuleEditor-4JTKq_N7.js → RuleEditor-Di-JZ2Lb.js} +6 -6
  18. package/dist/{TemplateOutlinePanel-DfFRc91I.js → TemplateOutlinePanel-D0mKfVWf.js} +3 -3
  19. package/dist/TemplateOutlinePanel-RiRgXnnH.cjs +1 -0
  20. package/dist/TemplateReusePanel-BdK91T7z.cjs +1 -0
  21. package/dist/{TemplateReusePanel-CmX1rq69.js → TemplateReusePanel-J6PvD2Sf.js} +3 -3
  22. package/dist/TemplateReviewPanel-B5yUgOgb.cjs +1 -0
  23. package/dist/{TemplateReviewPanel-BKMo7Qd7.js → TemplateReviewPanel-BlUbD2GY.js} +3 -3
  24. package/dist/analytics.cjs +1 -1
  25. package/dist/analytics.js +5 -5
  26. package/dist/artifact-integrity.json +112 -114
  27. package/dist/assets-CylgPA6P.cjs +1 -0
  28. package/dist/assets-Vt10jCtl.js +136 -0
  29. package/dist/auto-D3UNXBrM.cjs +1 -0
  30. package/dist/{auto-C7udkeAa.js → auto-Hq-xgrvS.js} +28 -25
  31. package/dist/{batch-DGCt44XM.js → batch-Be_NbW7U.js} +1 -1
  32. package/dist/{batch-DYcokH4v.cjs → batch-CI4ZpuoX.cjs} +1 -1
  33. package/dist/{charts-D-Vg-ak9.cjs → charts-Cy7muNWi.cjs} +1 -1
  34. package/dist/{charts-D48XCefN.js → charts-DLTz0OEG.js} +1 -1
  35. package/dist/{computed-BQgBrma-.cjs → computed-8nFyVnok.cjs} +1 -1
  36. package/dist/{computed-CH3NYPOW.js → computed-BR_O8uAv.js} +14 -20
  37. package/dist/{data-bar-DzceAVeR.cjs → data-bar--_aPWr-W.cjs} +1 -1
  38. package/dist/{data-bar-DjOgTLqu.js → data-bar-BVnzVbE9.js} +1 -1
  39. package/dist/designer-Bc5AXS38.cjs +2 -0
  40. package/dist/designer-CZqnLTyE.js +8350 -0
  41. package/dist/designer.cjs +1 -1
  42. package/dist/designer.d.cts +108 -1
  43. package/dist/designer.d.ts +108 -1
  44. package/dist/designer.js +1 -1
  45. package/dist/{diagnostic-collector-C-JBA016.js → diagnostic-collector-CZ8DV6wA.js} +208 -186
  46. package/dist/diagnostic-collector-DwMJWEHo.cjs +1 -0
  47. package/dist/{dom-DgWc-DY1.js → dom-CbOWY7KE.js} +5 -5
  48. package/dist/dom-VuLh_fhL.cjs +1 -0
  49. package/dist/{encoding-tWc2Wn89.cjs → encoding-D0ITsCCp.cjs} +1 -1
  50. package/dist/{encoding-D480EM2r.js → encoding-TbA3oQLr.js} +2 -2
  51. package/dist/{execution-result-Ba65gieT.js → execution-result-BUPPNlaS.js} +3 -3
  52. package/dist/{execution-result-7sG_mdcD.cjs → execution-result-BgZtqlOT.cjs} +1 -1
  53. package/dist/{font-loader-CHmEwkHl.js → font-loader-BSRR-a0C.js} +1 -1
  54. package/dist/{font-loader-BIxme_9g.cjs → font-loader-BZ4CRPys.cjs} +1 -1
  55. package/dist/{grid-strokes-DsoICRjZ.js → grid-strokes-CovSH3A2.js} +1 -1
  56. package/dist/{grid-strokes-RFMR91jn.cjs → grid-strokes-G5omPT3s.cjs} +1 -1
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.js +23 -23
  59. package/dist/{json-snapshot-BZ0CIQln.js → json-snapshot-DRQmh_k5.js} +718 -683
  60. package/dist/json-snapshot-HR8bez8j.cjs +2 -0
  61. package/dist/{matrix-CB9TqTEy.js → matrix-6wjFVN0Z.js} +149 -142
  62. package/dist/matrix-DeA6__cd.cjs +1 -0
  63. package/dist/media-IV_r4Sp7.cjs +1 -0
  64. package/dist/media-jiLdCn3i.js +208 -0
  65. package/dist/{pdf-DTR7fAIr.js → pdf-BqnoP1L_.js} +14 -15
  66. package/dist/{pdf-d9oJ6V0P.cjs → pdf-Ddm0HCuT.cjs} +48 -48
  67. package/dist/pdf.cjs +1 -1
  68. package/dist/pdf.js +2 -2
  69. package/dist/{plugin-OKDFQFS4.js → plugin-CK8Mm9VY.js} +1 -1
  70. package/dist/{plugin-B7Bi-1te.cjs → plugin-CmkPYdRI.cjs} +1 -1
  71. package/dist/{prefill-C8fF91JB.js → prefill-BqbuktRt.js} +3 -3
  72. package/dist/{prefill-C_Bf_AMo.cjs → prefill-DPLV68I7.cjs} +1 -1
  73. package/dist/prepared-Cl7C69N7.cjs +1 -0
  74. package/dist/{prepared-DhgQ0d-h.js → prepared-V7tYf1qj.js} +68 -64
  75. package/dist/{protocol-CZ-BILne.cjs → protocol-BVhKnBmX.cjs} +1 -1
  76. package/dist/{protocol-DHO91-Jt.js → protocol-Bf33Gu9J.js} +3 -3
  77. package/dist/{record-bindings-KEs-DKCS.cjs → record-bindings-DVs_g_No.cjs} +1 -1
  78. package/dist/{record-bindings-DBrCu6zO.js → record-bindings-hxJqcLSK.js} +3 -3
  79. package/dist/{region-binding-workflow-ikpY1Kbw.cjs → region-binding-workflow-Bu31bqCr.cjs} +1 -1
  80. package/dist/{region-binding-workflow-FSyIZge8.js → region-binding-workflow-DRvX25XH.js} +2 -2
  81. package/dist/report-encoding-worker.cjs +1 -1
  82. package/dist/report-encoding-worker.js +1 -1
  83. package/dist/{rich-text-layout-BYbIc3eJ.cjs → rich-text-layout-6VphrIcj.cjs} +1 -1
  84. package/dist/{rich-text-layout-BtygMWZC.js → rich-text-layout-BCdxMT4m.js} +1 -1
  85. package/dist/{runtime-BsvAqz4a.js → runtime-ChdUbPvs.js} +9 -9
  86. package/dist/{runtime-B5HG8poy.cjs → runtime-D2noLfgC.cjs} +1 -1
  87. package/dist/sbom.cdx.json +1 -1
  88. package/dist/server-node.cjs +5 -5
  89. package/dist/server-node.js +2099 -1959
  90. package/dist/server.cjs +1 -1
  91. package/dist/server.js +17 -13
  92. package/dist/sha256-C26wdjDi.cjs +1 -0
  93. package/dist/sha256-D-msitGX.js +166 -0
  94. package/dist/style.css +1 -1
  95. package/dist/{template-catalog-BbrN9dgu.js → template-catalog-CZfnMXKc.js} +4 -4
  96. package/dist/template-catalog-Dv4sOYaB.cjs +1 -0
  97. package/dist/{template-fragments-CUTE8-_I.js → template-fragments-BO6i19kt.js} +3 -3
  98. package/dist/{template-fragments-cyAQu7aw.cjs → template-fragments-CTfJeHoM.cjs} +1 -1
  99. package/dist/{template-registry-PSuLsnyq.js → template-registry-CIaC6qBW.js} +168 -171
  100. package/dist/template-registry-CKo-bogM.cjs +1 -0
  101. package/dist/template-serialization-Cb1ospyK.js +367 -0
  102. package/dist/template-serialization-D4Fofl9c.cjs +1 -0
  103. package/dist/{textwrap-LhJkHWb1.cjs → textwrap-BYSqmGGV.cjs} +1 -1
  104. package/dist/{textwrap-Bt_tnI6V.js → textwrap-CGjFy7gf.js} +1 -1
  105. package/dist/usePopoverBounds-C3hn7F1s.js +84 -0
  106. package/dist/usePopoverBounds-mJhJ-VqG.cjs +1 -0
  107. package/dist/vue/async.d.cts +28 -0
  108. package/dist/vue/async.d.ts +28 -0
  109. package/dist/vue/index.d.cts +36 -0
  110. package/dist/vue/index.d.ts +36 -0
  111. package/dist/vue-async.cjs +1 -1
  112. package/dist/vue-async.js +3 -3
  113. package/dist/vue.cjs +1 -1
  114. package/dist/vue.js +164 -157
  115. package/dist/{workbook-session-BJfZVp4q.cjs → workbook-session-DL3uBAl8.cjs} +1 -1
  116. package/dist/{workbook-session-DRnMjIFK.js → workbook-session-nkvroJUE.js} +2 -2
  117. package/dist/worker.cjs +1 -1
  118. package/dist/worker.js +4 -4
  119. package/dist/xlsx.cjs +4 -4
  120. package/dist/xlsx.js +28 -29
  121. package/package.json +1 -1
  122. package/dist/ExcelBindingWizard-D1LZxm93.cjs +0 -1
  123. package/dist/ParamEditor-BTIx9UDt.cjs +0 -1
  124. package/dist/ReportBatchPanel-CU2BbpBg.cjs +0 -1
  125. package/dist/ReportLabelStudio-BXKE0GVs.cjs +0 -1
  126. package/dist/ReportParamPanel-Chxu4MTx.cjs +0 -1
  127. package/dist/ReportPreview-C9c0Rp7Y.js +0 -7380
  128. package/dist/ReportPreview-CIMR4ERo.cjs +0 -6
  129. package/dist/ReportTemplateLibrary-tv1sNa78.cjs +0 -1
  130. package/dist/RuleEditor-CvyjPyR6.cjs +0 -1
  131. package/dist/TemplateOutlinePanel-hb8cKkKR.cjs +0 -1
  132. package/dist/TemplateReusePanel-CR5jF00y.cjs +0 -1
  133. package/dist/TemplateReviewPanel-BU35FHwG.cjs +0 -1
  134. package/dist/_plugin-vue_export-helper-8SL1F89S.js +0 -53
  135. package/dist/_plugin-vue_export-helper-BLmdZLlg.cjs +0 -1
  136. package/dist/assets-BFTP-0WR.js +0 -137
  137. package/dist/assets-CZiZhTf2.cjs +0 -1
  138. package/dist/auto-CXd2E2aZ.cjs +0 -1
  139. package/dist/capabilities-D8UU2clQ.cjs +0 -1
  140. package/dist/capabilities-g0a2j9Yy.js +0 -125
  141. package/dist/designer-CEMTZomv.cjs +0 -2
  142. package/dist/designer-_IKm_n5N.js +0 -8002
  143. package/dist/diagnostic-collector-wASg6Fzs.cjs +0 -1
  144. package/dist/dom-Fk4NF-gN.cjs +0 -1
  145. package/dist/json-snapshot-DGFeI30h.cjs +0 -2
  146. package/dist/matrix-CcqYOuq_.cjs +0 -1
  147. package/dist/media-B7vnpD8k.cjs +0 -1
  148. package/dist/media-Y90dHK9z.js +0 -70
  149. package/dist/prepared-BLhV7vdE.cjs +0 -1
  150. package/dist/sha256-BDQ1Qk7A.js +0 -158
  151. package/dist/sha256-DgZAKXqI.cjs +0 -1
  152. package/dist/template-catalog-DDH-5J57.cjs +0 -1
  153. package/dist/template-registry-D24Z8aQf.cjs +0 -1
  154. package/dist/template-serialization-BOUidUlh.cjs +0 -1
  155. package/dist/template-serialization-BgGWYV_1.js +0 -307
@@ -1,14 +1,14 @@
1
- import { G as Q, x as X } from "./diagnostic-collector-C-JBA016.js";
2
- import { d as Y, m as O, s as T, a as j, e as Z, f as ee, g as te, r as ae } from "./prepared-DhgQ0d-h.js";
3
- import { Q as S, R as h, S as se, N as F, H as k, n as re, T as oe, M as ne, J as ie, o as ce } from "./json-snapshot-BZ0CIQln.js";
1
+ import { G as Q, x as X } from "./diagnostic-collector-CZ8DV6wA.js";
2
+ import { d as Y, m as O, s as T, a as j, e as Z, f as ee, g as te, r as ae } from "./prepared-V7tYf1qj.js";
3
+ import { Q as S, R as h, S as se, N as F, H as k, n as re, T as oe, M as ne, J as ie, o as ce } from "./json-snapshot-DRQmh_k5.js";
4
4
  import { g as M } from "./report-params-D9tBuM9B.js";
5
5
  import { l as _, r as de, R as me } from "./param-validation-CnDEd2l-.js";
6
- import { t as P, b as x, D as le, v as pe, c as B, R as I } from "./sha256-BDQ1Qk7A.js";
7
- import { b as ge } from "./template-registry-PSuLsnyq.js";
8
- import { T as fe } from "./template-serialization-BgGWYV_1.js";
9
- import { r as A } from "./assets-BFTP-0WR.js";
10
- import { a as J, b as ue } from "./execution-result-Ba65gieT.js";
11
- import { f as xe, P as we, e as ye } from "./record-bindings-DBrCu6zO.js";
6
+ import { t as P, b as x, D as le, v as pe, c as B, R as I } from "./sha256-D-msitGX.js";
7
+ import { b as ge } from "./template-registry-CIaC6qBW.js";
8
+ import { T as fe } from "./template-serialization-Cb1ospyK.js";
9
+ import { r as A } from "./assets-Vt10jCtl.js";
10
+ import { a as J, b as ue } from "./execution-result-BUPPNlaS.js";
11
+ import { f as xe, P as we, e as ye } from "./record-bindings-hxJqcLSK.js";
12
12
  function he(e) {
13
13
  let t = `$.pages.${e.pageIndex}`;
14
14
  if (e.componentIndex < 0) return t;
@@ -1 +1 @@
1
- "use strict";var W=Object.create;var A=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var K=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!H.call(e,s)&&s!==r&&A(e,s,{get:()=>t[s],enumerable:!(n=X(t,s))||n.enumerable});return e};var I=(e,t,r)=>(r=e!=null?W(Q(e)):{},K(t||!e||!e.__esModule?A(r,"default",{value:e,enumerable:!0}):r,e));const B=require("./diagnostic-collector-wASg6Fzs.cjs"),R=require("./prepared-BLhV7vdE.cjs"),p=require("./json-snapshot-DGFeI30h.cjs"),F=require("./report-params-VTg8MoCp.cjs"),C=require("./param-validation-C-8sRJLq.cjs"),i=require("./sha256-DgZAKXqI.cjs"),Y=require("./template-registry-D24Z8aQf.cjs"),Z=require("./template-serialization-BOUidUlh.cjs"),q=require("./assets-CZiZhTf2.cjs"),k=require("./execution-result-7sG_mdcD.cjs"),L=require("./record-bindings-KEs-DKCS.cjs");function ee(e){let t=`$.pages.${e.pageIndex}`;if(e.componentIndex<0)return t;t+=`.components.${e.componentIndex}`;const r=e.componentPath??[];for(let n=0;n+1<r.length;n+=3)t+=`.grid.cells.${r[n]}.${r[n+1]}`,r[n+2]!==void 0&&(t+=`.children.${r[n+2]}`);return t}function S(e=[]){return e.map(t=>({...t,path:ee(t)}))}function te(e,t){const r=B.createDiagnosticCollector(t??(e.diagnosticSummary?B.DEFAULT_DIAGNOSTIC_LIMIT:void 0));return e.diagnosticSummary?r.merge(e.diagnosticSummary):e.diagnostics.forEach(n=>r.push(n)),r}function $(e,t){t.diagnosticSummary?e.merge({...t.diagnosticSummary,entries:S(t.diagnosticSummary.entries)}):S(t.diagnostics).forEach(r=>e.push(r))}function se(e){const t=e.prepared.diagnosticSummary?.counts,r=t?!!(t["asset-render-failed"]||t["asset-budget-exceeded"]):e.prepared.diagnostics.some(n=>n.code==="asset-render-failed"||n.code==="asset-budget-exceeded");if(e.fidelity==="strict"&&r)throw new p.ReportSourceError("validate","严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。")}async function _(e,t,r=Date.now()){const n=e.prepared;R.assertPreparedOutputBudget(e,t),se(e);const s=te(n,e.diagnosticLimit),a=e.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;i.throwIfAborted(e.signal);const l=e.pdf?.customFontFaces??(e.pdf?.customFontBytes?{regular:e.pdf.customFontBytes}:void 0),m=a&&l?a.createFontBytesMeasurer(l):void 0,u=p.createReportTaskReporter(e),c=await u.run("encode",async()=>{let g;const y={fidelity:e.fidelity,diagnosticLimit:e.diagnosticLimit??(n.diagnosticSummary?B.DEFAULT_DIAGNOSTIC_LIMIT:void 0),signal:e.signal,onProgress:(o,w)=>u.progress("encode",o,w)};if(e.format==="pdf"){i.throwIfAborted(e.signal);const o=await a.renderPlanToPdf(n.plan,{...e.pdf,...m?{measurer:m}:{},...y});g=o.bytes,$(s,o),R.mergeDiagnosticMessages(s,"pdf-fidelity",o.fidelityWarnings,"warning",o.fidelityWarningCount),R.mergeDiagnosticMessages(s,"pdf-page",o.pageErrors,"error",o.pageErrorCount),o.unsupportedTextCount&&s.push({code:"pdf-font",message:`${o.unsupportedTextCount} 段文本包含当前字体不支持的字符`,severity:"warning"})}else{const{renderPlanToXlsx:o}=await import("@agile-team/mach-report/xlsx");i.throwIfAborted(e.signal);const w=await o(n.plan,{...e.xlsx,...y});g=new Uint8Array(w.buffer),$(s,w),R.mergeDiagnosticMessages(s,"xlsx-fidelity",w.warnings,"warning",w.warningCount),w.notes?.forEach(P=>s.push({code:"xlsx-snapshot",message:P,severity:"info"}))}return i.throwIfAborted(e.signal),g});i.assertBudget(t,"maxOutputBytes",c.byteLength);const{plan:h,...x}=n;return{...x,diagnostics:s.entries,...e.diagnosticLimit===void 0&&!n.diagnosticSummary?{}:{diagnosticSummary:s.snapshot()},bytes:c,format:e.format,contentType:e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",stats:{...x.stats,durationMs:Date.now()-r,outputBytes:c.byteLength}}}function j(e){return{...e,reportIds:[...e.reportIds],...e.params?{params:{...e.params}}:{}}}function U(e,t){if(t.length===0)throw new p.ReportSourceError("config","缺少报表 ID");return t.map(r=>{if(!Object.prototype.hasOwnProperty.call(e,r))throw new p.ReportSourceError("config",`未注册报表 ${r}`);return e[r]})}function T(e){return e.grid?.cells.reduce((t,r)=>t+r.reduce((n,s)=>n+(s?1+(s.children?.reduce((a,l)=>a+T(l),0)??0):0),0),0)??0}function N(e,t,r,n){return e.pages.reduce((s,a)=>s+a.components.reduce((l,m)=>m.kind!=="list"?l+(r?0:T(m)):!!m.matrix!==r?l:l+p.estimateListLayoutCells(m,t,n),0),0)}function re(e,t=Object.keys(e)){return U(e,t).map((r,n)=>{const s=t[n],a=F.getReportParamDefs(e,[s]);return{id:s,params:JSON.parse(JSON.stringify(a)),paramsSchema:C.reportParamsJsonSchema(a),datasetsSchema:Object.fromEntries(Object.entries(r.dataSchema??{}).map(([l,m])=>[l,p.templateDatasetJsonSchema(typeof r.template=="function"?void 0:r.template,l,m)])),capabilities:{save:!!r.provider?.save,export:!!r.provider?.export,templates:!!r.provider?.templates}}})}function V(e,t){U(e,t.reportIds);const r=C.validateReportParams(F.getReportParamDefs(e,t.reportIds),t.params),n=t.reportIds.flatMap(a=>C.validateReportParams(F.getReportParamDefs(e,[a]),t.params).issues),s=new Map(n.map(a=>[JSON.stringify(a),a]));return{...r,ok:s.size===0,issues:[...s.values()]}}function O(e,t){const r=Y.validateRenderPlan(e.plan);if(!r.ok)throw new p.ReportSourceError("validate",`执行器返回无效计划:${r.errors[0]?.path}`);const n=e.plan.pages.length,s=e.plan.pages.reduce((a,l)=>a+l.components.reduce((m,u)=>m+T(u),0),0);return i.assertBudget(t,"maxRows",e.stats.rows),i.assertBudget(t,"maxPages",n),i.assertBudget(t,"maxCells",s),{...e,stats:{...e.stats,pages:n,cells:s}}}function J(e,t){const r=V(e.reports,t);if(!r.ok)throw new C.ReportParamValidationError(r.issues)}function ae(e){const t={...i.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget};i.validateBudget(t);const r=async(s,a)=>{const l=Date.now();let m=0,u=0;const c=B.createDiagnosticCollector(s.diagnosticLimit),h={},x=[],g=Object.fromEntries(Object.entries(e.reports).map(([d,f])=>[d,{...f,pagination:{...e.pagination,...f.pagination,...a?{measurer:a}:{}},dataValidation:{...f.dataValidation,maxRows:Math.min(t.maxRows??1e5,f.dataValidation?.maxRows??1/0),maxCells:Math.min(t.maxCells??2e6,f.dataValidation?.maxCells??1/0)}}])),o=await p.createReportSource(g,p.inspectOwnedSource({maxPages:t.maxPages,maxCells:t.maxCells,maxChartComponents:t.maxChartComponents,onDatasets:(d,f,v)=>{try{m+=p.templateDatasetRowCount(v,f,{maxRows:t.maxRows,signal:s.signal})}catch(b){throw b instanceof Z.TreeRowLimitError?new i.ReportRuntimeError("budget",b.message,"$.budget.maxRows"):b}i.assertBudget(t,"maxRows",m),u+=N(v,f,!1,g[d]?.pagination),i.assertBudget(t,"maxCells",u)}},(d,f,v)=>{u+=N(v,f,!0,g[d]?.pagination),i.assertBudget(t,"maxCells",u)}))({...s,params:s.params??{},onWarning:d=>c.push({code:"layout",message:d,severity:"warning"}),onQueryResult:(d,f,v=0)=>{const b=p.reportOccurrenceScope(v,d);Object.defineProperty(h,d,{value:{revision:f.revision,sourceToken:f.sourceToken},enumerable:!0,writable:!0}),x.push({reportId:d,reportIndex:v,reportScope:b,...f.revision===void 0?{}:{revision:f.revision},...f.sourceToken===void 0?{}:{sourceToken:f.sourceToken}}),(f.diagnostics??[]).forEach(E=>c.push({...E,...E.target?{target:{...E.target,reportScope:b,...E.target.tableId?{tableId:JSON.stringify([v,d,E.target.tableId])}:{}}}:{}}))}}).catch(d=>{throw d instanceof p.ReportSourceError&&d.cause instanceof L.PaginatePageLimitError?new i.ReportRuntimeError("budget",d.cause.message,"$.budget.maxPages"):d instanceof p.ReportSourceError&&d.cause instanceof L.PaginateCellLimitError?new i.ReportRuntimeError("budget",d.cause.message,"$.budget.maxCells"):d instanceof p.ReportSourceError&&d.cause instanceof L.PaginateChartComponentLimitError?new i.ReportRuntimeError("budget",d.cause.message,"$.budget.maxChartComponents"):d});i.throwIfAborted(s.signal);const w=e.assets?await p.createReportTaskReporter(s).run("assets",()=>q.resolvePlanAssets(o,{...e.assets,diagnosticLimit:s.diagnosticLimit,signal:s.signal})):{plan:o,diagnostics:[]},P=w.plan;w.diagnosticSummary?c.merge({...w.diagnosticSummary,entries:S(w.diagnosticSummary.entries)}):S(w.diagnostics).forEach(d=>c.push(d));const M=P.pages.reduce((d,f)=>d+f.components.reduce((v,b)=>v+T(b),0),0);i.assertBudget(t,"maxPages",P.pages.length),i.assertBudget(t,"maxCells",M);const D=R.reportFontFingerprint(s.pdf),G=e.pagination?.measurer||Object.values(e.reports).some(d=>d.pagination?.measurer);return{plan:P,diagnostics:c.entries,...s.diagnosticLimit===void 0?{}:{diagnosticSummary:c.snapshot()},revisions:h,sources:x,layout:{textMetrics:D?"font-bytes":G?"provided":"heuristic",...D?{fontFingerprint:D}:{}},stats:{rows:m,pages:P.pages.length,cells:M,durationMs:Date.now()-l}}},n=async s=>{const a=Date.now();if(s.format!=="pdf"&&s.format!=="xlsx")throw new p.ReportSourceError("config","不支持的报表导出格式");const l=s.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;i.throwIfAborted(s.signal);const m=s.pdf?.customFontFaces??(s.pdf?.customFontBytes?{regular:s.pdf.customFontBytes}:void 0),u=l&&m?l.createFontBytesMeasurer(m):void 0,c=await r(s,u);return i.throwIfAborted(s.signal),_({...s,prepared:c},t,a)};return{describe:s=>re(e.reports,s),validate:s=>V(e.reports,s),prepare:s=>i.controlled(s.signal,t.maxDurationMs,async a=>{const{signal:l,onEvent:m,...u}=j(s),c={...u,...u.pdf?{pdf:R.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??p.reportTaskId()},h=m?w=>p.notifyReportTaskEvent(m,w,a):void 0,x={...c,signal:a,onEvent:h};p.createReportTaskReporter(x).runSync("validate",()=>J(e,c));let g;const y=c.pdf?.customFontFaces??(c.pdf?.customFontBytes?{regular:c.pdf.customFontBytes}:void 0);if(!e.executor&&y){const w=await import("@agile-team/mach-report/pdf");i.throwIfAborted(a),g=w.createFontBytesMeasurer(y)}const o=e.executor?await e.executor.prepare(c,a,h):await r(x,g);return e.executor&&k.assertReportPreparedMetadata(o),O(o,t)}),exportPrepared:s=>i.controlled(s.signal,t.maxDurationMs,async a=>{const l=Date.now(),{signal:m,onEvent:u,...c}=s,h=O(R.snapshotPreparedReport(s.prepared,t.maxPreparedBytes??64e6,a),t),x={...c,xlsx:R.snapshotXlsxOptions(c.xlsx),prepared:h,...c.pdf?{pdf:R.snapshotPdfFonts(c.pdf)}:{},taskId:c.taskId??p.reportTaskId()};if(x.format!=="pdf"&&x.format!=="xlsx")throw new p.ReportSourceError("config","不支持的报表导出格式");const g=u?o=>p.notifyReportTaskEvent(u,o,a):void 0;if(e.executor){if(!e.executor.exportPrepared)throw new p.ReportSourceError("config","执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");const o=await e.executor.exportPrepared(x,a,g);return k.assertReportExportResult(o,x.format),i.assertBudget(t,"maxRows",o.stats.rows),i.assertBudget(t,"maxPages",o.stats.pages),i.assertBudget(t,"maxCells",o.stats.cells),i.assertBudget(t,"maxOutputBytes",o.bytes.byteLength),{...o,stats:{...o.stats,outputBytes:o.bytes.byteLength}}}const y={...x,signal:a,onEvent:g};if(p.createReportTaskReporter(y).runSync("validate",()=>R.checkPreparedFont(y)),e.assets){const o=await p.createReportTaskReporter(y).run("assets",()=>q.resolvePlanAssets(h.plan,{...e.assets,diagnosticLimit:s.diagnosticLimit,signal:a}));h.plan=o.plan,R.appendPreparedDiagnostics(h,S(o.diagnostics),o.diagnosticSummary?{...o.diagnosticSummary,entries:S(o.diagnosticSummary.entries)}:void 0,s.diagnosticLimit)}return _(y,t,l)}),export:s=>i.controlled(s.signal,t.maxDurationMs,async a=>{const{signal:l,onEvent:m,...u}=j(s),c={...u,xlsx:R.snapshotXlsxOptions(u.xlsx),...u.pdf?{pdf:R.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??p.reportTaskId()},h=m?y=>p.notifyReportTaskEvent(m,y,a):void 0,x={...c,signal:a,onEvent:h};if(p.createReportTaskReporter(x).runSync("validate",()=>J(e,c)),c.format!=="pdf"&&c.format!=="xlsx")throw new p.ReportSourceError("config","不支持的报表导出格式");const g=e.executor?await e.executor.export(c,a,h):await n(x);return e.executor&&k.assertReportExportResult(g,c.format),i.assertBudget(t,"maxRows",g.stats.rows),i.assertBudget(t,"maxPages",g.stats.pages),i.assertBudget(t,"maxCells",g.stats.cells),i.assertBudget(t,"maxOutputBytes",g.bytes.byteLength),{...g,stats:{...g.stats,outputBytes:g.bytes.byteLength}}})}}exports.createReportRuntime=ae;exports.enforcePrepared=O;
1
+ "use strict";var W=Object.create;var A=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var K=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!H.call(e,s)&&s!==r&&A(e,s,{get:()=>t[s],enumerable:!(n=X(t,s))||n.enumerable});return e};var I=(e,t,r)=>(r=e!=null?W(Q(e)):{},K(t||!e||!e.__esModule?A(r,"default",{value:e,enumerable:!0}):r,e));const B=require("./diagnostic-collector-DwMJWEHo.cjs"),R=require("./prepared-Cl7C69N7.cjs"),p=require("./json-snapshot-HR8bez8j.cjs"),F=require("./report-params-VTg8MoCp.cjs"),C=require("./param-validation-C-8sRJLq.cjs"),i=require("./sha256-C26wdjDi.cjs"),Y=require("./template-registry-CKo-bogM.cjs"),Z=require("./template-serialization-D4Fofl9c.cjs"),q=require("./assets-CylgPA6P.cjs"),k=require("./execution-result-BgZtqlOT.cjs"),L=require("./record-bindings-DVs_g_No.cjs");function ee(e){let t=`$.pages.${e.pageIndex}`;if(e.componentIndex<0)return t;t+=`.components.${e.componentIndex}`;const r=e.componentPath??[];for(let n=0;n+1<r.length;n+=3)t+=`.grid.cells.${r[n]}.${r[n+1]}`,r[n+2]!==void 0&&(t+=`.children.${r[n+2]}`);return t}function S(e=[]){return e.map(t=>({...t,path:ee(t)}))}function te(e,t){const r=B.createDiagnosticCollector(t??(e.diagnosticSummary?B.DEFAULT_DIAGNOSTIC_LIMIT:void 0));return e.diagnosticSummary?r.merge(e.diagnosticSummary):e.diagnostics.forEach(n=>r.push(n)),r}function $(e,t){t.diagnosticSummary?e.merge({...t.diagnosticSummary,entries:S(t.diagnosticSummary.entries)}):S(t.diagnostics).forEach(r=>e.push(r))}function se(e){const t=e.prepared.diagnosticSummary?.counts,r=t?!!(t["asset-render-failed"]||t["asset-budget-exceeded"]):e.prepared.diagnostics.some(n=>n.code==="asset-render-failed"||n.code==="asset-budget-exceeded");if(e.fidelity==="strict"&&r)throw new p.ReportSourceError("validate","严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。")}async function _(e,t,r=Date.now()){const n=e.prepared;R.assertPreparedOutputBudget(e,t),se(e);const s=te(n,e.diagnosticLimit),a=e.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;i.throwIfAborted(e.signal);const l=e.pdf?.customFontFaces??(e.pdf?.customFontBytes?{regular:e.pdf.customFontBytes}:void 0),m=a&&l?a.createFontBytesMeasurer(l):void 0,u=p.createReportTaskReporter(e),c=await u.run("encode",async()=>{let g;const y={fidelity:e.fidelity,diagnosticLimit:e.diagnosticLimit??(n.diagnosticSummary?B.DEFAULT_DIAGNOSTIC_LIMIT:void 0),signal:e.signal,onProgress:(o,w)=>u.progress("encode",o,w)};if(e.format==="pdf"){i.throwIfAborted(e.signal);const o=await a.renderPlanToPdf(n.plan,{...e.pdf,...m?{measurer:m}:{},...y});g=o.bytes,$(s,o),R.mergeDiagnosticMessages(s,"pdf-fidelity",o.fidelityWarnings,"warning",o.fidelityWarningCount),R.mergeDiagnosticMessages(s,"pdf-page",o.pageErrors,"error",o.pageErrorCount),o.unsupportedTextCount&&s.push({code:"pdf-font",message:`${o.unsupportedTextCount} 段文本包含当前字体不支持的字符`,severity:"warning"})}else{const{renderPlanToXlsx:o}=await import("@agile-team/mach-report/xlsx");i.throwIfAborted(e.signal);const w=await o(n.plan,{...e.xlsx,...y});g=new Uint8Array(w.buffer),$(s,w),R.mergeDiagnosticMessages(s,"xlsx-fidelity",w.warnings,"warning",w.warningCount),w.notes?.forEach(P=>s.push({code:"xlsx-snapshot",message:P,severity:"info"}))}return i.throwIfAborted(e.signal),g});i.assertBudget(t,"maxOutputBytes",c.byteLength);const{plan:h,...x}=n;return{...x,diagnostics:s.entries,...e.diagnosticLimit===void 0&&!n.diagnosticSummary?{}:{diagnosticSummary:s.snapshot()},bytes:c,format:e.format,contentType:e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",stats:{...x.stats,durationMs:Date.now()-r,outputBytes:c.byteLength}}}function j(e){return{...e,reportIds:[...e.reportIds],...e.params?{params:{...e.params}}:{}}}function U(e,t){if(t.length===0)throw new p.ReportSourceError("config","缺少报表 ID");return t.map(r=>{if(!Object.prototype.hasOwnProperty.call(e,r))throw new p.ReportSourceError("config",`未注册报表 ${r}`);return e[r]})}function T(e){return e.grid?.cells.reduce((t,r)=>t+r.reduce((n,s)=>n+(s?1+(s.children?.reduce((a,l)=>a+T(l),0)??0):0),0),0)??0}function N(e,t,r,n){return e.pages.reduce((s,a)=>s+a.components.reduce((l,m)=>m.kind!=="list"?l+(r?0:T(m)):!!m.matrix!==r?l:l+p.estimateListLayoutCells(m,t,n),0),0)}function re(e,t=Object.keys(e)){return U(e,t).map((r,n)=>{const s=t[n],a=F.getReportParamDefs(e,[s]);return{id:s,params:JSON.parse(JSON.stringify(a)),paramsSchema:C.reportParamsJsonSchema(a),datasetsSchema:Object.fromEntries(Object.entries(r.dataSchema??{}).map(([l,m])=>[l,p.templateDatasetJsonSchema(typeof r.template=="function"?void 0:r.template,l,m)])),capabilities:{save:!!r.provider?.save,export:!!r.provider?.export,templates:!!r.provider?.templates}}})}function V(e,t){U(e,t.reportIds);const r=C.validateReportParams(F.getReportParamDefs(e,t.reportIds),t.params),n=t.reportIds.flatMap(a=>C.validateReportParams(F.getReportParamDefs(e,[a]),t.params).issues),s=new Map(n.map(a=>[JSON.stringify(a),a]));return{...r,ok:s.size===0,issues:[...s.values()]}}function O(e,t){const r=Y.validateRenderPlan(e.plan);if(!r.ok)throw new p.ReportSourceError("validate",`执行器返回无效计划:${r.errors[0]?.path}`);const n=e.plan.pages.length,s=e.plan.pages.reduce((a,l)=>a+l.components.reduce((m,u)=>m+T(u),0),0);return i.assertBudget(t,"maxRows",e.stats.rows),i.assertBudget(t,"maxPages",n),i.assertBudget(t,"maxCells",s),{...e,stats:{...e.stats,pages:n,cells:s}}}function J(e,t){const r=V(e.reports,t);if(!r.ok)throw new C.ReportParamValidationError(r.issues)}function ae(e){const t={...i.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget};i.validateBudget(t);const r=async(s,a)=>{const l=Date.now();let m=0,u=0;const c=B.createDiagnosticCollector(s.diagnosticLimit),h={},x=[],g=Object.fromEntries(Object.entries(e.reports).map(([d,f])=>[d,{...f,pagination:{...e.pagination,...f.pagination,...a?{measurer:a}:{}},dataValidation:{...f.dataValidation,maxRows:Math.min(t.maxRows??1e5,f.dataValidation?.maxRows??1/0),maxCells:Math.min(t.maxCells??2e6,f.dataValidation?.maxCells??1/0)}}])),o=await p.createReportSource(g,p.inspectOwnedSource({maxPages:t.maxPages,maxCells:t.maxCells,maxChartComponents:t.maxChartComponents,onDatasets:(d,f,v)=>{try{m+=p.templateDatasetRowCount(v,f,{maxRows:t.maxRows,signal:s.signal})}catch(b){throw b instanceof Z.TreeRowLimitError?new i.ReportRuntimeError("budget",b.message,"$.budget.maxRows"):b}i.assertBudget(t,"maxRows",m),u+=N(v,f,!1,g[d]?.pagination),i.assertBudget(t,"maxCells",u)}},(d,f,v)=>{u+=N(v,f,!0,g[d]?.pagination),i.assertBudget(t,"maxCells",u)}))({...s,params:s.params??{},onWarning:d=>c.push({code:"layout",message:d,severity:"warning"}),onQueryResult:(d,f,v=0)=>{const b=p.reportOccurrenceScope(v,d);Object.defineProperty(h,d,{value:{revision:f.revision,sourceToken:f.sourceToken},enumerable:!0,writable:!0}),x.push({reportId:d,reportIndex:v,reportScope:b,...f.revision===void 0?{}:{revision:f.revision},...f.sourceToken===void 0?{}:{sourceToken:f.sourceToken}}),(f.diagnostics??[]).forEach(E=>c.push({...E,...E.target?{target:{...E.target,reportScope:b,...E.target.tableId?{tableId:JSON.stringify([v,d,E.target.tableId])}:{}}}:{}}))}}).catch(d=>{throw d instanceof p.ReportSourceError&&d.cause instanceof L.PaginatePageLimitError?new i.ReportRuntimeError("budget",d.cause.message,"$.budget.maxPages"):d instanceof p.ReportSourceError&&d.cause instanceof L.PaginateCellLimitError?new i.ReportRuntimeError("budget",d.cause.message,"$.budget.maxCells"):d instanceof p.ReportSourceError&&d.cause instanceof L.PaginateChartComponentLimitError?new i.ReportRuntimeError("budget",d.cause.message,"$.budget.maxChartComponents"):d});i.throwIfAborted(s.signal);const w=e.assets?await p.createReportTaskReporter(s).run("assets",()=>q.resolvePlanAssets(o,{...e.assets,diagnosticLimit:s.diagnosticLimit,signal:s.signal})):{plan:o,diagnostics:[]},P=w.plan;w.diagnosticSummary?c.merge({...w.diagnosticSummary,entries:S(w.diagnosticSummary.entries)}):S(w.diagnostics).forEach(d=>c.push(d));const M=P.pages.reduce((d,f)=>d+f.components.reduce((v,b)=>v+T(b),0),0);i.assertBudget(t,"maxPages",P.pages.length),i.assertBudget(t,"maxCells",M);const D=R.reportFontFingerprint(s.pdf),G=e.pagination?.measurer||Object.values(e.reports).some(d=>d.pagination?.measurer);return{plan:P,diagnostics:c.entries,...s.diagnosticLimit===void 0?{}:{diagnosticSummary:c.snapshot()},revisions:h,sources:x,layout:{textMetrics:D?"font-bytes":G?"provided":"heuristic",...D?{fontFingerprint:D}:{}},stats:{rows:m,pages:P.pages.length,cells:M,durationMs:Date.now()-l}}},n=async s=>{const a=Date.now();if(s.format!=="pdf"&&s.format!=="xlsx")throw new p.ReportSourceError("config","不支持的报表导出格式");const l=s.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;i.throwIfAborted(s.signal);const m=s.pdf?.customFontFaces??(s.pdf?.customFontBytes?{regular:s.pdf.customFontBytes}:void 0),u=l&&m?l.createFontBytesMeasurer(m):void 0,c=await r(s,u);return i.throwIfAborted(s.signal),_({...s,prepared:c},t,a)};return{describe:s=>re(e.reports,s),validate:s=>V(e.reports,s),prepare:s=>i.controlled(s.signal,t.maxDurationMs,async a=>{const{signal:l,onEvent:m,...u}=j(s),c={...u,...u.pdf?{pdf:R.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??p.reportTaskId()},h=m?w=>p.notifyReportTaskEvent(m,w,a):void 0,x={...c,signal:a,onEvent:h};p.createReportTaskReporter(x).runSync("validate",()=>J(e,c));let g;const y=c.pdf?.customFontFaces??(c.pdf?.customFontBytes?{regular:c.pdf.customFontBytes}:void 0);if(!e.executor&&y){const w=await import("@agile-team/mach-report/pdf");i.throwIfAborted(a),g=w.createFontBytesMeasurer(y)}const o=e.executor?await e.executor.prepare(c,a,h):await r(x,g);return e.executor&&k.assertReportPreparedMetadata(o),O(o,t)}),exportPrepared:s=>i.controlled(s.signal,t.maxDurationMs,async a=>{const l=Date.now(),{signal:m,onEvent:u,...c}=s,h=O(R.snapshotPreparedReport(s.prepared,t.maxPreparedBytes??64e6,a),t),x={...c,xlsx:R.snapshotXlsxOptions(c.xlsx),prepared:h,...c.pdf?{pdf:R.snapshotPdfFonts(c.pdf)}:{},taskId:c.taskId??p.reportTaskId()};if(x.format!=="pdf"&&x.format!=="xlsx")throw new p.ReportSourceError("config","不支持的报表导出格式");const g=u?o=>p.notifyReportTaskEvent(u,o,a):void 0;if(e.executor){if(!e.executor.exportPrepared)throw new p.ReportSourceError("config","执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");const o=await e.executor.exportPrepared(x,a,g);return k.assertReportExportResult(o,x.format),i.assertBudget(t,"maxRows",o.stats.rows),i.assertBudget(t,"maxPages",o.stats.pages),i.assertBudget(t,"maxCells",o.stats.cells),i.assertBudget(t,"maxOutputBytes",o.bytes.byteLength),{...o,stats:{...o.stats,outputBytes:o.bytes.byteLength}}}const y={...x,signal:a,onEvent:g};if(p.createReportTaskReporter(y).runSync("validate",()=>R.checkPreparedFont(y)),e.assets){const o=await p.createReportTaskReporter(y).run("assets",()=>q.resolvePlanAssets(h.plan,{...e.assets,diagnosticLimit:s.diagnosticLimit,signal:a}));h.plan=o.plan,R.appendPreparedDiagnostics(h,S(o.diagnostics),o.diagnosticSummary?{...o.diagnosticSummary,entries:S(o.diagnosticSummary.entries)}:void 0,s.diagnosticLimit)}return _(y,t,l)}),export:s=>i.controlled(s.signal,t.maxDurationMs,async a=>{const{signal:l,onEvent:m,...u}=j(s),c={...u,xlsx:R.snapshotXlsxOptions(u.xlsx),...u.pdf?{pdf:R.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??p.reportTaskId()},h=m?y=>p.notifyReportTaskEvent(m,y,a):void 0,x={...c,signal:a,onEvent:h};if(p.createReportTaskReporter(x).runSync("validate",()=>J(e,c)),c.format!=="pdf"&&c.format!=="xlsx")throw new p.ReportSourceError("config","不支持的报表导出格式");const g=e.executor?await e.executor.export(c,a,h):await n(x);return e.executor&&k.assertReportExportResult(g,c.format),i.assertBudget(t,"maxRows",g.stats.rows),i.assertBudget(t,"maxPages",g.stats.pages),i.assertBudget(t,"maxCells",g.stats.cells),i.assertBudget(t,"maxOutputBytes",g.bytes.byteLength),{...g,stats:{...g.stats,outputBytes:g.bytes.byteLength}}})}}exports.createReportRuntime=ae;exports.enforcePrepared=O;
@@ -6,7 +6,7 @@
6
6
  "component": {
7
7
  "type": "library",
8
8
  "name": "@agile-team/mach-report",
9
- "version": "2.26.1"
9
+ "version": "2.27.0"
10
10
  },
11
11
  "properties": [
12
12
  {