@agile-team/mach-report 2.26.0 → 2.26.2
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 +16 -5
- package/dist/ExcelBindingWizard-CnjjpYxD.cjs +1 -0
- package/dist/{ExcelBindingWizard-B418l44t.js → ExcelBindingWizard-DAprCgn-.js} +4 -4
- package/dist/{ParamEditor-XvMtf_XQ.js → ParamEditor-CY9d8QZD.js} +3 -3
- package/dist/ParamEditor-CiVjpbc-.cjs +1 -0
- package/dist/ReportBatchPanel-0-Oymcdm.cjs +1 -0
- package/dist/{ReportBatchPanel-Ds0R_uXn.js → ReportBatchPanel-CDp7xRHp.js} +4 -4
- package/dist/ReportLabelStudio-CsyHqBco.cjs +1 -0
- package/dist/{ReportLabelStudio-ZFy79eRv.js → ReportLabelStudio-DtKxk9n0.js} +183 -183
- package/dist/ReportParamPanel-CoKcXzSy.cjs +1 -0
- package/dist/{ReportParamPanel-Czm3OPo_.js → ReportParamPanel-jKDJVar2.js} +2 -2
- package/dist/{ReportPreview-C9c0Rp7Y.js → ReportPreview-DJqt40zA.js} +2863 -2836
- package/dist/ReportPreview-s7c2nrfo.cjs +6 -0
- package/dist/ReportTemplateLibrary-CsUm6edm.cjs +1 -0
- package/dist/{ReportTemplateLibrary-XJVoTDIz.js → ReportTemplateLibrary-qPQX0Dt_.js} +2 -2
- package/dist/RuleEditor-CJBibiLY.cjs +1 -0
- package/dist/{RuleEditor-CeNFPeOc.js → RuleEditor-Di-JZ2Lb.js} +6 -6
- package/dist/{TemplateOutlinePanel-BWN4Y9iz.js → TemplateOutlinePanel-D0mKfVWf.js} +3 -3
- package/dist/TemplateOutlinePanel-RiRgXnnH.cjs +1 -0
- package/dist/TemplateReusePanel-BdK91T7z.cjs +1 -0
- package/dist/{TemplateReusePanel-CR-4OHoU.js → TemplateReusePanel-J6PvD2Sf.js} +3 -3
- package/dist/TemplateReviewPanel-B5yUgOgb.cjs +1 -0
- package/dist/{TemplateReviewPanel-BkWzyNL4.js → TemplateReviewPanel-BlUbD2GY.js} +3 -3
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.js +5 -5
- package/dist/artifact-integrity.json +112 -114
- package/dist/assets-CylgPA6P.cjs +1 -0
- package/dist/assets-Vt10jCtl.js +136 -0
- package/dist/auto-D3UNXBrM.cjs +1 -0
- package/dist/{auto-C7udkeAa.js → auto-Hq-xgrvS.js} +28 -25
- package/dist/{batch-DGCt44XM.js → batch-Be_NbW7U.js} +1 -1
- package/dist/{batch-DYcokH4v.cjs → batch-CI4ZpuoX.cjs} +1 -1
- package/dist/{charts-D-Vg-ak9.cjs → charts-Cy7muNWi.cjs} +1 -1
- package/dist/{charts-D48XCefN.js → charts-DLTz0OEG.js} +1 -1
- package/dist/{computed-BQgBrma-.cjs → computed-8nFyVnok.cjs} +1 -1
- package/dist/{computed-CH3NYPOW.js → computed-BR_O8uAv.js} +14 -20
- package/dist/{data-bar-DzceAVeR.cjs → data-bar--_aPWr-W.cjs} +1 -1
- package/dist/{data-bar-DjOgTLqu.js → data-bar-BVnzVbE9.js} +1 -1
- package/dist/designer-Bc5AXS38.cjs +2 -0
- package/dist/designer-CZqnLTyE.js +8350 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +108 -1
- package/dist/designer.d.ts +108 -1
- package/dist/designer.js +1 -1
- package/dist/{diagnostic-collector-C-JBA016.js → diagnostic-collector-CZ8DV6wA.js} +208 -186
- package/dist/diagnostic-collector-DwMJWEHo.cjs +1 -0
- package/dist/{dom-DgWc-DY1.js → dom-CbOWY7KE.js} +5 -5
- package/dist/dom-VuLh_fhL.cjs +1 -0
- package/dist/{encoding-tWc2Wn89.cjs → encoding-D0ITsCCp.cjs} +1 -1
- package/dist/{encoding-D480EM2r.js → encoding-TbA3oQLr.js} +2 -2
- package/dist/{execution-result-Ba65gieT.js → execution-result-BUPPNlaS.js} +3 -3
- package/dist/{execution-result-7sG_mdcD.cjs → execution-result-BgZtqlOT.cjs} +1 -1
- package/dist/{font-loader-CHmEwkHl.js → font-loader-BSRR-a0C.js} +1 -1
- package/dist/{font-loader-BIxme_9g.cjs → font-loader-BZ4CRPys.cjs} +1 -1
- package/dist/{grid-strokes-DsoICRjZ.js → grid-strokes-CovSH3A2.js} +1 -1
- package/dist/{grid-strokes-RFMR91jn.cjs → grid-strokes-G5omPT3s.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +23 -23
- package/dist/{json-snapshot-BZ0CIQln.js → json-snapshot-DRQmh_k5.js} +718 -683
- package/dist/json-snapshot-HR8bez8j.cjs +2 -0
- package/dist/{matrix-CB9TqTEy.js → matrix-6wjFVN0Z.js} +149 -142
- package/dist/matrix-DeA6__cd.cjs +1 -0
- package/dist/media-IV_r4Sp7.cjs +1 -0
- package/dist/media-jiLdCn3i.js +208 -0
- package/dist/{pdf-DTR7fAIr.js → pdf-BqnoP1L_.js} +14 -15
- package/dist/{pdf-d9oJ6V0P.cjs → pdf-Ddm0HCuT.cjs} +48 -48
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-B7Bi-1te.cjs → plugin-BFBLxfsq.cjs} +1 -1
- package/dist/{plugin-OKDFQFS4.js → plugin-BnRcXQzg.js} +1 -1
- package/dist/{prefill-C8fF91JB.js → prefill-BqbuktRt.js} +3 -3
- package/dist/{prefill-C_Bf_AMo.cjs → prefill-DPLV68I7.cjs} +1 -1
- package/dist/prepared-Cl7C69N7.cjs +1 -0
- package/dist/{prepared-DhgQ0d-h.js → prepared-V7tYf1qj.js} +68 -64
- package/dist/{protocol-CZ-BILne.cjs → protocol-BVhKnBmX.cjs} +1 -1
- package/dist/{protocol-DHO91-Jt.js → protocol-Bf33Gu9J.js} +3 -3
- package/dist/{record-bindings-KEs-DKCS.cjs → record-bindings-DVs_g_No.cjs} +1 -1
- package/dist/{record-bindings-DBrCu6zO.js → record-bindings-hxJqcLSK.js} +3 -3
- package/dist/{region-binding-workflow-ikpY1Kbw.cjs → region-binding-workflow-Bu31bqCr.cjs} +1 -1
- package/dist/{region-binding-workflow-FSyIZge8.js → region-binding-workflow-DRvX25XH.js} +2 -2
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{rich-text-layout-BYbIc3eJ.cjs → rich-text-layout-6VphrIcj.cjs} +1 -1
- package/dist/{rich-text-layout-BtygMWZC.js → rich-text-layout-BCdxMT4m.js} +1 -1
- package/dist/{runtime-BsvAqz4a.js → runtime-ChdUbPvs.js} +9 -9
- package/dist/{runtime-B5HG8poy.cjs → runtime-D2noLfgC.cjs} +1 -1
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +2099 -1959
- package/dist/server.cjs +1 -1
- package/dist/server.js +17 -13
- package/dist/sha256-C26wdjDi.cjs +1 -0
- package/dist/sha256-D-msitGX.js +166 -0
- package/dist/style.css +1 -1
- package/dist/{template-catalog-BbrN9dgu.js → template-catalog-CZfnMXKc.js} +4 -4
- package/dist/template-catalog-Dv4sOYaB.cjs +1 -0
- package/dist/{template-fragments-CUTE8-_I.js → template-fragments-BO6i19kt.js} +3 -3
- package/dist/{template-fragments-cyAQu7aw.cjs → template-fragments-CTfJeHoM.cjs} +1 -1
- package/dist/{template-registry-PSuLsnyq.js → template-registry-CIaC6qBW.js} +168 -171
- package/dist/template-registry-CKo-bogM.cjs +1 -0
- package/dist/template-serialization-Cb1ospyK.js +367 -0
- package/dist/template-serialization-D4Fofl9c.cjs +1 -0
- package/dist/{textwrap-LhJkHWb1.cjs → textwrap-BYSqmGGV.cjs} +1 -1
- package/dist/{textwrap-Bt_tnI6V.js → textwrap-CGjFy7gf.js} +1 -1
- package/dist/usePopoverBounds-C3hn7F1s.js +84 -0
- package/dist/usePopoverBounds-mJhJ-VqG.cjs +1 -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 +13 -10
- package/dist/{workbook-session-BJfZVp4q.cjs → workbook-session-DL3uBAl8.cjs} +1 -1
- package/dist/{workbook-session-DRnMjIFK.js → workbook-session-nkvroJUE.js} +2 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.js +28 -29
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-C4FGVsY_.cjs +0 -1
- package/dist/ParamEditor-BemJE8n8.cjs +0 -1
- package/dist/ReportBatchPanel-CbY4fvXD.cjs +0 -1
- package/dist/ReportLabelStudio-DuTwN5er.cjs +0 -1
- package/dist/ReportParamPanel-Chxu4MTx.cjs +0 -1
- package/dist/ReportPreview-CIMR4ERo.cjs +0 -6
- package/dist/ReportTemplateLibrary-C6lByc69.cjs +0 -1
- package/dist/RuleEditor-gggUkEwB.cjs +0 -1
- package/dist/TemplateOutlinePanel-B0e-umq2.cjs +0 -1
- package/dist/TemplateReusePanel-Cthig1S1.cjs +0 -1
- package/dist/TemplateReviewPanel-D8o2gDaK.cjs +0 -1
- package/dist/_plugin-vue_export-helper-8SL1F89S.js +0 -53
- package/dist/_plugin-vue_export-helper-BLmdZLlg.cjs +0 -1
- package/dist/assets-BFTP-0WR.js +0 -137
- package/dist/assets-CZiZhTf2.cjs +0 -1
- package/dist/auto-CXd2E2aZ.cjs +0 -1
- package/dist/capabilities-D8UU2clQ.cjs +0 -1
- package/dist/capabilities-g0a2j9Yy.js +0 -125
- package/dist/designer-COuSUxZ1.cjs +0 -2
- package/dist/designer-CT4mlrr0.js +0 -7997
- package/dist/diagnostic-collector-wASg6Fzs.cjs +0 -1
- package/dist/dom-Fk4NF-gN.cjs +0 -1
- package/dist/json-snapshot-DGFeI30h.cjs +0 -2
- package/dist/matrix-CcqYOuq_.cjs +0 -1
- package/dist/media-B7vnpD8k.cjs +0 -1
- package/dist/media-Y90dHK9z.js +0 -70
- package/dist/prepared-BLhV7vdE.cjs +0 -1
- package/dist/sha256-BDQ1Qk7A.js +0 -158
- package/dist/sha256-DgZAKXqI.cjs +0 -1
- package/dist/template-catalog-DDH-5J57.cjs +0 -1
- package/dist/template-registry-D24Z8aQf.cjs +0 -1
- package/dist/template-serialization-BOUidUlh.cjs +0 -1
- package/dist/template-serialization-BgGWYV_1.js +0 -307
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { y as O, J as k, I as j } from "./json-snapshot-
|
|
2
|
-
import {
|
|
1
|
+
import { y as O, J as k, I as j } from "./json-snapshot-DRQmh_k5.js";
|
|
2
|
+
import { a as P } from "./media-jiLdCn3i.js";
|
|
3
3
|
import { v as L } from "./dataset-B8oTsC6o.js";
|
|
4
|
-
import { p as h } from "./template-registry-
|
|
5
|
-
import { b as S } from "./template-serialization-
|
|
4
|
+
import { p as h } from "./template-registry-CIaC6qBW.js";
|
|
5
|
+
import { b as S } from "./template-serialization-Cb1ospyK.js";
|
|
6
6
|
import { l as N } from "./param-validation-CnDEd2l-.js";
|
|
7
7
|
function $(e) {
|
|
8
8
|
if (e === void 0) return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const w=require("./json-snapshot-HR8bez8j.cjs"),j=require("./media-IV_r4Sp7.cjs"),L=require("./dataset-D3OsyzG1.cjs"),h=require("./template-registry-CKo-bogM.cjs"),E=require("./template-serialization-D4Fofl9c.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,6 +1,6 @@
|
|
|
1
|
-
import { p } from "./template-registry-
|
|
2
|
-
import { b } from "./template-serialization-
|
|
3
|
-
import { m as h } from "./diagnostic-collector-
|
|
1
|
+
import { p } from "./template-registry-CIaC6qBW.js";
|
|
2
|
+
import { b } from "./template-serialization-Cb1ospyK.js";
|
|
3
|
+
import { m as h } from "./diagnostic-collector-CZ8DV6wA.js";
|
|
4
4
|
function c(t) {
|
|
5
5
|
return JSON.parse(JSON.stringify(t));
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const f=require("./template-registry-
|
|
1
|
+
"use strict";const f=require("./template-registry-CKo-bogM.cjs"),T=require("./template-serialization-D4Fofl9c.cjs"),g=require("./diagnostic-collector-DwMJWEHo.cjs");function p(t){return JSON.parse(JSON.stringify(t))}function u(t){return{...t.repeatDataset?{repeat:{dataset:t.repeatDataset}}:{},pages:[{widthMm:4999,heightMm:4999,components:t.components}]}}function y(t){if(!t.id.trim()||!t.name.trim()||!t.revision.trim())throw new Error("Fragment identity, name and revision are required");if(!t.components.length||t.components.length>200)throw new RangeError("A fragment must contain 1–200 components");f.parseReportTemplate({schemaVersion:"1.0",id:t.id,name:t.name,template:u(t)})}function E(t,n,e,a){const r=f.parseReportTemplate(t).template.pages[n];if(!r||!e.length||e.some(o=>!Number.isSafeInteger(o)||!r.components[o]))throw new Error("Select existing components to capture a fragment");const s=[...new Set(e)].map(o=>r.components[o]),l=Math.min(...s.map(o=>o.leftMm)),i=Math.min(...s.map(o=>o.topMm)),m={...a,...t.template.repeat?{repeatDataset:t.template.repeat.dataset}:{},components:p(s).map(o=>({...o,leftMm:o.leftMm-l,topMm:o.topMm-i}))};return y(m),m}function b(t){y(t);const n=new Map;for(const e of T.collectTemplateDatasetBindings(u(t))){const a=n.get(e.dataset)??new Set;for(const r of e.fields)!e.generated.has(r.field)&&!e.summaries.has(r.field)&&a.add(r.field);n.set(e.dataset,a)}return[...n].map(([e,a])=>({dataset:e,fields:[...a]}))}function S(t,n,e){const a=n.replace(/^\$\.template\./,"").replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const s of a.slice(0,-1))r=r[s];r[a[a.length-1]]=e}function F(t,n,e={}){const a=u({...t,components:n});for(const r of T.collectTemplateDatasetBindings(a)){for(const l of r.fields){const i=e.fields?.[r.dataset]?.[l.field];i!==void 0&&S(a,l.path,i)}const s=e.datasets?.[r.dataset];s!==void 0&&S(a,`${r.path}.dataset`,s)}}function h(t){if(!t||typeof t!="object")return;if(Array.isArray(t)){t.forEach(h);return}const n=t;for(const e of["nid","rkey","table","source"])delete n[e];if(n.kind==="list"&&delete n.id,n.meta&&typeof n.meta=="object")for(const e of["fragment","labelSource","record"])delete n.meta[e];Object.values(n).forEach(h)}function D(t){const n=new Set(t.template.pages.flatMap(a=>a.components.map(r=>r.meta?.fragment?.instance)));let e=1;for(;n.has(`fragment-${e}`);)e++;return`fragment-${e}`}function R(t,n,e){const a=e?t.components.flatMap((s,l)=>s.meta?.fragment?.instance===e?[l]:[]):[];if(e&&!a.length)throw new Error("Fragment instance no longer exists");const r=a.map(s=>t.components[s]);if(r.some(s=>s.meta?.fragment?.id!==n.id))throw new Error("An upgrade must use the same fragment identity");return{replacing:a,left:r.length?Math.min(...r.map(s=>s.leftMm)):t.marginLeftMm??0,top:r.length?Math.min(...r.map(s=>s.topMm)):t.marginTopMm??0}}function x(t,n){if(n.some(e=>e.leftMm<0||e.topMm<0||e.leftMm+e.widthMm>t.widthMm+.001||e.topMm+(e.kind==="list"?e.rowHeightMm??7:e.heightMm)>t.heightMm+.001))throw new Error("Fragment exceeds the target page; choose a larger page or adjust its placement")}function k(t,n,e){y(n);const a=f.parseReportTemplate(t),r=a.template.pages[e.pageIndex];if(!r||r.flow)throw new Error("Choose a fixed page before inserting a fragment");const s=R(r,n,e.replaceInstance),l=s.replacing,i=e.leftMm??s.left,m=e.topMm??s.top,o=p(n.components),M=e.replaceInstance??D(a);if(n.repeatDataset&&a.template.repeat?.dataset!==(e.bindings?.datasets?.[n.repeatDataset]??n.repeatDataset))throw new Error("Bind this label fragment to the current record dataset");F(n,o,e.bindings),o.forEach(h),o.forEach((c,d)=>{c.leftMm+=i,c.topMm+=m,c.meta={...c.meta,fragment:{id:n.id,revision:n.revision,instance:M,slot:d}}}),x(r,o);const w=l[0]??r.components.length;return r.components=r.components.filter((c,d)=>!l.includes(d)),r.components.splice(w,0,...o),{document:f.parseReportTemplate(a),componentIndices:o.map((c,d)=>w+d),instance:M}}function C(t,n,e,a){const r=f.parseReportTemplate(t),s=r.template.pages[n];if(!s)throw new Error("Page no longer exists");for(const l of e){const i=s.components[l];if(!i)throw new Error("Component no longer exists");i.kind==="list"?a.target==="header"?I(i,a.style):i.columns.forEach(m=>{m.style=g.mergeComponentStyles(m.style,p(a.style)),a.style.align&&(m.align=a.style.align)}):i.style=g.mergeComponentStyles(i.style,p(a.style))}return f.parseReportTemplate(r)}function I(t,n){if(t.headerStyle=g.mergeComponentStyles(t.headerStyle,p(n)),t.columns.forEach(e=>{e.headerStyle=g.mergeComponentStyles(e.headerStyle,p(n)),n.align&&(e.headerAlign=n.align)}),t.headerGrid)for(const e of t.headerGrid.cells)for(const a of e)a&&(a.style=g.mergeComponentStyles(a.style,p(n)))}exports.applyReportDocumentStyle=C;exports.captureTemplateFragment=E;exports.insertTemplateFragment=k;exports.inspectTemplateFragmentBindings=b;
|