@agile-team/mach-report 2.23.0 → 2.23.1

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 (100) hide show
  1. package/README.md +3 -2
  2. package/dist/ExcelBindingWizard-BrTmdo7f.cjs +1 -0
  3. package/dist/ExcelBindingWizard-CcDMLO8Q.js +1486 -0
  4. package/dist/ParamEditor-BGjovFUe.js +737 -0
  5. package/dist/ParamEditor-CeNp4_zQ.cjs +1 -0
  6. package/dist/ReportBatchPanel-CHxBtG9R.cjs +1 -0
  7. package/dist/ReportBatchPanel-CJB67WNd.js +351 -0
  8. package/dist/ReportLabelStudio-Tplc1TLJ.js +784 -0
  9. package/dist/ReportLabelStudio-g8PkqJWn.cjs +1 -0
  10. package/dist/ReportParamPanel-C7fZTllk.cjs +1 -0
  11. package/dist/{ReportParamPanel-Dgmqro1Y.js → ReportParamPanel-GI43aGa0.js} +61 -56
  12. package/dist/{ReportPreview-FFIryrIr.cjs → ReportPreview-BoGBGyRr.cjs} +2 -2
  13. package/dist/{ReportPreview-DeWzG8jQ.js → ReportPreview-QLONCyci.js} +8 -8
  14. package/dist/ReportTemplateLibrary-BFQIX0sg.cjs +1 -0
  15. package/dist/ReportTemplateLibrary-KqX4E2sN.js +312 -0
  16. package/dist/RuleEditor-BZUP9yvL.cjs +1 -0
  17. package/dist/RuleEditor-OPX1awrH.js +2342 -0
  18. package/dist/TemplateOutlinePanel-CVYKVLv_.cjs +1 -0
  19. package/dist/TemplateOutlinePanel-DQS-eOs6.js +97 -0
  20. package/dist/TemplateReusePanel-CY6O93Zk.cjs +1 -0
  21. package/dist/TemplateReusePanel-DKXiFTyB.js +389 -0
  22. package/dist/TemplateReviewPanel-DbeNC8Ms.cjs +1 -0
  23. package/dist/TemplateReviewPanel-Dijwm9YE.js +593 -0
  24. package/dist/artifact-integrity.json +68 -68
  25. package/dist/{auto-CTIJ6PnR.js → auto-BB99S802.js} +4 -4
  26. package/dist/{auto-4pK9HePf.cjs → auto-BrPWo7Xm.cjs} +1 -1
  27. package/dist/designer-BZoVWTgl.js +7172 -0
  28. package/dist/designer-zS2uKJmY.cjs +2 -0
  29. package/dist/designer.cjs +1 -1
  30. package/dist/designer.d.cts +7 -0
  31. package/dist/designer.d.ts +7 -0
  32. package/dist/designer.js +2 -2
  33. package/dist/{encoding-BefcaHdp.cjs → encoding-7lquyj0w.cjs} +1 -1
  34. package/dist/{encoding-CL6rXEkR.js → encoding-CEd-dq9A.js} +2 -2
  35. package/dist/{font-loader-BT5baV-o.js → font-loader-CNWXomuV.js} +1 -1
  36. package/dist/{font-loader-Ga51c2VC.cjs → font-loader-D8pI87fL.cjs} +1 -1
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.js +7 -7
  39. package/dist/{json-snapshot-OqkPyUk5.js → json-snapshot-BRnzKudk.js} +1 -1
  40. package/dist/{json-snapshot-1tvQNzQE.cjs → json-snapshot-DNiIbpOr.cjs} +1 -1
  41. package/dist/{pdf-aobetCsy.js → pdf-CJToa81Z.js} +2 -2
  42. package/dist/{pdf-HiEeXe9H.cjs → pdf-DpMkW72B.cjs} +1 -1
  43. package/dist/pdf.cjs +1 -1
  44. package/dist/pdf.js +2 -2
  45. package/dist/{plugin-BFANt-i8.cjs → plugin-BWTp-X7b.cjs} +1 -1
  46. package/dist/{plugin-DeYYAL6F.js → plugin-_BkUVc2z.js} +1 -1
  47. package/dist/{prefill-Dk4C6S5R.js → prefill-CWGdnqQd.js} +1 -1
  48. package/dist/{prefill-DsUD5OoK.cjs → prefill-PaAy6wLk.cjs} +1 -1
  49. package/dist/{prepared-DCIxhKFo.js → prepared-CJy_qk7d.js} +1 -1
  50. package/dist/{prepared-Dv-XM3i1.cjs → prepared-D0yCSxSO.cjs} +1 -1
  51. package/dist/{protocol-DxeUKGYG.js → protocol-BG16rz6D.js} +2 -2
  52. package/dist/{protocol-B9YgfQ_d.cjs → protocol-wzhl1Fim.cjs} +1 -1
  53. package/dist/report-encoding-worker.cjs +1 -1
  54. package/dist/report-encoding-worker.js +1 -1
  55. package/dist/{runtime-DKlGd_D4.cjs → runtime-DYMOS_gz.cjs} +1 -1
  56. package/dist/{runtime-75Y5Oq5B.js → runtime-PiCax9zQ.js} +2 -2
  57. package/dist/sbom.cdx.json +1 -1
  58. package/dist/server-node.cjs +4 -4
  59. package/dist/server-node.js +737 -736
  60. package/dist/server.cjs +1 -1
  61. package/dist/server.js +5 -5
  62. package/dist/style.css +1 -1
  63. package/dist/{template-catalog--cjxzgH7.js → template-catalog-CRuZL3pi.js} +1 -1
  64. package/dist/{template-catalog-CoT7jm_6.cjs → template-catalog-DtrtT1FY.cjs} +1 -1
  65. package/dist/textwrap-D4ZksyMK.js +111 -0
  66. package/dist/textwrap-DEHqAjKZ.cjs +4 -0
  67. package/dist/vue/async.d.cts +7 -0
  68. package/dist/vue/async.d.ts +7 -0
  69. package/dist/vue/index.d.cts +7 -0
  70. package/dist/vue/index.d.ts +7 -0
  71. package/dist/vue-async.cjs +1 -1
  72. package/dist/vue-async.js +3 -3
  73. package/dist/vue.cjs +1 -1
  74. package/dist/vue.js +6 -6
  75. package/dist/worker.cjs +1 -1
  76. package/dist/worker.js +4 -4
  77. package/package.json +1 -1
  78. package/dist/ExcelBindingWizard-D4FLind-.js +0 -1485
  79. package/dist/ExcelBindingWizard-D4RS5Bpg.cjs +0 -1
  80. package/dist/ParamEditor-C-6C9rd2.cjs +0 -1
  81. package/dist/ParamEditor-CASZt-Ma.js +0 -732
  82. package/dist/ReportBatchPanel-Bq7t8a5r.js +0 -350
  83. package/dist/ReportBatchPanel-YVj5IO5y.cjs +0 -1
  84. package/dist/ReportLabelStudio-Cqhita1b.cjs +0 -1
  85. package/dist/ReportLabelStudio-Dj7GXhuv.js +0 -783
  86. package/dist/ReportParamPanel-DZbFVmDL.cjs +0 -1
  87. package/dist/ReportTemplateLibrary-BaWodmpm.cjs +0 -1
  88. package/dist/ReportTemplateLibrary-DdAAAD2I.js +0 -311
  89. package/dist/RuleEditor-D2UwQGF6.js +0 -2341
  90. package/dist/RuleEditor-DcT9xI1v.cjs +0 -1
  91. package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +0 -1
  92. package/dist/TemplateOutlinePanel-DrT7XN0m.js +0 -96
  93. package/dist/TemplateReusePanel-4eejkNqi.js +0 -388
  94. package/dist/TemplateReusePanel-DZMyiX5I.cjs +0 -1
  95. package/dist/TemplateReviewPanel-BIhNLeNw.js +0 -592
  96. package/dist/TemplateReviewPanel-DnYImiXu.cjs +0 -1
  97. package/dist/designer-DhrE7jzw.js +0 -7169
  98. package/dist/designer-IAZu6kBX.cjs +0 -2
  99. package/dist/textwrap-BIjtEWmq.js +0 -110
  100. package/dist/textwrap-Cy7o1hIR.cjs +0 -4
