@agile-team/mach-report 2.15.0 → 2.17.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 (171) hide show
  1. package/README.md +21 -12
  2. package/dist/{ExcelBindingWizard-Bs43BGNp.cjs → ExcelBindingWizard-Bq6FYME6.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-BKH1nGNS.js → ExcelBindingWizard-Co1svTsw.js} +3 -3
  4. package/dist/{ParamEditor-Da4akw6V.cjs → ParamEditor-B5UZRgxv.cjs} +1 -1
  5. package/dist/{ParamEditor-DoAhzJsm.js → ParamEditor-DNNARyeB.js} +1 -1
  6. package/dist/{ReportBatchPanel-wP9m9Pj1.cjs → ReportBatchPanel-Ctvs2t_9.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-BMf6boMA.js → ReportBatchPanel-uQh06usx.js} +3 -3
  8. package/dist/ReportPreview-BdQawRh0.js +4879 -0
  9. package/dist/ReportPreview-CJC_-j2I.cjs +6 -0
  10. package/dist/{ReportTemplateLibrary-Sxr3eD0J.cjs → ReportTemplateLibrary-CnP7_1pH.cjs} +1 -1
  11. package/dist/{ReportTemplateLibrary-C9wutIiT.js → ReportTemplateLibrary-TIL_Oj2l.js} +1 -1
  12. package/dist/RuleEditor-DkRjOLlr.js +2141 -0
  13. package/dist/RuleEditor-h5anGsDB.cjs +1 -0
  14. package/dist/{TemplateOutlinePanel-JTSR53vJ.cjs → TemplateOutlinePanel-BlLxRrfu.cjs} +1 -1
  15. package/dist/{TemplateOutlinePanel-D6Bkny59.js → TemplateOutlinePanel-BouxsuqQ.js} +1 -1
  16. package/dist/{TemplateReusePanel-rVuK1kTz.js → TemplateReusePanel-BEACLPaN.js} +2 -2
  17. package/dist/{TemplateReusePanel-Kx35S0Ql.cjs → TemplateReusePanel-yxsHSO40.cjs} +1 -1
  18. package/dist/{TemplateReviewPanel-B0ar9_zf.js → TemplateReviewPanel-B1OGRY2i.js} +1 -1
  19. package/dist/{TemplateReviewPanel-Dn6X9UmY.cjs → TemplateReviewPanel-D9Cx0m2N.cjs} +1 -1
  20. package/dist/analytics.cjs +1 -1
  21. package/dist/analytics.d.cts +65 -1
  22. package/dist/analytics.d.ts +65 -1
  23. package/dist/analytics.js +4 -4
  24. package/dist/artifact-integrity.json +105 -101
  25. package/dist/assets-BIMVwjQe.js +231 -0
  26. package/dist/assets-Dfs2ElxI.cjs +1 -0
  27. package/dist/auto-BIOmtVhk.js +240 -0
  28. package/dist/auto-DDHflI9v.cjs +1 -0
  29. package/dist/{batch-BfZHN1do.js → batch-WzDIXJAt.js} +1 -1
  30. package/dist/{batch-CLpELXBl.cjs → batch-z6Aw5GEY.cjs} +1 -1
  31. package/dist/codes.d.cts +2 -0
  32. package/dist/codes.d.ts +2 -0
  33. package/dist/component-tree-Ca6YYfHq.js +61 -0
  34. package/dist/component-tree-DkGLEfZC.cjs +1 -0
  35. package/dist/computed-BW5a8QFk.js +612 -0
  36. package/dist/computed-C2GD3XcE.cjs +1 -0
  37. package/dist/config-Dg_o8e7m.cjs +1 -0
  38. package/dist/{config-BVsJXSqS.js → config-XQ4qrQ7Q.js} +66 -64
  39. package/dist/dataset-DL83majE.js +161 -0
  40. package/dist/dataset-IrlXbUvh.cjs +1 -0
  41. package/dist/designer-D9XAxqSc.js +5178 -0
  42. package/dist/designer-uCDo5XSK.cjs +2 -0
  43. package/dist/designer.cjs +1 -1
  44. package/dist/designer.d.cts +178 -3
  45. package/dist/designer.d.ts +178 -3
  46. package/dist/designer.js +1 -1
  47. package/dist/drill-ByN8COs_.cjs +1 -0
  48. package/dist/{drill-ByJviLXS.js → drill-CKW3Xtfa.js} +5 -5
  49. package/dist/encoding-BFMFIc4r.cjs +1 -0
  50. package/dist/encoding-DP_Eaf0A.js +21 -0
  51. package/dist/{font-loader-B_UkxpzC.cjs → font-loader-7FWVlykp.cjs} +1 -1
  52. package/dist/{font-loader-Q3bQjmrI.js → font-loader-CQZowp0I.js} +1 -1
  53. package/dist/index.cjs +8 -9
  54. package/dist/index.d.cts +175 -1
  55. package/dist/index.d.ts +175 -1
  56. package/dist/index.js +1343 -915
  57. package/dist/json-snapshot-D7PE1NsU.cjs +2 -0
  58. package/dist/json-snapshot-DYmEe3sO.js +1779 -0
  59. package/dist/matrix-JLAXlux-.js +302 -0
  60. package/dist/matrix-gTHpDTGm.cjs +1 -0
  61. package/dist/{pdf-CvvrjPQg.cjs → pdf-B8JouyYv.cjs} +48 -50
  62. package/dist/{pdf-BwNyeGpt.js → pdf-l3ea86di.js} +2734 -2748
  63. package/dist/pdf.cjs +1 -1
  64. package/dist/pdf.d.cts +14 -0
  65. package/dist/pdf.d.ts +14 -0
  66. package/dist/pdf.js +2 -2
  67. package/dist/{plugin-Ca_XZG3l.js → plugin-BBp74CQZ.js} +1 -1
  68. package/dist/{plugin-DHO7X8z2.cjs → plugin-CtFX9PFG.cjs} +1 -1
  69. package/dist/prepared-CARicKYh.js +87 -0
  70. package/dist/prepared-Ch1x_Gog.cjs +1 -0
  71. package/dist/progress-BXzlVbIp.js +29 -0
  72. package/dist/progress-DJBd9Rb9.cjs +1 -0
  73. package/dist/{progress-D-OTpEav.js → progress-Hc2vxoCs.js} +2 -2
  74. package/dist/protocol-B5A2uom4.cjs +1 -0
  75. package/dist/protocol-BaiWjq5w.js +90 -0
  76. package/dist/record-bindings-B86Sur_y.cjs +1 -0
  77. package/dist/{record-bindings-Do_b3h4V.js → record-bindings-D4TuMzHs.js} +10 -11
  78. package/dist/{region-binding-workflow-BMhK_TjP.js → region-binding-workflow-BNasF5kz.js} +2 -2
  79. package/dist/{region-binding-workflow-DIYJdCUr.cjs → region-binding-workflow-O2Cni3mF.cjs} +1 -1
  80. package/dist/report-encoding-worker.cjs +1 -0
  81. package/dist/report-encoding-worker.d.ts +1 -0
  82. package/dist/report-encoding-worker.js +2 -0
  83. package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
  84. package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
  85. package/dist/runtime-DakRXui3.js +170 -0
  86. package/dist/runtime-dL5ygIfa.cjs +1 -0
  87. package/dist/sbom.cdx.json +2 -2
  88. package/dist/server/node.d.cts +132 -1
  89. package/dist/server/node.d.ts +132 -1
  90. package/dist/server-node.cjs +5 -1
  91. package/dist/server-node.js +5177 -463
  92. package/dist/server.cjs +1 -1
  93. package/dist/server.d.cts +182 -2
  94. package/dist/server.d.ts +182 -2
  95. package/dist/server.js +918 -833
  96. package/dist/sha256-BshdOkCC.cjs +1 -0
  97. package/dist/sha256-DTG-Gq8i.js +157 -0
  98. package/dist/style-67OqfNed.js +73 -0
  99. package/dist/style-C22Pbv3T.cjs +1 -0
  100. package/dist/style.css +1 -1
  101. package/dist/template-catalog-Dua8h9ZA.cjs +1 -0
  102. package/dist/{template-catalog-j2B1MJlL.js → template-catalog-wT1fNeAP.js} +10 -10
  103. package/dist/{template-fragments-DcKeiylI.cjs → template-fragments-BajTajb4.cjs} +1 -1
  104. package/dist/{template-fragments-BGbQLGlV.js → template-fragments-DmX5XK4N.js} +2 -2
  105. package/dist/template-registry-CpysHAxy.cjs +1 -0
  106. package/dist/{template-registry-BtaKPELV.js → template-registry-u11fPd8D.js} +389 -321
  107. package/dist/{textwrap-DE1kgcJB.js → textwrap-BEIg2w8y.js} +1 -1
  108. package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
  109. package/dist/{tree-BX380Rr7.cjs → tree-CLpxYbKa.cjs} +1 -1
  110. package/dist/{tree-CjVZLRw7.js → tree-DNJorJUf.js} +1 -1
  111. package/dist/vue/async.d.cts +174 -2
  112. package/dist/vue/async.d.ts +174 -2
  113. package/dist/vue/index.d.cts +218 -3
  114. package/dist/vue/index.d.ts +218 -3
  115. package/dist/vue-async.cjs +1 -1
  116. package/dist/vue-async.js +3 -3
  117. package/dist/vue.cjs +1 -1
  118. package/dist/vue.js +7 -7
  119. package/dist/{workbook-session-BvToI-Fd.js → workbook-session-B8pNW24X.js} +153 -140
  120. package/dist/{workbook-session-Bjv1YCRK.cjs → workbook-session-DN5LSA5C.cjs} +12 -12
  121. package/dist/worker.cjs +1 -1
  122. package/dist/worker.d.cts +84 -1
  123. package/dist/worker.d.ts +84 -1
  124. package/dist/worker.js +12 -157
  125. package/dist/xlsx-node.cjs +33 -33
  126. package/dist/xlsx-node.js +1282 -1289
  127. package/dist/xlsx.cjs +4 -3
  128. package/dist/xlsx.d.cts +90 -2
  129. package/dist/xlsx.d.ts +90 -2
  130. package/dist/xlsx.js +279 -259
  131. package/package.json +6 -3
  132. package/dist/ReportPreview-ChV19HBp.js +0 -4619
  133. package/dist/ReportPreview-DbLvvOUT.cjs +0 -6
  134. package/dist/RuleEditor-C_Clasvd.js +0 -2037
  135. package/dist/RuleEditor-XhGHK8DE.cjs +0 -1
  136. package/dist/assets-B9ImAi6_.cjs +0 -1
  137. package/dist/assets-DEaz4qsp.js +0 -124
  138. package/dist/batch-BaP6pWDE.cjs +0 -1
  139. package/dist/batch-CGyt-b2W.js +0 -273
  140. package/dist/capabilities-CAh2Nrue.cjs +0 -1
  141. package/dist/capabilities-DskCHs3V.js +0 -69
  142. package/dist/computed-C-4C2S5h.js +0 -521
  143. package/dist/computed-CGV2a809.cjs +0 -1
  144. package/dist/config-D10us76d.cjs +0 -1
  145. package/dist/data-explanation-B8MZRYVS.js +0 -16
  146. package/dist/data-explanation-DE55G30w.cjs +0 -1
  147. package/dist/dataset-BkRmwgeJ.cjs +0 -1
  148. package/dist/dataset-H5pFuQGU.js +0 -121
  149. package/dist/defaults-DXhiM1ZD.js +0 -10
  150. package/dist/defaults-xhmcLLrf.cjs +0 -1
  151. package/dist/designer-2bDlcNXQ.js +0 -5136
  152. package/dist/designer-BT7XCdbW.cjs +0 -2
  153. package/dist/drill-DYTxuL3A.cjs +0 -1
  154. package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
  155. package/dist/grid-strokes-DyyG1q_o.js +0 -53
  156. package/dist/json-snapshot-DFb2eWkf.js +0 -1416
  157. package/dist/json-snapshot-WWSGlaHG.cjs +0 -2
  158. package/dist/matrix-CGRGkn5s.js +0 -112
  159. package/dist/matrix-gEO7ZM_u.cjs +0 -1
  160. package/dist/prepared-CFy9B75C.cjs +0 -1
  161. package/dist/prepared-ajM-H-9B.js +0 -69
  162. package/dist/record-bindings-By_UKZ2g.cjs +0 -1
  163. package/dist/render-plan-7xpGrCEl.cjs +0 -1
  164. package/dist/render-plan-Ck6koX9L.js +0 -13
  165. package/dist/sha256-ArEYjaTI.cjs +0 -1
  166. package/dist/sha256-DPEuJ3nh.js +0 -155
  167. package/dist/style-CQ1PK8ZB.js +0 -67
  168. package/dist/style-UgIJSA1F.cjs +0 -1
  169. package/dist/template-catalog-FJE_c9Qe.cjs +0 -1
  170. package/dist/template-registry-Co1zPq5e.cjs +0 -1
  171. package/dist/textwrap-CWHyzkBH.cjs +0 -4
