@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.
- package/README.md +21 -12
- package/dist/{ExcelBindingWizard-Bs43BGNp.cjs → ExcelBindingWizard-Bq6FYME6.cjs} +1 -1
- package/dist/{ExcelBindingWizard-BKH1nGNS.js → ExcelBindingWizard-Co1svTsw.js} +3 -3
- package/dist/{ParamEditor-Da4akw6V.cjs → ParamEditor-B5UZRgxv.cjs} +1 -1
- package/dist/{ParamEditor-DoAhzJsm.js → ParamEditor-DNNARyeB.js} +1 -1
- package/dist/{ReportBatchPanel-wP9m9Pj1.cjs → ReportBatchPanel-Ctvs2t_9.cjs} +1 -1
- package/dist/{ReportBatchPanel-BMf6boMA.js → ReportBatchPanel-uQh06usx.js} +3 -3
- package/dist/ReportPreview-BdQawRh0.js +4879 -0
- package/dist/ReportPreview-CJC_-j2I.cjs +6 -0
- package/dist/{ReportTemplateLibrary-Sxr3eD0J.cjs → ReportTemplateLibrary-CnP7_1pH.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-C9wutIiT.js → ReportTemplateLibrary-TIL_Oj2l.js} +1 -1
- package/dist/RuleEditor-DkRjOLlr.js +2141 -0
- package/dist/RuleEditor-h5anGsDB.cjs +1 -0
- package/dist/{TemplateOutlinePanel-JTSR53vJ.cjs → TemplateOutlinePanel-BlLxRrfu.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-D6Bkny59.js → TemplateOutlinePanel-BouxsuqQ.js} +1 -1
- package/dist/{TemplateReusePanel-rVuK1kTz.js → TemplateReusePanel-BEACLPaN.js} +2 -2
- package/dist/{TemplateReusePanel-Kx35S0Ql.cjs → TemplateReusePanel-yxsHSO40.cjs} +1 -1
- package/dist/{TemplateReviewPanel-B0ar9_zf.js → TemplateReviewPanel-B1OGRY2i.js} +1 -1
- package/dist/{TemplateReviewPanel-Dn6X9UmY.cjs → TemplateReviewPanel-D9Cx0m2N.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +65 -1
- package/dist/analytics.d.ts +65 -1
- package/dist/analytics.js +4 -4
- package/dist/artifact-integrity.json +105 -101
- package/dist/assets-BIMVwjQe.js +231 -0
- package/dist/assets-Dfs2ElxI.cjs +1 -0
- package/dist/auto-BIOmtVhk.js +240 -0
- package/dist/auto-DDHflI9v.cjs +1 -0
- package/dist/{batch-BfZHN1do.js → batch-WzDIXJAt.js} +1 -1
- package/dist/{batch-CLpELXBl.cjs → batch-z6Aw5GEY.cjs} +1 -1
- package/dist/codes.d.cts +2 -0
- package/dist/codes.d.ts +2 -0
- package/dist/component-tree-Ca6YYfHq.js +61 -0
- package/dist/component-tree-DkGLEfZC.cjs +1 -0
- package/dist/computed-BW5a8QFk.js +612 -0
- package/dist/computed-C2GD3XcE.cjs +1 -0
- package/dist/config-Dg_o8e7m.cjs +1 -0
- package/dist/{config-BVsJXSqS.js → config-XQ4qrQ7Q.js} +66 -64
- package/dist/dataset-DL83majE.js +161 -0
- package/dist/dataset-IrlXbUvh.cjs +1 -0
- package/dist/designer-D9XAxqSc.js +5178 -0
- package/dist/designer-uCDo5XSK.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +178 -3
- package/dist/designer.d.ts +178 -3
- package/dist/designer.js +1 -1
- package/dist/drill-ByN8COs_.cjs +1 -0
- package/dist/{drill-ByJviLXS.js → drill-CKW3Xtfa.js} +5 -5
- package/dist/encoding-BFMFIc4r.cjs +1 -0
- package/dist/encoding-DP_Eaf0A.js +21 -0
- package/dist/{font-loader-B_UkxpzC.cjs → font-loader-7FWVlykp.cjs} +1 -1
- package/dist/{font-loader-Q3bQjmrI.js → font-loader-CQZowp0I.js} +1 -1
- package/dist/index.cjs +8 -9
- package/dist/index.d.cts +175 -1
- package/dist/index.d.ts +175 -1
- package/dist/index.js +1343 -915
- package/dist/json-snapshot-D7PE1NsU.cjs +2 -0
- package/dist/json-snapshot-DYmEe3sO.js +1779 -0
- package/dist/matrix-JLAXlux-.js +302 -0
- package/dist/matrix-gTHpDTGm.cjs +1 -0
- package/dist/{pdf-CvvrjPQg.cjs → pdf-B8JouyYv.cjs} +48 -50
- package/dist/{pdf-BwNyeGpt.js → pdf-l3ea86di.js} +2734 -2748
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +14 -0
- package/dist/pdf.d.ts +14 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-Ca_XZG3l.js → plugin-BBp74CQZ.js} +1 -1
- package/dist/{plugin-DHO7X8z2.cjs → plugin-CtFX9PFG.cjs} +1 -1
- package/dist/prepared-CARicKYh.js +87 -0
- package/dist/prepared-Ch1x_Gog.cjs +1 -0
- package/dist/progress-BXzlVbIp.js +29 -0
- package/dist/progress-DJBd9Rb9.cjs +1 -0
- package/dist/{progress-D-OTpEav.js → progress-Hc2vxoCs.js} +2 -2
- package/dist/protocol-B5A2uom4.cjs +1 -0
- package/dist/protocol-BaiWjq5w.js +90 -0
- package/dist/record-bindings-B86Sur_y.cjs +1 -0
- package/dist/{record-bindings-Do_b3h4V.js → record-bindings-D4TuMzHs.js} +10 -11
- package/dist/{region-binding-workflow-BMhK_TjP.js → region-binding-workflow-BNasF5kz.js} +2 -2
- package/dist/{region-binding-workflow-DIYJdCUr.cjs → region-binding-workflow-O2Cni3mF.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -0
- package/dist/report-encoding-worker.d.ts +1 -0
- package/dist/report-encoding-worker.js +2 -0
- package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
- package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
- package/dist/runtime-DakRXui3.js +170 -0
- package/dist/runtime-dL5ygIfa.cjs +1 -0
- package/dist/sbom.cdx.json +2 -2
- package/dist/server/node.d.cts +132 -1
- package/dist/server/node.d.ts +132 -1
- package/dist/server-node.cjs +5 -1
- package/dist/server-node.js +5177 -463
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +182 -2
- package/dist/server.d.ts +182 -2
- package/dist/server.js +918 -833
- package/dist/sha256-BshdOkCC.cjs +1 -0
- package/dist/sha256-DTG-Gq8i.js +157 -0
- package/dist/style-67OqfNed.js +73 -0
- package/dist/style-C22Pbv3T.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/template-catalog-Dua8h9ZA.cjs +1 -0
- package/dist/{template-catalog-j2B1MJlL.js → template-catalog-wT1fNeAP.js} +10 -10
- package/dist/{template-fragments-DcKeiylI.cjs → template-fragments-BajTajb4.cjs} +1 -1
- package/dist/{template-fragments-BGbQLGlV.js → template-fragments-DmX5XK4N.js} +2 -2
- package/dist/template-registry-CpysHAxy.cjs +1 -0
- package/dist/{template-registry-BtaKPELV.js → template-registry-u11fPd8D.js} +389 -321
- package/dist/{textwrap-DE1kgcJB.js → textwrap-BEIg2w8y.js} +1 -1
- package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
- package/dist/{tree-BX380Rr7.cjs → tree-CLpxYbKa.cjs} +1 -1
- package/dist/{tree-CjVZLRw7.js → tree-DNJorJUf.js} +1 -1
- package/dist/vue/async.d.cts +174 -2
- package/dist/vue/async.d.ts +174 -2
- package/dist/vue/index.d.cts +218 -3
- package/dist/vue/index.d.ts +218 -3
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +7 -7
- package/dist/{workbook-session-BvToI-Fd.js → workbook-session-B8pNW24X.js} +153 -140
- package/dist/{workbook-session-Bjv1YCRK.cjs → workbook-session-DN5LSA5C.cjs} +12 -12
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +84 -1
- package/dist/worker.d.ts +84 -1
- package/dist/worker.js +12 -157
- package/dist/xlsx-node.cjs +33 -33
- package/dist/xlsx-node.js +1282 -1289
- package/dist/xlsx.cjs +4 -3
- package/dist/xlsx.d.cts +90 -2
- package/dist/xlsx.d.ts +90 -2
- package/dist/xlsx.js +279 -259
- package/package.json +6 -3
- package/dist/ReportPreview-ChV19HBp.js +0 -4619
- package/dist/ReportPreview-DbLvvOUT.cjs +0 -6
- package/dist/RuleEditor-C_Clasvd.js +0 -2037
- package/dist/RuleEditor-XhGHK8DE.cjs +0 -1
- package/dist/assets-B9ImAi6_.cjs +0 -1
- package/dist/assets-DEaz4qsp.js +0 -124
- package/dist/batch-BaP6pWDE.cjs +0 -1
- package/dist/batch-CGyt-b2W.js +0 -273
- package/dist/capabilities-CAh2Nrue.cjs +0 -1
- package/dist/capabilities-DskCHs3V.js +0 -69
- package/dist/computed-C-4C2S5h.js +0 -521
- package/dist/computed-CGV2a809.cjs +0 -1
- package/dist/config-D10us76d.cjs +0 -1
- package/dist/data-explanation-B8MZRYVS.js +0 -16
- package/dist/data-explanation-DE55G30w.cjs +0 -1
- package/dist/dataset-BkRmwgeJ.cjs +0 -1
- package/dist/dataset-H5pFuQGU.js +0 -121
- package/dist/defaults-DXhiM1ZD.js +0 -10
- package/dist/defaults-xhmcLLrf.cjs +0 -1
- package/dist/designer-2bDlcNXQ.js +0 -5136
- package/dist/designer-BT7XCdbW.cjs +0 -2
- package/dist/drill-DYTxuL3A.cjs +0 -1
- package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
- package/dist/grid-strokes-DyyG1q_o.js +0 -53
- package/dist/json-snapshot-DFb2eWkf.js +0 -1416
- package/dist/json-snapshot-WWSGlaHG.cjs +0 -2
- package/dist/matrix-CGRGkn5s.js +0 -112
- package/dist/matrix-gEO7ZM_u.cjs +0 -1
- package/dist/prepared-CFy9B75C.cjs +0 -1
- package/dist/prepared-ajM-H-9B.js +0 -69
- package/dist/record-bindings-By_UKZ2g.cjs +0 -1
- package/dist/render-plan-7xpGrCEl.cjs +0 -1
- package/dist/render-plan-Ck6koX9L.js +0 -13
- package/dist/sha256-ArEYjaTI.cjs +0 -1
- package/dist/sha256-DPEuJ3nh.js +0 -155
- package/dist/style-CQ1PK8ZB.js +0 -67
- package/dist/style-UgIJSA1F.cjs +0 -1
- package/dist/template-catalog-FJE_c9Qe.cjs +0 -1
- package/dist/template-registry-Co1zPq5e.cjs +0 -1
- package/dist/textwrap-CWHyzkBH.cjs +0 -4
package/dist/config-D10us76d.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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-0e0e3248"]]),be={key:0,class:"mrp-params-title"},ye={class:"mrp-params-grid"},he=["id"],Ee={key:0,class:"mrp-param-star"},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-6f9fe7a1"]]),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,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,16 +0,0 @@
|
|
|
1
|
-
function i(t) {
|
|
2
|
-
if (!t || typeof t != "object" || Array.isArray(t)) return !1;
|
|
3
|
-
const e = t, r = (o) => typeof o == "string" && o.trim().length > 0 && o.length <= 256;
|
|
4
|
-
return !r(e.datasetId) || !r(e.field) || e.tableId !== void 0 && !r(e.tableId) || e.reportScope !== void 0 && (typeof e.reportScope != "string" || !e.reportScope.trim() || e.reportScope.length > 4096) ? !1 : e.rowKey === void 0 ? !0 : typeof e.rowKey == "string" ? e.rowKey.trim().length > 0 && e.rowKey.length <= 1024 : typeof e.rowKey == "number" && Number.isFinite(e.rowKey);
|
|
5
|
-
}
|
|
6
|
-
function n(t) {
|
|
7
|
-
return t === "missing-source" || t === "not-applicable" || t === "not-calculable";
|
|
8
|
-
}
|
|
9
|
-
function a(t) {
|
|
10
|
-
return t.target !== void 0 && !i(t.target) ? !1 : t.valueState === void 0 || n(t.valueState) && t.target !== void 0;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
n as a,
|
|
14
|
-
a as h,
|
|
15
|
-
i
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function a(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t,r=o=>typeof o=="string"&&o.trim().length>0&&o.length<=256;return!r(e.datasetId)||!r(e.field)||e.tableId!==void 0&&!r(e.tableId)||e.reportScope!==void 0&&(typeof e.reportScope!="string"||!e.reportScope.trim()||e.reportScope.length>4096)?!1:e.rowKey===void 0?!0:typeof e.rowKey=="string"?e.rowKey.trim().length>0&&e.rowKey.length<=1024:typeof e.rowKey=="number"&&Number.isFinite(e.rowKey)}function i(t){return t==="missing-source"||t==="not-applicable"||t==="not-calculable"}function n(t){return t.target!==void 0&&!a(t.target)?!1:t.valueState===void 0||i(t.valueState)&&t.target!==void 0}exports.hasValidDataExplanation=n;exports.isReportDataTarget=a;exports.isReportValueState=i;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const c=["text","number","boolean","date","decimal"],p=new Set(["__proto__","prototype","constructor"]);function i(e){throw new Error(`数据契约无效:${e}`)}function g(e){(!e||!Array.isArray(e.fields)||!e.fields.length||e.fields.length>2048)&&i("fields 应包含 1–2048 个字段");const n=new Set;for(const t of e.fields)(!t||typeof t.field!="string"||!t.field.trim()||p.has(t.field)||n.has(t.field))&&i("字段名应安全、非空且唯一"),n.add(t.field),c.includes(t.type)||i(`未知字段类型 ${t.type}`),x(t),l(t),d(t);b(e,n)}function d(e){e.enum!==void 0&&(!Array.isArray(e.enum)||!e.enum.length||e.enum.some(n=>!f(n,e.type)))&&i("enum 应为匹配字段类型的非空标量数组")}function b(e,n){e.rowKey!==void 0&&((typeof e.rowKey!="string"||!e.rowKey.trim()||!n.has(e.rowKey))&&i("rowKey 应为引用已声明字段的非空字符串"),e.fields.find(t=>t.field===e.rowKey)?.type==="boolean"&&i("布尔字段不能作为业务主键"))}function l(e){for(const n of["label","unit"])e[n]!==void 0&&typeof e[n]!="string"&&i(`${n} 应为字符串`);for(const n of["required","nullable"])e[n]!==void 0&&typeof e[n]!="boolean"&&i(`${n} 应为布尔值`);e.semanticRole!==void 0&&!["identifier","dimension","measure","date","text"].includes(e.semanticRole)&&i("未知字段语义")}function x(e){for(const n of["min","max","minLength","maxLength"]){const t=e[n];t!==void 0&&(!Number.isFinite(t)||n.includes("Length")&&(!Number.isInteger(t)||t<0))&&i(`${n} 无效`)}e.min!==void 0&&e.max!==void 0&&e.min>e.max&&i("min 不能超过 max"),e.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength&&i("minLength 不能超过 maxLength"),e.type!=="number"&&(e.min!==void 0||e.max!==void 0)&&i("min/max 仅适用于 number,精确小数文本需业务校验"),["number","boolean"].includes(e.type)&&(e.minLength!==void 0||e.maxLength!==void 0)&&i("长度约束仅适用于文本类型")}function w(e){const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!n)return!1;const t=Number(n[1]),r=Number(n[2]),s=Number(n[3]),m=t%4===0&&(t%100!==0||t%400===0);return t>0&&r>=1&&r<=12&&s>=1&&s<=[31,m?29:28,31,30,31,30,31,31,30,31,30,31][r-1]}function f(e,n){return n==="number"?typeof e=="number"&&Number.isFinite(e):n==="boolean"?typeof e=="boolean":typeof e!="string"?!1:n==="date"?w(e):n==="decimal"?e.length<=1e4&&/^-?(?:0|[1-9]\d*)(?:\.\d+)?$/.test(e):!0}function L(e,n){if(e==null)return n.required||e===null&&n.nullable===!1?{code:"required",message:"缺少必需字段值"}:void 0;if(!f(e,n.type))return{code:"type",message:`值应为 ${n.type},不会自动转换原始值`};if(n.enum&&!n.enum.includes(e))return{code:"enum",message:"值不在允许的枚举中"};if(typeof e=="number"&&(n.min!==void 0&&e<n.min||n.max!==void 0&&e>n.max))return{code:"range",message:"数值超出范围"};if(typeof e=="string"&&!v(e,n))return{code:"range",message:"文本长度超出范围"}}function v(e,n){if(n.minLength===void 0&&n.maxLength===void 0)return!0;let t=0;for(const r of e)t++;return(n.minLength===void 0||t>=n.minLength)&&(n.maxLength===void 0||t<=n.maxLength)}function h(e,n){const t=e??n;if(!Number.isInteger(t)||t<1)throw new Error("数据校验预算应为正整数");return t}function $(e,n,t){const r=Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0;if((typeof r!="string"||!r.trim())&&!(typeof r=="number"&&Number.isFinite(r)))return"业务主键应为非空字符串或有限数字";const s=JSON.stringify([typeof r,r]);if(t.has(s))return"业务主键重复";t.add(s)}function K(e,n,t={}){g(n);const r=t.path??"$.rows",s=[],m=h(t.maxIssues,100);if(!Array.isArray(e))return{ok:!1,issues:[{code:"row",path:r,message:"数据集应为对象数组"}]};if(e.length>h(t.maxRows,1e5)||e.length*n.fields.length>h(t.maxCells,2e6))return{ok:!1,issues:[{code:"budget",path:r,message:"数据校验超出行数或单元格预算"}]};const u=new Set;for(let o=0;o<e.length&&s.length<m;o++){const a=e[o];if(!a||typeof a!="object"||Array.isArray(a)){s.push({code:"row",path:`${r}[${o}]`,rowIndex:o,message:"行应为对象"});continue}k(a,n,o,r,u,s,m)}return{ok:s.length===0,issues:s}}function k(e,n,t,r,s,m,u){for(const o of n.fields){if(m.length>=u)return;const a=L(Object.prototype.hasOwnProperty.call(e,o.field)?e[o.field]:void 0,o);a&&m.push({...a,rowIndex:t,field:o.field,path:`${r}[${t}].${o.field}`})}if(n.rowKey&&m.length<u){const o=$(e,n.rowKey,s);o&&m.push({code:"row-key",path:`${r}[${t}].${n.rowKey}`,message:o,rowIndex:t,field:n.rowKey})}}function S(e){return g(e),{$schema:"https://json-schema.org/draft/2020-12/schema",type:"array",items:{type:"object",properties:Object.fromEntries(e.fields.map(t=>[t.field,N(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}:{}}}function N(e,n){const t=!n&&e.nullable!==!1&&!e.required;return{type:t?[y(e.type),"null"]:y(e.type),...e.label?{title:e.label}:{},...e.type==="date"?{format:"date"}:{},...e.type==="decimal"?{pattern:"^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$"}:{},...e.enum?{enum:t?[...e.enum,null]:[...e.enum]}:{},...e.min===void 0?{}:{minimum:e.min},...e.max===void 0?{}:{maximum:e.max},...R(e,n),...n&&e.type==="text"?{pattern:"\\S"}:{},...e.unit?{"x-report-unit":e.unit}:{},...e.semanticRole?{"x-report-semanticRole":e.semanticRole}:{}}}function R(e,n){const t={};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}function y(e){return e==="text"||e==="date"||e==="decimal"?"string":e}exports.datasetJsonSchema=S;exports.validateDatasetRows=K;
|
package/dist/dataset-H5pFuQGU.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
const c = ["text", "number", "boolean", "date", "decimal"], p = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
2
|
-
function i(e) {
|
|
3
|
-
throw new Error(`数据契约无效:${e}`);
|
|
4
|
-
}
|
|
5
|
-
function g(e) {
|
|
6
|
-
(!e || !Array.isArray(e.fields) || !e.fields.length || e.fields.length > 2048) && i("fields 应包含 1–2048 个字段");
|
|
7
|
-
const n = /* @__PURE__ */ new Set();
|
|
8
|
-
for (const t of e.fields)
|
|
9
|
-
(!t || typeof t.field != "string" || !t.field.trim() || p.has(t.field) || n.has(t.field)) && i("字段名应安全、非空且唯一"), n.add(t.field), c.includes(t.type) || i(`未知字段类型 ${t.type}`), l(t), x(t), d(t);
|
|
10
|
-
b(e, n);
|
|
11
|
-
}
|
|
12
|
-
function d(e) {
|
|
13
|
-
e.enum !== void 0 && (!Array.isArray(e.enum) || !e.enum.length || e.enum.some((n) => !f(n, e.type))) && i("enum 应为匹配字段类型的非空标量数组");
|
|
14
|
-
}
|
|
15
|
-
function b(e, n) {
|
|
16
|
-
e.rowKey !== void 0 && ((typeof e.rowKey != "string" || !e.rowKey.trim() || !n.has(e.rowKey)) && i("rowKey 应为引用已声明字段的非空字符串"), e.fields.find((t) => t.field === e.rowKey)?.type === "boolean" && i("布尔字段不能作为业务主键"));
|
|
17
|
-
}
|
|
18
|
-
function x(e) {
|
|
19
|
-
for (const n of ["label", "unit"]) e[n] !== void 0 && typeof e[n] != "string" && i(`${n} 应为字符串`);
|
|
20
|
-
for (const n of ["required", "nullable"]) e[n] !== void 0 && typeof e[n] != "boolean" && i(`${n} 应为布尔值`);
|
|
21
|
-
e.semanticRole !== void 0 && !["identifier", "dimension", "measure", "date", "text"].includes(e.semanticRole) && i("未知字段语义");
|
|
22
|
-
}
|
|
23
|
-
function l(e) {
|
|
24
|
-
for (const n of ["min", "max", "minLength", "maxLength"]) {
|
|
25
|
-
const t = e[n];
|
|
26
|
-
t !== void 0 && (!Number.isFinite(t) || n.includes("Length") && (!Number.isInteger(t) || t < 0)) && i(`${n} 无效`);
|
|
27
|
-
}
|
|
28
|
-
e.min !== void 0 && e.max !== void 0 && e.min > e.max && i("min 不能超过 max"), e.minLength !== void 0 && e.maxLength !== void 0 && e.minLength > e.maxLength && i("minLength 不能超过 maxLength"), e.type !== "number" && (e.min !== void 0 || e.max !== void 0) && i("min/max 仅适用于 number,精确小数文本需业务校验"), ["number", "boolean"].includes(e.type) && (e.minLength !== void 0 || e.maxLength !== void 0) && i("长度约束仅适用于文本类型");
|
|
29
|
-
}
|
|
30
|
-
function w(e) {
|
|
31
|
-
const n = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
32
|
-
if (!n) return !1;
|
|
33
|
-
const t = Number(n[1]), r = Number(n[2]), s = Number(n[3]), m = t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
|
|
34
|
-
return t > 0 && r >= 1 && r <= 12 && s >= 1 && s <= [31, m ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][r - 1];
|
|
35
|
-
}
|
|
36
|
-
function f(e, n) {
|
|
37
|
-
return n === "number" ? typeof e == "number" && Number.isFinite(e) : n === "boolean" ? typeof e == "boolean" : typeof e != "string" ? !1 : n === "date" ? w(e) : n === "decimal" ? e.length <= 1e4 && /^-?(?:0|[1-9]\d*)(?:\.\d+)?$/.test(e) : !0;
|
|
38
|
-
}
|
|
39
|
-
function L(e, n) {
|
|
40
|
-
if (e == null)
|
|
41
|
-
return n.required || e === null && n.nullable === !1 ? { code: "required", message: "缺少必需字段值" } : void 0;
|
|
42
|
-
if (!f(e, n.type)) return { code: "type", message: `值应为 ${n.type},不会自动转换原始值` };
|
|
43
|
-
if (n.enum && !n.enum.includes(e)) return { code: "enum", message: "值不在允许的枚举中" };
|
|
44
|
-
if (typeof e == "number" && (n.min !== void 0 && e < n.min || n.max !== void 0 && e > n.max)) return { code: "range", message: "数值超出范围" };
|
|
45
|
-
if (typeof e == "string" && !v(e, n)) return { code: "range", message: "文本长度超出范围" };
|
|
46
|
-
}
|
|
47
|
-
function v(e, n) {
|
|
48
|
-
if (n.minLength === void 0 && n.maxLength === void 0) return !0;
|
|
49
|
-
let t = 0;
|
|
50
|
-
for (const r of e) t++;
|
|
51
|
-
return (n.minLength === void 0 || t >= n.minLength) && (n.maxLength === void 0 || t <= n.maxLength);
|
|
52
|
-
}
|
|
53
|
-
function h(e, n) {
|
|
54
|
-
const t = e ?? n;
|
|
55
|
-
if (!Number.isInteger(t) || t < 1) throw new Error("数据校验预算应为正整数");
|
|
56
|
-
return t;
|
|
57
|
-
}
|
|
58
|
-
function $(e, n, t) {
|
|
59
|
-
const r = Object.prototype.hasOwnProperty.call(e, n) ? e[n] : void 0;
|
|
60
|
-
if ((typeof r != "string" || !r.trim()) && !(typeof r == "number" && Number.isFinite(r))) return "业务主键应为非空字符串或有限数字";
|
|
61
|
-
const s = JSON.stringify([typeof r, r]);
|
|
62
|
-
if (t.has(s)) return "业务主键重复";
|
|
63
|
-
t.add(s);
|
|
64
|
-
}
|
|
65
|
-
function S(e, n, t = {}) {
|
|
66
|
-
g(n);
|
|
67
|
-
const r = t.path ?? "$.rows", s = [], m = h(t.maxIssues, 100);
|
|
68
|
-
if (!Array.isArray(e)) return { ok: !1, issues: [{ code: "row", path: r, message: "数据集应为对象数组" }] };
|
|
69
|
-
if (e.length > h(t.maxRows, 1e5) || e.length * n.fields.length > h(t.maxCells, 2e6)) return { ok: !1, issues: [{ code: "budget", path: r, message: "数据校验超出行数或单元格预算" }] };
|
|
70
|
-
const u = /* @__PURE__ */ new Set();
|
|
71
|
-
for (let o = 0; o < e.length && s.length < m; o++) {
|
|
72
|
-
const a = e[o];
|
|
73
|
-
if (!a || typeof a != "object" || Array.isArray(a)) {
|
|
74
|
-
s.push({ code: "row", path: `${r}[${o}]`, rowIndex: o, message: "行应为对象" });
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
K(a, n, o, r, u, s, m);
|
|
78
|
-
}
|
|
79
|
-
return { ok: s.length === 0, issues: s };
|
|
80
|
-
}
|
|
81
|
-
function K(e, n, t, r, s, m, u) {
|
|
82
|
-
for (const o of n.fields) {
|
|
83
|
-
if (m.length >= u) return;
|
|
84
|
-
const a = L(Object.prototype.hasOwnProperty.call(e, o.field) ? e[o.field] : void 0, o);
|
|
85
|
-
a && m.push({ ...a, rowIndex: t, field: o.field, path: `${r}[${t}].${o.field}` });
|
|
86
|
-
}
|
|
87
|
-
if (n.rowKey && m.length < u) {
|
|
88
|
-
const o = $(e, n.rowKey, s);
|
|
89
|
-
o && m.push({ code: "row-key", path: `${r}[${t}].${n.rowKey}`, message: o, rowIndex: t, field: n.rowKey });
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function A(e) {
|
|
93
|
-
return g(e), { $schema: "https://json-schema.org/draft/2020-12/schema", type: "array", items: { type: "object", properties: Object.fromEntries(e.fields.map((t) => [t.field, k(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 } : {} };
|
|
94
|
-
}
|
|
95
|
-
function k(e, n) {
|
|
96
|
-
const t = !n && e.nullable !== !1 && !e.required;
|
|
97
|
-
return {
|
|
98
|
-
type: t ? [y(e.type), "null"] : y(e.type),
|
|
99
|
-
...e.label ? { title: e.label } : {},
|
|
100
|
-
...e.type === "date" ? { format: "date" } : {},
|
|
101
|
-
...e.type === "decimal" ? { pattern: "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$" } : {},
|
|
102
|
-
...e.enum ? { enum: t ? [...e.enum, null] : [...e.enum] } : {},
|
|
103
|
-
...e.min === void 0 ? {} : { minimum: e.min },
|
|
104
|
-
...e.max === void 0 ? {} : { maximum: e.max },
|
|
105
|
-
...N(e, n),
|
|
106
|
-
...n && e.type === "text" ? { pattern: "\\S" } : {},
|
|
107
|
-
...e.unit ? { "x-report-unit": e.unit } : {},
|
|
108
|
-
...e.semanticRole ? { "x-report-semanticRole": e.semanticRole } : {}
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function N(e, n) {
|
|
112
|
-
const t = {};
|
|
113
|
-
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;
|
|
114
|
-
}
|
|
115
|
-
function y(e) {
|
|
116
|
-
return e === "text" || e === "date" || e === "decimal" ? "string" : e;
|
|
117
|
-
}
|
|
118
|
-
export {
|
|
119
|
-
A as d,
|
|
120
|
-
S as v
|
|
121
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const T='"Microsoft YaHei", sans-serif';const _="#333333",E="#000000",L="1.0.0-mach";exports.DEFAULT_BORDER_PT=.75;exports.DEFAULT_FONT_FAMILY=T;exports.DEFAULT_FONT_PT=10.5;exports.DEFAULT_STROKE_COLOR=_;exports.DEFAULT_TEXT_COLOR=E;exports.LINE_HEIGHT=1.35;exports.SCHEMA_VERSION_MACH=L;
|