@@ -0,0 +1 @@
1
+ "use strict";var Ye=Object.create;var Me=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var tt=(t,l,o,i)=>{if(l&&typeof l=="object"||typeof l=="function")for(let s of We(l))!et.call(t,s)&&s!==o&&Me(t,s,{get:()=>l[s],enumerable:!(i=Ze(l,s))||i.enumerable});return t};var nt=(t,l,o)=>(o=t!=null?Ye(Xe(t)):{},tt(l||!t||!t.__esModule?Me(o,"default",{value:t,enumerable:!0}):o,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),be=require("@agile-team/mach-report/vue"),re=require("./_plugin-vue_export-helper-BLmdZLlg.cjs"),de=require("./designer-zS2uKJmY.cjs"),b=require("@agile-team/mach-report"),Re=require("./progress-WomPRP3B.cjs");function at(){let t;const l=()=>t??=import("@agile-team/mach-report/codes").then(i=>i.createCodeAssetRenderers()).catch(i=>{throw t=void 0,i}),o=i=>async s=>{Re.assertOutputActive(s.signal);const u=await l();return Re.assertOutputActive(s.signal),u[i](s)};return{assetRenderers:{barcode:o("barcode"),qrcode:o("qrcode")}}}function lt(t){const l=t.pages[0];if(!l||t.pages.some(s=>s.layout==="wide"||s.widthMm!==l.widthMm||s.heightMm!==l.heightMm))return;const o=Math.floor(190/(l.widthMm+4)),i=Math.floor(277/(l.heightMm+4));if(!(o<1||i<1||o*i>1e3))return{paper:"a4",columns:o,rows:i,marginMm:12,gapMm:4,capacity:o*i}}const ce=[{id:"material",widthMm:80,heightMm:55,faces:1},{id:"paired",widthMm:80,heightMm:55,faces:2},{id:"warehouse",widthMm:100,heightMm:60,faces:1}];function Be(t,l){return l??t.fields.find(o=>o.semanticRole==="identifier"&&o.field!==t.rowKey)?.field??t.rowKey??t.fields[0]?.field}function me(t,l,o){const i=t.fields.filter(n=>n.field!==l&&n.field!==t.rowKey);if(o===void 0)return i.map((n,a)=>({field:n,index:a,priority:rt(n)})).sort((n,a)=>n.priority-a.priority||n.index-a.index).slice(0,5).map(n=>n.field);const s=new Map(i.map(n=>[n.field,n])),u=[...new Set(o)];if(u.length>5)throw new Error("成品标签最多显示 5 个字段,请先精简显示字段");return u.map(n=>{const a=s.get(n);if(!a)throw new Error(`标签显示字段未在业务契约中声明:${n}`);return a})}function rt(t){return/^(?:name|title|label|category)$/i.test(t.field)||/名称|品名|品类|类别/.test(t.label??"")?0:t.semanticRole==="dimension"?1:t.semanticRole==="measure"&&t.unit?2:t.semanticRole==="identifier"?3:t.semanticRole==="date"?4:5}function ot(t="paired"){return ce.find(l=>l.id===t)??ce[1]}const ye="#173450",pe="#586c82";function F(t,l,o,i,s=4,u=7){return{kind:"text",text:t,leftMm:l,topMm:o,widthMm:i,heightMm:s,style:{fontSize:u,lineHeight:1.1,color:ye,verticalAlign:"middle"}}}function we(t,l){return{kind:"line",leftMm:4,topMm:t,widthMm:l-8,heightMm:.2,style:{lineColor:"#c9d7e5",lineWidthPt:.55}}}function Le(t,l,o){const i=[];let s=4;if(o?.logoData){if(!/^data:image\/(?:png|jpeg);base64,/i.test(o.logoData))throw new Error("标签Logo须使用PNG或JPEG图片数据");i.push({kind:"image",leftMm:4,topMm:3,widthMm:12,heightMm:7,imageData:o.logoData,meta:{labelBrandLogo:!0}}),s=19}return i.push({...F(o?.name?.trim()||t,s,3,l-s-4,5,9),style:{fontSize:9,color:"#205582"},meta:{labelStudioRole:"brand-name"}}),o?.tagline?.trim()&&i.push({...F(o.tagline.trim(),s,8,l-s-4,3,5.5),style:{fontSize:5.5,color:pe},meta:{labelStudioRole:"brand-tagline"}}),i.push(we(12,l)),i}function xe(t,l,o,i,s=4.7){return t.flatMap((u,n)=>{const a=l+n*s;return[{...F(u.label??u.field,4,a,o,4,6),style:{fontSize:6,color:pe},meta:{labelStudioRole:"field-label",labelStudioField:u.field}},{...F("",4+o,a,i,4,7),binding:{field:u.field,...u.format?{format:u.format}:{}},meta:{labelStudioRole:"field-value",labelStudioField:u.field}}]})}function it(t,l){return t?[{...F("",4,14,l,7,14),binding:{field:t},style:{fontSize:14,color:ye}}]:[]}function st(t,l,o,i){const s=me(t,o,i.fields),u=[...Le(l,80,i.brand),...it(o,71),...xe(s,23,21,27)];o&&u.push({kind:"qrcode",leftMm:55,topMm:23,widthMm:20,heightMm:20,binding:{field:o},code:{quietZoneModules:4,errorCorrection:"M"}}),u.push(we(48,80));const n=t.fields.find(a=>a.field===o)?.label??l;return u.push({...F(n,4,49,71,3,5.8),style:{fontSize:5.8,color:pe}}),u}function Te(t,l,o,i,s=80){const u=Le(l,s,i.brand);o&&(u.push({...F("",4,14,s-8,8,16),binding:{field:o},style:{fontSize:16,align:"center",color:ye}}),u.push({kind:"qrcode",leftMm:(s-20)/2,topMm:23,widthMm:20,heightMm:20,binding:{field:o},code:{quietZoneModules:4,errorCorrection:"M"}})),u.push(we(44,s));const n=me(t,o,i.fields);return s===100?n.forEach((a,h)=>{const v=h%2===0?4:52,f=46+Math.floor(h/2)*4.3;u.push({...F(a.label??a.field,v,f,19,3.7,5.8),style:{fontSize:5.8,color:pe},meta:{labelStudioRole:"field-label",labelStudioField:a.field}}),u.push({...F("",v+19,f,25,3.7,6.5),binding:{field:a.field,...a.format?{format:a.format}:{}},meta:{labelStudioRole:"field-value",labelStudioField:a.field}})}):u.push(...xe(n.slice(0,1),46,24,s-32,5)),u}function oe(t,l,o,i={},s){const u=Be(t,o),n=ot(i.preset),a=Object.fromEntries(["name","tagline"].flatMap(p=>{const y=i.brand?.[p];return typeof y=="string"?[[p,y]]:[]})),h={preset:n.id,brand:a,fields:me(t,u,i.fields).map(p=>p.field)},v=n.id==="warehouse"?Te(t,l,u,i,n.widthMm):st(t,l,u,i),f=[{widthMm:n.widthMm,heightMm:n.heightMm,meta:{title:`${l} · 1`,labelStudio:h},components:v}];return n.faces===2&&f.push({widthMm:n.widthMm,heightMm:n.heightMm,meta:{title:`${l} · 2`,labelStudio:h},components:Te(t,l,u,i)}),b.defineReportTemplate({id:"record-label",name:l,template:{...b.createLabelTemplate({dataset:"records",rowKey:t.rowKey,pages:f}),...s?{dataContract:s}:{}}})}const _=t=>t.meta?.labelStudioRole,he=t=>typeof _(t)=="string";function fe(t){const l={...t,...t.meta?{meta:{...t.meta}}:{}};return l.meta&&(delete l.meta.labelStudioRole,delete l.meta.labelStudioField,Object.keys(l.meta).length||delete l.meta),l}function ut(t,l){for(const o of l.components.filter(he)){if(t.components.some(s=>_(s)===_(o)&&s.meta?.labelStudioField===o.meta?.labelStudioField))continue;const i=t.components.find(s=>!he(s)&&JSON.stringify(fe(s))===JSON.stringify(fe(o)));i&&(i.meta={...i.meta,...o.meta})}}function dt(t,l){const o=t.kind==="list"?Number.POSITIVE_INFINITY:t.heightMm,i=l.kind==="list"?Number.POSITIVE_INFINITY:l.heightMm;return t.leftMm<l.leftMm+l.widthMm&&t.leftMm+t.widthMm>l.leftMm&&t.topMm<l.topMm+i&&t.topMm+o>l.topMm}function ct(t,l){const o={...t,meta:{...t.meta,...l.meta}};return o.kind==="text"&&l.kind==="text"&&(o.text=l.text,l.binding?o.binding=l.binding:delete o.binding),o}function ft(t,l,o,i){const s=i.has("field-value");ut(t,l);const u=new Set(t.components.filter(f=>_(f)==="field-label"||_(f)==="field-value")),n=[...u],a=new Map,h=[];for(const f of o.components.filter(he)){const p=_(f);if(!i.has(String(p)))continue;const y=p==="field-label"||p==="field-value"?n.find(N=>_(N)===p&&!a.has(N)):t.components.find(N=>_(N)===p);y?a.set(y,ct(y,f)):h.push(f)}const v=t.components.filter(f=>(!s||!u.has(f)||a.has(f))&&(!i.has("brand-tagline")||_(f)!=="brand-tagline"||o.components.some(p=>_(p)==="brand-tagline"))).map(f=>a.get(f)??f);for(const f of h){if(v.some(p=>dt(p,f)))return!1;v.push(f)}return t.components=v,t.meta={...t.meta,labelStudio:o.meta?.labelStudio},!0}function mt(t,l,o,i,s,u){const n=oe(l,o,i,s),a=oe(l,o,i,u),h=b.parseReportTemplate(t),v=new Set;JSON.stringify(s.fields)!==JSON.stringify(u.fields)&&(v.add("field-label"),v.add("field-value")),(s.brand?.name??"").trim()!==(u.brand?.name??"").trim()&&v.add("brand-name"),(s.brand?.tagline??"").trim()!==(u.brand?.tagline??"").trim()&&v.add("brand-tagline");for(const[f,p]of h.template.pages.entries()){const y=n.template.pages[f],N=a.template.pages[f];if(y&&N&&!ft(p,y,N,v))return}return h}function pt(t,l){const o=t.template.pages,i=l.template.pages;return o.length!==i.length||o.some((s,u)=>s.components.length!==i[u].components.length)?!0:o.some((s,u)=>{const n=i[u],a={...s,meta:void 0,components:void 0},h={...n,meta:void 0,components:void 0};return JSON.stringify(a)!==JSON.stringify(h)||s.components.some((v,f)=>JSON.stringify(fe(v))!==JSON.stringify(fe(n.components[f])))})}function vt(t,l,o,i,s){const u={...t,template:oe(l,o,i,s,t.template.dataContract).template},n=t.template.repeat;return n?.copies!==void 0&&u.template.repeat&&(u.template.repeat.copies=n.copies),u}function T(t){const l=t.template.pages[0]?.meta?.labelStudio;if(!l||typeof l!="object")return;const o=l,i=ce.find(a=>a.id===o.preset);if(!i)return;const s=Array.isArray(o.fields)?o.fields.filter(a=>typeof a=="string"):void 0;if(s&&s.length>5)return;const u=o.brand&&typeof o.brand=="object"?o.brand:{},n={};for(const a of["name","tagline","logoData"])typeof u[a]=="string"&&(n[a]=u[a]);return{preset:i.id,fields:s,brand:n}}function _e(t,l,o){const i=new Set(t.fields.filter(u=>u.field!==l&&u.field!==t.rowKey).map(u=>u.field)),s=o?.filter(u=>i.has(u));return me(t,l,s).map(u=>u.field)}function gt(t,l){const o=be.useMachReport(),i=e.computed(()=>({...de.LABEL_STUDIO_MESSAGES,...t.messages})),s=e.computed(()=>t.title??i.value.title),u={preset:t.preset,brand:t.brand,fields:t.fields},n=e.shallowRef(t.modelValue?b.parseReportTemplate(t.modelValue):oe(t.schema,s.value,t.identityField,u,t.dataContract)),a=e.shallowRef(b.parseReportTemplate(n.value)),h=e.ref(!1),v=e.shallowRef();let f,p;e.onMounted(()=>{t.modelValue||l(b.parseReportTemplate(n.value))});const y=e.ref("preview"),N=e.ref("all"),B=e.ref(1),C=e.ref(!1),Y=e.ref(!1),g=e.ref(),P=de.useTemplateDiscard(()=>t.beforeDiscard),O=e.computed(()=>Y.value||P.pending.value||h.value&&!g.value||g.value?.saving===!0||g.value?.blocked===!0||o.state.printing||o.state.exporting!==null),S=e.ref(""),J=e.computed(()=>Be(t.schema,t.identityField)),M=e.ref(T(n.value)?.preset??(t.modelValue?void 0:t.preset??"paired")),$=e.ref(T(n.value)?.brand?.name??t.brand?.name??""),D=e.ref(T(n.value)?.brand?.tagline??t.brand?.tagline??""),E=e.ref(_e(t.schema,J.value,T(n.value)?.fields??t.fields)),H=e.ref(""),K=e.computed(()=>t.schema.fields.filter(r=>r.field!==J.value&&r.field!==t.schema.rowKey)),U=e.computed(()=>E.value.map(r=>({field:r,label:t.schema.fields.find(m=>m.field===r)?.label??r}))),Z=e.computed(()=>{const r=H.value.trim().toLocaleLowerCase();return K.value.filter(m=>`${m.label??""} ${m.field}`.toLocaleLowerCase().includes(r)).slice(0,30)}),z=e.computed(()=>{const r=n.value.template.pages[0]?.components.find(m=>m.kind==="image"&&m.meta?.labelBrandLogo);return r?.kind==="image"?r.imageData:t.brand?.logoData}),W=e.computed(()=>({preset:M.value,fields:E.value,brand:{...t.brand,...z.value?{logoData:z.value}:{},name:$.value,tagline:D.value}}));let X=JSON.stringify(T(n.value));const ee=e.computed(()=>{const r=T(n.value);if(!r)return!0;try{const m=oe(t.schema,s.value,t.identityField,{...r,brand:{...r.brand,...z.value?{logoData:z.value}:{}}});return pt(n.value,m)}catch{return!0}}),L=e.ref(!1),I=e.computed(()=>M.value!==T(n.value)?.preset),q=()=>JSON.stringify({preset:M.value,fields:E.value,name:$.value,tagline:D.value}),te=e.ref(q()),x=e.computed(()=>q()!==te.value),ne=e.computed(()=>b.serializeReportTemplate(n.value)),ve=e.computed(()=>b.serializeReportTemplate(a.value)),j=e.computed(()=>ne.value!==ve.value),ie=e.computed(()=>x.value||j.value||g.value?.pendingLocalChanges===!0);function ae(){L.value=!1;const r=T(n.value);M.value=r?.preset,E.value=_e(t.schema,J.value,r?.fields??t.fields),$.value=r?.brand?.name??t.brand?.name??"",D.value=r?.brand?.tagline??t.brand?.tagline??"",X=JSON.stringify(r),te.value=q()}function se(r){const m=T(r),w=JSON.stringify(m);w!==X&&(X=w,ae())}let V=!1;e.onScopeDispose(()=>{V=!0,p?.abort()});const G=at();be.provideMachReportConfig({get defaults(){return{...t.preview,assets:{...G,...t.preview?.assets,assetRenderers:{...G.assetRenderers,...t.preview?.assets?.assetRenderers}}}}}),e.watch(g,r=>{const m=v.value;if(!r||!m)return;const w=n.value;b.serializeReportTemplate(m)!==ne.value&&r.applyTemplate?.(w.template),v.value=void 0,f=void 0},{flush:"post"}),e.watch([M,E,$,D],()=>{L.value=!1}),e.watch(()=>t.modelValue,r=>{r&&b.serializeReportTemplate(r)!==ne.value&&(n.value=b.parseReportTemplate(r),a.value=b.parseReportTemplate(r),f=void 0,se(r))}),e.watch(()=>t.rows,()=>{N.value="all",B.value=1});function A(r){S.value="",n.value=r,se(r),l(r)}function Q(r,m){m&&E.value.length<5&&!E.value.includes(r)?E.value=[...E.value,r]:m||(E.value=E.value.filter(w=>w!==r))}function R(r=!1){if(O.value||V)return!1;if(!M.value)return S.value=i.value.choosePreset,!1;if(g.value?.canApply===!1)return S.value=g.value.saveReason||i.value.applyFirst,!1;if(I.value&&!r)return L.value=!0,!1;try{const m=T(n.value);let w;if(r?w=vt(n.value,t.schema,s.value,t.identityField,W.value):m&&(w=mt(n.value,t.schema,s.value,t.identityField,m,W.value)),!w)return S.value=i.value.contentNeedsDesign,!1;if(g.value?.applyTemplate){if(!g.value.applyTemplate(w.template))return S.value=i.value.saveFailed,!1}else f=b.parseReportTemplate(n.value),A(w);return L.value=!1,te.value=q(),!0}catch(m){return S.value=m instanceof Error?m.message:i.value.saveFailed,!1}}const d=e.computed(()=>N.value==="all"?t.rows:Number.isSafeInteger(B.value)&&t.rows[B.value-1]?[t.rows[B.value-1]]:[]),c=e.computed(()=>n.value.template.repeat?.dataset??"records"),le=e.computed(()=>({[c.value]:d.value})),Fe=e.computed(()=>({[c.value]:d.value.slice(0,3)})),Oe=e.computed(()=>({[c.value]:t.schema})),Pe=e.computed(()=>[{id:c.value,label:s.value,rowKey:t.schema.rowKey,fields:t.schema.fields}]),$e=e.computed(()=>n.value.template.pages[0]),Se=e.computed(()=>n.value.template.pages.length),ze=e.computed(()=>{const r=n.value.template.repeat?.copies??1;return typeof r=="number"?r:void 0}),Ie=e.computed(()=>{const r=n.value.template.repeat?.copies;return typeof r=="object"?r.field:void 0}),Ne=e.computed(()=>{const r=Ie.value;if(!r)return;let m=0;for(const w of d.value){const k=Object.getOwnPropertyDescriptor(w,r)?.value;if(typeof k!="number"||!Number.isSafeInteger(k)||k<1||k>1e3)return;m+=k}return m}),qe=e.computed(()=>{const r=ze.value;return r!==void 0?Number.isSafeInteger(r)&&r>=1&&r<=1e3?d.value.length*r*Se.value:void 0:Ne.value===void 0?void 0:Ne.value*Se.value}),ue=e.computed(()=>lt(n.value.template)),Ae=e.computed(()=>{const r=ue.value;return r?i.value.sheetHint.replace("{columns}",String(r.columns)).replace("{rows}",String(r.rows)).replace("{capacity}",String(r.capacity)):i.value.sheetUnavailable});e.watch(ue,r=>{r||(C.value=!1)});const Je=e.computed(()=>{const r=b.createReportSource({labels:b.defineLabelReport({template:n.value.template,rows:d.value,dataSchema:t.schema})}),m=C.value?ue.value:void 0,w=t.dataContract?b.inspectReportTemplateCompatibility(n.value.template,t.dataContract):void 0;return async k=>{if(w&&!w.ok)throw new Error(w.issues.map(Qe=>Qe.message).join(";"));const Ce=await r(k);return m?b.imposeLabelSheets(Ce,{...m,signal:k.signal}):Ce}}),Ve=async(r,m)=>{if(V||m.signal.aborted)throw new DOMException("标签模板保存已取消","AbortError");const w=b.parseReportTemplate(r),k=b.parseReportTemplate(t.save?await t.save(w,m):w);if(k.id!==r.id)throw new Error(i.value.invalidSavedTemplate);if(V||m.signal.aborted)throw new DOMException("标签模板保存已取消","AbortError");return a.value=b.parseReportTemplate(k),A(k),k};async function Ee(){if(!(O.value||V)){if(x.value&&I.value){S.value=i.value.applyLayoutFirst;return}if(!(x.value&&!R())){Y.value=!0;try{if(g.value){if(g.value.canApply===!1){S.value=g.value.saveReason||i.value.applyFirst;return}if(g.value.pendingLocalChanges&&await g.value.save(),g.value.pendingLocalChanges){S.value=i.value.saveFailed;return}}else j.value&&(p=new AbortController,await Ve(n.value,{expectedRevision:n.value.revision,signal:p.signal}),f=void 0);if(!V)return S.value="",b.parseReportTemplate(n.value)}catch(r){V||(S.value=r instanceof Error?r.message:i.value.saveFailed)}finally{Y.value=!1,p=void 0}}}}async function ke(r){if(!(O.value||r===y.value))if(r==="design"&&!h.value){if(x.value&&I.value){S.value=i.value.applyLayoutFirst;return}if(x.value&&!R())return;v.value=f,h.value=!0,y.value=r}else await Ee()&&(y.value=r)}function He(r){h.value=!1,y.value="preview",S.value=`${i.value.designLoadFailed} ${r instanceof Error?r.message:String(r)}`}let ge=!1;const Ke=r=>ge||P.request(r);async function Ue(){if(O.value)return!1;const r=g.value?.pendingLocalChanges===!0;if(!r&&!j.value&&!x.value)return!0;if(!(r&&g.value?await g.value.guardChanges():await P.request({reason:"replace",document:b.parseReportTemplate(n.value),pendingLocalChanges:!0}))||V)return!1;if(r&&g.value){ge=!0;try{await g.value.reset()}finally{ge=!1}}return A(b.parseReportTemplate(a.value)),f=void 0,ae(),!0}const De=e.computed(()=>y.value==="preview"&&!O.value&&o.state.canPrint);async function je(){return await ke("preview"),!V&&y.value==="preview"}async function Ge(){De.value&&await o.print()}return{m:i,notice:S,title:s,document:n,mode:y,preview:o,showPreview:je,print:Ge,canPrint:De,editorVisited:h,editorInitialDocument:v,failDesignLoad:He,sheetLayout:ue,sheetHint:Ae,rebuilding:L,layoutChanged:I,record:N,recordIndex:B,sheet:C,busy:O,editor:g,rows:d,datasets:le,designDatasets:Fe,schemas:Oe,bindings:Pe,paper:$e,labelCount:qe,fetcher:Je,update:A,save:Ve,navigate:ke,prepare:Ee,guardChanges:Ue,preset:M,presets:ce,brandName:$,brandTagline:D,fields:E,fieldQuery:H,selectedFields:U,availableFields:Z,fieldCount:e.computed(()=>K.value.length),configurationDirty:x,pendingLocalChanges:ie,custom:ee,toggleField:Q,applyConfiguration:R,requestRebuild:()=>{L.value=!0},cancelRebuild:()=>{L.value=!1},restoreConfiguration:ae,beforeDiscard:Ke,confirmation:P.confirmation,decideDiscard:P.decide}}const bt=["aria-label"],ht={class:"mr-label-context"},yt={class:"mr-label-identity"},wt={class:"mr-label-spec"},St=["disabled"],Nt=["aria-label"],Vt=["aria-pressed","onClick"],Et={class:"mr-label-fields"},kt={key:0,class:"mr-label-selected-fields"},Dt=["aria-label","onClick"],Ct={class:"mr-label-field-search"},Mt=["aria-label","placeholder"],Rt={class:"mr-label-field-options"},Tt=["checked","disabled","onChange"],_t={key:0},Bt={key:1},Lt={class:"mr-label-brand"},xt=["placeholder"],Ft=["disabled"],Ot={key:1,class:"mr-label-rebuild",role:"alert"},Pt={key:3,class:"mr-label-reflow-hint"},$t={class:"mr-label-reflow-hint"},zt={class:"mr-label-record"},It=["disabled"],qt={value:"all"},At={value:"single"},Jt={key:0,class:"mr-label-record-index"},Ht=["max","aria-label","disabled"],Kt={class:"mr-label-count"},Ut={class:"mr-label-help"},jt={class:"mr-label-main"},Gt={class:"mr-label-bar"},Qt=["aria-label"],Yt=["aria-pressed","disabled"],Zt=["aria-pressed","disabled"],Wt={key:0,class:"mr-label-notice",role:"status"},Xt=["aria-label"],en={class:"mr-label-imposition"},tn=["disabled"],nn={key:3,class:"mr-label-editor"},an={key:0,class:"mr-label-editor-loading",role:"status"},ln=e.defineComponent({__name:"ReportLabelStudio",props:{showSave:{type:Boolean,default:!0},rows:{},schema:{},title:{},identityField:{},dataContract:{},modelValue:{},preview:{},save:{},beforeDiscard:{},messages:{},preset:{},brand:{},fields:{}},emits:["update:modelValue"],setup(t,{expose:l,emit:o}){const i=t,s=de.useDesignerTheme(()=>i.preview?.theme),u=o,n=gt(i,R=>u("update:modelValue",R)),{m:a,notice:h,title:v,document:f,mode:p,record:y,recordIndex:N,sheet:B,busy:C,editor:Y,rows:g,designDatasets:P,schemas:O,bindings:S,paper:J,labelCount:M,fetcher:$,preset:D,presets:E,brandName:H,brandTagline:K,fields:U,fieldQuery:Z,selectedFields:z,availableFields:W,fieldCount:X,configurationDirty:ee,pendingLocalChanges:L,custom:I,confirmation:q,editorVisited:te,editorInitialDocument:x,sheetLayout:ne,sheetHint:ve,rebuilding:j,layoutChanged:ie}=n,{previewVisited:ae,visibleFetcher:se}=de.useDesignerViews(f,p,$),V=e.shallowRef();let G=!1;e.onScopeDispose(()=>{G=!0}),e.watch(n.editorVisited,async R=>{if(!(!R||V.value))try{const d=await Promise.resolve().then(()=>require("./designer-zS2uKJmY.cjs")).then(c=>c.ReportTemplateEditor$1);G||(V.value=e.markRaw(d.default))}catch(d){G||n.failDesignLoad(d)}});const A=e.ref();let Q=null;return e.watch(q,async R=>{R?(Q=window.document.activeElement,await e.nextTick(),A.value?.focus()):Q?.isConnected&&(Q.focus(),Q=null)}),l({guardChanges:n.guardChanges,prepare:n.prepare,preview:n.showPreview,print:n.print,get mode(){return p.value},get canPrint(){return n.canPrint.value},get busy(){return C.value},get pendingLocalChanges(){return L.value}}),(R,d)=>(e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["mr-label-studio",{"is-design":e.unref(p)==="design"}]),style:e.normalizeStyle(e.unref(s)),"aria-label":e.unref(v)},[e.createElementVNode("aside",ht,[e.createElementVNode("div",yt,[e.createVNode(re._sfc_main,{name:"file",size:18}),e.createElementVNode("strong",null,e.toDisplayString(e.unref(v)),1),e.createElementVNode("small",null,e.toDisplayString(e.unref(I)?e.unref(a).customTemplate:e.unref(a).readyTemplate),1)]),e.createElementVNode("div",wt,[e.createElementVNode("strong",null,[e.createTextVNode(e.toDisplayString(e.unref(J)?.widthMm)+" ",1),d[16]||(d[16]=e.createElementVNode("i",null,"×",-1)),e.createTextVNode(" "+e.toDisplayString(e.unref(J)?.heightMm),1)]),e.createElementVNode("span",null,"mm · "+e.toDisplayString(e.unref(f).template.pages.length)+" "+e.toDisplayString(e.unref(a).faces),1)]),e.createElementVNode("fieldset",{class:"mr-label-quick",disabled:e.unref(C)},[e.createElementVNode("legend",null,e.toDisplayString(e.unref(a).layout),1),e.createElementVNode("div",{class:"mr-label-presets","aria-label":e.unref(a).layout},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),c=>(e.openBlock(),e.createElementBlock("button",{key:c.id,type:"button","aria-pressed":e.unref(D)===c.id,onClick:le=>D.value=c.id},[e.createElementVNode("span",{class:e.normalizeClass(["mr-label-preset-art",`is-${c.id}`]),"aria-hidden":"true"},[...d[17]||(d[17]=[e.createElementVNode("i",null,null,-1),e.createElementVNode("i",null,null,-1),e.createElementVNode("i",null,null,-1)])],2),e.createElementVNode("span",null,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(a)[`${c.id}Preset`]),1),e.createElementVNode("small",null,e.toDisplayString(c.widthMm)+" × "+e.toDisplayString(c.heightMm)+" · "+e.toDisplayString(c.faces)+" "+e.toDisplayString(e.unref(a).faces),1)])],8,Vt))),128))],8,Nt),e.createElementVNode("details",Et,[e.createElementVNode("summary",null,[e.createTextVNode(e.toDisplayString(e.unref(a).fields)+" ",1),e.createElementVNode("span",null,e.toDisplayString(e.unref(U).length)+" / 5",1)]),e.unref(z).length?(e.openBlock(),e.createElementBlock("div",kt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(z),c=>(e.openBlock(),e.createElementBlock("button",{key:c.field,type:"button","aria-label":`${e.unref(a).removeField} ${c.label}`,onClick:le=>e.unref(n).toggleField(c.field,!1)},[e.createTextVNode(e.toDisplayString(c.label)+" ",1),d[18]||(d[18]=e.createElementVNode("span",{"aria-hidden":"true"},"×",-1))],8,Dt))),128))])):e.createCommentVNode("",!0),e.createElementVNode("label",Ct,[e.createVNode(re._sfc_main,{name:"search",size:13}),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=c=>e.isRef(Z)?Z.value=c:null),type:"search","aria-label":e.unref(a).findField,placeholder:e.unref(a).findField},null,8,Mt),[[e.vModelText,e.unref(Z)]])]),e.createElementVNode("div",Rt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(W),c=>(e.openBlock(),e.createElementBlock("label",{key:c.field},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(U).includes(c.field),disabled:!e.unref(U).includes(c.field)&&e.unref(U).length>=5,onChange:le=>e.unref(n).toggleField(c.field,le.target.checked)},null,40,Tt),e.createElementVNode("span",null,e.toDisplayString(c.label??c.field),1)]))),128)),e.unref(W).length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",_t,e.toDisplayString(e.unref(a).noFields),1))]),e.createElementVNode("small",null,e.toDisplayString(e.unref(a).fieldLimit),1),e.unref(X)>30?(e.openBlock(),e.createElementBlock("small",Bt,e.toDisplayString(e.unref(a).fieldSearchHint),1)):e.createCommentVNode("",!0)]),e.createElementVNode("details",Lt,[e.createElementVNode("summary",null,e.toDisplayString(e.unref(a).brand),1),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(a).brandName),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=c=>e.isRef(H)?H.value=c:null),maxlength:"80",placeholder:e.unref(v)},null,8,xt),[[e.vModelText,e.unref(H)]])]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(a).brandTagline),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[2]||(d[2]=c=>e.isRef(K)?K.value=c:null),maxlength:"120"},null,512),[[e.vModelText,e.unref(K)]])])]),e.createElementVNode("button",{class:"mr-label-apply",type:"button",disabled:!e.unref(ee)||!e.unref(D),onClick:d[3]||(d[3]=c=>e.unref(n).applyConfiguration())},[e.createVNode(re._sfc_main,{name:"arrow-right",size:13}),e.createTextVNode(e.toDisplayString(e.unref(ie)?e.unref(a).applyLayout:e.unref(a).applyContent),1)],8,Ft),e.unref(I)&&e.unref(D)&&!e.unref(j)?(e.openBlock(),e.createElementBlock("button",{key:0,class:"mr-label-reset-configuration mr-label-rebuild-current",type:"button",onClick:d[4]||(d[4]=(...c)=>e.unref(n).requestRebuild&&e.unref(n).requestRebuild(...c))},e.toDisplayString(e.unref(a).rebuildCurrent),1)):e.createCommentVNode("",!0),e.unref(j)?(e.openBlock(),e.createElementBlock("div",Ot,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(a).rebuildTitle),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(a).rebuildDescription),1),e.createElementVNode("div",null,[e.createElementVNode("button",{type:"button",onClick:d[5]||(d[5]=(...c)=>e.unref(n).cancelRebuild&&e.unref(n).cancelRebuild(...c))},e.toDisplayString(e.unref(a).cancelRebuild),1),e.createElementVNode("button",{type:"button",onClick:d[6]||(d[6]=c=>e.unref(n).applyConfiguration(!0))},e.toDisplayString(e.unref(a).confirmRebuild),1)])])):e.createCommentVNode("",!0),e.unref(ee)?(e.openBlock(),e.createElementBlock("button",{key:2,class:"mr-label-reset-configuration",type:"button",onClick:d[7]||(d[7]=(...c)=>e.unref(n).restoreConfiguration&&e.unref(n).restoreConfiguration(...c))},e.toDisplayString(e.unref(a).restoreConfiguration),1)):e.createCommentVNode("",!0),e.unref(ee)&&!e.unref(D)?(e.openBlock(),e.createElementBlock("p",Pt,e.toDisplayString(e.unref(a).choosePreset),1)):e.createCommentVNode("",!0),e.createElementVNode("p",$t,e.toDisplayString(e.unref(ie)?e.unref(a).reflowHint:e.unref(a).contentHint),1)],8,St),e.createElementVNode("label",zt,[e.createTextVNode(e.toDisplayString(e.unref(a).records),1),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[8]||(d[8]=c=>e.isRef(y)?y.value=c:null),disabled:e.unref(C)||!i.rows.length},[e.createElementVNode("option",qt,e.toDisplayString(e.unref(a).all)+" · "+e.toDisplayString(i.rows.length),1),e.createElementVNode("option",At,e.toDisplayString(e.unref(a).single),1)],8,It),[[e.vModelSelect,e.unref(y)]])]),e.unref(y)==="single"?(e.openBlock(),e.createElementBlock("label",Jt,[e.createTextVNode(e.toDisplayString(e.unref(a).record),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[9]||(d[9]=c=>e.isRef(N)?N.value=c:null),type:"number",min:"1",max:i.rows.length,"aria-label":e.unref(a).record,disabled:e.unref(C)},null,8,Ht),[[e.vModelText,e.unref(N),void 0,{number:!0}]]),e.createTextVNode(" / "+e.toDisplayString(i.rows.length),1)])):e.createCommentVNode("",!0),e.createElementVNode("p",Kt,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(g).length),1),e.createTextVNode(" "+e.toDisplayString(e.unref(a).count)+" ",1),d[19]||(d[19]=e.createElementVNode("span",null,"→",-1)),d[20]||(d[20]=e.createTextVNode()),e.unref(M)!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("strong",null,e.toDisplayString(e.unref(M)),1),e.createTextVNode(" "+e.toDisplayString(e.unref(a).labels),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(e.unref(a).invalidCopies),1)],64))]),e.createElementVNode("details",Ut,[e.createElementVNode("summary",null,e.toDisplayString(e.unref(a).guide),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(a).help),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(a).printHint),1)])]),e.createElementVNode("div",jt,[e.createElementVNode("header",Gt,[e.createElementVNode("nav",{"aria-label":e.unref(v)},[e.createElementVNode("button",{type:"button","aria-pressed":e.unref(p)==="preview",disabled:e.unref(C),onClick:d[10]||(d[10]=c=>e.unref(n).navigate("preview"))},[e.createVNode(re._sfc_main,{name:"file",size:14}),e.createTextVNode(e.toDisplayString(e.unref(a).preview),1)],8,Yt),e.createElementVNode("button",{type:"button","aria-pressed":e.unref(p)==="design",disabled:e.unref(C),onClick:d[11]||(d[11]=c=>e.unref(n).navigate("design"))},[e.createVNode(re._sfc_main,{name:"settings",size:14}),e.createTextVNode(e.toDisplayString(e.unref(a).design),1)],8,Zt)],8,Qt),e.createElementVNode("span",null,e.toDisplayString(e.unref(p)==="design"?e.unref(a).designHint:e.unref(a).flow),1)]),e.unref(h)?(e.openBlock(),e.createElementBlock("p",Wt,e.toDisplayString(e.unref(h)),1)):e.createCommentVNode("",!0),e.unref(q)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"mr-label-confirm",role:"alertdialog","aria-label":e.unref(a).discardTitle,onKeydown:d[14]||(d[14]=e.withKeys(e.withModifiers(c=>e.unref(n).decideDiscard(!1),["prevent","stop"]),["esc"]))},[e.createElementVNode("div",null,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(a).discardTitle),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(a).discardDescription),1)]),e.createElementVNode("button",{ref_key:"keepEditingButton",ref:A,type:"button",onClick:d[12]||(d[12]=c=>e.unref(n).decideDiscard(!1))},e.toDisplayString(e.unref(a).keepEditing),513),e.createElementVNode("button",{type:"button",onClick:d[13]||(d[13]=c=>e.unref(n).decideDiscard(!0))},e.toDisplayString(e.unref(a).discard),1)],40,Xt)):e.createCommentVNode("",!0),e.unref(ae)?e.withDirectives((e.openBlock(),e.createBlock(e.unref(be.ReportPreview),{key:e.unref(f).id,ref:e.unref(n).preview.ref,"report-id":"labels",fetcher:e.unref(se),refresh:{retainPrevious:!0,key:e.unref(f).id},"show-params":!1,height:"100%",toolbar:{exportFormats:["pdf","png","html"],editing:!1,excelImport:!1},messages:{title:e.unref(v),empty:e.unref(a).empty}},{settings:e.withCtx(()=>[e.createElementVNode("label",en,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[15]||(d[15]=c=>e.isRef(B)?B.value=c:null),type:"checkbox",disabled:!e.unref(ne)},null,8,tn),[[e.vModelCheckbox,e.unref(B)]]),e.createTextVNode(e.toDisplayString(e.unref(a).sheet),1),e.createElementVNode("small",null,e.toDisplayString(e.unref(ve)),1)])]),_:1},8,["fetcher","refresh","messages"])),[[e.vShow,e.unref(p)==="preview"]]):e.createCommentVNode("",!0),e.unref(te)?e.withDirectives((e.openBlock(),e.createElementBlock("div",nn,[V.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",an,e.toDisplayString(e.unref(a).designLoading),1)),V.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(V.value),{key:1,ref_key:"editor",ref:Y,"model-value":e.unref(x)??e.unref(f),mode:"design","show-mode-switch":!1,"show-save":t.showSave,capabilities:{params:!1},datasets:e.unref(P),"data-schemas":e.unref(O),"binding-datasets":e.unref(S),"binding-data-contract":t.dataContract,save:e.unref(n).save,"before-discard":e.unref(n).beforeDiscard,preview:t.preview,"onUpdate:modelValue":e.unref(n).update},null,8,["model-value","show-save","datasets","data-schemas","binding-datasets","binding-data-contract","save","before-discard","preview","onUpdate:modelValue"])):e.createCommentVNode("",!0)],512)),[[e.vShow,e.unref(p)==="design"]]):e.createCommentVNode("",!0)])],14,bt))}});exports.default=ln;
@@ -0,0 +1 @@
1
+ "use strict";const a=require("vue"),$=require("./injection-keys-Db_DyLkm.cjs"),M=require("@agile-team/mach-report"),ae=require("./progress-WomPRP3B.cjs"),D=require("./_plugin-vue_export-helper-BLmdZLlg.cjs"),z={printPrepareTimeout:"打印资源准备超时,请检查字体与图片后重试。",printImageFailed:"第 {index} 张图片未能加载,已停止打印,避免输出缺失内容。",printFontFailed:"打印字体 {family} 未能加载,请检查字体资源后重试。",printPrepareFailed:"打印准备失败,请检查打印配置或改用 PDF。",printCalibration:"打印校准",printOffsetX:"水平偏移(mm)",printOffsetY:"垂直偏移(mm)",printCalibrationTest:"打印校准页",printCalibrationHint:"正值向右/向下移动,负值向左/向上。使用同规格纸张及 100% 比例,先试打一张。系统对话框关闭不代表设备已完成。"};function te(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 ne(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 K(e={}){const n=a.ref(!1),l=a.ref(null),r=a.ref(null),i=a.ref(null);function f(d=!1){n.value=!1,d&&a.nextTick(()=>r.value?.focus())}function v(d){d.target instanceof Node&&!l.value?.contains(d.target)&&f()}function s(d){d.key!=="Escape"||!n.value||d.isComposing||(d.preventDefault(),d.stopPropagation(),f(!0))}return a.watch(n,d=>{!d||e.focusOnOpen===!1||a.nextTick(()=>(i.value?.querySelector("input")??i.value?.querySelector("button:not(:disabled)"))?.focus())}),a.onMounted(()=>{document.addEventListener("pointerdown",v),document.addEventListener("focusin",v)}),a.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("focusin",v)}),{opened:n,root:l,trigger:r,panel:i,close:f,onKeydown:s}}const T={paramOptionsLoading:"正在搜索选项…",paramOptionsEmpty:"没有匹配选项",paramOptionsFailed:"选项加载失败,请重试",paramOptionsMissingLoader:"尚未配置选项加载服务",paramOptionsDependencies:"请先选择上级条件",paramOptionsClear:"清除选择",paramNumberRangeStart:"最小值",paramNumberRangeEnd:"最大值"},V={prefillTitle:"安全预填",prefillHint:"按业务主键匹配白名单字段,先核对差异再整批应用;默认只补空白。",prefillCurrent:"当前值",prefillReference:"参考 / 待填值",prefillLoad:"读取参考数据",prefillApply:"应用预填",prefillMatched:"一致",prefillChanged:"可补入",prefillSkipped:"已跳过",prefillConflict:"需处理",prefillUnchanged:"值一致",prefillReadonly:"只读",prefillOccupied:"保留已有值",prefillMissingSource:"来源为空",prefillMissingTarget:"无匹配目标",prefillAmbiguous:"同源值不一致",prefillInvalid:"值格式无效",comparisonTitle:"业务数据对比",comparisonHint:"按稳定业务主键比较参考数据与本次查询,不按显示行号匹配。",comparisonLoad:"读取并对比",comparisonAdded:"新增",comparisonRemoved:"删除",comparisonChanged:"变化",comparisonUnchanged:"一致",reviewCancel:"取消读取",reviewClose:"关闭数据核对",reviewBefore:"参考值",reviewAfter:"当前 / 待填值",reviewField:"字段",reviewKey:"业务主键",reviewDelta:"差额",reviewRatio:"变化比率",reviewLocate:"定位",reviewEmpty:"暂无差异记录",reviewPrevious:"上一页",reviewNext:"下一页",reviewPage:"差异分页"};function le(e){return{...V,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))}}const U={calculationTitle:"选区计算",calculationLocal:"仅本地分析,不写回实绩、不重算原公式。请选取同一单位与量纲的数值。",calculationHint:"点击起点,Shift + 点击终点或方向键扩选。",calculationFormula:"计算方式",calculationExpression:"组合公式",calculationExpressionHint:"支持 SUM、AVERAGE/AVG、MIN、MAX、COUNT、MEDIAN 及 + - * / 和括号,不执行 Excel 公式;采用浮点数,精度仅用于展示。",calculationPrecision:"展示小数位",calculationRun:"计算选区",calculationCancel:"取消计算",calculationResult:"计算结果",calculationIncluded:"参与数值",calculationExcluded:"排除单元格",calculationEmpty:"选区没有可计算数值,计数为 0,其余结果为空。",calculationNoSelection:"在旁边报表中点击起点,再 Shift + 点击终点选择数据。",calculationSummary:"选区摘要",calculationAdvanced:"高级计算",calculationClose:"收起选区计算",calculationPending:"正在计算选区…",calculationSummarySum:"求和",calculationSummaryAverage:"均值",calculationSummaryCount:"数值",calculationMixedColumns:"选区跨多列,请确认单位与口径后使用高级计算。",calculationSum:"求和 SUM",calculationAverage:"平均值 AVERAGE",calculationMin:"最小值 MIN",calculationMax:"最大值 MAX",calculationCount:"数值计数 COUNT",calculationMedian:"中位数 MEDIAN",calculationCustom:"组合公式",calculationErrorSelection:"请选择同一明细区域中的数据。",calculationErrorLimit:"选区超过计算预算,请缩小范围后重试。",calculationErrorExpression:"公式无效,请使用支持的摘要名称、运算符与括号。",calculationErrorDivision:"除数不能为 0。",calculationErrorOverflow:"结果超出有效数值范围。",calculationErrorPrecision:"数值超出安全精度,或展示小数位不是 0 至 12 的整数。"};function re(e){const n={...U};for(const l of Object.keys(n)){const r=e[l];typeof r=="string"&&(n[l]=r)}return n}const W={previousSnapshot:"当前保留上次成功结果,刷新成功后恢复编辑和输出。",...T,...V,reviewTools:"数据工具",validationTitle:"数据校验",validationError:"错误",validationWarning:"提示",validationDataset:"全表",validationRow:"行",validationMore:"请缩小范围查看更多问题",drillActions:"查看关联",drillOpening:"正在打开…",drillMissingValue:"当前单元格缺少关联参数",drillFailed:"关联内容打开失败,请重试",...z,...U,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 取消",editCellEditable:"可编辑",editCellReadOnly:"只读",editCellFormula:"公式结果由计算生成,不能直接修改。",editCellProtected:"此单元格已受保护。",editCellComplex:"此单元格包含复合内容,请在模板设计中调整。",editCellStructure:"表头与结构单元格由模板控制。",editCellDerived:"汇总或派生值随来源数据计算。",editCellPermission:"当前业务权限不允许修改此单元格。",editCellBusy:"报表处理中,当前单元格暂时只读。",editHistoryLimited:"较早的撤销记录已释放,当前修改与来源差异仍完整保留。",changesSearch:"搜索字段、行键或数据集",changesAllDatasets:"全部数据集",changesNoMatches:"没有匹配的修改",changesRange:"{start}–{end} / {total}",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:"图片资源超出处理范围,请减少资源或缩小报表范围。"},J={colorScheme:"light",emptyAccent:"#79a7e8",shellBg:"#f4f7fc",shellFg:"#334155",toolbarBg:"#ffffff",toolbarBorder:"#e4eaf3",toolbarFg:"#334155",btnFg:"#526078",btnBorder:"#dbe3ef",btnHoverBg:"#edf3ff",btnHoverFg:"#315fba",btnActiveBg:"#3569d4",btnActiveFg:"#ffffff",errorFg:"#b91c1c",warningFg:"#92400e",successFg:"#047857"};function Y(e={}){return{...e,defaults:e.defaults??{},presets:e.presets??{}}}function oe(e){return e}const O={showExport:!0,showPrint:!0,showPdfWindow:!0,showSettings:!0,showParams:!0,gapPx:18,pdfFontUrl:"/simhei.ttf",logger:console},ie={warn:()=>{},info:()=>{}};function se(e,n){if(!(!e&&!n))return{...e,...n,calibration:{...e?.calibration,...n?.calibration}}}function ce(e={},n={}){const l={...e,...n};return(e.unavailableReasons||n.unavailableReasons)&&(l.unavailableReasons={...e.unavailableReasons,...n.unavailableReasons}),l}function N(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:ce(e?.toolbar,n?.toolbar),interaction:{...e?.interaction,...n?.interaction},refresh:{...e?.refresh,...n?.refresh},output:{...e?.output,...n?.output},printOptions:se(e?.printOptions,n?.printOptions)}}function de(e){return{showExport:e.showExport??O.showExport,showPrint:e.showPrint??O.showPrint,showPdfWindow:e.showPdfWindow??O.showPdfWindow,showSettings:e.showSettings??O.showSettings,showParams:e.showParams??O.showParams,gapPx:e.gapPx??O.gapPx}}function ue(e,n){const l=n?e?.presets?.[n]:e?.defaultPreset?e?.presets?.[e.defaultPreset]:void 0,r=N(e?.defaults,l);return{drill:r.drill,prefill:r.prefill,dataComparison:r.dataComparison,exportExecution:r.exportExecution,loadParamOptions:r.loadParamOptions,...de(r),pdfFontUrl:r.pdfFontUrl??O.pdfFontUrl,theme:{...J,...r.theme},messages:{...W,...r.messages},logger:r.logger??O.logger,preview:{overscanPages:j(r.preview?.overscanPages,1,10,!0),searchDebounceMs:j(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,refresh:r.refresh,assets:r.assets,guardChanges:r.guardChanges??!0,beforeDiscard:r.beforeDiscard,output:{...r.output},printOptions:r.printOptions}}function j(e,n,l,r=!1){if(e==null||!Number.isFinite(e))return n;const i=Math.max(0,Math.min(l,e));return r?Math.floor(i):i}function fe(e){const n={};return e.colorScheme!=null&&(n["--mrp-color-scheme"]=e.colorScheme),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),e.btnActiveFg!=null&&(n["--mrp-btn-active-fg"]=e.btnActiveFg),e.errorFg!=null&&(n["--mrp-error-fg"]=e.errorFg),e.warningFg!=null&&(n["--mrp-warning-fg"]=e.warningFg),e.successFg!=null&&(n["--mrp-success-fg"]=e.successFg),n}function pe(e){const n=a.inject($.MACH_REPORT_CONFIG_KEY,null),l=a.computed(()=>{const r=n?.value??null,i="defaults"in e||"presets"in e||"defaultPreset"in e?Y(e):{defaults:e,presets:{}};if(!r)return i;const f={...r.presets,...i.presets};for(const v of Object.keys(f))f[v]=N(N(r.presets[v],i.defaults),i.presets[v]);return{defaults:N(r.defaults,i.defaults),presets:f,defaultPreset:i.defaultPreset??r.defaultPreset}});a.provide($.MACH_REPORT_CONFIG_KEY,l)}function me(){return a.inject($.MACH_REPORT_CONFIG_KEY,a.computed(()=>null))}class x extends Error{constructor(n,l,r){super(l),this.name="MachReportError",this.code=n,this.cause=r}}function ve(e){return e instanceof x?{code:e.code,cause:e.cause}:{code:"render",cause:e}}function ge(e){if(e instanceof x)return e;if(e instanceof M.ReportParamValidationError)return new x("param",e.message,e);if(e instanceof M.ReportSourceError)return new x(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 x(n[l],e.message,e)}return new x("fetch",e instanceof Error?e.message:"预览加载失败",e)}let be=0;function ye(){return`mrp-params-${++be}`}function X(e,n,l){const r=(Array.isArray(n)?n.find(i=>i?.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 he(e){const n=a.ref({}),l=a.ref(!1);function r(){const s={};for(const d of Array.isArray(e.defs.value)?e.defs.value:[])typeof d?.field=="string"&&Object.defineProperty(s,d.field,{value:e.params()[d.field]??d.defaultValue??"",writable:!0,enumerable:!0,configurable:!0});n.value=s,l.value=!1}r(),a.watch(e.defs,r),a.watch(e.reportIds,r),a.watch(()=>JSON.stringify(e.params()),r);const i=a.computed(()=>M.validateReportParams(e.defs.value,{...e.params(),...n.value})),f=a.computed(()=>!l.value&&i.value.issues.length>0&&i.value.issues.every(s=>s.code==="required"));function v(){const s=i.value;if(!s.ok){const b=s.issues[0];return{quiet:f.value,error:new x(b.code==="definition"?"config":"param",X(b,e.defs.value,e.messages()),{issues:s.issues})}}const d={...s.values},C=new Set(e.defs.value.filter(b=>b.defaultValue!==void 0).map(b=>b.field));for(const[b,u]of Object.entries(d))u===""&&!C.has(b)&&delete d[b];return{params:d,quiet:!1}}return{values:n,attempted:l,validation:i,pendingRequired:f,reset:r,query:v}}const q=100,Ee=32,Se=6e4,ke=15e3;function we(e){let n=0;const l=new Set;function r(i,f){if(!Array.isArray(i)||f>16||i.length>q)throw new Error("Invalid option response");const v=new Set;return Object.freeze(i.map(s=>{if(++n>q||!s||l.has(s)||typeof s.value!="string"||!s.value||s.value.length>1024||typeof s.label!="string"||s.label.length>1024||v.has(s.value))throw new Error("Invalid option response");return l.add(s),v.add(s.value),Object.freeze({label:s.label,value:s.value,...s.children===void 0?{}:{children:r(s.children,f+1)}})}))}return r(e,1)}function Q(e){const n=a.ref(""),l=a.shallowRef([]),r=a.ref(!1),i=a.ref(!1),f=a.computed(()=>Object.fromEntries((Array.isArray(e.def().dependsOn)?e.def().dependsOn:[]).map(w=>[w,e.values()[w]??""]))),v=a.computed(()=>Object.values(f.value).some(w=>!w.trim())),s=a.computed(()=>!e.loader()),d=new Map;let C,b,u=0;function y(){u++,C?.abort(),C=void 0,clearTimeout(b),r.value=!1}async function g(){y(),i.value=!1;const w=e.loader(),P=e.def();if(!w||!P.optionsSource||v.value||e.disabled()||!e.opened())return;const A={source:P.optionsSource,field:P.field,query:n.value.trim().slice(0,256),params:Object.freeze({...f.value}),limit:q},o=JSON.stringify(A),p=d.get(o);if(p&&Date.now()-p.at<Se){d.delete(o),d.set(o,p),l.value=p.options;return}const t=u,c=new AbortController;C=c,r.value=!0;const h=setTimeout(()=>c.abort(),ke);try{const k=we(await ae.waitForOutput(w(Object.freeze({...A,signal:c.signal})),c.signal));if(t!==u)return;for(l.value=k,d.delete(o),d.set(o,{at:Date.now(),options:k});d.size>Ee;)d.delete(d.keys().next().value)}catch{t===u&&(i.value=!0)}finally{clearTimeout(h),t===u&&(r.value=!1,C=void 0)}}function S(){y(),l.value=[],i.value=!1,b=setTimeout(()=>{g()},180)}return a.watch(n,S,{flush:"sync"}),a.watch([()=>e.def().field,()=>e.def().type,()=>e.def().optionsSource,()=>JSON.stringify(f.value),e.loader],()=>{d.clear(),n.value="",y(),l.value=[],i.value=!1,e.opened()&&g()},{flush:"sync"}),a.watch([e.opened,e.disabled],()=>{!e.opened()||e.disabled()?y():g()},{immediate:!0}),a.onBeforeUnmount(()=>{y(),d.clear()}),{query:n,options:l,loading:r,failed:i,waiting:v,missingLoader:s,request:g,cancel:y}}const Ce=["aria-labelledby"],Pe=["value","disabled","aria-label","aria-invalid","aria-describedby","aria-required","onChange"],Be={value:""},Ae=["value"],Re=["id"],Oe=a.defineComponent({__name:"ReportCascaderParam",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,i=Q({def:()=>l.def,values:()=>l.values,loader:()=>l.loadOptions,opened:()=>!0,disabled:()=>l.disabled===!0}),f=a.computed(()=>{const b=M.parseReportCascaderPath(l.value);if(b)return b;try{const u=JSON.parse(l.value);return Array.isArray(u)&&u.length<=16&&u[u.length-1]===null&&u.slice(0,-1).every(y=>typeof y=="string")?u.slice(0,-1):[]}catch{return[]}}),v=a.computed(()=>({...T,...l.messages})),s=a.computed(()=>{const b=[];let u=l.def.optionsSource?i.options.value:l.def.options??[];for(let y=0;y<16&&u.length;y++)b.push(u),u=u.find(g=>g.value===f.value[y])?.children??[];return b}),d=a.computed(()=>l.def.optionsSource?i.waiting.value?v.value.paramOptionsDependencies:i.missingLoader.value?v.value.paramOptionsMissingLoader:i.failed.value?v.value.paramOptionsFailed:i.loading.value?v.value.paramOptionsLoading:s.value.length?"":v.value.paramOptionsEmpty:"");function C(b,u){if(l.disabled)return;const y=f.value.slice(0,b);u&&y.push(u);const g=u?s.value[b]?.find(S=>S.value===u)?.children:s.value[b];r("change",y.length?g?.length?JSON.stringify([...y,null]):M.formatReportCascaderPath(y):"")}return(b,u)=>(a.openBlock(),a.createElementBlock("div",{class:"mrp-cascader",role:"group","aria-labelledby":`${e.id}-label`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,(y,g)=>(a.openBlock(),a.createElementBlock("select",{key:g,class:"mrp-param-input",value:f.value[g]??"",disabled:e.disabled||a.unref(i).loading.value,"aria-label":`${e.def.label??e.def.field} · ${g+1}`,"aria-invalid":e.invalid||void 0,"aria-describedby":e.invalid?`${e.id}-error`:d.value?`${e.id}-status`:void 0,"aria-required":e.def.required||void 0,onChange:S=>C(g,S.target.value)},[a.createElementVNode("option",Be,a.toDisplayString(e.def.placeholder??(e.messages.paramSelectPlaceholder??"请选择{label}").replace("{label}",e.def.label??e.def.field)),1),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(y,S=>(a.openBlock(),a.createElementBlock("option",{key:S.value,value:S.value},a.toDisplayString(S.label),9,Ae))),128))],40,Pe))),128)),d.value?(a.openBlock(),a.createElementBlock("small",{key:0,id:`${e.id}-status`,role:"status"},[a.createTextVNode(a.toDisplayString(d.value),1),a.unref(i).failed.value?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",onClick:u[0]||(u[0]=(...y)=>a.unref(i).request&&a.unref(i).request(...y))},a.toDisplayString(e.messages.retry),1)):a.createCommentVNode("",!0)],8,Re)):a.createCommentVNode("",!0)],8,Ce))}}),xe=D._export_sfc(Oe,[["__scopeId","data-v-734dde49"]]),Me=["id","value","aria-labelledby","aria-invalid","aria-required","aria-describedby","aria-expanded","aria-controls","aria-activedescendant","disabled","placeholder"],Fe=["aria-label","disabled"],De=["aria-label","disabled"],Ne=["id"],Te=["id","aria-label","aria-busy","aria-multiselectable"],Le=["id","aria-selected","disabled","onPointermove","onClick"],Ie={key:0,"aria-hidden":"true",class:"mrp-option-check"},$e={key:0},qe={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,i=K({focusOnOpen:!1}),{root:f,panel:v,opened:s}=i,d=Q({def:()=>l.def,values:()=>l.values,loader:()=>l.loadOptions,opened:()=>s.value,disabled:()=>l.disabled===!0}),{query:C,options:b,loading:u,failed:y,waiting:g,missingLoader:S}=d,w=a.computed(()=>({...T,...l.messages})),P=a.computed(()=>l.def.type==="multiSelect"),A=a.computed(()=>P.value?M.parseReportParamSelection(l.value)??[]:[l.value]),o=a.computed(()=>l.def.optionsSource?b.value:(l.def.options??[]).filter(m=>`${m.label} ${m.value}`.toLocaleLowerCase().includes(C.value.toLocaleLowerCase())).slice(0,100)),p=new Map,t=a.computed(()=>P.value?A.value.map(m=>p.get(m)??l.def.options?.find(E=>E.value===m)?.label??m).join("、"):h.value||l.value),c=a.ref(0),h=a.ref(""),k=a.ref(),F=a.computed(()=>`${l.id}-options`),R=a.computed(()=>g.value?w.value.paramOptionsDependencies:l.def.optionsSource&&S.value?w.value.paramOptionsMissingLoader:y.value?w.value.paramOptionsFailed:u.value?w.value.paramOptionsLoading:o.value.length?"":w.value.paramOptionsEmpty);a.watch(()=>l.value,()=>{h.value=""}),a.watch(o,()=>{c.value=0}),a.watch(()=>[l.def.field,l.def.optionsSource,JSON.stringify(l.def.options)],()=>{p.clear(),h.value=""}),a.watch(s,m=>{m&&a.nextTick(()=>k.value?.focus())});function H(m){if(!(l.disabled||g.value||u.value||y.value)){p.set(m.value,m.label);for(const E of p.keys())E!==m.value&&!A.value.includes(E)&&p.delete(E);if(P.value){const E=A.value.includes(m.value)?A.value.filter(B=>B!==m.value):[...A.value,m.value];if(E.length>Math.min(l.def.maxItems??100,100))return;r("change",E.length?M.formatReportParamSelection(E):"")}else r("change",m.value),i.close();a.nextTick(()=>{h.value=m.label,k.value?.focus()})}}function G(m){m.isComposing||(s.value=!0,C.value=m.target.value)}function L(){!l.disabled&&!g.value&&(!l.def.optionsSource||!S.value)&&(C.value="",s.value=!0)}function Z(m){if(!(m.isComposing||m.keyCode===229)){if(m.key==="Escape"){s.value&&(m.preventDefault(),m.stopPropagation(),i.close());return}if(["ArrowUp","ArrowDown","Enter"].includes(m.key)){if(m.preventDefault(),m.stopPropagation(),!s.value){L();return}if(m.key==="Enter"){const E=o.value[c.value];E&&H(E);return}o.value.length&&(c.value=(c.value+(m.key==="ArrowDown"?1:-1)+o.value.length)%o.value.length,a.nextTick(()=>v.value?.querySelector(`[id="${F.value}-${c.value}"]`)?.scrollIntoView?.({block:"nearest"})))}}}function _(){l.disabled||(r("change",""),h.value="",i.close())}return(m,E)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"root",ref:f,class:"mrp-remote-param"},[a.createElementVNode("div",{class:a.normalizeClass(["mrp-remote-control",{"is-invalid":e.invalid}])},[a.createVNode(D._sfc_main,{name:"search",size:14}),a.createElementVNode("input",{id:e.id,ref_key:"input",ref:k,type:"text",role:"combobox",autocomplete:"off",value:a.unref(s)?a.unref(C):t.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(g)||e.def.optionsSource&&a.unref(S)?`${e.id}-remote-status`:void 0,"aria-autocomplete":"list","aria-expanded":a.unref(s),"aria-controls":a.unref(s)?F.value:void 0,"aria-activedescendant":a.unref(s)&&o.value.length?`${F.value}-${c.value}`:void 0,disabled:e.disabled||a.unref(g)||!!e.def.optionsSource&&a.unref(S),placeholder:e.def.placeholder??(e.messages.paramSelectPlaceholder??"请选择{label}").replace("{label}",e.def.label??e.def.field),onClick:L,onInput:G,onCompositionend:G,onKeydown:Z},null,40,Me),e.value?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button","aria-label":w.value.paramOptionsClear,disabled:e.disabled,onClick:_},[a.createVNode(D._sfc_main,{name:"close",size:12})],8,Fe)):(a.openBlock(),a.createElementBlock("button",{key:1,type:"button","aria-label":e.def.label??e.def.field,disabled:e.disabled||a.unref(g)||!!e.def.optionsSource&&a.unref(S),onClick:E[0]||(E[0]=B=>a.unref(s)?a.unref(i).close():L())},[a.createVNode(D._sfc_main,{name:"chevron-down",size:12})],8,De))],2),a.unref(g)||e.def.optionsSource&&a.unref(S)?(a.openBlock(),a.createElementBlock("small",{key:0,id:`${e.id}-remote-status`,role:"status"},a.toDisplayString(R.value),9,Ne)):a.createCommentVNode("",!0),a.unref(s)?(a.openBlock(),a.createElementBlock("div",{key:1,ref_key:"panel",ref:v,class:"mrp-remote-options"},[a.createElementVNode("div",{id:F.value,role:"listbox","aria-label":e.def.label??e.def.field,"aria-busy":a.unref(u),"aria-multiselectable":P.value||void 0},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,(B,I)=>(a.openBlock(),a.createElementBlock("button",{id:`${F.value}-${I}`,key:B.value,type:"button",role:"option",tabindex:"-1","aria-selected":A.value.includes(B.value),class:a.normalizeClass({active:I===c.value}),disabled:a.unref(u),onPointermove:ee=>c.value=I,onMousedown:E[1]||(E[1]=a.withModifiers(()=>{},["prevent"])),onClick:ee=>H(B)},[a.createElementVNode("span",null,[P.value?(a.openBlock(),a.createElementBlock("span",Ie,a.toDisplayString(A.value.includes(B.value)?"✓":""),1)):a.createCommentVNode("",!0),a.createTextVNode(a.toDisplayString(B.label),1)]),B.label!==B.value?(a.openBlock(),a.createElementBlock("small",$e,a.toDisplayString(B.value),1)):a.createCommentVNode("",!0)],42,Le))),128))],8,Te),R.value?(a.openBlock(),a.createElementBlock("p",qe,[a.createTextVNode(a.toDisplayString(R.value),1),a.unref(y)?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",onClick:E[2]||(E[2]=(...B)=>a.unref(d).request&&a.unref(d).request(...B))},a.toDisplayString(e.messages.retry),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)],512)):a.createCommentVNode("",!0)],512))}}),Ue=D._export_sfc(Ve,[["__scopeId","data-v-6ad41cf4"]]),He={key:0,class:"mrp-params-title"},Ge={class:"mrp-params-grid"},je=["id"],ze={key:0,class:"mrp-param-star","aria-hidden":"true"},Ke=["value","disabled","aria-labelledby","aria-invalid","aria-describedby","aria-required","onChange"],We=["disabled","hidden"],Je=["value"],Ye=["aria-labelledby"],Xe=["type","step","value","disabled","min","max","aria-label","aria-invalid","aria-describedby","aria-required","onInput"],Qe=["type","inputmode","maxlength","placeholder","value","disabled","min","max","step","aria-labelledby","aria-invalid","aria-describedby","aria-required","onInput"],Ze=["id"],_e={key:1,class:"mrp-params-actions"},ea=["disabled"],aa=["disabled"],ta=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,i=l,f=a.ref({...r.modelValue}),v=a.ref(null),s=ye();a.watch(()=>r.modelValue,o=>{f.value={...o}});const d=a.computed(()=>r.issues??M.validateReportParams(r.defs,f.value).issues),C=a.computed(()=>(Array.isArray(r.defs)?r.defs:[]).filter(o=>o&&typeof o.field=="string").map((o,p)=>({def:o,id:`${s}-${p}`,label:o.label??o.field,value:f.value[o.field]??"",error:r.attempted?d.value.find(t=>t.field===o.field):void 0}))),b=a.computed(()=>{const o=new Map;for(const p of r.defs)for(const t of Array.isArray(p.dependsOn)?p.dependsOn:[]){const c=o.get(t)??[];c.push(p.field),o.set(t,c)}return o});function u(o,p){if(r.disabled||f.value[o]===p)return;f.value={...f.value,[o]:p};const t=new Set([o]),c=[o];for(let h=0;h<c.length;h++)for(const k of b.value.get(c[h])??[])t.has(k)||(f.value[k]="",t.add(k),c.push(k));i("update:modelValue",{...f.value})}function y(o){return o.type==="number"?"number":o.type==="date"||o.type==="month"?o.type:"text"}function g(o,p,t=!1){if(!t)return o.split("/")[p]??"";try{const c=JSON.parse(o);return Array.isArray(c)&&(typeof c[p]=="number"||typeof c[p]=="string")?String(c[p]):""}catch{return""}}function S(o,p,t){return t?!!g(o,0)!=!!g(o,1)?!g(o,p)||void 0:!0:void 0}function w(o,p,t){const c=o.type==="numberRange",h=f.value[o.field]??"",k=[g(h,0,c),g(h,1,c)];k[p]=t;const F=c?JSON.stringify(k.map(R=>R===""?null:Number(R))):k.join("/");u(o.field,k.every(R=>!R)?"":F)}function P(o){o.isComposing||i("query")}function A(){v.value?.querySelector('[aria-invalid="true"]')?.focus()}return n({focusInvalid:A}),(o,p)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"root",ref:v,class:"mrp-params"},[e.showTitle!==!1?(a.openBlock(),a.createElementBlock("span",He,a.toDisplayString(e.messages.paramsTitle),1)):a.createCommentVNode("",!0),a.createElementVNode("div",Ge,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(C.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",ze,"*")):a.createCommentVNode("",!0)],8,je),t.def.type==="cascader"?(a.openBlock(),a.createBlock(xe,{key:0,id:t.id,def:t.def,value:t.value,values:f.value,"load-options":e.loadOptions,messages:e.messages,disabled:e.disabled,invalid:!!t.error,onChange:c=>u(t.def.field,c)},null,8,["id","def","value","values","load-options","messages","disabled","invalid","onChange"])):t.def.optionsSource||t.def.type==="multiSelect"?(a.openBlock(),a.createBlock(Ue,{key:1,id:t.id,def:t.def,value:t.value,values:f.value,"load-options":e.loadOptions,messages:e.messages,disabled:e.disabled,invalid:!!t.error,onChange:c=>u(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:2,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=>u(t.def.field,c.target.value),onKeydown:a.withKeys(P,["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,Je))),128))],40,Ke)):t.def.type==="dateRange"||t.def.type==="numberRange"?(a.openBlock(),a.createElementBlock("div",{key:3,class:"mrp-param-range",role:"group","aria-labelledby":`${t.id}-label`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.def.type==="numberRange"?[e.messages.paramNumberRangeStart??"最小值",e.messages.paramNumberRangeEnd??"最大值"]:[e.messages.paramRangeStart??"开始日期",e.messages.paramRangeEnd??"结束日期"],(c,h)=>(a.openBlock(),a.createElementBlock("input",{key:h,class:"mrp-param-input",type:t.def.type==="numberRange"?"number":"date",step:t.def.type==="numberRange"?"any":void 0,value:g(t.value,h,t.def.type==="numberRange"),disabled:e.disabled,min:t.def.min,max:t.def.max,"aria-label":`${t.label} · ${c}`,"aria-invalid":t.def.type==="numberRange"?!!t.error||void 0:S(t.value,h,t.error),"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onInput:k=>w(t.def,h,k.target.value),onKeydown:a.withKeys(P,["enter"])},null,40,Xe))),128))],8,Ye)):(a.openBlock(),a.createElementBlock("input",{key:4,class:"mrp-param-input",type:y(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=>u(t.def.field,c.target.value),onKeydown:a.withKeys(P,["enter"])},null,40,Qe)),t.error?(a.openBlock(),a.createElementBlock("small",{key:5,id:`${t.id}-error`,class:"mrp-param-error",role:"status"},a.toDisplayString(a.unref(X)(t.error,e.defs,e.messages)),9,Ze)):a.createCommentVNode("",!0)],2))),128))]),e.showActions!==!1?(a.openBlock(),a.createElementBlock("div",_e,[a.createElementVNode("button",{class:"mrp-nav mrp-param-query",type:"button",disabled:e.disabled,onClick:p[0]||(p[0]=t=>o.$emit("query"))},a.toDisplayString(e.messages.query),9,ea),a.createElementVNode("button",{class:"mrp-nav",type:"button",disabled:e.disabled,onClick:p[1]||(p[1]=t=>o.$emit("reset"))},a.toDisplayString(e.messages.reset),9,aa)])):a.createCommentVNode("",!0)],512))}}),na=D._export_sfc(ta,[["__scopeId","data-v-bad4d7de"]]);exports.DEFAULT_CALCULATION_MESSAGES=U;exports.DEFAULT_DATA_REVIEW_MESSAGES=V;exports.DEFAULT_MESSAGES=W;exports.DEFAULT_PRINT_MESSAGES=z;exports.DEFAULT_THEME=J;exports.MachReportError=x;exports.PARAM_OPTIONS_MESSAGES=T;exports.ReportParamPanel=na;exports.SILENT_LOGGER=ie;exports.defineMachReportConfig=Y;exports.defineMachReportPreset=oe;exports.normalizeReportLoadError=ge;exports.printCalibration=te;exports.provideMachReportConfig=pe;exports.resolveCalculationMessages=re;exports.resolveConfig=ue;exports.resolveDataReviewMessages=le;exports.snapshotPrintOptions=ne;exports.themeToCssVars=fe;exports.toErrorDetail=ve;exports.useMachReportConfig=me;exports.usePopover=K;exports.useReportParams=he;
@@ -3,7 +3,7 @@ import { a as Q } from "./injection-keys-e85udZCp.js";
3
3
  import { ReportParamValidationError as we, ReportSourceError as Ee, validateReportParams as oe, parseReportCascaderPath as Se, formatReportCascaderPath as Ce, parseReportParamSelection as Pe, formatReportParamSelection as Oe } from "@agile-team/mach-report";
4
4
  import { w as xe } from "./progress-ByiOxUD3.js";
5
5
  import { _ as ee, a as X } from "./_plugin-vue_export-helper-8SL1F89S.js";
6
- const Re = {
6
+ const Ae = {
7
7
  printPrepareTimeout: "打印资源准备超时,请检查字体与图片后重试。",
8
8
  printImageFailed: "第 {index} 张图片未能加载,已停止打印,避免输出缺失内容。",
9
9
  printFontFailed: "打印字体 {family} 未能加载,请检查字体资源后重试。",
@@ -23,7 +23,7 @@ function xa(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
- function Ae(e = {}) {
26
+ function Re(e = {}) {
27
27
  const t = k(!1), l = k(null), n = k(null), i = k(null);
28
28
  function c(d = !1) {
29
29
  t.value = !1, d && V(() => n.value?.focus());
@@ -90,7 +90,7 @@ const ae = {
90
90
  reviewNext: "下一页",
91
91
  reviewPage: "差异分页"
92
92
  };
93
- function Ra(e) {
93
+ function Aa(e) {
94
94
  return { ...de, ...Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)) };
95
95
  }
96
96
  const ue = {
@@ -130,7 +130,7 @@ const ue = {
130
130
  calculationErrorOverflow: "结果超出有效数值范围。",
131
131
  calculationErrorPrecision: "数值超出安全精度,或展示小数位不是 0 至 12 的整数。"
132
132
  };
133
- function Aa(e) {
133
+ function Ra(e) {
134
134
  const t = { ...ue };
135
135
  for (const l of Object.keys(t)) {
136
136
  const n = e[l];
@@ -153,7 +153,7 @@ const ke = {
153
153
  drillOpening: "正在打开…",
154
154
  drillMissingValue: "当前单元格缺少关联参数",
155
155
  drillFailed: "关联内容打开失败,请重试",
156
- ...Re,
156
+ ...Ae,
157
157
  ...ue,
158
158
  exportMenu: "导出",
159
159
  exportMenuDescription: "选择文件格式",
@@ -325,6 +325,7 @@ const ke = {
325
325
  diagnosticAssetFailed: "图表或图片生成失败,请重试或联系管理员。",
326
326
  diagnosticAssetBudget: "图片资源超出处理范围,请减少资源或缩小报表范围。"
327
327
  }, Me = {
328
+ colorScheme: "light",
328
329
  emptyAccent: "#79a7e8",
329
330
  shellBg: "#f4f7fc",
330
331
  shellFg: "#334155",
@@ -335,9 +336,13 @@ const ke = {
335
336
  btnBorder: "#dbe3ef",
336
337
  btnHoverBg: "#edf3ff",
337
338
  btnHoverFg: "#315fba",
338
- btnActiveBg: "#3569d4"
339
+ btnActiveBg: "#3569d4",
340
+ btnActiveFg: "#ffffff",
341
+ errorFg: "#b91c1c",
342
+ warningFg: "#92400e",
343
+ successFg: "#047857"
339
344
  };
340
- function $e(e = {}) {
345
+ function Fe(e = {}) {
341
346
  return { ...e, defaults: e.defaults ?? {}, presets: e.presets ?? {} };
342
347
  }
343
348
  function ka(e) {
@@ -355,7 +360,7 @@ const T = {
355
360
  }, Ma = { warn: () => {
356
361
  }, info: () => {
357
362
  } };
358
- function Fe(e, t) {
363
+ function $e(e, t) {
359
364
  if (!(!e && !t))
360
365
  return { ...e, ...t, calibration: { ...e?.calibration, ...t?.calibration } };
361
366
  }
@@ -375,7 +380,7 @@ function j(e, t) {
375
380
  interaction: { ...e?.interaction, ...t?.interaction },
376
381
  refresh: { ...e?.refresh, ...t?.refresh },
377
382
  output: { ...e?.output, ...t?.output },
378
- printOptions: Fe(e?.printOptions, t?.printOptions)
383
+ printOptions: $e(e?.printOptions, t?.printOptions)
379
384
  };
380
385
  }
381
386
  function Ie(e) {
@@ -388,7 +393,7 @@ function Ie(e) {
388
393
  gapPx: e.gapPx ?? T.gapPx
389
394
  };
390
395
  }
391
- function $a(e, t) {
396
+ function Fa(e, t) {
392
397
  const l = t ? e?.presets?.[t] : e?.defaultPreset ? e?.presets?.[e.defaultPreset] : void 0, n = j(e?.defaults, l);
393
398
  return {
394
399
  drill: n.drill,
@@ -424,13 +429,13 @@ function re(e, t, l, n = !1) {
424
429
  const i = Math.max(0, Math.min(l, e));
425
430
  return n ? Math.floor(i) : i;
426
431
  }
427
- function Fa(e) {
432
+ function $a(e) {
428
433
  const t = {};
429
- return e.emptyAccent != null && (t["--mrp-empty-accent"] = e.emptyAccent), e.shellBg != null && (t["--mrp-shell-bg"] = e.shellBg), e.shellFg != null && (t["--mrp-shell-fg"] = e.shellFg), e.toolbarBg != null && (t["--mrp-toolbar-bg"] = e.toolbarBg), e.toolbarBorder != null && (t["--mrp-toolbar-border"] = e.toolbarBorder), e.toolbarFg != null && (t["--mrp-toolbar-fg"] = e.toolbarFg), e.btnFg != null && (t["--mrp-btn-fg"] = e.btnFg), e.btnBorder != null && (t["--mrp-btn-border"] = e.btnBorder), e.btnHoverBg != null && (t["--mrp-btn-hover-bg"] = e.btnHoverBg), e.btnHoverFg != null && (t["--mrp-btn-hover-fg"] = e.btnHoverFg), e.btnActiveBg != null && (t["--mrp-btn-active-bg"] = e.btnActiveBg), t;
434
+ return e.colorScheme != null && (t["--mrp-color-scheme"] = e.colorScheme), e.emptyAccent != null && (t["--mrp-empty-accent"] = e.emptyAccent), e.shellBg != null && (t["--mrp-shell-bg"] = e.shellBg), e.shellFg != null && (t["--mrp-shell-fg"] = e.shellFg), e.toolbarBg != null && (t["--mrp-toolbar-bg"] = e.toolbarBg), e.toolbarBorder != null && (t["--mrp-toolbar-border"] = e.toolbarBorder), e.toolbarFg != null && (t["--mrp-toolbar-fg"] = e.toolbarFg), e.btnFg != null && (t["--mrp-btn-fg"] = e.btnFg), e.btnBorder != null && (t["--mrp-btn-border"] = e.btnBorder), e.btnHoverBg != null && (t["--mrp-btn-hover-bg"] = e.btnHoverBg), e.btnHoverFg != null && (t["--mrp-btn-hover-fg"] = e.btnHoverFg), e.btnActiveBg != null && (t["--mrp-btn-active-bg"] = e.btnActiveBg), e.btnActiveFg != null && (t["--mrp-btn-active-fg"] = e.btnActiveFg), e.errorFg != null && (t["--mrp-error-fg"] = e.errorFg), e.warningFg != null && (t["--mrp-warning-fg"] = e.warningFg), e.successFg != null && (t["--mrp-success-fg"] = e.successFg), t;
430
435
  }
431
436
  function Da(e) {
432
437
  const t = se(Q, null), l = E(() => {
433
- const n = t?.value ?? null, i = "defaults" in e || "presets" in e || "defaultPreset" in e ? $e(e) : { defaults: e, presets: {} };
438
+ const n = t?.value ?? null, i = "defaults" in e || "presets" in e || "defaultPreset" in e ? Fe(e) : { defaults: e, presets: {} };
434
439
  if (!n) return i;
435
440
  const c = { ...n.presets, ...i.presets };
436
441
  for (const g of Object.keys(c))
@@ -491,8 +496,8 @@ function Ta(e) {
491
496
  const y = s.issues[0];
492
497
  return { quiet: c.value, error: new B(y.code === "definition" ? "config" : "param", ce(y, e.defs.value, e.messages()), { issues: s.issues }) };
493
498
  }
494
- const d = { ...s.values }, A = new Set(e.defs.value.filter((y) => y.defaultValue !== void 0).map((y) => y.field));
495
- for (const [y, u] of Object.entries(d)) u === "" && !A.has(y) && delete d[y];
499
+ const d = { ...s.values }, R = new Set(e.defs.value.filter((y) => y.defaultValue !== void 0).map((y) => y.field));
500
+ for (const [y, u] of Object.entries(d)) u === "" && !R.has(y) && delete d[y];
496
501
  return { params: d, quiet: !1 };
497
502
  }
498
503
  return { values: t, attempted: l, validation: i, pendingRequired: c, reset: n, query: g };
@@ -512,31 +517,31 @@ function Ue(e) {
512
517
  return n(e, 1);
513
518
  }
514
519
  function fe(e) {
515
- const t = k(""), l = ye([]), n = k(!1), i = k(!1), c = E(() => Object.fromEntries((Array.isArray(e.def().dependsOn) ? e.def().dependsOn : []).map((R) => [R, e.values()[R] ?? ""]))), g = E(() => Object.values(c.value).some((R) => !R.trim())), s = E(() => !e.loader()), d = /* @__PURE__ */ new Map();
516
- let A, y, u = 0;
520
+ const t = k(""), l = ye([]), n = k(!1), i = k(!1), c = E(() => Object.fromEntries((Array.isArray(e.def().dependsOn) ? e.def().dependsOn : []).map((A) => [A, e.values()[A] ?? ""]))), g = E(() => Object.values(c.value).some((A) => !A.trim())), s = E(() => !e.loader()), d = /* @__PURE__ */ new Map();
521
+ let R, y, u = 0;
517
522
  function h() {
518
- u++, A?.abort(), A = void 0, clearTimeout(y), n.value = !1;
523
+ u++, R?.abort(), R = void 0, clearTimeout(y), n.value = !1;
519
524
  }
520
525
  async function b() {
521
526
  h(), i.value = !1;
522
- const R = e.loader(), M = e.def();
523
- if (!R || !M.optionsSource || g.value || e.disabled() || !e.opened()) return;
524
- const F = { source: M.optionsSource, field: M.field, query: t.value.trim().slice(0, 256), params: Object.freeze({ ...c.value }), limit: Z }, r = JSON.stringify(F), p = d.get(r);
527
+ const A = e.loader(), M = e.def();
528
+ if (!A || !M.optionsSource || g.value || e.disabled() || !e.opened()) return;
529
+ const $ = { source: M.optionsSource, field: M.field, query: t.value.trim().slice(0, 256), params: Object.freeze({ ...c.value }), limit: Z }, r = JSON.stringify($), p = d.get(r);
525
530
  if (p && Date.now() - p.at < Ne) {
526
531
  d.delete(r), d.set(r, p), l.value = p.options;
527
532
  return;
528
533
  }
529
534
  const a = u, o = new AbortController();
530
- A = o, n.value = !0;
535
+ R = o, n.value = !0;
531
536
  const S = setTimeout(() => o.abort(), Be);
532
537
  try {
533
- const O = Ue(await xe(R(Object.freeze({ ...F, signal: o.signal })), o.signal));
538
+ const O = Ue(await xe(A(Object.freeze({ ...$, signal: o.signal })), o.signal));
534
539
  if (a !== u) return;
535
540
  for (l.value = O, d.delete(r), d.set(r, { at: Date.now(), options: O }); d.size > Te; ) d.delete(d.keys().next().value);
536
541
  } catch {
537
542
  a === u && (i.value = !0);
538
543
  } finally {
539
- clearTimeout(S), a === u && (n.value = !1, A = void 0);
544
+ clearTimeout(S), a === u && (n.value = !1, R = void 0);
540
545
  }
541
546
  }
542
547
  function P() {
@@ -582,7 +587,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
582
587
  y.push(u), u = u.find((b) => b.value === c.value[h])?.children ?? [];
583
588
  return y;
584
589
  }), d = E(() => l.def.optionsSource ? i.waiting.value ? g.value.paramOptionsDependencies : i.missingLoader.value ? g.value.paramOptionsMissingLoader : i.failed.value ? g.value.paramOptionsFailed : i.loading.value ? g.value.paramOptionsLoading : s.value.length ? "" : g.value.paramOptionsEmpty : "");
585
- function A(y, u) {
590
+ function R(y, u) {
586
591
  if (l.disabled) return;
587
592
  const h = c.value.slice(0, y);
588
593
  u && h.push(u);
@@ -603,7 +608,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
603
608
  "aria-invalid": e.invalid || void 0,
604
609
  "aria-describedby": e.invalid ? `${e.id}-error` : d.value ? `${e.id}-status` : void 0,
605
610
  "aria-required": e.def.required || void 0,
606
- onChange: (P) => A(b, P.target.value)
611
+ onChange: (P) => R(b, P.target.value)
607
612
  }, [
608
613
  q("option", je, x(e.def.placeholder ?? (e.messages.paramSelectPlaceholder ?? "请选择{label}").replace("{label}", e.def.label ?? e.def.field)), 1),
609
614
  (f(!0), m(U, null, H(h, (P) => (f(), m("option", {
@@ -647,7 +652,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
647
652
  },
648
653
  emits: ["change"],
649
654
  setup(e, { emit: t }) {
650
- const l = e, n = t, i = Ae({ focusOnOpen: !1 }), { root: c, panel: g, opened: s } = i, d = fe({ def: () => l.def, values: () => l.values, loader: () => l.loadOptions, opened: () => s.value, disabled: () => l.disabled === !0 }), { query: A, options: y, loading: u, failed: h, waiting: b, missingLoader: P } = d, R = E(() => ({ ...ae, ...l.messages })), M = E(() => l.def.type === "multiSelect"), F = E(() => M.value ? Pe(l.value) ?? [] : [l.value]), r = E(() => l.def.optionsSource ? y.value : (l.def.options ?? []).filter((v) => `${v.label} ${v.value}`.toLocaleLowerCase().includes(A.value.toLocaleLowerCase())).slice(0, 100)), p = /* @__PURE__ */ new Map(), a = E(() => M.value ? F.value.map((v) => p.get(v) ?? l.def.options?.find((C) => C.value === v)?.label ?? v).join("、") : S.value || l.value), o = k(0), S = k(""), O = k(), N = E(() => `${l.id}-options`), L = E(() => b.value ? R.value.paramOptionsDependencies : l.def.optionsSource && P.value ? R.value.paramOptionsMissingLoader : h.value ? R.value.paramOptionsFailed : u.value ? R.value.paramOptionsLoading : r.value.length ? "" : R.value.paramOptionsEmpty);
655
+ const l = e, n = t, i = Re({ focusOnOpen: !1 }), { root: c, panel: g, opened: s } = i, d = fe({ def: () => l.def, values: () => l.values, loader: () => l.loadOptions, opened: () => s.value, disabled: () => l.disabled === !0 }), { query: R, options: y, loading: u, failed: h, waiting: b, missingLoader: P } = d, A = E(() => ({ ...ae, ...l.messages })), M = E(() => l.def.type === "multiSelect"), $ = E(() => M.value ? Pe(l.value) ?? [] : [l.value]), r = E(() => l.def.optionsSource ? y.value : (l.def.options ?? []).filter((v) => `${v.label} ${v.value}`.toLocaleLowerCase().includes(R.value.toLocaleLowerCase())).slice(0, 100)), p = /* @__PURE__ */ new Map(), a = E(() => M.value ? $.value.map((v) => p.get(v) ?? l.def.options?.find((C) => C.value === v)?.label ?? v).join("、") : S.value || l.value), o = k(0), S = k(""), O = k(), N = E(() => `${l.id}-options`), L = E(() => b.value ? A.value.paramOptionsDependencies : l.def.optionsSource && P.value ? A.value.paramOptionsMissingLoader : h.value ? A.value.paramOptionsFailed : u.value ? A.value.paramOptionsLoading : r.value.length ? "" : A.value.paramOptionsEmpty);
651
656
  I(() => l.value, () => {
652
657
  S.value = "";
653
658
  }), I(r, () => {
@@ -660,9 +665,9 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
660
665
  function te(v) {
661
666
  if (!(l.disabled || b.value || u.value || h.value)) {
662
667
  p.set(v.value, v.label);
663
- for (const C of p.keys()) C !== v.value && !F.value.includes(C) && p.delete(C);
668
+ for (const C of p.keys()) C !== v.value && !$.value.includes(C) && p.delete(C);
664
669
  if (M.value) {
665
- const C = F.value.includes(v.value) ? F.value.filter(($) => $ !== v.value) : [...F.value, v.value];
670
+ const C = $.value.includes(v.value) ? $.value.filter((F) => F !== v.value) : [...$.value, v.value];
666
671
  if (C.length > Math.min(l.def.maxItems ?? 100, 100)) return;
667
672
  n("change", C.length ? Oe(C) : "");
668
673
  } else
@@ -673,10 +678,10 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
673
678
  }
674
679
  }
675
680
  function le(v) {
676
- v.isComposing || (s.value = !0, A.value = v.target.value);
681
+ v.isComposing || (s.value = !0, R.value = v.target.value);
677
682
  }
678
683
  function z() {
679
- !l.disabled && !b.value && (!l.def.optionsSource || !P.value) && (A.value = "", s.value = !0);
684
+ !l.disabled && !b.value && (!l.def.optionsSource || !P.value) && (R.value = "", s.value = !0);
680
685
  }
681
686
  function pe(v) {
682
687
  if (!(v.isComposing || v.keyCode === 229)) {
@@ -720,7 +725,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
720
725
  type: "text",
721
726
  role: "combobox",
722
727
  autocomplete: "off",
723
- value: w(s) ? w(A) : a.value,
728
+ value: w(s) ? w(R) : a.value,
724
729
  maxlength: 256,
725
730
  "aria-labelledby": `${e.id}-label`,
726
731
  "aria-invalid": e.invalid || void 0,
@@ -740,7 +745,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
740
745
  e.value ? (f(), m("button", {
741
746
  key: 0,
742
747
  type: "button",
743
- "aria-label": R.value.paramOptionsClear,
748
+ "aria-label": A.value.paramOptionsClear,
744
749
  disabled: e.disabled,
745
750
  onClick: ve
746
751
  }, [
@@ -753,7 +758,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
753
758
  type: "button",
754
759
  "aria-label": e.def.label ?? e.def.field,
755
760
  disabled: e.disabled || w(b) || !!e.def.optionsSource && w(P),
756
- onClick: C[0] || (C[0] = ($) => w(s) ? w(i).close() : z())
761
+ onClick: C[0] || (C[0] = (F) => w(s) ? w(i).close() : z())
757
762
  }, [
758
763
  W(X, {
759
764
  name: "chevron-down",
@@ -779,25 +784,25 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
779
784
  "aria-busy": w(u),
780
785
  "aria-multiselectable": M.value || void 0
781
786
  }, [
782
- (f(!0), m(U, null, H(r.value, ($, J) => (f(), m("button", {
787
+ (f(!0), m(U, null, H(r.value, (F, J) => (f(), m("button", {
783
788
  id: `${N.value}-${J}`,
784
- key: $.value,
789
+ key: F.value,
785
790
  type: "button",
786
791
  role: "option",
787
792
  tabindex: "-1",
788
- "aria-selected": F.value.includes($.value),
793
+ "aria-selected": $.value.includes(F.value),
789
794
  class: Y({ active: J === o.value }),
790
795
  disabled: w(u),
791
796
  onPointermove: (me) => o.value = J,
792
797
  onMousedown: C[1] || (C[1] = he(() => {
793
798
  }, ["prevent"])),
794
- onClick: (me) => te($)
799
+ onClick: (me) => te(F)
795
800
  }, [
796
801
  q("span", null, [
797
- M.value ? (f(), m("span", ea, x(F.value.includes($.value) ? "✓" : ""), 1)) : D("", !0),
798
- G(x($.label), 1)
802
+ M.value ? (f(), m("span", ea, x($.value.includes(F.value) ? "✓" : ""), 1)) : D("", !0),
803
+ G(x(F.label), 1)
799
804
  ]),
800
- $.label !== $.value ? (f(), m("small", aa, x($.value), 1)) : D("", !0)
805
+ F.label !== F.value ? (f(), m("small", aa, x(F.value), 1)) : D("", !0)
801
806
  ], 42, _e))), 128))
802
807
  ], 8, Ze),
803
808
  L.value ? (f(), m("p", ta, [
@@ -806,7 +811,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
806
811
  key: 0,
807
812
  type: "button",
808
813
  onClick: C[2] || (C[2] = //@ts-ignore
809
- (...$) => w(d).request && w(d).request(...$))
814
+ (...F) => w(d).request && w(d).request(...F))
810
815
  }, x(e.messages.retry), 1)) : D("", !0)
811
816
  ])) : D("", !0)
812
817
  ], 512)) : D("", !0)
@@ -844,7 +849,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
844
849
  c.value = { ...r };
845
850
  }
846
851
  );
847
- const d = E(() => n.issues ?? oe(n.defs, c.value).issues), A = E(
852
+ const d = E(() => n.issues ?? oe(n.defs, c.value).issues), R = E(
848
853
  () => (Array.isArray(n.defs) ? n.defs : []).filter((r) => r && typeof r.field == "string").map((r, p) => ({
849
854
  def: r,
850
855
  id: `${s}-${p}`,
@@ -883,7 +888,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
883
888
  function P(r, p, a) {
884
889
  return a ? !!b(r, 0) != !!b(r, 1) ? !b(r, p) || void 0 : !0 : void 0;
885
890
  }
886
- function R(r, p, a) {
891
+ function A(r, p, a) {
887
892
  const o = r.type === "numberRange", S = c.value[r.field] ?? "", O = [b(S, 0, o), b(S, 1, o)];
888
893
  O[p] = a;
889
894
  const N = o ? JSON.stringify(O.map((L) => L === "" ? null : Number(L))) : O.join("/");
@@ -892,17 +897,17 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
892
897
  function M(r) {
893
898
  r.isComposing || i("query");
894
899
  }
895
- function F() {
900
+ function $() {
896
901
  g.value?.querySelector('[aria-invalid="true"]')?.focus();
897
902
  }
898
- return t({ focusInvalid: F }), (r, p) => (f(), m("div", {
903
+ return t({ focusInvalid: $ }), (r, p) => (f(), m("div", {
899
904
  ref_key: "root",
900
905
  ref: g,
901
906
  class: "mrp-params"
902
907
  }, [
903
908
  e.showTitle !== !1 ? (f(), m("span", ra, x(e.messages.paramsTitle), 1)) : D("", !0),
904
909
  q("div", ia, [
905
- (f(!0), m(U, null, H(A.value, (a) => (f(), m("label", {
910
+ (f(!0), m(U, null, H(R.value, (a) => (f(), m("label", {
906
911
  key: a.id,
907
912
  class: Y(["mrp-param", { "mrp-param-missing": !!a.error }])
908
913
  }, [
@@ -975,7 +980,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
975
980
  "aria-invalid": a.def.type === "numberRange" ? !!a.error || void 0 : P(a.value, S, a.error),
976
981
  "aria-describedby": a.error ? `${a.id}-error` : void 0,
977
982
  "aria-required": a.def.required || void 0,
978
- onInput: (O) => R(a.def, S, O.target.value),
983
+ onInput: (O) => A(a.def, S, O.target.value),
979
984
  onKeydown: K(M, ["enter"])
980
985
  }, null, 40, pa))), 128))
981
986
  ], 8, fa)) : (f(), m("input", {
@@ -1021,7 +1026,7 @@ const He = ["aria-labelledby"], Ve = ["value", "disabled", "aria-label", "aria-i
1021
1026
  ])) : D("", !0)
1022
1027
  ], 512));
1023
1028
  }
1024
- }), Na = /* @__PURE__ */ ee(ha, [["__scopeId", "data-v-e74206d7"]]);
1029
+ }), Na = /* @__PURE__ */ ee(ha, [["__scopeId", "data-v-bad4d7de"]]);
1025
1030
  export {
1026
1031
  ue as D,
1027
1032
  B as M,
@@ -1030,20 +1035,20 @@ export {
1030
1035
  Ma as S,
1031
1036
  de as a,
1032
1037
  ke as b,
1033
- Re as c,
1038
+ Ae as c,
1034
1039
  Me as d,
1035
- $e as e,
1040
+ Fe as e,
1036
1041
  ka as f,
1037
1042
  Da as g,
1038
- $a as h,
1039
- Ra as i,
1043
+ Fa as h,
1044
+ Aa as i,
1040
1045
  qa as j,
1041
- Ae as k,
1046
+ Re as k,
1042
1047
  Ta as l,
1043
1048
  La as n,
1044
1049
  Oa as p,
1045
- Aa as r,
1050
+ Ra as r,
1046
1051
  xa as s,
1047
- Fa as t,
1052
+ $a as t,
1048
1053
  Ia as u
1049
1054
  };