@@ -0,0 +1 @@
1
+ "use strict";const a=require("vue"),D=require("@agile-team/mach-report"),_=require("./progress-B0ctFpKf.cjs"),M=require("./_plugin-vue_export-helper-BLmdZLlg.cjs"),T=require("./injection-keys-Db_DyLkm.cjs"),L={printPrepareTimeout:"打印资源准备超时,请检查字体与图片后重试。",printImageFailed:"第 {index} 张图片未能加载,已停止打印,避免输出缺失内容。",printFontFailed:"打印字体 {family} 未能加载,请检查字体资源后重试。",printPrepareFailed:"打印准备失败,请检查打印配置或改用 PDF。",printCalibration:"打印校准",printOffsetX:"水平偏移(mm)",printOffsetY:"垂直偏移(mm)",printCalibrationTest:"打印校准页",printCalibrationHint:"正值向右/向下移动,负值向左/向上。使用同规格纸张及 100% 比例,先试打一张。系统对话框关闭不代表设备已完成。"};function J(e){const n=e?.calibration?.offsetXmm??0,l=e?.calibration?.offsetYmm??0;if(![n,l].every(r=>Number.isFinite(r)&&Math.abs(r)<=20))throw new RangeError("Print calibration must be within ±20 mm");return{x:n,y:l}}function Y(e={}){if(e.fonts&&(!Array.isArray(e.fonts)||e.fonts.length>8))throw new RangeError("At most eight print font faces are allowed");return{...e,...e.fonts?{fonts:e.fonts.map(n=>({...n}))}:{},...e.calibration?{calibration:{...e.calibration}}:{}}}function V(e={}){const n=a.ref(!1),l=a.ref(null),r=a.ref(null),s=a.ref(null);function u(i=!1){n.value=!1,i&&a.nextTick(()=>r.value?.focus())}function m(i){i.target instanceof Node&&!l.value?.contains(i.target)&&u()}function f(i){i.key!=="Escape"||!n.value||i.isComposing||(i.preventDefault(),i.stopPropagation(),u(!0))}return a.watch(n,i=>{!i||e.focusOnOpen===!1||a.nextTick(()=>(s.value?.querySelector("input")??s.value?.querySelector("button:not(:disabled)"))?.focus())}),a.onMounted(()=>{document.addEventListener("pointerdown",m),document.addEventListener("focusin",m)}),a.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("focusin",m)}),{opened:n,root:l,trigger:r,panel:s,close:u,onKeydown:f}}class O extends Error{constructor(n,l,r){super(l),this.name="MachReportError",this.code=n,this.cause=r}}function X(e){return e instanceof O?{code:e.code,cause:e.cause}:{code:"render",cause:e}}function Q(e){if(e instanceof O)return e;if(e instanceof D.ReportParamValidationError)return new O("param",e.message,e);if(e instanceof D.ReportSourceError)return new O(e.code,e.message,e.cause);if(e instanceof Error){const n={params:"param",config:"config",validate:"validate",fetch:"fetch"},l=e.code;if(typeof l=="string"&&Object.prototype.hasOwnProperty.call(n,l))return new O(n[l],e.message,e)}return new O("fetch",e instanceof Error?e.message:"预览加载失败",e)}let Z=0;function ee(){return`mrp-params-${++Z}`}function $(e,n,l){const r=(Array.isArray(n)?n.find(s=>s?.field===e.field)?.label:void 0)??e.field;return e.code==="required"?l.paramRequired.replace("{label}",r):(l.paramInvalid??"{label}:{message}").replace("{label}",r).replace("{message}",e.message)}function ae(e){const n=a.ref({}),l=a.ref(!1);function r(){const f={};for(const i of Array.isArray(e.defs.value)?e.defs.value:[])typeof i?.field=="string"&&Object.defineProperty(f,i.field,{value:e.params()[i.field]??i.defaultValue??"",writable:!0,enumerable:!0,configurable:!0});n.value=f,l.value=!1}r(),a.watch(e.defs,r),a.watch(e.reportIds,r),a.watch(()=>JSON.stringify(e.params()),r);const s=a.computed(()=>D.validateReportParams(e.defs.value,{...e.params(),...n.value})),u=a.computed(()=>!l.value&&s.value.issues.length>0&&s.value.issues.every(f=>f.code==="required"));function m(){const f=s.value;if(!f.ok){const p=f.issues[0];return{quiet:u.value,error:new O(p.code==="definition"?"config":"param",$(p,e.defs.value,e.messages()),{issues:f.issues})}}const i={...f.values},w=new Set(e.defs.value.filter(p=>p.defaultValue!==void 0).map(p=>p.field));for(const[p,b]of Object.entries(i))b===""&&!w.has(p)&&delete i[p];return{params:i,quiet:!1}}return{values:n,attempted:l,validation:s,pendingRequired:u,reset:r,query:m}}const I={paramOptionsLoading:"正在搜索选项…",paramOptionsEmpty:"没有匹配选项",paramOptionsFailed:"选项加载失败,请重试",paramOptionsMissingLoader:"尚未配置选项加载服务",paramOptionsDependencies:"请先选择上级条件",paramOptionsClear:"清除选择"},U=100,te=32,ne=6e4,re=15e3;function le(e){if(!Array.isArray(e)||e.length>U)throw new Error("Invalid option response");const n=new Set;return Object.freeze(e.map(l=>{if(!l||typeof l.value!="string"||!l.value||l.value.length>1024||typeof l.label!="string"||l.label.length>1024||n.has(l.value))throw new Error("Invalid option response");return n.add(l.value),Object.freeze({label:l.label,value:l.value})}))}function oe(e){const n=a.ref(""),l=a.shallowRef([]),r=a.ref(!1),s=a.ref(!1),u=a.computed(()=>Object.fromEntries((Array.isArray(e.def().dependsOn)?e.def().dependsOn:[]).map(y=>[y,e.values()[y]??""]))),m=a.computed(()=>Object.values(u.value).some(y=>!y.trim())),f=a.computed(()=>!e.loader()),i=new Map;let w,p,b=0;function P(){b++,w?.abort(),w=void 0,clearTimeout(p),r.value=!1}async function v(){P(),s.value=!1;const y=e.loader(),h=e.def();if(!y||!h.optionsSource||m.value||e.disabled()||!e.opened())return;const x={source:h.optionsSource,field:h.field,query:n.value.trim().slice(0,256),params:Object.freeze({...u.value}),limit:U},o=JSON.stringify(x),d=i.get(o);if(d&&Date.now()-d.at<ne){i.delete(o),i.set(o,d),l.value=d.options;return}const t=b,c=new AbortController;w=c,r.value=!0;const E=setTimeout(()=>c.abort(),re);try{const k=le(await _.waitForOutput(y(Object.freeze({...x,signal:c.signal})),c.signal));if(t!==b)return;for(l.value=k,i.delete(o),i.set(o,{at:Date.now(),options:k});i.size>te;)i.delete(i.keys().next().value)}catch{t===b&&(s.value=!0)}finally{clearTimeout(E),t===b&&(r.value=!1,w=void 0)}}function S(){P(),l.value=[],s.value=!1,p=setTimeout(()=>{v()},180)}return a.watch(n,S,{flush:"sync"}),a.watch([()=>e.def().field,()=>e.def().optionsSource,()=>JSON.stringify(u.value),e.loader],()=>{i.clear(),n.value="",P(),l.value=[],s.value=!1,e.opened()&&v()},{flush:"sync"}),a.watch([e.opened,e.disabled],()=>{!e.opened()||e.disabled()?P():v()}),a.onBeforeUnmount(()=>{P(),i.clear()}),{query:n,options:l,loading:r,failed:s,waiting:m,missingLoader:f,request:v,cancel:P}}const ie=["id","value","aria-labelledby","aria-invalid","aria-required","aria-describedby","aria-expanded","aria-controls","aria-activedescendant","disabled","placeholder"],se=["aria-label","disabled"],ce=["aria-label","disabled"],de=["id"],ue=["id","aria-label","aria-busy"],fe=["id","aria-selected","disabled","onPointermove","onClick"],pe={key:0},me={key:0,role:"status"},ve=a.defineComponent({__name:"ReportRemoteParamSelect",props:{def:{},value:{},values:{},loadOptions:{type:Function},messages:{},disabled:{type:Boolean},id:{},invalid:{type:Boolean}},emits:["change"],setup(e,{emit:n}){const l=e,r=n,s=V({focusOnOpen:!1}),{root:u,panel:m,opened:f}=s,i=oe({def:()=>l.def,values:()=>l.values,loader:()=>l.loadOptions,opened:()=>f.value,disabled:()=>l.disabled===!0}),{query:w,options:p,loading:b,failed:P,waiting:v,missingLoader:S}=i,y=a.computed(()=>({...I,...l.messages})),h=a.ref(0),x=a.ref(""),o=a.ref(),d=a.computed(()=>`${l.id}-options`),t=a.computed(()=>v.value?y.value.paramOptionsDependencies:S.value?y.value.paramOptionsMissingLoader:P.value?y.value.paramOptionsFailed:b.value?y.value.paramOptionsLoading:p.value.length?"":y.value.paramOptionsEmpty);a.watch(()=>l.value,()=>{x.value=""}),a.watch(p,()=>{h.value=0}),a.watch(f,g=>{g&&a.nextTick(()=>o.value?.focus())});function c(g){l.disabled||v.value||b.value||P.value||(r("change",g.value),s.close(),a.nextTick(()=>{x.value=g.label,o.value?.focus()}))}function E(g){g.isComposing||(f.value=!0,w.value=g.target.value)}function k(){!l.disabled&&!v.value&&!S.value&&(w.value="",f.value=!0)}function z(g){if(!(g.isComposing||g.keyCode===229)){if(g.key==="Escape"){f.value&&(g.preventDefault(),g.stopPropagation(),s.close());return}if(["ArrowUp","ArrowDown","Enter"].includes(g.key)){if(g.preventDefault(),g.stopPropagation(),!f.value){k();return}if(g.key==="Enter"){const B=p.value[h.value];B&&c(B);return}p.value.length&&(h.value=(h.value+(g.key==="ArrowDown"?1:-1)+p.value.length)%p.value.length,a.nextTick(()=>m.value?.querySelector(`[id="${d.value}-${h.value}"]`)?.scrollIntoView?.({block:"nearest"})))}}}function K(){l.disabled||(r("change",""),x.value="",s.close())}return(g,B)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"root",ref:u,class:"mrp-remote-param"},[a.createElementVNode("div",{class:a.normalizeClass(["mrp-remote-control",{"is-invalid":e.invalid}])},[a.createVNode(M._sfc_main,{name:"search",size:14}),a.createElementVNode("input",{id:e.id,ref_key:"input",ref:o,type:"text",role:"combobox",autocomplete:"off",value:a.unref(f)?a.unref(w):x.value||e.value,maxlength:256,"aria-labelledby":`${e.id}-label`,"aria-invalid":e.invalid||void 0,"aria-required":e.def.required||void 0,"aria-describedby":e.invalid?`${e.id}-error`:a.unref(v)||a.unref(S)?`${e.id}-remote-status`:void 0,"aria-autocomplete":"list","aria-expanded":a.unref(f),"aria-controls":a.unref(f)?d.value:void 0,"aria-activedescendant":a.unref(f)&&a.unref(p).length?`${d.value}-${h.value}`:void 0,disabled:e.disabled||a.unref(v)||a.unref(S),placeholder:e.def.placeholder??(e.messages.paramSelectPlaceholder??"请选择{label}").replace("{label}",e.def.label??e.def.field),onClick:k,onInput:E,onCompositionend:E,onKeydown:z},null,40,ie),e.value?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button","aria-label":y.value.paramOptionsClear,disabled:e.disabled,onClick:K},[a.createVNode(M._sfc_main,{name:"close",size:12})],8,se)):(a.openBlock(),a.createElementBlock("button",{key:1,type:"button","aria-label":e.def.label??e.def.field,disabled:e.disabled||a.unref(v)||a.unref(S),onClick:B[0]||(B[0]=C=>a.unref(f)?a.unref(s).close():k())},[a.createVNode(M._sfc_main,{name:"chevron-down",size:12})],8,ce))],2),a.unref(v)||a.unref(S)?(a.openBlock(),a.createElementBlock("small",{key:0,id:`${e.id}-remote-status`,role:"status"},a.toDisplayString(t.value),9,de)):a.createCommentVNode("",!0),a.unref(f)?(a.openBlock(),a.createElementBlock("div",{key:1,ref_key:"panel",ref:m,class:"mrp-remote-options"},[a.createElementVNode("div",{id:d.value,role:"listbox","aria-label":e.def.label??e.def.field,"aria-busy":a.unref(b)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(p),(C,F)=>(a.openBlock(),a.createElementBlock("button",{id:`${d.value}-${F}`,key:C.value,type:"button",role:"option",tabindex:"-1","aria-selected":e.value===C.value,class:a.normalizeClass({active:F===h.value}),disabled:a.unref(b),onPointermove:W=>h.value=F,onMousedown:B[1]||(B[1]=a.withModifiers(()=>{},["prevent"])),onClick:W=>c(C)},[a.createElementVNode("span",null,a.toDisplayString(C.label),1),C.label!==C.value?(a.openBlock(),a.createElementBlock("small",pe,a.toDisplayString(C.value),1)):a.createCommentVNode("",!0)],42,fe))),128))],8,ue),t.value?(a.openBlock(),a.createElementBlock("p",me,[a.createTextVNode(a.toDisplayString(t.value),1),a.unref(P)?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",onClick:B[2]||(B[2]=(...C)=>a.unref(i).request&&a.unref(i).request(...C))},a.toDisplayString(e.messages.retry),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)],512)):a.createCommentVNode("",!0)],512))}}),ge=M._export_sfc(ve,[["__scopeId","data-v-5dbac6ad"]]),be={key:0,class:"mrp-params-title"},ye={class:"mrp-params-grid"},he=["id"],Ee={key:0,class:"mrp-param-star","aria-hidden":"true"},ke=["value","disabled","aria-labelledby","aria-invalid","aria-describedby","aria-required","onChange"],we=["disabled","hidden"],Pe=["value"],Se=["aria-labelledby"],Ce=["value","disabled","min","max","aria-label","aria-invalid","aria-describedby","aria-required","onInput"],xe=["type","inputmode","maxlength","placeholder","value","disabled","min","max","step","aria-labelledby","aria-invalid","aria-describedby","aria-required","onInput"],Be=["id"],Ae={key:1,class:"mrp-params-actions"},Oe=["disabled"],Me=["disabled"],Re=a.defineComponent({__name:"ReportParamPanel",props:{defs:{},modelValue:{},messages:{},attempted:{type:Boolean},issues:{default:void 0},showActions:{type:Boolean,default:!0},showTitle:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},loadOptions:{type:Function,default:void 0}},emits:["update:modelValue","query","reset"],setup(e,{expose:n,emit:l}){const r=e,s=l,u=a.ref({...r.modelValue}),m=a.ref(null),f=ee();a.watch(()=>r.modelValue,o=>{u.value={...o}});const i=a.computed(()=>r.issues??D.validateReportParams(r.defs,u.value).issues),w=a.computed(()=>(Array.isArray(r.defs)?r.defs:[]).filter(o=>o&&typeof o.field=="string").map((o,d)=>({def:o,id:`${f}-${d}`,label:o.label??o.field,value:u.value[o.field]??"",error:r.attempted?i.value.find(t=>t.field===o.field):void 0}))),p=a.computed(()=>{const o=new Map;for(const d of r.defs)for(const t of Array.isArray(d.dependsOn)?d.dependsOn:[]){const c=o.get(t)??[];c.push(d.field),o.set(t,c)}return o});function b(o,d){if(r.disabled||u.value[o]===d)return;u.value={...u.value,[o]:d};const t=new Set([o]),c=[o];for(let E=0;E<c.length;E++)for(const k of p.value.get(c[E])??[])t.has(k)||(u.value[k]="",t.add(k),c.push(k));s("update:modelValue",{...u.value})}function P(o){return o.type==="number"?"number":o.type==="date"||o.type==="month"?o.type:"text"}function v(o,d){return o.split("/")[d]??""}function S(o,d,t){return t?!!v(o,0)!=!!v(o,1)?!v(o,d)||void 0:!0:void 0}function y(o,d,t){const c=[v(u.value[o]??"",0),v(u.value[o]??"",1)];c[d]=t,b(o,c.every(E=>!E)?"":c.join("/"))}function h(o){o.isComposing||s("query")}function x(){m.value?.querySelector('[aria-invalid="true"]')?.focus()}return n({focusInvalid:x}),(o,d)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"root",ref:m,class:"mrp-params"},[e.showTitle!==!1?(a.openBlock(),a.createElementBlock("span",be,a.toDisplayString(e.messages.paramsTitle),1)):a.createCommentVNode("",!0),a.createElementVNode("div",ye,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(w.value,t=>(a.openBlock(),a.createElementBlock("label",{key:t.id,class:a.normalizeClass(["mrp-param",{"mrp-param-missing":!!t.error}])},[a.createElementVNode("span",{id:`${t.id}-label`,class:"mrp-param-label"},[a.createTextVNode(a.toDisplayString(t.label),1),t.def.required?(a.openBlock(),a.createElementBlock("i",Ee,"*")):a.createCommentVNode("",!0)],8,he),t.def.optionsSource?(a.openBlock(),a.createBlock(ge,{key:0,id:t.id,def:t.def,value:t.value,values:u.value,"load-options":e.loadOptions,messages:e.messages,disabled:e.disabled,invalid:!!t.error,onChange:c=>b(t.def.field,c)},null,8,["id","def","value","values","load-options","messages","disabled","invalid","onChange"])):(t.def.type??"text")==="select"?(a.openBlock(),a.createElementBlock("select",{key:1,class:"mrp-param-input",value:t.value,disabled:e.disabled,"aria-labelledby":`${t.id}-label`,"aria-invalid":t.error?!0:void 0,"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onChange:c=>b(t.def.field,c.target.value),onKeydown:a.withKeys(h,["enter"])},[a.createElementVNode("option",{value:"",disabled:t.def.required,hidden:t.def.required},a.toDisplayString(t.def.placeholder??(e.messages.paramSelectPlaceholder??"请选择{label}").replace("{label}",t.label)),9,we),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.def.options??[],c=>(a.openBlock(),a.createElementBlock("option",{key:c.value,value:c.value},a.toDisplayString(c.label),9,Pe))),128))],40,ke)):t.def.type==="dateRange"?(a.openBlock(),a.createElementBlock("div",{key:2,class:"mrp-param-range",role:"group","aria-labelledby":`${t.id}-label`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList([e.messages.paramRangeStart??"开始日期",e.messages.paramRangeEnd??"结束日期"],(c,E)=>(a.openBlock(),a.createElementBlock("input",{key:E,class:"mrp-param-input",type:"date",value:v(t.value,E),disabled:e.disabled,min:t.def.min,max:t.def.max,"aria-label":`${t.label} · ${c}`,"aria-invalid":S(t.value,E,t.error),"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onInput:k=>y(t.def.field,E,k.target.value),onKeydown:a.withKeys(h,["enter"])},null,40,Ce))),128))],8,Se)):(a.openBlock(),a.createElementBlock("input",{key:3,class:"mrp-param-input",type:P(t.def),inputmode:t.def.type==="year"?"numeric":void 0,maxlength:t.def.type==="year"?4:void 0,placeholder:t.def.placeholder??(e.messages.paramTextPlaceholder??"请输入{label}").replace("{label}",t.label),value:t.value,disabled:e.disabled,min:t.def.min,max:t.def.max,step:t.def.type==="number"?"any":void 0,"aria-labelledby":`${t.id}-label`,"aria-invalid":t.error?!0:void 0,"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onInput:c=>b(t.def.field,c.target.value),onKeydown:a.withKeys(h,["enter"])},null,40,xe)),t.error?(a.openBlock(),a.createElementBlock("small",{key:4,id:`${t.id}-error`,class:"mrp-param-error",role:"status"},a.toDisplayString(a.unref($)(t.error,e.defs,e.messages)),9,Be)):a.createCommentVNode("",!0)],2))),128))]),e.showActions!==!1?(a.openBlock(),a.createElementBlock("div",Ae,[a.createElementVNode("button",{class:"mrp-nav mrp-param-query",type:"button",disabled:e.disabled,onClick:d[0]||(d[0]=t=>o.$emit("query"))},a.toDisplayString(e.messages.query),9,Oe),a.createElementVNode("button",{class:"mrp-nav",type:"button",disabled:e.disabled,onClick:d[1]||(d[1]=t=>o.$emit("reset"))},a.toDisplayString(e.messages.reset),9,Me)])):a.createCommentVNode("",!0)],512))}}),De=M._export_sfc(Re,[["__scopeId","data-v-5fa48e40"]]),N={calculationTitle:"选区计算",calculationLocal:"仅本地分析,不写回实绩、不重算原公式。请选取同一单位与量纲的数值。",calculationHint:"点击起点,Shift + 点击终点或方向键扩选。",calculationFormula:"计算方式",calculationExpression:"组合公式",calculationExpressionHint:"支持 SUM、AVERAGE/AVG、MIN、MAX、COUNT、MEDIAN 及 + - * / 和括号,不执行 Excel 公式;采用浮点数,精度仅用于展示。",calculationPrecision:"展示小数位",calculationRun:"计算选区",calculationCancel:"取消计算",calculationResult:"计算结果",calculationIncluded:"参与数值",calculationExcluded:"排除单元格",calculationEmpty:"选区没有可计算数值,计数为 0,其余结果为空。",calculationNoSelection:"先关闭设置并选择数据,再从底部工具栏打开选区计算。",calculationSum:"求和 SUM",calculationAverage:"平均值 AVERAGE",calculationMin:"最小值 MIN",calculationMax:"最大值 MAX",calculationCount:"数值计数 COUNT",calculationMedian:"中位数 MEDIAN",calculationCustom:"组合公式",calculationErrorSelection:"请选择同一明细区域中的数据。",calculationErrorLimit:"选区超过计算预算,请缩小范围后重试。",calculationErrorExpression:"公式无效,请使用支持的摘要名称、运算符与括号。",calculationErrorDivision:"除数不能为 0。",calculationErrorOverflow:"结果超出有效数值范围。",calculationErrorPrecision:"数值超出安全精度,或展示小数位不是 0 至 12 的整数。"};function Fe(e){const n={...N};for(const l of Object.keys(n)){const r=e[l];typeof r=="string"&&(n[l]=r)}return n}const H={...I,drillActions:"查看关联",drillOpening:"正在打开…",drillMissingValue:"当前单元格缺少关联参数",drillFailed:"关联内容打开失败,请重试",...L,...N,exportMenu:"导出",exportMenuDescription:"选择文件格式",clearSearch:"清除搜索",searchHint:"Enter 下一个 · Shift+Enter 上一个",searchNoMatches:"没有匹配内容",pageJump:"跳至页",pageJumpInvalid:"请输入有效页码",pageJumpHint:"Enter 跳转",pagination:"报表分页",recordNavigation:"标签记录",recordInfo:"记录 {cur} / {total}",prevRecord:"上一条记录",nextRecord:"下一条记录",dataExplanation:"来源数据说明",dataExplanationHint:"按字段查看来源与计算说明",dataExplanationSearch:"搜索说明、字段或记录",dataExplanationEmpty:"没有匹配的数据说明",dataMissingSource:"暂无来源",dataNotApplicable:"业务不适用",dataNotCalculable:"无法计算",columnSearchHint:"输入列名或字段标识",columnSearchShortcut:"↑ ↓ 选择 · Enter 定位",closeColumnDirectory:"关闭字段目录",columnResultsMore:"{count} 个匹配字段,显示前 {limit} 个;继续输入可缩小范围",columnCount:"{count} 个字段",settingsGeneral:"常规",settingsTools:"工具",settingsAdvanced:"高级",settingsAdvancedDescription:"按需开启分析能力,保持日常阅读简洁。",settingsCalculations:"启用选区计算",settingsCalculationsDescription:"选取数值后计算求和、平均值或组合公式,仅用于本地分析。",title:"报表预览",prevPage:"‹ 上一页",nextPage:"下一页 ›",pageInfo:"{cur} / {total}",fitWidth:"适宽",exportHtml:"导出 HTML",exportPdf:"导出 PDF",exportExcel:"导出 Excel",exportImage:"导出图片",exportWord:"导出 Word",exporting:"正在生成 {format}…",print:"打印",pdfWindow:"PDF 窗口",loading:"报表渲染中…",empty:"暂无预览数据",errorPrefix:"",retry:"重试",pdfFontUnavailable:"PDF 字体尚未就绪,请联系管理员检查字体配置;预览及其它导出仍可使用。",searchPlaceholder:"搜索报表内容",matchInfo:"{cur}/{total}",prevMatch:"‹",nextMatch:"›",thumbnails:"缩略图",paramsTitle:"查询条件",query:"查 询",reset:"重 置",paramRequired:"请填写{label}",paramInvalid:"{label}:{message}",paramPrompt:"请先完善查询条件",paramPromptDescription:"填写必填条件后点击查询,即可生成报表。",paramSelectPlaceholder:"请选择{label}",paramTextPlaceholder:"请输入{label}",paramRangeStart:"开始日期",paramRangeEnd:"结束日期",searching:"搜索中…",importExcel:"导入 Excel 模板",importing:"正在导入 Excel…",editCell:"编辑单元格",editingHint:"双击单元格编辑 · Enter 确认 · Esc 取消",saving:"正在保存修改…",editInvalidNumber:"请输入有效数字;清空表示无值",editInvalidBoolean:"请输入 true / false、是 / 否或 1 / 0",editConflict:"该单元格已变化,请重新打开编辑",settings:"设置",settingsDisplay:"阅读工具",settingsExport:"导出与打印",settingsData:"数据操作",settingsUnavailable:"需由接入方配置启用",settingsReset:"恢复默认",settingsClose:"关闭设置",search:"内容搜索",closeSearch:"关闭搜索",prevSearchMatch:"上一个匹配",nextSearchMatch:"下一个匹配",zoom:"缩放工具",settingsLocal:"按需启用工具,仅作用于当前预览。",editingLocal:"修改为本地草稿;不会自动写入业务数据库。",editingSaved:"修改将通过接入方配置的保存回调提交。",importLocal:"导入仅生成本地预览,不自动替换业务数据。",emptyDescription:"当前查询没有明细,请调整查询条件后重试。",undo:"撤销",redo:"重做",restoreChanges:"恢复来源值",changes:"修改明细",changesCount:"{count} 处修改",changesEmpty:"尚无修改",changesBefore:"来源值",changesAfter:"当前值",editAtomicRequired:"批量保存需要接入方提供原子 saveBatch 回调;本次未写入任何单元格。",clipboardLimit:"单次最多粘贴 10000 个单元格,请分批处理。",preferencesError:"偏好存储不可用,设置仍在当前预览中生效。",freezeHeaders:"冻结表头",frozenColumns:"冻结前列",sections:"工作表与章节",locateField:"定位字段",locateFieldPlaceholder:"输入字段标识,Enter 定位",locateFieldMissing:"未找到该字段,请核对字段标识。",importSummary:"Excel 导入摘要",importPreserved:"已导入 {sheets} 个工作表,保留内容、合并和样式。",importWarnings:"兼容性提示",importReadOnly:"公式、日期及受保护单元格保持只读;公式不重算。",conflicts:"保存冲突",editReadOnly:"选区包含只读或无权限单元格,本次修改未应用。",editMissing:"选区超出报表范围或缺少业务来源,请重新选择。",editRecalculationUnavailable:"此报表缺少重算会话或稳定数据来源,暂不支持编辑;请使用 reports/本地数据源重新加载。",editDuplicate:"选区包含同一业务字段的重复单元格,请缩小选区。",clipboardInvalid:"剪贴板内容无法识别,请使用矩形表格文本重新粘贴。",editSaved:"修改已通过保存回调确认",settingsPanes:"冻结窗格",columnDirectory:"字段目录",columnSearch:"搜索列名或字段",columnNoMatches:"未找到匹配字段",columnResults:"匹配字段",columnGroup:"明细区域",discardTitle:"保留当前修改?",discardDescription:"当前报表有尚未保存的输入或本地草稿,继续操作将替换这些内容。",discardKeep:"继续编辑",discardProceed:"放弃修改并继续",taskQuery:"正在获取数据…",taskValidate:"正在校验数据…",taskLayout:"正在生成版式…",taskAssets:"正在准备图片和字体…",taskEncode:"正在生成文件…",taskDownload:"正在准备下载…",taskPrint:"正在准备打印…",taskCancel:"取消任务",taskCancelled:"任务已取消,可重新操作。",diagnosticsSearch:"搜索提示、错误码或位置",diagnosticsMore:"共 {count} 条匹配,当前展示前 100 条;请搜索缩小范围。",diagnosticsTitle:"输出兼容性提示",diagnosticsLocate:"定位",diagnosticsLocation:"第 {page} 页 · 组件 {component}",diagnosticsStrict:"当前格式存在已知内容降级,请查看兼容性提示或选择其他输出格式。",diagnosticsDetails:"查看技术详情",diagnosticMissingImage:"图片或图表资源尚未准备完成,请重试或联系管理员。",diagnosticUnsupported:"当前输出格式会省略此内容,建议选择 PDF 或图片格式。",diagnosticUnsupportedStyle:"当前格式无法保留部分样式,请查看位置并选择适合的输出格式。",diagnosticImageFormat:"当前图片格式无法直接导出,请转换资源后重试。",diagnosticRichText:"文字内容会保留,部分字体与段落样式将简化。",diagnosticNested:"单元格中的嵌套内容会省略,单元格文字会保留。",diagnosticImageAsync:"图片需要完成加载后才能输出。",diagnosticImageDecode:"图片加载失败,请检查资源后重试。",diagnosticAssetFailed:"图表或图片生成失败,请重试或联系管理员。",diagnosticAssetBudget:"图片资源超出处理范围,请减少资源或缩小报表范围。"},G={emptyAccent:"#79a7e8",shellBg:"#f4f7fc",shellFg:"#334155",toolbarBg:"#ffffff",toolbarBorder:"#e4eaf3",toolbarFg:"#334155",btnFg:"#526078",btnBorder:"#dbe3ef",btnHoverBg:"#edf3ff",btnHoverFg:"#315fba",btnActiveBg:"#3569d4"};function j(e={}){return{...e,defaults:e.defaults??{},presets:e.presets??{}}}function Te(e){return e}const A={showExport:!0,showPrint:!0,showPdfWindow:!0,showSettings:!0,showParams:!0,gapPx:18,pdfFontUrl:"/simhei.ttf",logger:console},Ie={warn:()=>{},info:()=>{}};function Ne(e,n){if(!(!e&&!n))return{...e,...n,calibration:{...e?.calibration,...n?.calibration}}}function R(e,n){return{...e,...n,theme:{...e?.theme,...n?.theme},messages:{...e?.messages,...n?.messages},preview:{...e?.preview,...n?.preview},xlsx:{...e?.xlsx,...n?.xlsx},toolbar:{...e?.toolbar,...n?.toolbar},interaction:{...e?.interaction,...n?.interaction},output:{...e?.output,...n?.output},printOptions:Ne(e?.printOptions,n?.printOptions)}}function qe(e){return{showExport:e.showExport??A.showExport,showPrint:e.showPrint??A.showPrint,showPdfWindow:e.showPdfWindow??A.showPdfWindow,showSettings:e.showSettings??A.showSettings,showParams:e.showParams??A.showParams,gapPx:e.gapPx??A.gapPx}}function Le(e,n){const l=n?e?.presets?.[n]:e?.defaultPreset?e?.presets?.[e.defaultPreset]:void 0,r=R(e?.defaults,l);return{drill:r.drill,exportExecution:r.exportExecution,loadParamOptions:r.loadParamOptions,...qe(r),pdfFontUrl:r.pdfFontUrl??A.pdfFontUrl,theme:{...G,...r.theme},messages:{...H,...r.messages},logger:r.logger??A.logger,preview:{overscanPages:q(r.preview?.overscanPages,1,10,!0),searchDebounceMs:q(r.preview?.searchDebounceMs,200,2e3)},xlsx:{...r.xlsx},editable:r.editable??!1,excelImport:r.excelImport??!1,toolbar:{...r.toolbar},interaction:{...r.interaction},preferences:r.preferences,assets:r.assets,guardChanges:r.guardChanges??!0,beforeDiscard:r.beforeDiscard,output:{...r.output},printOptions:r.printOptions}}function q(e,n,l,r=!1){if(e==null||!Number.isFinite(e))return n;const s=Math.max(0,Math.min(l,e));return r?Math.floor(s):s}function Ve(e){const n={};return e.emptyAccent!=null&&(n["--mrp-empty-accent"]=e.emptyAccent),e.shellBg!=null&&(n["--mrp-shell-bg"]=e.shellBg),e.shellFg!=null&&(n["--mrp-shell-fg"]=e.shellFg),e.toolbarBg!=null&&(n["--mrp-toolbar-bg"]=e.toolbarBg),e.toolbarBorder!=null&&(n["--mrp-toolbar-border"]=e.toolbarBorder),e.toolbarFg!=null&&(n["--mrp-toolbar-fg"]=e.toolbarFg),e.btnFg!=null&&(n["--mrp-btn-fg"]=e.btnFg),e.btnBorder!=null&&(n["--mrp-btn-border"]=e.btnBorder),e.btnHoverBg!=null&&(n["--mrp-btn-hover-bg"]=e.btnHoverBg),e.btnHoverFg!=null&&(n["--mrp-btn-hover-fg"]=e.btnHoverFg),e.btnActiveBg!=null&&(n["--mrp-btn-active-bg"]=e.btnActiveBg),n}function $e(e){const n=a.inject(T.MACH_REPORT_CONFIG_KEY,null),l=a.computed(()=>{const r=n?.value??null,s="defaults"in e||"presets"in e||"defaultPreset"in e?j(e):{defaults:e,presets:{}};if(!r)return s;const u={...r.presets,...s.presets};for(const m of Object.keys(u))u[m]=R(R(r.presets[m],s.defaults),s.presets[m]);return{defaults:R(r.defaults,s.defaults),presets:u,defaultPreset:s.defaultPreset??r.defaultPreset}});a.provide(T.MACH_REPORT_CONFIG_KEY,l)}function Ue(){return a.inject(T.MACH_REPORT_CONFIG_KEY,a.computed(()=>null))}exports.DEFAULT_CALCULATION_MESSAGES=N;exports.DEFAULT_MESSAGES=H;exports.DEFAULT_PRINT_MESSAGES=L;exports.DEFAULT_THEME=G;exports.MachReportError=O;exports.PARAM_OPTIONS_MESSAGES=I;exports.ReportParamPanel=De;exports.SILENT_LOGGER=Ie;exports.defineMachReportConfig=j;exports.defineMachReportPreset=Te;exports.normalizeReportLoadError=Q;exports.printCalibration=J;exports.provideMachReportConfig=$e;exports.resolveCalculationMessages=Fe;exports.resolveConfig=Le;exports.snapshotPrintOptions=Y;exports.themeToCssVars=Ve;exports.toErrorDetail=X;exports.useMachReportConfig=Ue;exports.usePopover=V;exports.useReportParams=ae;
@@ -1,6 +1,6 @@
1
- import { ref as x, watch as M, nextTick as B, onMounted as oe, onBeforeUnmount as X, computed as O, shallowRef as de, defineComponent as Y, openBlock as f, createElementBlock as v, createElementVNode as q, normalizeClass as K, createVNode as j, unref as p, toDisplayString as k, createCommentVNode as $, Fragment as N, renderList as U, withModifiers as ue, createTextVNode as Q, createBlock as ce, withKeys as z, inject as Z, provide as fe } from "vue";
1
+ import { ref as x, watch as M, nextTick as B, onMounted as se, onBeforeUnmount as X, computed as O, shallowRef as de, defineComponent as Y, openBlock as f, createElementBlock as v, createElementVNode as q, normalizeClass as K, createVNode as j, unref as p, toDisplayString as k, createCommentVNode as $, Fragment as N, renderList as U, withModifiers as ue, createTextVNode as Q, createBlock as ce, withKeys as z, inject as Z, provide as fe } from "vue";
2
2
  import { ReportParamValidationError as pe, ReportSourceError as ve, validateReportParams as _ } from "@agile-team/mach-report";
3
- import { w as me } from "./progress-D-OTpEav.js";
3
+ import { w as me } from "./progress-Hc2vxoCs.js";
4
4
  import { a as G, _ as ee } from "./_plugin-vue_export-helper-8SL1F89S.js";
5
5
  import { a as W } from "./injection-keys-e85udZCp.js";
6
6
  const ge = {
@@ -19,12 +19,12 @@ function ia(e) {
19
19
  if (![t, r].every((n) => Number.isFinite(n) && Math.abs(n) <= 20)) throw new RangeError("Print calibration must be within ±20 mm");
20
20
  return { x: t, y: r };
21
21
  }
22
- function sa(e = {}) {
22
+ function oa(e = {}) {
23
23
  if (e.fonts && (!Array.isArray(e.fonts) || e.fonts.length > 8)) throw new RangeError("At most eight print font faces are allowed");
24
24
  return { ...e, ...e.fonts ? { fonts: e.fonts.map((t) => ({ ...t })) } : {}, ...e.calibration ? { calibration: { ...e.calibration } } : {} };
25
25
  }
26
26
  function be(e = {}) {
27
- const t = x(!1), r = x(null), n = x(null), s = x(null);
27
+ const t = x(!1), r = x(null), n = x(null), o = x(null);
28
28
  function u(i = !1) {
29
29
  t.value = !1, i && B(() => n.value?.focus());
30
30
  }
@@ -35,19 +35,19 @@ function be(e = {}) {
35
35
  i.key !== "Escape" || !t.value || i.isComposing || (i.preventDefault(), i.stopPropagation(), u(!0));
36
36
  }
37
37
  return M(t, (i) => {
38
- !i || e.focusOnOpen === !1 || B(() => (s.value?.querySelector("input") ?? s.value?.querySelector("button:not(:disabled)"))?.focus());
39
- }), oe(() => {
38
+ !i || e.focusOnOpen === !1 || B(() => (o.value?.querySelector("input") ?? o.value?.querySelector("button:not(:disabled)"))?.focus());
39
+ }), se(() => {
40
40
  document.addEventListener("pointerdown", g), document.addEventListener("focusin", g);
41
41
  }), X(() => {
42
42
  document.removeEventListener("pointerdown", g), document.removeEventListener("focusin", g);
43
- }), { opened: t, root: r, trigger: n, panel: s, close: u, onKeydown: c };
43
+ }), { opened: t, root: r, trigger: n, panel: o, close: u, onKeydown: c };
44
44
  }
45
45
  class L extends Error {
46
46
  constructor(t, r, n) {
47
47
  super(r), this.name = "MachReportError", this.code = t, this.cause = n;
48
48
  }
49
49
  }
50
- function oa(e) {
50
+ function sa(e) {
51
51
  return e instanceof L ? { code: e.code, cause: e.cause } : { code: "render", cause: e };
52
52
  }
53
53
  function da(e) {
@@ -65,7 +65,7 @@ function he() {
65
65
  return `mrp-params-${++ye}`;
66
66
  }
67
67
  function ae(e, t, r) {
68
- const n = (Array.isArray(t) ? t.find((s) => s?.field === e.field)?.label : void 0) ?? e.field;
68
+ const n = (Array.isArray(t) ? t.find((o) => o?.field === e.field)?.label : void 0) ?? e.field;
69
69
  return e.code === "required" ? r.paramRequired.replace("{label}", n) : (r.paramInvalid ?? "{label}:{message}").replace("{label}", n).replace("{message}", e.message);
70
70
  }
71
71
  function ua(e) {
@@ -77,9 +77,9 @@ function ua(e) {
77
77
  t.value = c, r.value = !1;
78
78
  }
79
79
  n(), M(e.defs, n), M(e.reportIds, n), M(() => JSON.stringify(e.params()), n);
80
- const s = O(() => _(e.defs.value, { ...e.params(), ...t.value })), u = O(() => !r.value && s.value.issues.length > 0 && s.value.issues.every((c) => c.code === "required"));
80
+ const o = O(() => _(e.defs.value, { ...e.params(), ...t.value })), u = O(() => !r.value && o.value.issues.length > 0 && o.value.issues.every((c) => c.code === "required"));
81
81
  function g() {
82
- const c = s.value;
82
+ const c = o.value;
83
83
  if (!c.ok) {
84
84
  const m = c.issues[0];
85
85
  return { quiet: u.value, error: new L(m.code === "definition" ? "config" : "param", ae(m, e.defs.value, e.messages()), { issues: c.issues }) };
@@ -88,7 +88,7 @@ function ua(e) {
88
88
  for (const [m, h] of Object.entries(i)) h === "" && !C.has(m) && delete i[m];
89
89
  return { params: i, quiet: !1 };
90
90
  }
91
- return { values: t, attempted: r, validation: s, pendingRequired: u, reset: n, query: g };
91
+ return { values: t, attempted: r, validation: o, pendingRequired: u, reset: n, query: g };
92
92
  }
93
93
  const te = {
94
94
  paramOptionsLoading: "正在搜索选项…",
@@ -107,13 +107,13 @@ function xe(e) {
107
107
  }));
108
108
  }
109
109
  function Se(e) {
110
- const t = x(""), r = de([]), n = x(!1), s = x(!1), u = O(() => Object.fromEntries((Array.isArray(e.def().dependsOn) ? e.def().dependsOn : []).map((E) => [E, e.values()[E] ?? ""]))), g = O(() => Object.values(u.value).some((E) => !E.trim())), c = O(() => !e.loader()), i = /* @__PURE__ */ new Map();
110
+ const t = x(""), r = de([]), n = x(!1), o = x(!1), u = O(() => Object.fromEntries((Array.isArray(e.def().dependsOn) ? e.def().dependsOn : []).map((E) => [E, e.values()[E] ?? ""]))), g = O(() => Object.values(u.value).some((E) => !E.trim())), c = O(() => !e.loader()), i = /* @__PURE__ */ new Map();
111
111
  let C, m, h = 0;
112
112
  function A() {
113
113
  h++, C?.abort(), C = void 0, clearTimeout(m), n.value = !1;
114
114
  }
115
115
  async function b() {
116
- A(), s.value = !1;
116
+ A(), o.value = !1;
117
117
  const E = e.loader(), w = e.def();
118
118
  if (!E || !w.optionsSource || g.value || e.disabled() || !e.opened()) return;
119
119
  const I = { source: w.optionsSource, field: w.field, query: t.value.trim().slice(0, 256), params: Object.freeze({ ...u.value }), limit: ne }, l = JSON.stringify(I), d = i.get(l);
@@ -121,31 +121,31 @@ function Se(e) {
121
121
  i.delete(l), i.set(l, d), r.value = d.options;
122
122
  return;
123
123
  }
124
- const a = h, o = new AbortController();
125
- C = o, n.value = !0;
126
- const P = setTimeout(() => o.abort(), Pe);
124
+ const a = h, s = new AbortController();
125
+ C = s, n.value = !0;
126
+ const P = setTimeout(() => s.abort(), Pe);
127
127
  try {
128
- const S = xe(await me(E(Object.freeze({ ...I, signal: o.signal })), o.signal));
128
+ const S = xe(await me(E(Object.freeze({ ...I, signal: s.signal })), s.signal));
129
129
  if (a !== h) return;
130
130
  for (r.value = S, i.delete(l), i.set(l, { at: Date.now(), options: S }); i.size > Ee; ) i.delete(i.keys().next().value);
131
131
  } catch {
132
- a === h && (s.value = !0);
132
+ a === h && (o.value = !0);
133
133
  } finally {
134
134
  clearTimeout(P), a === h && (n.value = !1, C = void 0);
135
135
  }
136
136
  }
137
137
  function F() {
138
- A(), r.value = [], s.value = !1, m = setTimeout(() => {
138
+ A(), r.value = [], o.value = !1, m = setTimeout(() => {
139
139
  b();
140
140
  }, 180);
141
141
  }
142
142
  return M(t, F, { flush: "sync" }), M([() => e.def().field, () => e.def().optionsSource, () => JSON.stringify(u.value), e.loader], () => {
143
- i.clear(), t.value = "", A(), r.value = [], s.value = !1, e.opened() && b();
143
+ i.clear(), t.value = "", A(), r.value = [], o.value = !1, e.opened() && b();
144
144
  }, { flush: "sync" }), M([e.opened, e.disabled], () => {
145
145
  !e.opened() || e.disabled() ? A() : b();
146
146
  }), X(() => {
147
147
  A(), i.clear();
148
- }), { query: t, options: r, loading: n, failed: s, waiting: g, missingLoader: c, request: b, cancel: A };
148
+ }), { query: t, options: r, loading: n, failed: o, waiting: g, missingLoader: c, request: b, cancel: A };
149
149
  }
150
150
  const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "aria-describedby", "aria-expanded", "aria-controls", "aria-activedescendant", "disabled", "placeholder"], Ce = ["aria-label", "disabled"], Ae = ["aria-label", "disabled"], ke = ["id"], Me = ["id", "aria-label", "aria-busy"], Fe = ["id", "aria-selected", "disabled", "onPointermove", "onClick"], Re = { key: 0 }, Ie = {
151
151
  key: 0,
@@ -164,7 +164,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
164
164
  },
165
165
  emits: ["change"],
166
166
  setup(e, { emit: t }) {
167
- const r = e, n = t, s = be({ focusOnOpen: !1 }), { root: u, panel: g, opened: c } = s, i = Se({ def: () => r.def, values: () => r.values, loader: () => r.loadOptions, opened: () => c.value, disabled: () => r.disabled === !0 }), { query: C, options: m, loading: h, failed: A, waiting: b, missingLoader: F } = i, E = O(() => ({ ...te, ...r.messages })), w = x(0), I = x(""), l = x(), d = O(() => `${r.id}-options`), a = O(() => b.value ? E.value.paramOptionsDependencies : F.value ? E.value.paramOptionsMissingLoader : A.value ? E.value.paramOptionsFailed : h.value ? E.value.paramOptionsLoading : m.value.length ? "" : E.value.paramOptionsEmpty);
167
+ const r = e, n = t, o = be({ focusOnOpen: !1 }), { root: u, panel: g, opened: c } = o, i = Se({ def: () => r.def, values: () => r.values, loader: () => r.loadOptions, opened: () => c.value, disabled: () => r.disabled === !0 }), { query: C, options: m, loading: h, failed: A, waiting: b, missingLoader: F } = i, E = O(() => ({ ...te, ...r.messages })), w = x(0), I = x(""), l = x(), d = O(() => `${r.id}-options`), a = O(() => b.value ? E.value.paramOptionsDependencies : F.value ? E.value.paramOptionsMissingLoader : A.value ? E.value.paramOptionsFailed : h.value ? E.value.paramOptionsLoading : m.value.length ? "" : E.value.paramOptionsEmpty);
168
168
  M(() => r.value, () => {
169
169
  I.value = "";
170
170
  }), M(m, () => {
@@ -172,8 +172,8 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
172
172
  }), M(c, (y) => {
173
173
  y && B(() => l.value?.focus());
174
174
  });
175
- function o(y) {
176
- r.disabled || b.value || h.value || A.value || (n("change", y.value), s.close(), B(() => {
175
+ function s(y) {
176
+ r.disabled || b.value || h.value || A.value || (n("change", y.value), o.close(), B(() => {
177
177
  I.value = y.label, l.value?.focus();
178
178
  }));
179
179
  }
@@ -186,7 +186,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
186
186
  function le(y) {
187
187
  if (!(y.isComposing || y.keyCode === 229)) {
188
188
  if (y.key === "Escape") {
189
- c.value && (y.preventDefault(), y.stopPropagation(), s.close());
189
+ c.value && (y.preventDefault(), y.stopPropagation(), o.close());
190
190
  return;
191
191
  }
192
192
  if (["ArrowUp", "ArrowDown", "Enter"].includes(y.key)) {
@@ -196,7 +196,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
196
196
  }
197
197
  if (y.key === "Enter") {
198
198
  const D = m.value[w.value];
199
- D && o(D);
199
+ D && s(D);
200
200
  return;
201
201
  }
202
202
  m.value.length && (w.value = (w.value + (y.key === "ArrowDown" ? 1 : -1) + m.value.length) % m.value.length, B(() => g.value?.querySelector(`[id="${d.value}-${w.value}"]`)?.scrollIntoView?.({ block: "nearest" })));
@@ -204,7 +204,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
204
204
  }
205
205
  }
206
206
  function ie() {
207
- r.disabled || (n("change", ""), I.value = "", s.close());
207
+ r.disabled || (n("change", ""), I.value = "", o.close());
208
208
  }
209
209
  return (y, D) => (f(), v("div", {
210
210
  ref_key: "root",
@@ -258,7 +258,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
258
258
  type: "button",
259
259
  "aria-label": e.def.label ?? e.def.field,
260
260
  disabled: e.disabled || p(b) || p(F),
261
- onClick: D[0] || (D[0] = (R) => p(c) ? p(s).close() : S())
261
+ onClick: D[0] || (D[0] = (R) => p(c) ? p(o).close() : S())
262
262
  }, [
263
263
  j(G, {
264
264
  name: "chevron-down",
@@ -292,10 +292,10 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
292
292
  "aria-selected": e.value === R.value,
293
293
  class: K({ active: V === w.value }),
294
294
  disabled: p(h),
295
- onPointermove: (se) => w.value = V,
295
+ onPointermove: (oe) => w.value = V,
296
296
  onMousedown: D[1] || (D[1] = ue(() => {
297
297
  }, ["prevent"])),
298
- onClick: (se) => o(R)
298
+ onClick: (oe) => s(R)
299
299
  }, [
300
300
  q("span", null, k(R.label), 1),
301
301
  R.label !== R.value ? (f(), v("small", Re, k(R.value), 1)) : $("", !0)
@@ -313,12 +313,13 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
313
313
  ], 512)) : $("", !0)
314
314
  ], 512));
315
315
  }
316
- }), qe = /* @__PURE__ */ ee(De, [["__scopeId", "data-v-0e0e3248"]]), $e = {
316
+ }), qe = /* @__PURE__ */ ee(De, [["__scopeId", "data-v-5dbac6ad"]]), $e = {
317
317
  key: 0,
318
318
  class: "mrp-params-title"
319
319
  }, Te = { class: "mrp-params-grid" }, Le = ["id"], Be = {
320
320
  key: 0,
321
- class: "mrp-param-star"
321
+ class: "mrp-param-star",
322
+ "aria-hidden": "true"
322
323
  }, Ne = ["value", "disabled", "aria-labelledby", "aria-invalid", "aria-describedby", "aria-required", "onChange"], Ue = ["disabled", "hidden"], He = ["value"], Ve = ["aria-labelledby"], je = ["value", "disabled", "min", "max", "aria-label", "aria-invalid", "aria-describedby", "aria-required", "onInput"], ze = ["type", "inputmode", "maxlength", "placeholder", "value", "disabled", "min", "max", "step", "aria-labelledby", "aria-invalid", "aria-describedby", "aria-required", "onInput"], Ge = ["id"], Ke = {
323
324
  key: 1,
324
325
  class: "mrp-params-actions"
@@ -337,7 +338,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
337
338
  },
338
339
  emits: ["update:modelValue", "query", "reset"],
339
340
  setup(e, { expose: t, emit: r }) {
340
- const n = e, s = r, u = x({ ...n.modelValue }), g = x(null), c = he();
341
+ const n = e, o = r, u = x({ ...n.modelValue }), g = x(null), c = he();
341
342
  M(
342
343
  () => n.modelValue,
343
344
  (l) => {
@@ -355,18 +356,18 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
355
356
  ), m = O(() => {
356
357
  const l = /* @__PURE__ */ new Map();
357
358
  for (const d of n.defs) for (const a of Array.isArray(d.dependsOn) ? d.dependsOn : []) {
358
- const o = l.get(a) ?? [];
359
- o.push(d.field), l.set(a, o);
359
+ const s = l.get(a) ?? [];
360
+ s.push(d.field), l.set(a, s);
360
361
  }
361
362
  return l;
362
363
  });
363
364
  function h(l, d) {
364
365
  if (n.disabled || u.value[l] === d) return;
365
366
  u.value = { ...u.value, [l]: d };
366
- const a = /* @__PURE__ */ new Set([l]), o = [l];
367
- for (let P = 0; P < o.length; P++) for (const S of m.value.get(o[P]) ?? [])
368
- a.has(S) || (u.value[S] = "", a.add(S), o.push(S));
369
- s("update:modelValue", { ...u.value });
367
+ const a = /* @__PURE__ */ new Set([l]), s = [l];
368
+ for (let P = 0; P < s.length; P++) for (const S of m.value.get(s[P]) ?? [])
369
+ a.has(S) || (u.value[S] = "", a.add(S), s.push(S));
370
+ o("update:modelValue", { ...u.value });
370
371
  }
371
372
  function A(l) {
372
373
  return l.type === "number" ? "number" : l.type === "date" || l.type === "month" ? l.type : "text";
@@ -378,11 +379,11 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
378
379
  return a ? !!b(l, 0) != !!b(l, 1) ? !b(l, d) || void 0 : !0 : void 0;
379
380
  }
380
381
  function E(l, d, a) {
381
- const o = [b(u.value[l] ?? "", 0), b(u.value[l] ?? "", 1)];
382
- o[d] = a, h(l, o.every((P) => !P) ? "" : o.join("/"));
382
+ const s = [b(u.value[l] ?? "", 0), b(u.value[l] ?? "", 1)];
383
+ s[d] = a, h(l, s.every((P) => !P) ? "" : s.join("/"));
383
384
  }
384
385
  function w(l) {
385
- l.isComposing || s("query");
386
+ l.isComposing || o("query");
386
387
  }
387
388
  function I() {
388
389
  g.value?.querySelector('[aria-invalid="true"]')?.focus();
@@ -415,7 +416,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
415
416
  messages: e.messages,
416
417
  disabled: e.disabled,
417
418
  invalid: !!a.error,
418
- onChange: (o) => h(a.def.field, o)
419
+ onChange: (s) => h(a.def.field, s)
419
420
  }, null, 8, ["id", "def", "value", "values", "load-options", "messages", "disabled", "invalid", "onChange"])) : (a.def.type ?? "text") === "select" ? (f(), v("select", {
420
421
  key: 1,
421
422
  class: "mrp-param-input",
@@ -425,7 +426,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
425
426
  "aria-invalid": a.error ? !0 : void 0,
426
427
  "aria-describedby": a.error ? `${a.id}-error` : void 0,
427
428
  "aria-required": a.def.required || void 0,
428
- onChange: (o) => h(a.def.field, o.target.value),
429
+ onChange: (s) => h(a.def.field, s.target.value),
429
430
  onKeydown: z(w, ["enter"])
430
431
  }, [
431
432
  q("option", {
@@ -433,17 +434,17 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
433
434
  disabled: a.def.required,
434
435
  hidden: a.def.required
435
436
  }, k(a.def.placeholder ?? (e.messages.paramSelectPlaceholder ?? "请选择{label}").replace("{label}", a.label)), 9, Ue),
436
- (f(!0), v(N, null, U(a.def.options ?? [], (o) => (f(), v("option", {
437
- key: o.value,
438
- value: o.value
439
- }, k(o.label), 9, He))), 128))
437
+ (f(!0), v(N, null, U(a.def.options ?? [], (s) => (f(), v("option", {
438
+ key: s.value,
439
+ value: s.value
440
+ }, k(s.label), 9, He))), 128))
440
441
  ], 40, Ne)) : a.def.type === "dateRange" ? (f(), v("div", {
441
442
  key: 2,
442
443
  class: "mrp-param-range",
443
444
  role: "group",
444
445
  "aria-labelledby": `${a.id}-label`
445
446
  }, [
446
- (f(!0), v(N, null, U([e.messages.paramRangeStart ?? "开始日期", e.messages.paramRangeEnd ?? "结束日期"], (o, P) => (f(), v("input", {
447
+ (f(!0), v(N, null, U([e.messages.paramRangeStart ?? "开始日期", e.messages.paramRangeEnd ?? "结束日期"], (s, P) => (f(), v("input", {
447
448
  key: P,
448
449
  class: "mrp-param-input",
449
450
  type: "date",
@@ -451,7 +452,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
451
452
  disabled: e.disabled,
452
453
  min: a.def.min,
453
454
  max: a.def.max,
454
- "aria-label": `${a.label} · ${o}`,
455
+ "aria-label": `${a.label} · ${s}`,
455
456
  "aria-invalid": F(a.value, P, a.error),
456
457
  "aria-describedby": a.error ? `${a.id}-error` : void 0,
457
458
  "aria-required": a.def.required || void 0,
@@ -474,7 +475,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
474
475
  "aria-invalid": a.error ? !0 : void 0,
475
476
  "aria-describedby": a.error ? `${a.id}-error` : void 0,
476
477
  "aria-required": a.def.required || void 0,
477
- onInput: (o) => h(a.def.field, o.target.value),
478
+ onInput: (s) => h(a.def.field, s.target.value),
478
479
  onKeydown: z(w, ["enter"])
479
480
  }, null, 40, ze)),
480
481
  a.error ? (f(), v("small", {
@@ -501,7 +502,7 @@ const Oe = ["id", "value", "aria-labelledby", "aria-invalid", "aria-required", "
501
502
  ])) : $("", !0)
502
503
  ], 512));
503
504
  }
504
- }), ca = /* @__PURE__ */ ee(Xe, [["__scopeId", "data-v-6f9fe7a1"]]), re = {
505
+ }), ca = /* @__PURE__ */ ee(Xe, [["__scopeId", "data-v-5fa48e40"]]), re = {
505
506
  calculationTitle: "选区计算",
506
507
  calculationLocal: "仅本地分析,不写回实绩、不重算原公式。请选取同一单位与量纲的数值。",
507
508
  calculationHint: "点击起点,Shift + 点击终点或方向键扩选。",
@@ -764,6 +765,7 @@ function ma(e, t) {
764
765
  const r = t ? e?.presets?.[t] : e?.defaultPreset ? e?.presets?.[e.defaultPreset] : void 0, n = H(e?.defaults, r);
765
766
  return {
766
767
  drill: n.drill,
768
+ exportExecution: n.exportExecution,
767
769
  loadParamOptions: n.loadParamOptions,
768
770
  ...ea(n),
769
771
  pdfFontUrl: n.pdfFontUrl ?? T.pdfFontUrl,
@@ -789,8 +791,8 @@ function ma(e, t) {
789
791
  }
790
792
  function J(e, t, r, n = !1) {
791
793
  if (e == null || !Number.isFinite(e)) return t;
792
- const s = Math.max(0, Math.min(r, e));
793
- return n ? Math.floor(s) : s;
794
+ const o = Math.max(0, Math.min(r, e));
795
+ return n ? Math.floor(o) : o;
794
796
  }
795
797
  function ga(e) {
796
798
  const t = {};
@@ -798,18 +800,18 @@ function ga(e) {
798
800
  }
799
801
  function ba(e) {
800
802
  const t = Z(W, null), r = O(() => {
801
- const n = t?.value ?? null, s = "defaults" in e || "presets" in e || "defaultPreset" in e ? Ze(e) : { defaults: e, presets: {} };
802
- if (!n) return s;
803
- const u = { ...n.presets, ...s.presets };
803
+ const n = t?.value ?? null, o = "defaults" in e || "presets" in e || "defaultPreset" in e ? Ze(e) : { defaults: e, presets: {} };
804
+ if (!n) return o;
805
+ const u = { ...n.presets, ...o.presets };
804
806
  for (const g of Object.keys(u))
805
807
  u[g] = H(
806
- H(n.presets[g], s.defaults),
807
- s.presets[g]
808
+ H(n.presets[g], o.defaults),
809
+ o.presets[g]
808
810
  );
809
811
  return {
810
- defaults: H(n.defaults, s.defaults),
812
+ defaults: H(n.defaults, o.defaults),
811
813
  presets: u,
812
- defaultPreset: s.defaultPreset ?? n.defaultPreset
814
+ defaultPreset: o.defaultPreset ?? n.defaultPreset
813
815
  };
814
816
  });
815
817
  fe(W, r);
@@ -830,13 +832,13 @@ export {
830
832
  pa as e,
831
833
  ba as f,
832
834
  ma as g,
833
- oa as h,
835
+ sa as h,
834
836
  be as i,
835
837
  ua as j,
836
838
  da as n,
837
839
  ia as p,
838
840
  fa as r,
839
- sa as s,
841
+ oa as s,
840
842
  ga as t,
841
843
  ya as u
842
844
  };
@@ -0,0 +1,161 @@
1
+ function u(e) {
2
+ throw new Error(`数据契约无效:${e}`);
3
+ }
4
+ function d(e) {
5
+ return typeof e == "string" && e.trim().length > 0 && e.length <= 4096;
6
+ }
7
+ function y(e) {
8
+ for (const n of ["description", "missingMeaning"]) e[n] !== void 0 && !d(e[n]) && u(`${n} 应为 1–4096 位非空字符串`);
9
+ e.aggregation !== void 0 && !["sum", "avg", "min", "max", "count", "none"].includes(e.aggregation) && u("未知字段聚合语义"), e.aggregation && !["count", "none"].includes(e.aggregation) && !["number", "decimal"].includes(e.type) && u("数值聚合仅适用于 number/decimal"), e.format !== void 0 && l(e), e.calculation !== void 0 && (!e.calculation || !d(e.calculation.description) || !Array.isArray(e.calculation.dependsOn) || !e.calculation.dependsOn.length || e.calculation.dependsOn.length > 256 || e.calculation.dependsOn.some((n) => typeof n != "string" || !n.trim()) || new Set(e.calculation.dependsOn).size !== e.calculation.dependsOn.length) && u("计算说明需包含说明及 1–256 个唯一依赖字段");
10
+ }
11
+ function l(e) {
12
+ const n = e.format;
13
+ if ((!n || !["number", "percent", "date"].includes(n.kind)) && u("未知字段显示格式"), n.kind === "date") {
14
+ (e.type !== "date" || n.pattern !== void 0 && (!d(n.pattern) || n.pattern.length > 128)) && u("日期格式仅适用于日期,pattern 最多 128 位");
15
+ return;
16
+ }
17
+ ["number", "decimal"].includes(e.type) || u("数值显示格式仅适用于 number/decimal"), n.digits !== void 0 && (!Number.isSafeInteger(n.digits) || n.digits < 0 || n.digits > 100) && u("显示小数位应为 0–100 的整数"), n.kind === "number" && n.thousands !== void 0 && typeof n.thousands != "boolean" && u("thousands 应为布尔值");
18
+ }
19
+ function x(e) {
20
+ const n = new Map(e.map((i) => [i.field, i])), t = /* @__PURE__ */ new Set();
21
+ for (const i of e) {
22
+ const o = [{ field: i.field, exit: !1 }], m = /* @__PURE__ */ new Set();
23
+ for (; o.length; ) {
24
+ const s = o.pop();
25
+ if (s.exit) {
26
+ m.delete(s.field), t.add(s.field);
27
+ continue;
28
+ }
29
+ if (m.has(s.field) && u("字段计算依赖存在循环"), t.has(s.field)) continue;
30
+ const r = n.get(s.field);
31
+ r || u(`计算依赖字段未声明:${s.field}`), m.add(s.field), o.push({ field: s.field, exit: !0 });
32
+ for (const c of r.calculation?.dependsOn ?? []) o.push({ field: c, exit: !1 });
33
+ }
34
+ }
35
+ }
36
+ const b = ["text", "number", "boolean", "date", "decimal"], w = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
37
+ function a(e) {
38
+ throw new Error(`数据契约无效:${e}`);
39
+ }
40
+ function h(e) {
41
+ (!e || !Array.isArray(e.fields) || !e.fields.length || e.fields.length > 2048) && a("fields 应包含 1–2048 个字段");
42
+ const n = /* @__PURE__ */ new Set();
43
+ for (const t of e.fields)
44
+ (!t || typeof t.field != "string" || !t.field.trim() || w.has(t.field) || n.has(t.field)) && a("字段名应安全、非空且唯一"), n.add(t.field), b.includes(t.type) || a(`未知字段类型 ${t.type}`), k(t), $(t), y(t), v(t);
45
+ L(e, n), x(e.fields);
46
+ }
47
+ function v(e) {
48
+ e.enum !== void 0 && (!Array.isArray(e.enum) || !e.enum.length || e.enum.some((n) => !f(n, e.type))) && a("enum 应为匹配字段类型的非空标量数组");
49
+ }
50
+ function L(e, n) {
51
+ e.rowKey !== void 0 && ((typeof e.rowKey != "string" || !e.rowKey.trim() || !n.has(e.rowKey)) && a("rowKey 应为引用已声明字段的非空字符串"), e.fields.find((t) => t.field === e.rowKey)?.type === "boolean" && a("布尔字段不能作为业务主键"));
52
+ }
53
+ function $(e) {
54
+ for (const n of ["label", "unit"]) e[n] !== void 0 && typeof e[n] != "string" && a(`${n} 应为字符串`);
55
+ for (const n of ["required", "nullable"]) e[n] !== void 0 && typeof e[n] != "boolean" && a(`${n} 应为布尔值`);
56
+ e.semanticRole !== void 0 && !["identifier", "dimension", "measure", "date", "text"].includes(e.semanticRole) && a("未知字段语义");
57
+ }
58
+ function k(e) {
59
+ for (const n of ["min", "max", "minLength", "maxLength"]) {
60
+ const t = e[n];
61
+ t !== void 0 && (!Number.isFinite(t) || n.includes("Length") && (!Number.isInteger(t) || t < 0)) && a(`${n} 无效`);
62
+ }
63
+ e.min !== void 0 && e.max !== void 0 && e.min > e.max && a("min 不能超过 max"), e.minLength !== void 0 && e.maxLength !== void 0 && e.minLength > e.maxLength && a("minLength 不能超过 maxLength"), e.type !== "number" && (e.min !== void 0 || e.max !== void 0) && a("min/max 仅适用于 number,精确小数文本需业务校验"), ["number", "boolean"].includes(e.type) && (e.minLength !== void 0 || e.maxLength !== void 0) && a("长度约束仅适用于文本类型");
64
+ }
65
+ function O(e) {
66
+ const n = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
67
+ if (!n) return !1;
68
+ const t = Number(n[1]), i = Number(n[2]), o = Number(n[3]), m = t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
69
+ return t > 0 && i >= 1 && i <= 12 && o >= 1 && o <= [31, m ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][i - 1];
70
+ }
71
+ function f(e, n) {
72
+ return n === "number" ? typeof e == "number" && Number.isFinite(e) : n === "boolean" ? typeof e == "boolean" : typeof e != "string" ? !1 : n === "date" ? O(e) : n === "decimal" ? e.length <= 1e4 && /^-?(?:0|[1-9]\d*)(?:\.\d+)?$/.test(e) : !0;
73
+ }
74
+ function S(e, n) {
75
+ if (e == null)
76
+ return n.required || e === null && n.nullable === !1 ? { code: "required", message: "缺少必需字段值" } : void 0;
77
+ if (!f(e, n.type)) return { code: "type", message: `值应为 ${n.type},不会自动转换原始值` };
78
+ if (n.enum && !n.enum.includes(e)) return { code: "enum", message: "值不在允许的枚举中" };
79
+ if (typeof e == "number" && (n.min !== void 0 && e < n.min || n.max !== void 0 && e > n.max)) return { code: "range", message: "数值超出范围" };
80
+ if (typeof e == "string" && !K(e, n)) return { code: "range", message: "文本长度超出范围" };
81
+ }
82
+ function K(e, n) {
83
+ if (n.minLength === void 0 && n.maxLength === void 0) return !0;
84
+ let t = 0;
85
+ for (const i of e) t++;
86
+ return (n.minLength === void 0 || t >= n.minLength) && (n.maxLength === void 0 || t <= n.maxLength);
87
+ }
88
+ function g(e, n) {
89
+ const t = e ?? n;
90
+ if (!Number.isInteger(t) || t < 1) throw new Error("数据校验预算应为正整数");
91
+ return t;
92
+ }
93
+ function A(e, n, t) {
94
+ const i = Object.prototype.hasOwnProperty.call(e, n) ? e[n] : void 0;
95
+ if ((typeof i != "string" || !i.trim()) && !(typeof i == "number" && Number.isFinite(i))) return "业务主键应为非空字符串或有限数字";
96
+ const o = JSON.stringify([typeof i, i]);
97
+ if (t.has(o)) return "业务主键重复";
98
+ t.add(o);
99
+ }
100
+ function M(e, n, t = {}) {
101
+ h(n);
102
+ const i = t.path ?? "$.rows", o = [], m = g(t.maxIssues, 100);
103
+ if (!Array.isArray(e)) return { ok: !1, issues: [{ code: "row", path: i, message: "数据集应为对象数组" }] };
104
+ if (e.length > g(t.maxRows, 1e5) || e.length * n.fields.length > g(t.maxCells, 2e6)) return { ok: !1, issues: [{ code: "budget", path: i, message: "数据校验超出行数或单元格预算" }] };
105
+ const s = /* @__PURE__ */ new Set();
106
+ for (let r = 0; r < e.length && o.length < m; r++) {
107
+ const c = e[r];
108
+ if (!c || typeof c != "object" || Array.isArray(c)) {
109
+ o.push({ code: "row", path: `${i}[${r}]`, rowIndex: r, message: "行应为对象" });
110
+ continue;
111
+ }
112
+ N(c, n, r, i, s, o, m);
113
+ }
114
+ return { ok: o.length === 0, issues: o };
115
+ }
116
+ function N(e, n, t, i, o, m, s) {
117
+ for (const r of n.fields) {
118
+ if (m.length >= s) return;
119
+ const c = S(Object.prototype.hasOwnProperty.call(e, r.field) ? e[r.field] : void 0, r);
120
+ c && m.push({ ...c, rowIndex: t, field: r.field, path: `${i}[${t}].${r.field}` });
121
+ }
122
+ if (n.rowKey && m.length < s) {
123
+ const r = A(e, n.rowKey, o);
124
+ r && m.push({ code: "row-key", path: `${i}[${t}].${n.rowKey}`, message: r, rowIndex: t, field: n.rowKey });
125
+ }
126
+ }
127
+ function j(e) {
128
+ return h(e), { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: { type: "object", properties: Object.fromEntries(e.fields.map((t) => [t.field, R(t, t.field === e.rowKey)])), required: e.fields.filter((t) => t.required || t.field === e.rowKey).map((t) => t.field), additionalProperties: !0 }, ...e.rowKey ? { "x-report-rowKey": e.rowKey } : {} };
129
+ }
130
+ function R(e, n) {
131
+ const t = !n && e.nullable !== !1 && !e.required;
132
+ return {
133
+ type: t ? [p(e.type), "null"] : p(e.type),
134
+ ...e.label ? { title: e.label } : {},
135
+ ...e.description ? { description: e.description } : {},
136
+ ...e.type === "date" ? { format: "date" } : {},
137
+ ...e.type === "decimal" ? { pattern: "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$" } : {},
138
+ ...e.enum ? { enum: t ? [...e.enum, null] : [...e.enum] } : {},
139
+ ...e.min === void 0 ? {} : { minimum: e.min },
140
+ ...e.max === void 0 ? {} : { maximum: e.max },
141
+ ...E(e, n),
142
+ ...n && e.type === "text" ? { pattern: "\\S" } : {},
143
+ ...e.unit ? { "x-report-unit": e.unit } : {},
144
+ ...e.semanticRole ? { "x-report-semanticRole": e.semanticRole } : {},
145
+ ...e.aggregation ? { "x-report-aggregation": e.aggregation } : {},
146
+ ...e.format ? { "x-report-format": { ...e.format } } : {},
147
+ ...e.missingMeaning ? { "x-report-missingMeaning": e.missingMeaning } : {},
148
+ ...e.calculation ? { "x-report-calculation": { description: e.calculation.description, dependsOn: [...e.calculation.dependsOn] } } : {}
149
+ };
150
+ }
151
+ function E(e, n) {
152
+ const t = {};
153
+ return (e.minLength !== void 0 || n && e.type !== "number") && (t.minLength = Math.max(e.minLength ?? 0, n ? 1 : 0)), e.type === "decimal" ? t.maxLength = Math.min(e.maxLength ?? 1e4, 1e4) : e.maxLength !== void 0 && (t.maxLength = e.maxLength), t;
154
+ }
155
+ function p(e) {
156
+ return e === "text" || e === "date" || e === "decimal" ? "string" : e;
157
+ }
158
+ export {
159
+ j as d,
160
+ M as v
161
+ };