@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.
- package/README.md +3 -2
- package/dist/ExcelBindingWizard-BrTmdo7f.cjs +1 -0
- package/dist/ExcelBindingWizard-CcDMLO8Q.js +1486 -0
- package/dist/ParamEditor-BGjovFUe.js +737 -0
- package/dist/ParamEditor-CeNp4_zQ.cjs +1 -0
- package/dist/ReportBatchPanel-CHxBtG9R.cjs +1 -0
- package/dist/ReportBatchPanel-CJB67WNd.js +351 -0
- package/dist/ReportLabelStudio-Tplc1TLJ.js +784 -0
- package/dist/ReportLabelStudio-g8PkqJWn.cjs +1 -0
- package/dist/ReportParamPanel-C7fZTllk.cjs +1 -0
- package/dist/{ReportParamPanel-Dgmqro1Y.js → ReportParamPanel-GI43aGa0.js} +61 -56
- package/dist/{ReportPreview-FFIryrIr.cjs → ReportPreview-BoGBGyRr.cjs} +2 -2
- package/dist/{ReportPreview-DeWzG8jQ.js → ReportPreview-QLONCyci.js} +8 -8
- package/dist/ReportTemplateLibrary-BFQIX0sg.cjs +1 -0
- package/dist/ReportTemplateLibrary-KqX4E2sN.js +312 -0
- package/dist/RuleEditor-BZUP9yvL.cjs +1 -0
- package/dist/RuleEditor-OPX1awrH.js +2342 -0
- package/dist/TemplateOutlinePanel-CVYKVLv_.cjs +1 -0
- package/dist/TemplateOutlinePanel-DQS-eOs6.js +97 -0
- package/dist/TemplateReusePanel-CY6O93Zk.cjs +1 -0
- package/dist/TemplateReusePanel-DKXiFTyB.js +389 -0
- package/dist/TemplateReviewPanel-DbeNC8Ms.cjs +1 -0
- package/dist/TemplateReviewPanel-Dijwm9YE.js +593 -0
- package/dist/artifact-integrity.json +68 -68
- package/dist/{auto-CTIJ6PnR.js → auto-BB99S802.js} +4 -4
- package/dist/{auto-4pK9HePf.cjs → auto-BrPWo7Xm.cjs} +1 -1
- package/dist/designer-BZoVWTgl.js +7172 -0
- package/dist/designer-zS2uKJmY.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +7 -0
- package/dist/designer.d.ts +7 -0
- package/dist/designer.js +2 -2
- package/dist/{encoding-BefcaHdp.cjs → encoding-7lquyj0w.cjs} +1 -1
- package/dist/{encoding-CL6rXEkR.js → encoding-CEd-dq9A.js} +2 -2
- package/dist/{font-loader-BT5baV-o.js → font-loader-CNWXomuV.js} +1 -1
- package/dist/{font-loader-Ga51c2VC.cjs → font-loader-D8pI87fL.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/{json-snapshot-OqkPyUk5.js → json-snapshot-BRnzKudk.js} +1 -1
- package/dist/{json-snapshot-1tvQNzQE.cjs → json-snapshot-DNiIbpOr.cjs} +1 -1
- package/dist/{pdf-aobetCsy.js → pdf-CJToa81Z.js} +2 -2
- package/dist/{pdf-HiEeXe9H.cjs → pdf-DpMkW72B.cjs} +1 -1
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BFANt-i8.cjs → plugin-BWTp-X7b.cjs} +1 -1
- package/dist/{plugin-DeYYAL6F.js → plugin-_BkUVc2z.js} +1 -1
- package/dist/{prefill-Dk4C6S5R.js → prefill-CWGdnqQd.js} +1 -1
- package/dist/{prefill-DsUD5OoK.cjs → prefill-PaAy6wLk.cjs} +1 -1
- package/dist/{prepared-DCIxhKFo.js → prepared-CJy_qk7d.js} +1 -1
- package/dist/{prepared-Dv-XM3i1.cjs → prepared-D0yCSxSO.cjs} +1 -1
- package/dist/{protocol-DxeUKGYG.js → protocol-BG16rz6D.js} +2 -2
- package/dist/{protocol-B9YgfQ_d.cjs → protocol-wzhl1Fim.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{runtime-DKlGd_D4.cjs → runtime-DYMOS_gz.cjs} +1 -1
- package/dist/{runtime-75Y5Oq5B.js → runtime-PiCax9zQ.js} +2 -2
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +737 -736
- package/dist/server.cjs +1 -1
- package/dist/server.js +5 -5
- package/dist/style.css +1 -1
- package/dist/{template-catalog--cjxzgH7.js → template-catalog-CRuZL3pi.js} +1 -1
- package/dist/{template-catalog-CoT7jm_6.cjs → template-catalog-DtrtT1FY.cjs} +1 -1
- package/dist/textwrap-D4ZksyMK.js +111 -0
- package/dist/textwrap-DEHqAjKZ.cjs +4 -0
- package/dist/vue/async.d.cts +7 -0
- package/dist/vue/async.d.ts +7 -0
- package/dist/vue/index.d.cts +7 -0
- package/dist/vue/index.d.ts +7 -0
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +6 -6
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-D4FLind-.js +0 -1485
- package/dist/ExcelBindingWizard-D4RS5Bpg.cjs +0 -1
- package/dist/ParamEditor-C-6C9rd2.cjs +0 -1
- package/dist/ParamEditor-CASZt-Ma.js +0 -732
- package/dist/ReportBatchPanel-Bq7t8a5r.js +0 -350
- package/dist/ReportBatchPanel-YVj5IO5y.cjs +0 -1
- package/dist/ReportLabelStudio-Cqhita1b.cjs +0 -1
- package/dist/ReportLabelStudio-Dj7GXhuv.js +0 -783
- package/dist/ReportParamPanel-DZbFVmDL.cjs +0 -1
- package/dist/ReportTemplateLibrary-BaWodmpm.cjs +0 -1
- package/dist/ReportTemplateLibrary-DdAAAD2I.js +0 -311
- package/dist/RuleEditor-D2UwQGF6.js +0 -2341
- package/dist/RuleEditor-DcT9xI1v.cjs +0 -1
- package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +0 -1
- package/dist/TemplateOutlinePanel-DrT7XN0m.js +0 -96
- package/dist/TemplateReusePanel-4eejkNqi.js +0 -388
- package/dist/TemplateReusePanel-DZMyiX5I.cjs +0 -1
- package/dist/TemplateReviewPanel-BIhNLeNw.js +0 -592
- package/dist/TemplateReviewPanel-DnYImiXu.cjs +0 -1
- package/dist/designer-DhrE7jzw.js +0 -7169
- package/dist/designer-IAZu6kBX.cjs +0 -2
- package/dist/textwrap-BIjtEWmq.js +0 -110
- package/dist/textwrap-Cy7o1hIR.cjs +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { y as O, J as k, I as j } from "./json-snapshot-
|
|
1
|
+
import { y as O, J as k, I as j } from "./json-snapshot-BRnzKudk.js";
|
|
2
2
|
import { i as P } from "./capabilities-pg7j7VLT.js";
|
|
3
3
|
import { v as L } from "./dataset-DL83majE.js";
|
|
4
4
|
import { p as h } from "./template-registry-O0hNIOfB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const w=require("./json-snapshot-1tvQNzQE.cjs"),j=require("./capabilities-DiBj4Qgl.cjs"),L=require("./dataset-IrlXbUvh.cjs"),h=require("./template-registry-DI59PXVK.cjs"),E=require("./template-serialization-CqQY4zDg.cjs"),P=require("./param-validation-C-8sRJLq.cjs");function R(e){if(e===void 0)return;const t=typeof e=="string"?e:JSON.stringify(e);return t.length>160?t.slice(0,157)+"…":t}function N(e){return/\.(?:repeat|binding)(?:\.|$)/.test(e)?/\.format(?:\.|$)/.test(e)?"format":"binding":/\.tree\.(?:idField|parentField|childrenField|labelField|input)$/.test(e)?"binding":/\.tree\.parentValues$/.test(e)?"calculation":/\.tree\.indentMm$/.test(e)?"format":/\.(?:computed|computeOptions|groups|groupBy|aggregates|grandTotal)(?:\.|\[|$)/.test(e)?"calculation":/\.(?:dataset|field|rowKey|revisionField|sourceTokenField|foreignKey|parentKey)$/.test(e)?"binding":/\.(?:style|headerStyle|format|rules|align|headerAlign|semanticRole|unit)(?:\.|\[|$)/.test(e)?"format":e.startsWith("$.template")?"structure":"metadata"}function T(e){const t=new Map;for(const r of e){if(!r||typeof r!="object"||!("field"in r)||typeof r.field!="string"||t.has(r.field))return;t.set(r.field,r)}return t}function D(e,t,r){return!e.startsWith("$.template.params")||t==="moved"?!1:/\.(?:type|required|min|max|minLength|maxLength|options|defaultValue)(?:\[|$)/.test(e)?!0:t!=="added"?!1:Array.isArray(r)?r.some(a=>!!a&&typeof a=="object"&&"required"in a&&a.required===!0):!!r&&typeof r=="object"&&"required"in r&&r.required===!0}function A(e,t,r={}){const a=h.parseReportTemplate(e),n=h.parseReportTemplate(t),o=r.maxChanges??500;if(!Number.isSafeInteger(o)||o<1||o>1e4)throw new RangeError("maxChanges must be between 1 and 10000");const s={changes:[],totalChanges:0,breakingChanges:0,truncated:!1};function d(c,l,u,m){const f=N(l),y=c!=="moved"&&(f==="binding"||l==="$.id"||c==="removed"&&f==="structure"||D(l,c,m));s.totalChanges++,y&&s.breakingChanges++,s.changes.length<o&&s.changes.push({kind:c,category:f,path:l,before:R(u),after:R(m),breaking:y})}function p(c,l,u){const m=T(c),f=T(l);if(!m||!f)return!1;const y=new Map(l.map((g,b)=>[g.field,b]));Array.from(m).forEach(([g,b],$)=>{const x=`${u}[${JSON.stringify(g)}]`;f.has(g)?(y.get(g)!==$&&d("moved",x,$,y.get(g)),i(b,f.get(g),x)):d("removed",x,b,void 0)});for(const[g,b]of f)m.has(g)||d("added",`${u}[${JSON.stringify(g)}]`,void 0,b);return!0}function i(c,l,u){if(!(Object.is(c,l)||u==="$.revision")){if(c===void 0||l===void 0){d(c===void 0?"added":"removed",u,c,l);return}if(Array.isArray(c)&&Array.isArray(l)){if((u.endsWith(".columns")||u.endsWith(".params"))&&p(c,l,u))return;for(let m=0;m<Math.max(c.length,l.length);m++)i(c[m],l[m],`${u}[${m}]`)}else if(c&&l&&typeof c=="object"&&typeof l=="object"&&!Array.isArray(c)&&!Array.isArray(l)){const m=c,f=l;for(const y of new Set([...Object.keys(m),...Object.keys(f)]))i(m[y],f[y],`${u}.${y}`)}else d("modified",u,c,l)}}return i(a,n,"$"),s.truncated=s.totalChanges>s.changes.length,s}function M(e,t,r){for(const a of E.collectTemplateDatasetBindings(e)){const n=Object.prototype.hasOwnProperty.call(t,a.dataset)?t[a.dataset]:void 0;if(!n){r.push({code:"dataset",severity:"error",path:`${a.path}.dataset`,message:`未声明数据集 ${a.dataset}`});continue}const o=new Set(n.fields.map(s=>s.field));a.fields.forEach(({field:s,path:d,summary:p})=>{!o.has(s)&&!a.generated.has(s)&&!(p&&a.summaries.has(s))&&r.push({code:"field",severity:"error",path:d,field:s,message:`数据集 ${a.dataset} 缺少字段 ${s}`})})}}function q(e,t,r,a){const n=r.maxSampleRows??1e3;let o;try{o=w.templateValidationDatasets(t,e.datasets,{maxRows:n})}catch(p){return a.push({code:"sample",severity:"error",path:"$.fixtures",fixture:e.name,message:p instanceof Error?p.message:String(p)}),!1}const s=Object.values(o).reduce((p,i)=>p+i.length,0);if(s>n)return a.push({code:"sample",severity:"error",path:"$.fixtures",fixture:e.name,message:`样例 ${s} 行超过预算 ${n},请显式选择验收样例`}),!1;const d=new Set(E.collectTemplateDatasetBindings(t).map(p=>p.dataset));for(const[p,i]of Object.entries(r.dataSchemas??{}).filter(([c])=>d.has(c)))try{const c=L.validateDatasetRows(o[p],i,{path:`$.datasets.${p}`,maxRows:n});if(a.push(...c.issues.map(l=>({...l,code:"sample",severity:"error",fixture:e.name}))),!c.ok)return!1}catch(c){return a.push({code:"dataset",severity:"error",path:`$.dataSchemas.${p}`,message:String(c)}),!1}return!0}function F(e,t){const r=e.pages[t.pageIndex]?.components[t.componentIndex]?.meta?.labelSource;if(r&&typeof r=="object"&&"pageIndex"in r&&"componentIndex"in r&&typeof r.pageIndex=="number"&&typeof r.componentIndex=="number")return{path:`$.template.pages[${r.pageIndex}].components[${r.componentIndex}]`,pageIndex:r.pageIndex,componentIndex:r.componentIndex};const a=e.pages[t.pageIndex]?.meta?.record;if(a&&typeof a=="object"&&"templatePageIndex"in a&&typeof a.templatePageIndex=="number")return{path:`$.template.pages[${a.templatePageIndex}].components[${t.componentIndex}]`,pageIndex:a.templatePageIndex,componentIndex:t.componentIndex}}function B(e,t,r){const a=F(t,r);if(a)return a;const n=t.pages[r.pageIndex]?.components[r.componentIndex],o=/^table:(\d+):(\d+)(?::|$)/.exec(n?.table?.id??"");if(o)return{path:`$.template.pages[${o[1]}].components[${o[2]}]`,pageIndex:Number(o[1]),componentIndex:Number(o[2])};for(const[s,d]of e.pages.entries()){const p=d.components.findIndex(i=>i===n||n?.nid!==void 0&&"nid"in i&&i.nid===n.nid);if(p>=0)return{path:`$.template.pages[${s}].components[${p}]`,pageIndex:s,componentIndex:p}}return{path:"$.template"}}function J(e,t,r,a,n){const o=P.validateReportParams(e.template.params??[],t.params??{});if(n.issues.push(...o.issues.map(s=>({...s,code:"params",severity:"error",fixture:t.name,path:s.path.replace(/^\$\.params/,`$.fixtures[${r}].params`)}))),!!o.ok&&q(t,e.template,a,n.issues))try{const{plan:s,warnings:d}=w.paginateTemplate(e.template,t.datasets,{maxPages:a.maxPages??100,maxCells:a.maxCells??25e4}),p=(a.formats??["pdf","xlsx"]).flatMap(i=>j.inspectOutputCapabilities(s,i));n.issues.push(...d.map(i=>({code:"layout",severity:"warning",path:"$.template",fixture:t.name,message:i}))),n.issues.push(...p.map(i=>({code:"output",severity:a.strictOutputs?"error":"warning",...B(e.template,s,i),fixture:t.name,message:`${i.format}: ${i.message}`,diagnostic:i}))),n.samples.push({name:t.name,pages:s.pages.length,rows:w.templateDatasetRowCount(e.template,t.datasets),diagnostics:p})}catch(s){n.issues.push({code:"layout",severity:"error",path:"$.template",fixture:t.name,message:s instanceof Error?s.message:String(s)})}}function V(e){for(const[r,a]of[["maxPages",e.maxPages],["maxCells",e.maxCells],["maxSampleRows",e.maxSampleRows]])if(a!==void 0&&(!Number.isSafeInteger(a)||a<1))throw new RangeError(`${r} must be a positive safe integer`);if((e.fixtures?.length??0)>20)throw new RangeError("At most 20 review fixtures are allowed");const t=new Set;for(const r of e.fixtures??[]){if(typeof r.name!="string"||!r.name.trim()||r.name.length>120||t.has(r.name))throw new Error("Review fixtures require unique non-empty names of at most 120 characters");t.add(r.name)}}function*C(e,t,r){let a;yield{stage:"template",run:()=>{V(t),a=h.parseReportTemplate(e)}};const n=t.previous;n&&(yield{stage:"baseline",run:()=>{r.changes=A(n,a),r.changes.breakingChanges&&!t.allowBreakingChanges&&r.issues.push({code:"compatibility",severity:"error",path:"$.template",message:`${r.changes.breakingChanges} 项字段或结构变更需要明确确认兼容性`})}}),t.dataSchemas&&(yield{stage:"bindings",run:()=>M(a.template,t.dataSchemas,r.issues)});for(const[o,s]of(t.fixtures??[]).entries())yield{stage:"fixture",fixture:s.name,run:()=>J(a,s,o,t,r)};t.fixtures?.length||r.issues.push({code:"sample",severity:"warning",path:"$.fixtures",message:"未提供验收样例,仅完成结构和字段检查,尚未验证排版与输出"})}function O(e){return e.ok=e.issues.every(t=>t.severity!=="error"),e}function k(e,t){e.issues.push({code:"template",severity:"error",path:"$",message:t instanceof Error?t.message:String(t)})}function W(e,t={}){const r={ok:!1,issues:[],samples:[]};try{for(const a of C(e,t,r))a.run()}catch(a){k(r,a)}return O(r)}function v(e){if(e?.aborted)throw e.reason??new DOMException("Template review was aborted","AbortError")}function K(e){return v(e),new Promise((t,r)=>{const a=()=>{clearTimeout(n),e?.removeEventListener("abort",a),r(e?.reason??new DOMException("Template review was aborted","AbortError"))},n=setTimeout(()=>{e?.removeEventListener("abort",a),t()},0);e?.addEventListener("abort",a,{once:!0}),e?.aborted&&a()})}function I(e,t){try{e.onProgress?.(t)}catch{}}async function _(e,t={}){const r={ok:!1,issues:[],samples:[]},a=t.fixtures?.length??0;let n=0;v(t.signal);try{const o=C(e,t,r),s=o.next();s.done||(s.value.run(),I(t,{completed:n,total:a,stage:s.value.stage})),v(t.signal);for(const d of o)await K(t.signal),v(t.signal),d.run(),d.stage==="fixture"&&n++,I(t,{completed:n,total:a,stage:d.stage,...d.fixture?{fixture:d.fixture}:{}}),v(t.signal)}catch(o){v(t.signal),k(r,o)}return O(r)}function z(e,t){const r=e.publishedRevision??e.published?.revision;for(const a of[e.draftRevision,r])if(a!==void 0&&(typeof a!="string"||!a.trim()))throw new TypeError("模板生命周期修订应为非空字符串");if(e.draftRevision!==void 0&&e.draftRevision!==t.revision)throw new TypeError("可编辑文档应与草稿修订一致");if(e.published&&(e.published.id!==t.id||e.published.revision!==r))throw new TypeError("发布文档身份或修订不一致");if(!e.published&&r!==void 0&&r!==t.revision)throw new TypeError("发布修订需要对应的独立文档");return{...e.draftRevision===void 0?{}:{draftRevision:e.draftRevision},...r===void 0?{}:{publishedRevision:r}}}function G(e,t){const r=h.parseReportTemplate(e);if(t.id===r.id)throw new Error("复制模板应使用新的 ID");const{revision:a,...n}=r;return h.parseReportTemplate({...n,id:t.id,name:t.name})}function H(e){if(!Array.isArray(e)||e.length>1e3)throw new RangeError("本地模板目录最多 1000 项");const t=new Map,r=new Map,a=[];for(const n of e){const o=h.parseReportTemplate(n.document);if(t.has(o.id))throw new Error(`模板 ID 重复:${o.id}`);if(n.category!==void 0&&(typeof n.category!="string"||n.category.length>128)||n.tags!==void 0&&(!Array.isArray(n.tags)||n.tags.length>20||n.tags.some(i=>typeof i!="string"||i.length>128)))throw new TypeError("模板分类和标签无效");const s=z(n,o),{template:d,...p}=o;t.set(o.id,o),n.published?r.set(o.id,h.parseReportTemplate(n.published)):s.publishedRevision&&r.set(o.id,h.parseReportTemplate(o)),a.push({...p,...s,...n.category?{category:n.category}:{},...n.tags?{tags:[...n.tags]}:{}})}return a.sort((n,o)=>n.id<o.id?-1:1),{search:async n=>{S(n.signal);const o=n.limit??30;if(!Number.isSafeInteger(o)||o<1||o>100)throw new RangeError("模板每页数量应为 1–100");const s=n.query?.trim().toLocaleLowerCase()??"",d=a.filter(i=>(!n.category||i.category===n.category)&&(!n.cursor||i.id>n.cursor)&&(!s||[i.id,i.name,i.description,...i.tags??[]].some(c=>c?.toLocaleLowerCase().includes(s)))),p=new Map;for(const i of a)i.category&&p.set(i.category,(p.get(i.category)??0)+1);return JSON.parse(JSON.stringify({items:d.slice(0,o),...d.length>o?{next:d[o-1].id}:{},categories:Array.from(p,([i,c])=>({id:i,label:i,count:c}))}))},get:async(n,o)=>{S(o.signal);const s=o.mode==="published"?r.get(n):t.get(n);return s?h.parseReportTemplate(s):void 0}}}function S(e){if(!e?.aborted)return;const t=new Error("模板目录操作已取消");throw t.name="AbortError",t}exports.cloneReportTemplate=G;exports.createLocalTemplateCatalog=H;exports.diffReportTemplates=A;exports.reviewReportTemplate=W;exports.reviewReportTemplateAsync=_;
|
|
1
|
+
"use strict";const w=require("./json-snapshot-DNiIbpOr.cjs"),j=require("./capabilities-DiBj4Qgl.cjs"),L=require("./dataset-IrlXbUvh.cjs"),h=require("./template-registry-DI59PXVK.cjs"),E=require("./template-serialization-CqQY4zDg.cjs"),P=require("./param-validation-C-8sRJLq.cjs");function R(e){if(e===void 0)return;const t=typeof e=="string"?e:JSON.stringify(e);return t.length>160?t.slice(0,157)+"…":t}function N(e){return/\.(?:repeat|binding)(?:\.|$)/.test(e)?/\.format(?:\.|$)/.test(e)?"format":"binding":/\.tree\.(?:idField|parentField|childrenField|labelField|input)$/.test(e)?"binding":/\.tree\.parentValues$/.test(e)?"calculation":/\.tree\.indentMm$/.test(e)?"format":/\.(?:computed|computeOptions|groups|groupBy|aggregates|grandTotal)(?:\.|\[|$)/.test(e)?"calculation":/\.(?:dataset|field|rowKey|revisionField|sourceTokenField|foreignKey|parentKey)$/.test(e)?"binding":/\.(?:style|headerStyle|format|rules|align|headerAlign|semanticRole|unit)(?:\.|\[|$)/.test(e)?"format":e.startsWith("$.template")?"structure":"metadata"}function T(e){const t=new Map;for(const r of e){if(!r||typeof r!="object"||!("field"in r)||typeof r.field!="string"||t.has(r.field))return;t.set(r.field,r)}return t}function D(e,t,r){return!e.startsWith("$.template.params")||t==="moved"?!1:/\.(?:type|required|min|max|minLength|maxLength|options|defaultValue)(?:\[|$)/.test(e)?!0:t!=="added"?!1:Array.isArray(r)?r.some(a=>!!a&&typeof a=="object"&&"required"in a&&a.required===!0):!!r&&typeof r=="object"&&"required"in r&&r.required===!0}function A(e,t,r={}){const a=h.parseReportTemplate(e),n=h.parseReportTemplate(t),o=r.maxChanges??500;if(!Number.isSafeInteger(o)||o<1||o>1e4)throw new RangeError("maxChanges must be between 1 and 10000");const s={changes:[],totalChanges:0,breakingChanges:0,truncated:!1};function d(c,l,u,m){const f=N(l),y=c!=="moved"&&(f==="binding"||l==="$.id"||c==="removed"&&f==="structure"||D(l,c,m));s.totalChanges++,y&&s.breakingChanges++,s.changes.length<o&&s.changes.push({kind:c,category:f,path:l,before:R(u),after:R(m),breaking:y})}function p(c,l,u){const m=T(c),f=T(l);if(!m||!f)return!1;const y=new Map(l.map((g,b)=>[g.field,b]));Array.from(m).forEach(([g,b],$)=>{const x=`${u}[${JSON.stringify(g)}]`;f.has(g)?(y.get(g)!==$&&d("moved",x,$,y.get(g)),i(b,f.get(g),x)):d("removed",x,b,void 0)});for(const[g,b]of f)m.has(g)||d("added",`${u}[${JSON.stringify(g)}]`,void 0,b);return!0}function i(c,l,u){if(!(Object.is(c,l)||u==="$.revision")){if(c===void 0||l===void 0){d(c===void 0?"added":"removed",u,c,l);return}if(Array.isArray(c)&&Array.isArray(l)){if((u.endsWith(".columns")||u.endsWith(".params"))&&p(c,l,u))return;for(let m=0;m<Math.max(c.length,l.length);m++)i(c[m],l[m],`${u}[${m}]`)}else if(c&&l&&typeof c=="object"&&typeof l=="object"&&!Array.isArray(c)&&!Array.isArray(l)){const m=c,f=l;for(const y of new Set([...Object.keys(m),...Object.keys(f)]))i(m[y],f[y],`${u}.${y}`)}else d("modified",u,c,l)}}return i(a,n,"$"),s.truncated=s.totalChanges>s.changes.length,s}function M(e,t,r){for(const a of E.collectTemplateDatasetBindings(e)){const n=Object.prototype.hasOwnProperty.call(t,a.dataset)?t[a.dataset]:void 0;if(!n){r.push({code:"dataset",severity:"error",path:`${a.path}.dataset`,message:`未声明数据集 ${a.dataset}`});continue}const o=new Set(n.fields.map(s=>s.field));a.fields.forEach(({field:s,path:d,summary:p})=>{!o.has(s)&&!a.generated.has(s)&&!(p&&a.summaries.has(s))&&r.push({code:"field",severity:"error",path:d,field:s,message:`数据集 ${a.dataset} 缺少字段 ${s}`})})}}function q(e,t,r,a){const n=r.maxSampleRows??1e3;let o;try{o=w.templateValidationDatasets(t,e.datasets,{maxRows:n})}catch(p){return a.push({code:"sample",severity:"error",path:"$.fixtures",fixture:e.name,message:p instanceof Error?p.message:String(p)}),!1}const s=Object.values(o).reduce((p,i)=>p+i.length,0);if(s>n)return a.push({code:"sample",severity:"error",path:"$.fixtures",fixture:e.name,message:`样例 ${s} 行超过预算 ${n},请显式选择验收样例`}),!1;const d=new Set(E.collectTemplateDatasetBindings(t).map(p=>p.dataset));for(const[p,i]of Object.entries(r.dataSchemas??{}).filter(([c])=>d.has(c)))try{const c=L.validateDatasetRows(o[p],i,{path:`$.datasets.${p}`,maxRows:n});if(a.push(...c.issues.map(l=>({...l,code:"sample",severity:"error",fixture:e.name}))),!c.ok)return!1}catch(c){return a.push({code:"dataset",severity:"error",path:`$.dataSchemas.${p}`,message:String(c)}),!1}return!0}function F(e,t){const r=e.pages[t.pageIndex]?.components[t.componentIndex]?.meta?.labelSource;if(r&&typeof r=="object"&&"pageIndex"in r&&"componentIndex"in r&&typeof r.pageIndex=="number"&&typeof r.componentIndex=="number")return{path:`$.template.pages[${r.pageIndex}].components[${r.componentIndex}]`,pageIndex:r.pageIndex,componentIndex:r.componentIndex};const a=e.pages[t.pageIndex]?.meta?.record;if(a&&typeof a=="object"&&"templatePageIndex"in a&&typeof a.templatePageIndex=="number")return{path:`$.template.pages[${a.templatePageIndex}].components[${t.componentIndex}]`,pageIndex:a.templatePageIndex,componentIndex:t.componentIndex}}function B(e,t,r){const a=F(t,r);if(a)return a;const n=t.pages[r.pageIndex]?.components[r.componentIndex],o=/^table:(\d+):(\d+)(?::|$)/.exec(n?.table?.id??"");if(o)return{path:`$.template.pages[${o[1]}].components[${o[2]}]`,pageIndex:Number(o[1]),componentIndex:Number(o[2])};for(const[s,d]of e.pages.entries()){const p=d.components.findIndex(i=>i===n||n?.nid!==void 0&&"nid"in i&&i.nid===n.nid);if(p>=0)return{path:`$.template.pages[${s}].components[${p}]`,pageIndex:s,componentIndex:p}}return{path:"$.template"}}function J(e,t,r,a,n){const o=P.validateReportParams(e.template.params??[],t.params??{});if(n.issues.push(...o.issues.map(s=>({...s,code:"params",severity:"error",fixture:t.name,path:s.path.replace(/^\$\.params/,`$.fixtures[${r}].params`)}))),!!o.ok&&q(t,e.template,a,n.issues))try{const{plan:s,warnings:d}=w.paginateTemplate(e.template,t.datasets,{maxPages:a.maxPages??100,maxCells:a.maxCells??25e4}),p=(a.formats??["pdf","xlsx"]).flatMap(i=>j.inspectOutputCapabilities(s,i));n.issues.push(...d.map(i=>({code:"layout",severity:"warning",path:"$.template",fixture:t.name,message:i}))),n.issues.push(...p.map(i=>({code:"output",severity:a.strictOutputs?"error":"warning",...B(e.template,s,i),fixture:t.name,message:`${i.format}: ${i.message}`,diagnostic:i}))),n.samples.push({name:t.name,pages:s.pages.length,rows:w.templateDatasetRowCount(e.template,t.datasets),diagnostics:p})}catch(s){n.issues.push({code:"layout",severity:"error",path:"$.template",fixture:t.name,message:s instanceof Error?s.message:String(s)})}}function V(e){for(const[r,a]of[["maxPages",e.maxPages],["maxCells",e.maxCells],["maxSampleRows",e.maxSampleRows]])if(a!==void 0&&(!Number.isSafeInteger(a)||a<1))throw new RangeError(`${r} must be a positive safe integer`);if((e.fixtures?.length??0)>20)throw new RangeError("At most 20 review fixtures are allowed");const t=new Set;for(const r of e.fixtures??[]){if(typeof r.name!="string"||!r.name.trim()||r.name.length>120||t.has(r.name))throw new Error("Review fixtures require unique non-empty names of at most 120 characters");t.add(r.name)}}function*C(e,t,r){let a;yield{stage:"template",run:()=>{V(t),a=h.parseReportTemplate(e)}};const n=t.previous;n&&(yield{stage:"baseline",run:()=>{r.changes=A(n,a),r.changes.breakingChanges&&!t.allowBreakingChanges&&r.issues.push({code:"compatibility",severity:"error",path:"$.template",message:`${r.changes.breakingChanges} 项字段或结构变更需要明确确认兼容性`})}}),t.dataSchemas&&(yield{stage:"bindings",run:()=>M(a.template,t.dataSchemas,r.issues)});for(const[o,s]of(t.fixtures??[]).entries())yield{stage:"fixture",fixture:s.name,run:()=>J(a,s,o,t,r)};t.fixtures?.length||r.issues.push({code:"sample",severity:"warning",path:"$.fixtures",message:"未提供验收样例,仅完成结构和字段检查,尚未验证排版与输出"})}function O(e){return e.ok=e.issues.every(t=>t.severity!=="error"),e}function k(e,t){e.issues.push({code:"template",severity:"error",path:"$",message:t instanceof Error?t.message:String(t)})}function W(e,t={}){const r={ok:!1,issues:[],samples:[]};try{for(const a of C(e,t,r))a.run()}catch(a){k(r,a)}return O(r)}function v(e){if(e?.aborted)throw e.reason??new DOMException("Template review was aborted","AbortError")}function K(e){return v(e),new Promise((t,r)=>{const a=()=>{clearTimeout(n),e?.removeEventListener("abort",a),r(e?.reason??new DOMException("Template review was aborted","AbortError"))},n=setTimeout(()=>{e?.removeEventListener("abort",a),t()},0);e?.addEventListener("abort",a,{once:!0}),e?.aborted&&a()})}function I(e,t){try{e.onProgress?.(t)}catch{}}async function _(e,t={}){const r={ok:!1,issues:[],samples:[]},a=t.fixtures?.length??0;let n=0;v(t.signal);try{const o=C(e,t,r),s=o.next();s.done||(s.value.run(),I(t,{completed:n,total:a,stage:s.value.stage})),v(t.signal);for(const d of o)await K(t.signal),v(t.signal),d.run(),d.stage==="fixture"&&n++,I(t,{completed:n,total:a,stage:d.stage,...d.fixture?{fixture:d.fixture}:{}}),v(t.signal)}catch(o){v(t.signal),k(r,o)}return O(r)}function z(e,t){const r=e.publishedRevision??e.published?.revision;for(const a of[e.draftRevision,r])if(a!==void 0&&(typeof a!="string"||!a.trim()))throw new TypeError("模板生命周期修订应为非空字符串");if(e.draftRevision!==void 0&&e.draftRevision!==t.revision)throw new TypeError("可编辑文档应与草稿修订一致");if(e.published&&(e.published.id!==t.id||e.published.revision!==r))throw new TypeError("发布文档身份或修订不一致");if(!e.published&&r!==void 0&&r!==t.revision)throw new TypeError("发布修订需要对应的独立文档");return{...e.draftRevision===void 0?{}:{draftRevision:e.draftRevision},...r===void 0?{}:{publishedRevision:r}}}function G(e,t){const r=h.parseReportTemplate(e);if(t.id===r.id)throw new Error("复制模板应使用新的 ID");const{revision:a,...n}=r;return h.parseReportTemplate({...n,id:t.id,name:t.name})}function H(e){if(!Array.isArray(e)||e.length>1e3)throw new RangeError("本地模板目录最多 1000 项");const t=new Map,r=new Map,a=[];for(const n of e){const o=h.parseReportTemplate(n.document);if(t.has(o.id))throw new Error(`模板 ID 重复:${o.id}`);if(n.category!==void 0&&(typeof n.category!="string"||n.category.length>128)||n.tags!==void 0&&(!Array.isArray(n.tags)||n.tags.length>20||n.tags.some(i=>typeof i!="string"||i.length>128)))throw new TypeError("模板分类和标签无效");const s=z(n,o),{template:d,...p}=o;t.set(o.id,o),n.published?r.set(o.id,h.parseReportTemplate(n.published)):s.publishedRevision&&r.set(o.id,h.parseReportTemplate(o)),a.push({...p,...s,...n.category?{category:n.category}:{},...n.tags?{tags:[...n.tags]}:{}})}return a.sort((n,o)=>n.id<o.id?-1:1),{search:async n=>{S(n.signal);const o=n.limit??30;if(!Number.isSafeInteger(o)||o<1||o>100)throw new RangeError("模板每页数量应为 1–100");const s=n.query?.trim().toLocaleLowerCase()??"",d=a.filter(i=>(!n.category||i.category===n.category)&&(!n.cursor||i.id>n.cursor)&&(!s||[i.id,i.name,i.description,...i.tags??[]].some(c=>c?.toLocaleLowerCase().includes(s)))),p=new Map;for(const i of a)i.category&&p.set(i.category,(p.get(i.category)??0)+1);return JSON.parse(JSON.stringify({items:d.slice(0,o),...d.length>o?{next:d[o-1].id}:{},categories:Array.from(p,([i,c])=>({id:i,label:i,count:c}))}))},get:async(n,o)=>{S(o.signal);const s=o.mode==="published"?r.get(n):t.get(n);return s?h.parseReportTemplate(s):void 0}}}function S(e){if(!e?.aborted)return;const t=new Error("模板目录操作已取消");throw t.name="AbortError",t}exports.cloneReportTemplate=G;exports.createLocalTemplateCatalog=H;exports.diffReportTemplates=A;exports.reviewReportTemplate=W;exports.reviewReportTemplateAsync=_;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { D as d } from "./progress-ByiOxUD3.js";
|
|
2
|
+
const M = /[\u3000-\u9fff\uff00-\uffef]/, w = /[ \n\u3000-\u9fff\uff00-\uffef]/, s = new Uint8Array(128);
|
|
3
|
+
{
|
|
4
|
+
for (const t of "iljtf.,:;'`|!()[]") s[t.charCodeAt(0)] = 1;
|
|
5
|
+
for (const t of "mwMW@") s[t.charCodeAt(0)] = 2;
|
|
6
|
+
for (let t = 48; t <= 57; t++) s[t] = 3;
|
|
7
|
+
for (let t = 65; t <= 90; t++) s[t] = 4;
|
|
8
|
+
s[32] = 5;
|
|
9
|
+
}
|
|
10
|
+
const g = [0.54, 0.26, 0.95, 0.59, 0.67, 0.3];
|
|
11
|
+
function p(t) {
|
|
12
|
+
const e = t.charCodeAt(0);
|
|
13
|
+
return e < 128 ? g[s[e]] : M.test(t) ? 1 : /[A-Z]/.test(t) ? 0.67 : 0.54;
|
|
14
|
+
}
|
|
15
|
+
const h = {
|
|
16
|
+
measureMm(t, e) {
|
|
17
|
+
const { fontSizePt: f, bold: c = !1, letterSpacingPt: i = 0 } = e, n = 25.4 / 72;
|
|
18
|
+
let r = 0, o = 0;
|
|
19
|
+
for (const a of t)
|
|
20
|
+
r += p(a), o++;
|
|
21
|
+
return c && (r *= 1.04), (r * f + i * Math.max(0, o - 1)) * n;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
function x() {
|
|
25
|
+
return h;
|
|
26
|
+
}
|
|
27
|
+
function j(t, e) {
|
|
28
|
+
return h.measureMm(t, e);
|
|
29
|
+
}
|
|
30
|
+
function k(t) {
|
|
31
|
+
let e;
|
|
32
|
+
return {
|
|
33
|
+
measureMm(f, c) {
|
|
34
|
+
if (e === void 0 && (e = t()), !e) return h.measureMm(f, c);
|
|
35
|
+
const i = c.fontSizePt * 96 / 72;
|
|
36
|
+
e.font = `${c.italic ? "italic " : ""}${c.bold ? "bold " : ""}${i}px ${c.fontFamily ?? d}`, "letterSpacing" in e && (e.letterSpacing = "0px");
|
|
37
|
+
const n = (c.letterSpacingPt ?? 0) * Math.max(0, Array.from(f).length - 1);
|
|
38
|
+
return e.measureText(f).width * 25.4 / 96 + n * 25.4 / 72;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function A(t, e, f) {
|
|
43
|
+
if (!w.test(t)) return [{ text: t, widthMm: f.measureMm(t, e), cjk: !1 }];
|
|
44
|
+
const c = [];
|
|
45
|
+
let i = "";
|
|
46
|
+
const n = () => {
|
|
47
|
+
i && (c.push({ text: i, widthMm: f.measureMm(i, e), cjk: !1 }), i = "");
|
|
48
|
+
};
|
|
49
|
+
for (const r of t) {
|
|
50
|
+
if (r === `
|
|
51
|
+
`) {
|
|
52
|
+
n(), c.push({ text: `
|
|
53
|
+
`, widthMm: 0, cjk: !1, br: !0 });
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (r === " ") {
|
|
57
|
+
n(), c.push({ text: r, widthMm: f.measureMm(r, e), cjk: !1, space: !0 });
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (M.test(r)) {
|
|
61
|
+
n(), c.push({ text: r, widthMm: f.measureMm(r, e), cjk: !0 });
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
i += r;
|
|
65
|
+
}
|
|
66
|
+
return n(), c;
|
|
67
|
+
}
|
|
68
|
+
function _(t, e, f, c = h) {
|
|
69
|
+
if (!t) return [""];
|
|
70
|
+
t = t.replace(/\r\n?/g, `
|
|
71
|
+
`);
|
|
72
|
+
const i = [];
|
|
73
|
+
let n = "", r = 0;
|
|
74
|
+
const o = (f.letterSpacingPt ?? 0) * 25.4 / 72, a = () => {
|
|
75
|
+
i.push(n), n = "", r = 0;
|
|
76
|
+
};
|
|
77
|
+
for (const u of A(t, f, c)) {
|
|
78
|
+
if (u.br) {
|
|
79
|
+
a();
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const m = n.length > 0 ? o : 0;
|
|
83
|
+
if (r + m + u.widthMm <= e) {
|
|
84
|
+
n += u.text, r += m + u.widthMm;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (u.space) {
|
|
88
|
+
a();
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (u.cjk) {
|
|
92
|
+
n.length > 0 && a(), n = u.text, r = u.widthMm;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (n.length > 0 && a(), u.widthMm <= e) {
|
|
96
|
+
n = u.text, r = u.widthMm;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
for (const l of u.text)
|
|
100
|
+
c.measureMm(n + l, f) > e && n.length > 0 && a(), n += l, r = c.measureMm(n, f);
|
|
101
|
+
}
|
|
102
|
+
return a(), i;
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
k as a,
|
|
106
|
+
x as b,
|
|
107
|
+
p as c,
|
|
108
|
+
h,
|
|
109
|
+
j as m,
|
|
110
|
+
_ as w
|
|
111
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";const w=require("./progress-WomPRP3B.cjs"),M=/[\u3000-\u9fff\uff00-\uffef]/,g=/[ \n\u3000-\u9fff\uff00-\uffef]/,a=new Uint8Array(128);{for(const t of"iljtf.,:;'`|!()[]")a[t.charCodeAt(0)]=1;for(const t of"mwMW@")a[t.charCodeAt(0)]=2;for(let t=48;t<=57;t++)a[t]=3;for(let t=65;t<=90;t++)a[t]=4;a[32]=5}const p=[.54,.26,.95,.59,.67,.3];function d(t){const e=t.charCodeAt(0);return e<128?p[a[e]]:M.test(t)?1:/[A-Z]/.test(t)?.67:.54}const o={measureMm(t,e){const{fontSizePt:i,bold:c=!1,letterSpacingPt:f=0}=e,r=25.4/72;let n=0,h=0;for(const s of t)n+=d(s),h++;return c&&(n*=1.04),(n*i+f*Math.max(0,h-1))*r}};function A(){return o}function T(t,e){return o.measureMm(t,e)}function x(t){let e;return{measureMm(i,c){if(e===void 0&&(e=t()),!e)return o.measureMm(i,c);const f=c.fontSizePt*96/72;e.font=`${c.italic?"italic ":""}${c.bold?"bold ":""}${f}px ${c.fontFamily??w.DEFAULT_FONT_FAMILY}`,"letterSpacing"in e&&(e.letterSpacing="0px");const r=(c.letterSpacingPt??0)*Math.max(0,Array.from(i).length-1);return e.measureText(i).width*25.4/96+r*25.4/72}}}function S(t,e,i){if(!g.test(t))return[{text:t,widthMm:i.measureMm(t,e),cjk:!1}];const c=[];let f="";const r=()=>{f&&(c.push({text:f,widthMm:i.measureMm(f,e),cjk:!1}),f="")};for(const n of t){if(n===`
|
|
2
|
+
`){r(),c.push({text:`
|
|
3
|
+
`,widthMm:0,cjk:!1,br:!0});continue}if(n===" "){r(),c.push({text:n,widthMm:i.measureMm(n,e),cjk:!1,space:!0});continue}if(M.test(n)){r(),c.push({text:n,widthMm:i.measureMm(n,e),cjk:!0});continue}f+=n}return r(),c}function j(t,e,i,c=o){if(!t)return[""];t=t.replace(/\r\n?/g,`
|
|
4
|
+
`);const f=[];let r="",n=0;const h=(i.letterSpacingPt??0)*25.4/72,s=()=>{f.push(r),r="",n=0};for(const u of S(t,i,c)){if(u.br){s();continue}const m=r.length>0?h:0;if(n+m+u.widthMm<=e){r+=u.text,n+=m+u.widthMm;continue}if(u.space){s();continue}if(u.cjk){r.length>0&&s(),r=u.text,n=u.widthMm;continue}if(r.length>0&&s(),u.widthMm<=e){r=u.text,n=u.widthMm;continue}for(const l of u.text)c.measureMm(r+l,i)>e&&r.length>0&&s(),r+=l,n=c.measureMm(r,i)}return s(),f}exports.charWidthEm=d;exports.createCanvasMeasurer=x;exports.createHeuristicMeasurer=A;exports.heuristicMeasurer=o;exports.measureTextMm=T;exports.wrapText=j;
|
package/dist/vue/async.d.cts
CHANGED
|
@@ -1179,6 +1179,8 @@ declare interface MachReportStateError {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
/** 主题变量(组件外壳注入的 --mrp-* CSS 自定义属性) */
|
|
1181
1181
|
declare interface MachReportTheme {
|
|
1182
|
+
/** Native controls follow the host's declared light/dark palette. */
|
|
1183
|
+
colorScheme?: "light" | "dark";
|
|
1182
1184
|
/** 空态插图强调色,不随正文颜色变灰。 */
|
|
1183
1185
|
emptyAccent?: string;
|
|
1184
1186
|
shellBg: string;
|
|
@@ -1191,6 +1193,11 @@ declare interface MachReportTheme {
|
|
|
1191
1193
|
btnHoverBg: string;
|
|
1192
1194
|
btnHoverFg: string;
|
|
1193
1195
|
btnActiveBg: string;
|
|
1196
|
+
/** Foreground on solid primary actions. Optional for existing complete themes. */
|
|
1197
|
+
btnActiveFg?: string;
|
|
1198
|
+
errorFg?: string;
|
|
1199
|
+
warningFg?: string;
|
|
1200
|
+
successFg?: string;
|
|
1194
1201
|
}
|
|
1195
1202
|
declare interface MachReportToolbarOptions {
|
|
1196
1203
|
/** Reasons explain host restrictions without granting capabilities. */
|
package/dist/vue/async.d.ts
CHANGED
|
@@ -1179,6 +1179,8 @@ declare interface MachReportStateError {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
/** 主题变量(组件外壳注入的 --mrp-* CSS 自定义属性) */
|
|
1181
1181
|
declare interface MachReportTheme {
|
|
1182
|
+
/** Native controls follow the host's declared light/dark palette. */
|
|
1183
|
+
colorScheme?: "light" | "dark";
|
|
1182
1184
|
/** 空态插图强调色,不随正文颜色变灰。 */
|
|
1183
1185
|
emptyAccent?: string;
|
|
1184
1186
|
shellBg: string;
|
|
@@ -1191,6 +1193,11 @@ declare interface MachReportTheme {
|
|
|
1191
1193
|
btnHoverBg: string;
|
|
1192
1194
|
btnHoverFg: string;
|
|
1193
1195
|
btnActiveBg: string;
|
|
1196
|
+
/** Foreground on solid primary actions. Optional for existing complete themes. */
|
|
1197
|
+
btnActiveFg?: string;
|
|
1198
|
+
errorFg?: string;
|
|
1199
|
+
warningFg?: string;
|
|
1200
|
+
successFg?: string;
|
|
1194
1201
|
}
|
|
1195
1202
|
declare interface MachReportToolbarOptions {
|
|
1196
1203
|
/** Reasons explain host restrictions without granting capabilities. */
|
package/dist/vue/index.d.cts
CHANGED
|
@@ -2024,6 +2024,8 @@ export declare interface MachReportStateError {
|
|
|
2024
2024
|
}
|
|
2025
2025
|
/** 主题变量(组件外壳注入的 --mrp-* CSS 自定义属性) */
|
|
2026
2026
|
export declare interface MachReportTheme {
|
|
2027
|
+
/** Native controls follow the host's declared light/dark palette. */
|
|
2028
|
+
colorScheme?: "light" | "dark";
|
|
2027
2029
|
/** 空态插图强调色,不随正文颜色变灰。 */
|
|
2028
2030
|
emptyAccent?: string;
|
|
2029
2031
|
shellBg: string;
|
|
@@ -2036,6 +2038,11 @@ export declare interface MachReportTheme {
|
|
|
2036
2038
|
btnHoverBg: string;
|
|
2037
2039
|
btnHoverFg: string;
|
|
2038
2040
|
btnActiveBg: string;
|
|
2041
|
+
/** Foreground on solid primary actions. Optional for existing complete themes. */
|
|
2042
|
+
btnActiveFg?: string;
|
|
2043
|
+
errorFg?: string;
|
|
2044
|
+
warningFg?: string;
|
|
2045
|
+
successFg?: string;
|
|
2039
2046
|
}
|
|
2040
2047
|
export declare interface MachReportToolbarOptions {
|
|
2041
2048
|
/** Reasons explain host restrictions without granting capabilities. */
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -2024,6 +2024,8 @@ export declare interface MachReportStateError {
|
|
|
2024
2024
|
}
|
|
2025
2025
|
/** 主题变量(组件外壳注入的 --mrp-* CSS 自定义属性) */
|
|
2026
2026
|
export declare interface MachReportTheme {
|
|
2027
|
+
/** Native controls follow the host's declared light/dark palette. */
|
|
2028
|
+
colorScheme?: "light" | "dark";
|
|
2027
2029
|
/** 空态插图强调色,不随正文颜色变灰。 */
|
|
2028
2030
|
emptyAccent?: string;
|
|
2029
2031
|
shellBg: string;
|
|
@@ -2036,6 +2038,11 @@ export declare interface MachReportTheme {
|
|
|
2036
2038
|
btnHoverBg: string;
|
|
2037
2039
|
btnHoverFg: string;
|
|
2038
2040
|
btnActiveBg: string;
|
|
2041
|
+
/** Foreground on solid primary actions. Optional for existing complete themes. */
|
|
2042
|
+
btnActiveFg?: string;
|
|
2043
|
+
errorFg?: string;
|
|
2044
|
+
warningFg?: string;
|
|
2045
|
+
successFg?: string;
|
|
2039
2046
|
}
|
|
2040
2047
|
export declare interface MachReportToolbarOptions {
|
|
2041
2048
|
/** Reasons explain host restrictions without granting capabilities. */
|
package/dist/vue-async.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./plugin-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./plugin-BWTp-X7b.cjs");function i(){return Promise.resolve().then(()=>require("./ReportPreview-BoGBGyRr.cjs")).then(e=>e.ReportPreview$1)}const t={install(e,o={}){r.machReportPlugin.install(e,o)}};exports.MachReportPreview=r.MachReportPreview;exports.default=t;exports.machReportAsyncPlugin=t;exports.preloadMachReport=i;
|
package/dist/vue-async.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as o } from "./plugin-
|
|
2
|
-
import { M as l } from "./plugin-
|
|
1
|
+
import { m as o } from "./plugin-_BkUVc2z.js";
|
|
2
|
+
import { M as l } from "./plugin-_BkUVc2z.js";
|
|
3
3
|
function a() {
|
|
4
|
-
return import("./ReportPreview-
|
|
4
|
+
return import("./ReportPreview-QLONCyci.js").then((t) => t.x);
|
|
5
5
|
}
|
|
6
6
|
const n = {
|
|
7
7
|
install(t, r = {}) {
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("@agile-team/mach-report"),o=require("./ReportPreview-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("@agile-team/mach-report"),o=require("./ReportPreview-BoGBGyRr.cjs"),i=require("./ReportParamPanel-C7fZTllk.cjs"),f=require("./injection-keys-Db_DyLkm.cjs"),A=require("./plugin-BWTp-X7b.cjs"),h=require("vue"),v=require("./json-snapshot-DNiIbpOr.cjs"),w=require("./progress-WomPRP3B.cjs");function C(r){const e=E.createReportSource(r),a=async t=>{if(t.reportIds.length===0)throw new o.PlanLoadError("缺少报表 ID");for(const n of t.reportIds)if(!Object.prototype.hasOwnProperty.call(r,n)||!r[n])throw new o.PlanLoadError(`本地模板 ${n} 不存在`);return e(t)};return a.getParamDefs=e.getParamDefs,a}const I=Object.freeze({loading:!1,hasPlan:!1,pageCount:0,currentPage:1,exporting:null,printing:!1,canExport:!1,canPrint:!1,error:null,pdfFont:Object.freeze({status:"unchecked",fontUrl:""})});function D(){const r=h.shallowRef(null),e=()=>r.value?.state??I,a=Object.freeze({get loading(){return e().loading},get stale(){return e().stale??!1},get hasPlan(){return e().hasPlan},get pageCount(){return e().pageCount},get currentPage(){return e().currentPage},get exporting(){return e().exporting},get printing(){return e().printing},get canExport(){return e().canExport},get canPrint(){return e().canPrint},get error(){return e().error},get pdfFont(){return e().pdfFont},get editing(){return e().editing??!1},get saving(){return e().saving??!1},get importing(){return e().importing??!1},get dirty(){return e().dirty??!1},get pendingLocalChanges(){return e().pendingLocalChanges??!1},get task(){return e().task??null},get diagnostics(){return e().diagnostics??[]},get reportIds(){return e().reportIds??[]},get params(){return e().params??{}},get canUndo(){return e().canUndo??!1},get canRedo(){return e().canRedo??!1},get changeCount(){return e().changeCount??0},get selection(){return e().selection??null}});function t(){if(!r.value)throw new i.MachReportError("config","报表预览尚未挂载,请在 ready 后调用控制器");return r.value}return{ref(n){const s=n;r.value=s&&typeof s.reload=="function"&&typeof s.print=="function"&&typeof s.exportAs=="function"&&typeof s.openPdfWindow=="function"&&typeof s.gotoPage=="function"&&typeof s.setParams=="function"?s:null},ready:h.computed(()=>r.value!==null),state:a,async checkPdfFont(){const n=t();return n.checkPdfFont?n.checkPdfFont():{status:"unverified",fontUrl:"",message:"旧自定义控制器未提供字体检查,请由宿主确认字体配置"}},cancelTask(){t().cancelTask?.()},async confirmDiscard(n){return await t().confirmDiscard?.(n)??!0},getOutputDiagnostics(n){return t().getOutputDiagnostics?.(n)??[]},async reload(){await t().reload()},async print(){await t().print()},async exportAs(n){await t().exportAs(n)},openPdfWindow(){t().openPdfWindow()},gotoPage(n){t().gotoPage(n)},async setParams(n,s){await t().setParams(n,s)},async importExcel(n,s){const g=t();if(!g.importExcel)throw new i.MachReportError("config","旧自定义控制器未提供 Excel 导入");return g.importExcel(n,s)},getPlan(){return t().getPlan?.()??null},getChanges(){return t().getChanges?.()??[]},getDifferences:()=>t().getDifferences?.()??[],undo:async()=>await t().undo?.()??!1,redo:async()=>await t().redo?.()??!1,restoreChanges:async()=>await t().restoreChanges?.()??!1,getSelection:()=>t().getSelection?.()??null,focusCell:async(n,s)=>await t().focusCell?.(n,s)??!1,focusField:async n=>await t().focusField?.(n)??!1,copySelection:()=>t().copySelection?.()??"",pasteSelection:async n=>await t().pasteSelection?.(n)??!1}}function L(){return h.inject(f.MACH_REPORT_CONTROLLER_KEY,null)}function T(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function x(r){return Array.isArray(r)&&r.every(e=>T(e)&&typeof e.code=="string"&&typeof e.message=="string"&&["info","warning","error"].includes(e.severity)&&(e.path===void 0||typeof e.path=="string")&&v.hasValidDataExplanation(e))}function F(r,e){return Array.isArray(r)&&r.every(a=>T(a)&&Number.isSafeInteger(a.editIndex)&&a.editIndex>=0&&a.editIndex<e&&typeof a.code=="string"&&typeof a.message=="string")}function b(r,e){let a;if(!T(r)||typeof r.revision!="string"||!r.revision.trim()?a="非空 revision(请先在适配器解包业务响应)":r.sourceToken!==void 0&&typeof r.sourceToken!="string"?a="字符串 sourceToken":r.diagnostics!==void 0&&!x(r.diagnostics)?a="结构化 diagnostics":r.conflicts!==void 0&&!F(r.conflicts,e)&&(a="有效 editIndex/code/message conflicts"),a)throw new i.MachReportError("edit",`ReportProvider.save 必须返回${a};服务器可能已提交,请重新查询确认后再编辑`)}function m(r){return typeof r=="function"?r():r}function q(r,e){const a=new Set(r.flatMap(t=>t.source?.[e]===void 0?[]:[String(t.source[e])]));return a.size===1?[...a][0]:void 0}function O(r,e,a,t){return typeof r=="function"?r():q(e,a)??t??r}function k(r){return r.requestId??globalThis.crypto?.randomUUID?.()??`mr-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function U(r,e){if(!r.save)throw new i.MachReportError("config","ReportProvider.save 未配置,无法启用业务保存");let a="",t,n,s=0;function g(c,l,p){c.conflicts?.length||l!==a||p!==s||(t=c.revision,n=c.sourceToken)}async function S(c,l){if(l.signal.aborted)throw l.signal.reason??new DOMException("Aborted","AbortError");const p=m(e.reportId),_={...m(e.params??{})},R=JSON.stringify([p,_]),M=++s;if(R!==a&&(a=R,t=void 0,n=void 0),e.requireSource!==!1&&c.edits.some(u=>!u.source))throw new E.ReportCellEditError("missing");const d=await r.save({reportId:p,params:_,signal:l.signal,requestId:c.requestId,action:l.action,edits:o.cloneReportSnapshot(c.edits),expectedRevision:O(e.expectedRevision,c.edits,"revision",t),sourceToken:O(e.sourceToken,c.edits,"sourceToken",n)});if(l.signal.aborted)throw l.signal.reason??new DOMException("Aborted","AbortError");b(d,c.edits.length),d.diagnostics?.forEach(u=>w.observeOutput(()=>e.onDiagnostic?.(u)));const P=d.diagnostics?.filter(u=>u.severity==="error");if(P?.length)throw new i.MachReportError("edit",P.map(u=>u.message).join(";"),{diagnostics:P});const y=d.conflicts?.map(u=>({source:c.edits[u.editIndex]?.source,address:c.edits[u.editIndex]?.address,message:u.message}));return g(d,R,M),{revision:d.revision,sourceToken:d.sourceToken,conflicts:y}}return{requireSource:e.requireSource??!0,canEdit:e.canEdit,readOnlyReason:e.readOnlyReason,history:e.history,fields:e.fields,validate:e.validate,validation:e.validation,validateBatch:e.validateBatch,saveBatch:S,save:(c,l)=>S({requestId:k(l),edits:[o.cloneReportSnapshot(c)]},l)}}exports.PlanLoadError=o.PlanLoadError;exports.REPORT_EXPORT_FORMATS=o.REPORT_EXPORT_FORMATS;exports.REPORT_PREVIEW_TOOLS=o.REPORT_PREVIEW_TOOLS;exports.ReportDataComparisonPanel=o._sfc_main;exports.ReportExportMenu=o.ReportExportMenu;exports.ReportPagination=o.ReportPagination;exports.ReportPrefillPanel=o._sfc_main$1;exports.ReportPreview=o.ReportPreview;exports.ReportPrintResourceError=o.ReportPrintResourceError;exports.ReportTaskStatus=o.ReportTaskStatus;exports.ReportToolbar=o.ReportToolbar;exports.ReportValidationPanel=o.ReportValidationPanel;exports.buildPrintDocument=o.buildPrintDocument;exports.buildWordHtml=o.buildWordHtml;exports.createDefaultPdfExporter=o.createDefaultPdfExporter;exports.createFetchRequest=o.createFetchRequest;exports.createPrintCalibrationPlan=o.createPrintCalibrationPlan;exports.createReportStoragePreferences=o.createReportStoragePreferences;exports.joinReportIds=o.joinReportIds;exports.normalizeReportIds=o.normalizeReportIds;exports.preparePrintResources=o.preparePrintResources;exports.printPlans=o.printPlans;exports.usePageWindow=o.usePageWindow;exports.usePrintExport=o.usePrintExport;exports.useZoom=o.useZoom;exports.DEFAULT_CALCULATION_MESSAGES=i.DEFAULT_CALCULATION_MESSAGES;exports.DEFAULT_DATA_REVIEW_MESSAGES=i.DEFAULT_DATA_REVIEW_MESSAGES;exports.DEFAULT_MESSAGES=i.DEFAULT_MESSAGES;exports.DEFAULT_PRINT_MESSAGES=i.DEFAULT_PRINT_MESSAGES;exports.DEFAULT_THEME=i.DEFAULT_THEME;exports.MachReportError=i.MachReportError;exports.PARAM_OPTIONS_MESSAGES=i.PARAM_OPTIONS_MESSAGES;exports.ReportParamPanel=i.ReportParamPanel;exports.SILENT_LOGGER=i.SILENT_LOGGER;exports.defineMachReportConfig=i.defineMachReportConfig;exports.defineMachReportPreset=i.defineMachReportPreset;exports.normalizeReportLoadError=i.normalizeReportLoadError;exports.printCalibration=i.printCalibration;exports.provideMachReportConfig=i.provideMachReportConfig;exports.resolveCalculationMessages=i.resolveCalculationMessages;exports.resolveConfig=i.resolveConfig;exports.resolveDataReviewMessages=i.resolveDataReviewMessages;exports.snapshotPrintOptions=i.snapshotPrintOptions;exports.themeToCssVars=i.themeToCssVars;exports.toErrorDetail=i.toErrorDetail;exports.useMachReportConfig=i.useMachReportConfig;exports.MACH_REPORT_CONFIG_KEY=f.MACH_REPORT_CONFIG_KEY;exports.MACH_REPORT_CONTROLLER_KEY=f.MACH_REPORT_CONTROLLER_KEY;exports.MACH_REPORT_FETCHER_KEY=f.MACH_REPORT_FETCHER_KEY;exports.MACH_REPORT_PDF_EXPORTER_KEY=f.MACH_REPORT_PDF_EXPORTER_KEY;exports.MachReportPreview=A.MachReportPreview;exports.machReportPlugin=A.machReportPlugin;exports.createLocalFetcher=C;exports.createProviderEditing=U;exports.useMachReport=D;exports.useReportPreview=L;Object.keys(E).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(exports,r)&&Object.defineProperty(exports,r,{enumerable:!0,get:()=>E[r]})});
|
package/dist/vue.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createReportSource as T, ReportCellEditError as A } from "@agile-team/mach-report";
|
|
2
2
|
export * from "@agile-team/mach-report";
|
|
3
|
-
import { P as R, c as h } from "./ReportPreview-
|
|
4
|
-
import { R as Z, a as Q, _ as ee, b as re, d as te, e as ne, f as oe, g as ae, h as se, i as ie, j as ce, k as ue, l as fe, m as le, n as de, o as ge, p as pe, q as Pe, r as me, s as Ee, t as Re, u as he, v as ye, w as we } from "./ReportPreview-
|
|
5
|
-
import { M as f } from "./ReportParamPanel-
|
|
6
|
-
import { D as ve, a as Te, b as Ae, c as xe, d as Ce, P as Oe, R as _e, S as Ie, e as Me, f as De, n as ke, p as Fe, g as Le, r as be, h as Ue, i as qe, s as je, t as Ge, j as Ne, u as He } from "./ReportParamPanel-
|
|
3
|
+
import { P as R, c as h } from "./ReportPreview-QLONCyci.js";
|
|
4
|
+
import { R as Z, a as Q, _ as ee, b as re, d as te, e as ne, f as oe, g as ae, h as se, i as ie, j as ce, k as ue, l as fe, m as le, n as de, o as ge, p as pe, q as Pe, r as me, s as Ee, t as Re, u as he, v as ye, w as we } from "./ReportPreview-QLONCyci.js";
|
|
5
|
+
import { M as f } from "./ReportParamPanel-GI43aGa0.js";
|
|
6
|
+
import { D as ve, a as Te, b as Ae, c as xe, d as Ce, P as Oe, R as _e, S as Ie, e as Me, f as De, n as ke, p as Fe, g as Le, r as be, h as Ue, i as qe, s as je, t as Ge, j as Ne, u as He } from "./ReportParamPanel-GI43aGa0.js";
|
|
7
7
|
import { M as x } from "./injection-keys-e85udZCp.js";
|
|
8
8
|
import { a as ze, b as Ve, c as Ye } from "./injection-keys-e85udZCp.js";
|
|
9
|
-
import { M as $e, m as Be } from "./plugin-
|
|
9
|
+
import { M as $e, m as Be } from "./plugin-_BkUVc2z.js";
|
|
10
10
|
import { shallowRef as C, computed as O, inject as _ } from "vue";
|
|
11
|
-
import { v as I } from "./json-snapshot-
|
|
11
|
+
import { v as I } from "./json-snapshot-BRnzKudk.js";
|
|
12
12
|
import { u as M } from "./progress-ByiOxUD3.js";
|
|
13
13
|
function V(r) {
|
|
14
14
|
const e = T(r), o = async (t) => {
|
package/dist/worker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./protocol-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./protocol-wzhl1Fim.cjs"),s=require("./auto-BrPWo7Xm.cjs"),R=require("./encoding-7lquyj0w.cjs");function p(n,e=globalThis){const a=t=>{r.isReportWorkerRequest(t.data)&&r.runReportWorkerRequest(n,t.data,o=>e.postMessage({protocol:r.REPORT_WORKER_PROTOCOL,id:t.data.id,type:"event",event:o})).then(o=>e.postMessage(o,r.reportWorkerTransferList(o)))};return e.addEventListener("message",a),()=>e.removeEventListener("message",a)}exports.ReportWorkerError=r.ReportWorkerError;exports.ReportWorkerStartError=s.ReportWorkerStartError;exports.createAutoReportExporter=s.createAutoReportExporter;exports.createBrowserReportExecutor=s.createBrowserReportExecutor;exports.serveReportEncodingWorker=R.serveReportEncodingWorker;exports.serveReportWorker=p;
|
package/dist/worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as a, r as R, R as p, a as n } from "./protocol-
|
|
2
|
-
import { b as W } from "./protocol-
|
|
3
|
-
import { R as g, c as k, a as u } from "./auto-
|
|
4
|
-
import { s as x } from "./encoding-
|
|
1
|
+
import { i as a, r as R, R as p, a as n } from "./protocol-BG16rz6D.js";
|
|
2
|
+
import { b as W } from "./protocol-BG16rz6D.js";
|
|
3
|
+
import { R as g, c as k, a as u } from "./auto-BB99S802.js";
|
|
4
|
+
import { s as x } from "./encoding-CEd-dq9A.js";
|
|
5
5
|
function d(s, r = globalThis) {
|
|
6
6
|
const t = (o) => {
|
|
7
7
|
a(o.data) && R(s, o.data, (e) => r.postMessage({ protocol: p, id: o.data.id, type: "event", event: e })).then((e) => r.postMessage(e, n(e)));
|