@agile-team/mach-report 2.24.0 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/{ExcelBindingWizard-BV12hGiK.cjs → ExcelBindingWizard-BgJG-T6k.cjs} +1 -1
- package/dist/{ExcelBindingWizard-Cy_lPjWV.js → ExcelBindingWizard-NQ_v396s.js} +3 -3
- package/dist/{ParamEditor-DenKjvKu.cjs → ParamEditor-DEP38mBp.cjs} +1 -1
- package/dist/{ParamEditor-PyOqHzzw.js → ParamEditor-Z-3yodp5.js} +2 -2
- package/dist/{ReportBatchPanel-pQ6d0yqJ.cjs → ReportBatchPanel-D33LjMrA.cjs} +1 -1
- package/dist/{ReportBatchPanel-8EFtMrKk.js → ReportBatchPanel-DG8FV-5X.js} +2 -2
- package/dist/{ReportLabelStudio-HUeo2TsU.js → ReportLabelStudio-BZp23_hA.js} +3 -3
- package/dist/{ReportLabelStudio-B_KF3Zc_.cjs → ReportLabelStudio-Bz-xAayk.cjs} +1 -1
- package/dist/{ReportParamPanel-8xR85nz-.cjs → ReportParamPanel-B27IGJjk.cjs} +1 -1
- package/dist/{ReportParamPanel-DA-YpkvC.js → ReportParamPanel-DGXzBzl2.js} +1 -1
- package/dist/{ReportPreview-_wTJnsG1.js → ReportPreview-CilFAS9U.js} +2392 -2342
- package/dist/ReportPreview-dOOzPts2.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DH8jl9IF.js → ReportTemplateLibrary-DpSGgvFa.js} +1 -1
- package/dist/{ReportTemplateLibrary-CjArKxRG.cjs → ReportTemplateLibrary-uG1gENaW.cjs} +1 -1
- package/dist/{RuleEditor-GDydlEHz.js → RuleEditor-BONALh1Q.js} +2 -3
- package/dist/{RuleEditor-Bmj98oC4.cjs → RuleEditor-bLXiRcxL.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-B554_qk1.cjs → TemplateOutlinePanel-C3nfHuaR.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-DjPqzU9h.js → TemplateOutlinePanel-JGBKeF3e.js} +2 -2
- package/dist/{TemplateReusePanel-D0628OYc.cjs → TemplateReusePanel-BKhgp6kg.cjs} +1 -1
- package/dist/{TemplateReusePanel-DtYbCN7U.js → TemplateReusePanel-DXQUO6nQ.js} +2 -2
- package/dist/{TemplateReviewPanel-CSwvCz3f.cjs → TemplateReviewPanel-5RWFUUEf.cjs} +1 -1
- package/dist/{TemplateReviewPanel-D_FR4ISq.js → TemplateReviewPanel-DhL7Hapy.js} +1 -1
- package/dist/analytics.d.cts +1 -1
- package/dist/analytics.d.ts +1 -1
- package/dist/artifact-integrity.json +98 -98
- package/dist/{assets-B4AJIOTB.cjs → assets-BYdpkTIt.cjs} +1 -1
- package/dist/{assets-D0FbszhB.js → assets-C4MIvzQ4.js} +2 -2
- package/dist/{auto-C3mGqzJ8.cjs → auto-D-eDZa_V.cjs} +1 -1
- package/dist/{auto-BksreoKc.js → auto-umW_ozwr.js} +10 -10
- package/dist/{capabilities-lqDEZSq5.js → capabilities-CN_kSVjO.js} +7 -7
- package/dist/{capabilities-CTwlcl8q.cjs → capabilities-D4nfhcvB.cjs} +1 -1
- package/dist/cell-style-B6Qffrx8.js +37 -0
- package/dist/cell-style-y_uh1pZp.cjs +1 -0
- package/dist/{data-bar-BnGtnJ82.js → data-bar-Bfh54sT4.js} +1 -1
- package/dist/{data-bar-2NLRzOCQ.cjs → data-bar-DzceAVeR.cjs} +1 -1
- package/dist/{designer-BNf7NWd6.js → designer-CCyj5WYS.js} +2254 -2248
- package/dist/designer-Cj7fn4Hh.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +6 -6
- package/dist/designer.d.ts +6 -6
- package/dist/designer.js +1 -1
- package/dist/diagnostic-collector-gB07PHy2.js +392 -0
- package/dist/diagnostic-collector-wASg6Fzs.cjs +1 -0
- package/dist/dom-CXWMmwh-.cjs +1 -0
- package/dist/{dom-C90cTM6Y.js → dom-DxdCMLzs.js} +185 -185
- package/dist/{encoding-DSc9zv2F.js → encoding-CEkBtlUP.js} +2 -2
- package/dist/{encoding-CkziAnZI.cjs → encoding-Cipno7dq.cjs} +1 -1
- package/dist/{font-loader-i7lZbqH_.js → font-loader-D4NLIKJL.js} +1 -1
- package/dist/{font-loader-D-znWNWS.cjs → font-loader-p_SyTvqt.cjs} +1 -1
- package/dist/{grid-strokes-BPiV1WHe.js → grid-strokes-DkZEZvcI.js} +1 -1
- package/dist/{grid-strokes-DYf-6DMl.cjs → grid-strokes-RFMR91jn.cjs} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +137 -137
- package/dist/json-snapshot-DQdkA_At.cjs +2 -0
- package/dist/{json-snapshot-BJWZNryO.js → json-snapshot-x0JpllWL.js} +8 -8
- package/dist/{pdf-DWuq6uxx.cjs → pdf-C060D5UY.cjs} +2 -2
- package/dist/{pdf-0_5XiTCx.js → pdf-DU8HelKd.js} +17 -17
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BQBz2vLG.cjs → plugin-B_k23hut.cjs} +1 -1
- package/dist/{plugin-B1ydqEmS.js → plugin-CttO46hc.js} +1 -1
- package/dist/{prefill-Cuzh1wxf.js → prefill-BkF9Fw_p.js} +2 -2
- package/dist/{prefill-2p9wrpn9.cjs → prefill-BvkuwooY.cjs} +1 -1
- package/dist/{prepared-DAwe8Il2.cjs → prepared-CSywIEAZ.cjs} +1 -1
- package/dist/{prepared-CVbgO9KR.js → prepared-Cyuh61fJ.js} +2 -2
- package/dist/protocol-BwbJNVZl.cjs +1 -0
- package/dist/protocol-DwtxjXzO.js +96 -0
- package/dist/record-bindings-B7djSjNs.cjs +1 -0
- package/dist/{record-bindings-fhav-NLG.js → record-bindings-Cv7lFiof.js} +47 -47
- package/dist/{region-binding-workflow-DWCUgjZl.cjs → region-binding-workflow-COD8nISZ.cjs} +1 -1
- package/dist/{region-binding-workflow-Cm4mqhih.js → region-binding-workflow-D8I4QWRh.js} +2 -2
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{rich-text-layout-YJHtCWQI.js → rich-text-layout-Ch_N0Ubu.js} +1 -1
- package/dist/{rich-text-layout-X9YOz1JD.cjs → rich-text-layout-yJGuThtC.cjs} +1 -1
- package/dist/runtime-BE30icyB.js +227 -0
- package/dist/runtime-DRSuy_SQ.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +1695 -1661
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +8 -8
- package/dist/style.css +1 -1
- package/dist/{template-catalog--yBX169M.cjs → template-catalog-C0riwrx7.cjs} +1 -1
- package/dist/{template-catalog-Bu7s7ReF.js → template-catalog-D_gl93va.js} +3 -3
- package/dist/{template-fragments-5EzVn7bm.cjs → template-fragments-CgzPdFKB.cjs} +1 -1
- package/dist/{template-fragments-Di2vDFnx.js → template-fragments-D94ZZmPc.js} +2 -2
- package/dist/{template-registry-Bnh5aEYf.cjs → template-registry-BMScUmM4.cjs} +1 -1
- package/dist/{template-registry-BCBF2b8j.js → template-registry-DZOtRY7t.js} +10 -10
- package/dist/{textwrap-CmVkhMhx.js → textwrap-BywMBMXM.js} +1 -1
- package/dist/{textwrap-BPFxhpOw.cjs → textwrap-LhJkHWb1.cjs} +1 -1
- package/dist/vue/async.d.cts +4 -4
- package/dist/vue/async.d.ts +4 -4
- package/dist/vue/index.d.cts +6 -6
- package/dist/vue/index.d.ts +6 -6
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +7 -7
- package/dist/{workbook-session-BnPK3T58.cjs → workbook-session-DR2j6Hxm.cjs} +3 -3
- package/dist/{workbook-session-B6P_-5a4.js → workbook-session-SzfILBJJ.js} +106 -107
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx/node.d.cts +30 -1
- package/dist/xlsx/node.d.ts +30 -1
- package/dist/xlsx-node.cjs +42 -42
- package/dist/xlsx-node.js +3908 -3889
- package/dist/xlsx.cjs +2 -2
- package/dist/xlsx.d.cts +2 -2
- package/dist/xlsx.d.ts +2 -2
- package/dist/xlsx.js +151 -151
- package/package.json +1 -1
- package/dist/ReportPreview-CyUXJSVX.cjs +0 -6
- package/dist/designer-DWnZZ_ej.cjs +0 -2
- package/dist/diagnostic-collector-1sqd7DQP.js +0 -355
- package/dist/diagnostic-collector-D3rlvxm3.cjs +0 -1
- package/dist/dom-CxOkm_Sy.cjs +0 -1
- package/dist/json-snapshot-C7QZrRBf.cjs +0 -2
- package/dist/progress-BXzlVbIp.js +0 -29
- package/dist/progress-DJBd9Rb9.cjs +0 -1
- package/dist/protocol-BOri9qJL.js +0 -105
- package/dist/protocol-DD5dHSz-.cjs +0 -1
- package/dist/record-bindings-CAyM5tGg.cjs +0 -1
- package/dist/runtime-BpSAgOw1.js +0 -201
- package/dist/runtime-Cd2UTnwe.cjs +0 -1
|
@@ -139,7 +139,7 @@ function I(t) {
|
|
|
139
139
|
const a = String.fromCharCode(...t.subarray(0, 4));
|
|
140
140
|
if (!["\0\0\0", "true", "OTTO", "wOFF", "wOF2", "ttcf"].includes(a))
|
|
141
141
|
throw new Error("文件内容不是支持的 TTF/OTF/WOFF 字体(可能返回了 JSON 或文本)");
|
|
142
|
-
const { default: r } = await import("./pdf-
|
|
142
|
+
const { default: r } = await import("./pdf-DU8HelKd.js").then((i) => i.f), o = r.create(t);
|
|
143
143
|
if (!Number.isFinite(o.unitsPerEm) || o.unitsPerEm <= 0 || !o.characterSet?.length || !o.numGlyphs)
|
|
144
144
|
throw new Error("字体结构无效或不含可嵌入的单字体;请提供有效的 TTF/OTF/WOFF 文件");
|
|
145
145
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=new Map;let b=0,d={maxFonts:8,maxBytes:64*1024*1024,maxFontBytes:24*1024*1024};function O(){for(;f.size>d.maxFonts||b>d.maxBytes;){const t=f.keys().next().value;b-=f.get(t).byteLength,f.delete(t)}}function W(t){const e={...d,...t};if(!Object.values(e).every(n=>Number.isSafeInteger(n)&&n>0))throw new Error("字体缓存预算应为正整数字节/数量");d=e;for(const[n,a]of f)a.byteLength>d.maxFontBytes&&B(n);O()}function p(){return{fonts:f.size,bytes:b,...d}}function j(t){const e=f.get(t);return e&&(f.delete(t),f.set(t,e)),e}function B(t){const e=f.get(t);e&&(b-=e.byteLength),f.delete(t)}function q(){f.clear(),b=0}function H(t,e){B(t),!(e.byteLength>d.maxBytes||e.byteLength>d.maxFontBytes)&&(f.set(t,e),b+=e.byteLength,O())}const V="mach-report-fonts",u="fonts";function $(){return new Promise((t,e)=>{const n=indexedDB.open(V,1);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(u)||n.result.createObjectStore(u)},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error)})}function M(t){if(t instanceof Uint8Array)return{bytes:t,accessedAt:0};const e=t;return e?.bytes instanceof Uint8Array&&Number.isFinite(e.accessedAt)?e:void 0}async function C(t,e){if(typeof indexedDB>"u")return t;let n;try{return n=await $(),await e(n)}catch{return t}finally{n?.close()}}function G(t){return C(null,e=>new Promise((n,a)=>{const r=e.transaction(u,"readwrite"),o=r.objectStore(u),i=o.get(t);let c=null;i.onsuccess=()=>{const s=M(i.result);s&&s.bytes.byteLength<=p().maxFontBytes?(c=s.bytes,o.put({bytes:s.bytes,accessedAt:Date.now()},t)):i.result!==void 0&&o.delete(t)},r.oncomplete=()=>n(c),r.onerror=()=>a(r.error),r.onabort=()=>a(r.error)}))}function J(t,e,n,a){const r=p(),o=e.filter(s=>s.key!==n);t.delete(n),a.byteLength<=Math.min(r.maxFontBytes,r.maxBytes)&&o.unshift({key:n,bytes:a.byteLength,accessedAt:Date.now()}),o.sort((s,h)=>h.accessedAt-s.accessedAt);let i=0,c=0;for(const s of o){if(c>=r.maxFonts||i+s.bytes>r.maxBytes||s.bytes>r.maxFontBytes){t.delete(s.key);continue}i+=s.bytes,c++,s.key===n&&t.put({bytes:a,accessedAt:s.accessedAt},n)}}function _(t,e){return C(void 0,n=>new Promise((a,r)=>{const o=n.transaction(u,"readwrite"),i=o.objectStore(u),c=i.openCursor(),s=[];c.onsuccess=()=>{const h=c.result;if(!h){J(i,s,t,e);return}const x=M(h.value);x?s.push({key:h.key,bytes:x.bytes.byteLength,accessedAt:x.accessedAt}):h.delete(),h.continue()},o.oncomplete=()=>a(),o.onerror=()=>r(o.error),o.onabort=()=>r(o.error)}))}function D(t){return C(void 0,e=>new Promise((n,a)=>{const r=e.transaction(u,"readwrite"),o=r.objectStore(u);t===void 0?o.clear():o.delete(t),r.oncomplete=()=>n(),r.onerror=()=>a(r.error),r.onabort=()=>a(r.error)}))}let L=0,S=0,v=Promise.resolve();const g=new Map;async function N(t){l.set(t,(l.get(t)??0)+1),B(t),w.delete(t);const e=g.get(t),n=(async()=>{await v,await e,await y.get(t),await D(t)})();g.set(t,n);try{await n}finally{g.get(t)===n&&g.delete(t)}}async function I(){L++,q(),w.clear(),l.clear();const t=v,e=(async()=>{await t,await Promise.all(y.values()),await D()})();v=e.catch(()=>{}),await e}const l=new Map,y=new Map,w=new Map,E=new Set;function k(){!S&&!E.size&&l.clear()}const T=new WeakMap;function K(t){const e=new TextDecoder().decode(t.subarray(0,256));return/^\s*(?:\uFEFF)?\s*<(?:!doctype\s+html|html|head|body)(?:\s|>)/i.test(e)}function R(t){if(t.byteLength===0)throw new Error("字体文件为空");if(K(t))throw new Error("字体 URL 返回 HTML 页面(可能是 SPA 路由回退),不是字体文件")}function Q(t){const e=T.get(t);if(e)return e;const n=(async()=>{const a=String.fromCharCode(...t.subarray(0,4));if(!["\0\0\0","true","OTTO","wOFF","wOF2","ttcf"].includes(a))throw new Error("文件内容不是支持的 TTF/OTF/WOFF 字体(可能返回了 JSON 或文本)");const{default:r}=await Promise.resolve().then(()=>require("./pdf-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=new Map;let b=0,d={maxFonts:8,maxBytes:64*1024*1024,maxFontBytes:24*1024*1024};function O(){for(;f.size>d.maxFonts||b>d.maxBytes;){const t=f.keys().next().value;b-=f.get(t).byteLength,f.delete(t)}}function W(t){const e={...d,...t};if(!Object.values(e).every(n=>Number.isSafeInteger(n)&&n>0))throw new Error("字体缓存预算应为正整数字节/数量");d=e;for(const[n,a]of f)a.byteLength>d.maxFontBytes&&B(n);O()}function p(){return{fonts:f.size,bytes:b,...d}}function j(t){const e=f.get(t);return e&&(f.delete(t),f.set(t,e)),e}function B(t){const e=f.get(t);e&&(b-=e.byteLength),f.delete(t)}function q(){f.clear(),b=0}function H(t,e){B(t),!(e.byteLength>d.maxBytes||e.byteLength>d.maxFontBytes)&&(f.set(t,e),b+=e.byteLength,O())}const V="mach-report-fonts",u="fonts";function $(){return new Promise((t,e)=>{const n=indexedDB.open(V,1);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(u)||n.result.createObjectStore(u)},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error)})}function M(t){if(t instanceof Uint8Array)return{bytes:t,accessedAt:0};const e=t;return e?.bytes instanceof Uint8Array&&Number.isFinite(e.accessedAt)?e:void 0}async function C(t,e){if(typeof indexedDB>"u")return t;let n;try{return n=await $(),await e(n)}catch{return t}finally{n?.close()}}function G(t){return C(null,e=>new Promise((n,a)=>{const r=e.transaction(u,"readwrite"),o=r.objectStore(u),i=o.get(t);let c=null;i.onsuccess=()=>{const s=M(i.result);s&&s.bytes.byteLength<=p().maxFontBytes?(c=s.bytes,o.put({bytes:s.bytes,accessedAt:Date.now()},t)):i.result!==void 0&&o.delete(t)},r.oncomplete=()=>n(c),r.onerror=()=>a(r.error),r.onabort=()=>a(r.error)}))}function J(t,e,n,a){const r=p(),o=e.filter(s=>s.key!==n);t.delete(n),a.byteLength<=Math.min(r.maxFontBytes,r.maxBytes)&&o.unshift({key:n,bytes:a.byteLength,accessedAt:Date.now()}),o.sort((s,h)=>h.accessedAt-s.accessedAt);let i=0,c=0;for(const s of o){if(c>=r.maxFonts||i+s.bytes>r.maxBytes||s.bytes>r.maxFontBytes){t.delete(s.key);continue}i+=s.bytes,c++,s.key===n&&t.put({bytes:a,accessedAt:s.accessedAt},n)}}function _(t,e){return C(void 0,n=>new Promise((a,r)=>{const o=n.transaction(u,"readwrite"),i=o.objectStore(u),c=i.openCursor(),s=[];c.onsuccess=()=>{const h=c.result;if(!h){J(i,s,t,e);return}const x=M(h.value);x?s.push({key:h.key,bytes:x.bytes.byteLength,accessedAt:x.accessedAt}):h.delete(),h.continue()},o.oncomplete=()=>a(),o.onerror=()=>r(o.error),o.onabort=()=>r(o.error)}))}function D(t){return C(void 0,e=>new Promise((n,a)=>{const r=e.transaction(u,"readwrite"),o=r.objectStore(u);t===void 0?o.clear():o.delete(t),r.oncomplete=()=>n(),r.onerror=()=>a(r.error),r.onabort=()=>a(r.error)}))}let L=0,S=0,v=Promise.resolve();const g=new Map;async function N(t){l.set(t,(l.get(t)??0)+1),B(t),w.delete(t);const e=g.get(t),n=(async()=>{await v,await e,await y.get(t),await D(t)})();g.set(t,n);try{await n}finally{g.get(t)===n&&g.delete(t)}}async function I(){L++,q(),w.clear(),l.clear();const t=v,e=(async()=>{await t,await Promise.all(y.values()),await D()})();v=e.catch(()=>{}),await e}const l=new Map,y=new Map,w=new Map,E=new Set;function k(){!S&&!E.size&&l.clear()}const T=new WeakMap;function K(t){const e=new TextDecoder().decode(t.subarray(0,256));return/^\s*(?:\uFEFF)?\s*<(?:!doctype\s+html|html|head|body)(?:\s|>)/i.test(e)}function R(t){if(t.byteLength===0)throw new Error("字体文件为空");if(K(t))throw new Error("字体 URL 返回 HTML 页面(可能是 SPA 路由回退),不是字体文件")}function Q(t){const e=T.get(t);if(e)return e;const n=(async()=>{const a=String.fromCharCode(...t.subarray(0,4));if(!["\0\0\0","true","OTTO","wOFF","wOF2","ttcf"].includes(a))throw new Error("文件内容不是支持的 TTF/OTF/WOFF 字体(可能返回了 JSON 或文本)");const{default:r}=await Promise.resolve().then(()=>require("./pdf-C060D5UY.cjs")).then(i=>i.fontkit_es),o=r.create(t);if(!Number.isFinite(o.unitsPerEm)||o.unitsPerEm<=0||!o.characterSet?.length||!o.numGlyphs)throw new Error("字体结构无效或不含可嵌入的单字体;请提供有效的 TTF/OTF/WOFF 文件")})();return T.set(t,n),n}function A(t,e,n=!1){const a=n?"字体加载超时,请检查网络或字体服务":e instanceof Error?e.message:String(e);return Object.assign(new Error(`PDF 字体 ${JSON.stringify(t)} 加载失败:${a}`),{cause:e})}function P(t,e){if(t>e)throw new Error(`字体文件超过单字体下载预算(${e}字节)`)}async function X(t,e,n){const a=Number(t.headers?.get("content-length"));try{Number.isFinite(a)&&P(a,e)}catch(r){throw t.body?.cancel(r).catch(()=>{}),r}if(!t.body){const r=new Uint8Array(await F(t.arrayBuffer(),n));return P(r.byteLength,e),r}return U(t.body,e,n)}async function U(t,e,n){const a=t.getReader(),r=[];let o=0;try{for(;;){const s=await F(a.read(),n);if(s.done)break;o+=s.value.byteLength,P(o,e),r.push(s.value)}const i=new Uint8Array(o);let c=0;for(const s of r)i.set(s,c),c+=s.byteLength;return i}catch(i){throw a.cancel(i).catch(()=>{}),i}finally{a.releaseLock()}}async function Y(t,e,n){if(t[0]!==31||t[1]!==139)return t;if(typeof DecompressionStream>"u")throw new Error("当前环境不支持 gzip 字体解压,请使用未压缩的字体 URL 或支持 DecompressionStream 的浏览器 / Node 环境");const r=new ReadableStream({start(o){o.enqueue(t),o.close()}}).pipeThrough(new DecompressionStream("gzip"));return U(r,e,n)}async function Z(t){const e=new AbortController;let n=!1;const a=setTimeout(()=>{n=!0,e.abort()},15e3);try{const r=await fetch(t,{signal:e.signal});if(!r.ok)throw new Error(`字体请求返回 HTTP ${r.status}`);if(/text\/html|application\/xhtml\+xml/i.test(r.headers?.get("content-type")??""))throw new Error("字体 URL 返回 HTML 页面(可能是 SPA 路由回退),不是字体文件");const o=p().maxFontBytes,i=await X(r,o,e.signal),c=await Y(i,o,e.signal);return R(c),{bytes:c,fromCache:!1}}catch(r){throw e.abort(),A(t,r,n)}finally{clearTimeout(a)}}async function tt(t){await v,await g.get(t);const e=await G(t);if(e)try{return R(e),{bytes:e,fromCache:!0}}catch{}return Z(t)}function et(t){const e=w.get(t);if(e)return e;const n=tt(t);w.set(t,n),E.add(n);const a=()=>{w.get(t)===n&&w.delete(t),E.delete(n),k()};return n.then(a,a),n}async function nt(t,e,n,a){if((l.get(t)??0)!==n||L!==a)return;H(t,e);const r=y.get(t);if(r){await r;return}const o=_(t,e);y.set(t,o),await o,y.get(t)===o&&y.delete(t)}function m(t){return t.reason??new DOMException("字体加载已取消","AbortError")}function F(t,e){return e?e.aborted?Promise.reject(m(e)):new Promise((n,a)=>{const r=()=>{e.removeEventListener("abort",r),a(m(e))};e.addEventListener("abort",r,{once:!0}),t.then(o=>{e.removeEventListener("abort",r),n(o)},o=>{e.removeEventListener("abort",r),a(o)})}):t}async function rt(t,e,n,a,r){try{return await F(Q(e.bytes),n.signal),e.bytes}catch(o){if(n.signal?.aborted)throw m(n.signal);if((l.get(t)??0)!==a||L!==r)throw A(t,o);if(await N(t),e.fromCache)return await z(t,n);throw A(t,o)}}async function z(t,e={}){if(e.signal?.aborted)throw m(e.signal);const n=l.get(t)??0,a=L,r=j(t);if(r&&!e.strict)return r;const o=r?void 0:et(t);S++;try{const i=r?{bytes:r,fromCache:!0}:await F(o,e.signal),c=e.strict?await rt(t,i,e,n,a):i.bytes;if(e.signal?.aborted)throw m(e.signal);return r||await F(nt(t,c,n,a),e.signal),c}catch(i){if(e.signal?.aborted)throw m(e.signal);if(e.strict)throw i;return null}finally{S--,k()}}exports.clearFontCache=I;exports.configureFontCache=W;exports.getFontCacheStats=p;exports.invalidateFontCache=N;exports.loadFontWithCache=z;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as p, e as g, m as k } from "./diagnostic-collector-gB07PHy2.js";
|
|
2
2
|
const S = ["borderTop", "borderRight", "borderBottom", "borderLeft", "borderColor", "lineColor", "lineWidthPt"];
|
|
3
3
|
function v(r, o) {
|
|
4
4
|
const s = p(o.style), t = s.inner ? [...r.edges] : [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const h=require("./diagnostic-collector-
|
|
1
|
+
"use strict";const h=require("./diagnostic-collector-wASg6Fzs.cjs"),w=["borderTop","borderRight","borderBottom","borderLeft","borderColor","lineColor","lineWidthPt"];function k(r,o){const s=h.resolveBoxBorders(o.style),e=s.inner?[...r.edges]:[];s.top&&e.push({kind:"h",pos:0,from:0,to:o.widthMm}),s.bottom&&e.push({kind:"h",pos:o.heightMm,from:0,to:o.widthMm}),s.left&&e.push({kind:"v",pos:0,from:0,to:o.heightMm}),s.right&&e.push({kind:"v",pos:o.widthMm,from:0,to:o.heightMm});const t=h.resolveStroke(o.style);return e.map(n=>({...n,...t}))}function g(r,o,s){const e=r.get(o);(!e||s.widthPt>e.widthPt)&&r.set(o,s)}function d(r,o,s,e,t,n){const l=s<o.rows.length?o.rows[s].pos:o.rows[o.rows.length-1].pos+o.rows[o.rows.length-1].size;for(let i=e;i<t;i++){const c=o.columns[i];g(r,`h:${s}:${i}`,{kind:"h",pos:l,from:c.pos,to:c.pos+c.size,...n})}}function m(r,o,s,e,t,n){const l=s<o.columns.length?o.columns[s].pos:o.columns[o.columns.length-1].pos+o.columns[o.columns.length-1].size;for(let i=e;i<t;i++){const c=o.rows[i];g(r,`v:${s}:${i}`,{kind:"v",pos:l,from:c.pos,to:c.pos+c.size,...n})}}function p(r,o,s,e){const t=Math.min(o.columns.length,s.ci+(s.cell.colSpan??1)),n=Math.min(o.rows.length,s.ri+(s.cell.rowSpan??1)),l=h.mergeComponentStyles(e,s.cell.style),i=h.resolveBoxBorders(l),c=h.resolveStroke(l);i.top&&d(r,o,s.ri,s.ci,t,c),i.bottom&&d(r,o,n,s.ci,t,c),i.left&&m(r,o,s.ci,s.ri,n,c),i.right&&m(r,o,t,s.ri,n,c)}function v(r){const o=[...r.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.pos-t.pos||e.from-t.from),s=[];for(const e of o){const t=s[s.length-1];t&&t.kind===e.kind&&t.pos===e.pos&&Math.abs(t.to-e.from)<1e-6&&t.color===e.color&&t.widthPt===e.widthPt?t.to=e.to:s.push({...e})}return s}function S(r,o){if(!r.cells.some(({cell:n})=>w.some(l=>n.style?.[l]!==void 0)))return k(r,o);const s=new Map,e=new Set,t=r.columns.length;for(const n of r.cells){p(s,r,n,o.style);const l=Math.min(r.rows.length,n.ri+(n.cell.rowSpan??1)),i=Math.min(t,n.ci+(n.cell.colSpan??1));for(let c=n.ri;c<l;c++)for(let f=n.ci;f<i;f++)e.add(c*t+f)}for(let n=0;n<r.rows.length;n++)for(let l=0;l<t;l++)e.has(n*t+l)||p(s,r,{ri:n,ci:l,cell:{}},o.style);return v(s)}exports.resolveGridStrokes=S;
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./diagnostic-collector-
|
|
2
|
-
`),m=l.length*a;let p=r;s==="middle"?p=r+(i-m)/2:s==="bottom"&&(p=r+i-m),l.forEach((d,u)=>{const f=p+u*a+t.fontSizePx*.8;st(e,d,t,n,f,o),t.underline&&d&<(e,d,t,n,f,o)}),e.textAlign="left"}function st(e,t,n,r,o,i){const c=Array.from(t),s=n.letterSpacingPx??0;if(!s){e.textAlign=n.align==="center"?"center":n.align==="right"?"right":"left";const p=n.align==="center"?r+i/2:n.align==="right"?r+i:r;e.fillText(t,p,o);return}const a=e.measureText(t).width+Math.max(0,c.length-1)*s,l=n.align==="center"?r+(i-a)/2:n.align==="right"?r+i-a:r;e.textAlign="left";let m="";c.forEach((p,d)=>{e.fillText(p,l+e.measureText(m).width+d*s,o),m+=p})}function lt(e,t,n,r,o,i){const c=e.measureText(t).width+Math.max(0,Array.from(t).length-1)*(n.letterSpacingPx??0),s=n.align==="center"?r+(i-c)/2:n.align==="right"?r+i-c:r;e.strokeStyle=n.color,e.lineWidth=Math.max(.5,n.fontSizePx/20),e.beginPath(),e.moveTo(s,o+1),e.lineTo(s+c,o+1),e.stroke()}function _e(e,t,n,r,o){const i=r/72,c=s=>{e.font=`${s.italic?"italic ":""}${s.bold?"bold ":""}${g.resolveFontSize(s,r).fontSizePx}px ${s.fontFamily??o}`,"letterSpacing"in e&&(e.letterSpacing="0px")};it.drawRichText(t,{x:n.x/i,yTop:-n.y/i,width:n.width/i,height:n.height/i},{measure(s,a){return c(a),e.measureText(s).width/i+(a.letterSpacing??0)},draw(s,a,l,m,p){const d=g.resolveFontSize(a,r).fontSizePx,u=-m*i-d*.8;a.backgroundColor&&(e.fillStyle=a.backgroundColor,e.fillRect(l*i,u,p*i,d*g.resolveLineHeight(a))),ve(e,{text:s,fontSizePx:d,bold:!!a.bold,italic:a.italic,underline:a.underline,color:g.resolveTextColor(a),align:"left",lineHeight:g.resolveLineHeight(a),letterSpacingPx:(a.letterSpacing??0)*i},l*i,u,p*i,d,a.fontFamily??o)}})}function L(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}const ct=(e,t)=>(L(t),/^data:image\/(?:png|jpe?g|webp|gif|svg\+xml)[;,]/i.test(e)?new Promise((n,r)=>{const o=new Image,i=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},c=()=>{i(),o.src="",r(t?.reason??new DOMException("The operation was aborted.","AbortError"))};o.onload=()=>{i(),n(o)},o.onerror=()=>{i(),r(new Error("Image could not be decoded for Canvas output."))},t?.addEventListener("abort",c,{once:!0}),o.src=e}):Promise.reject(new TypeError("Canvas imageData must be an image data URL; provide imageLoader for other sources.")));function mt(e,t,n){return L(n),n?new Promise((r,o)=>{const i=()=>o(n.reason??new DOMException("The operation was aborted.","AbortError"));n.addEventListener("abort",i,{once:!0}),Promise.resolve().then(()=>e(t,n)).then(r,o).finally(()=>n.removeEventListener("abort",i))}):e(t)}function*Me(e){function*t(n,r,o,i){if(i.has(n))throw new TypeError("Cyclic grid children cannot be rendered.");g.isImageBackedComponent(n)&&(yield{component:n,componentIndex:r,componentPath:o});const c=new Set(i).add(n);for(const[s,a]of(n.grid?.cells??[]).entries())for(const[l,m]of a.entries())for(const[p,d]of(m?.children??[]).entries())yield*t(d,r,[...o,s,l,p],c)}for(const[n,r]of e.components.entries())yield*t(r,n,[],new Set)}async function dt(e,t,n){const r=new Map;for(const{component:o}of Me(e))!g.isImageBackedComponent(o)||r.has(o.imageData)||r.set(o.imageData,await mt(t,o.imageData,n));return L(n),r}function pt(e,t,n,r,o,i){const c=t,s=c.naturalWidth??c.width??o,a=c.naturalHeight??c.height??i;if(s<=0||a<=0)throw new RangeError("Decoded Canvas image dimensions must be positive.");const l=Math.min(o/s,i/a),m=s*l,p=a*l;e.drawImage(t,n+(o-m)/2,r+(i-p)/2,m,p)}function je(e){return B.createPageWindowIndex(e.pageHeightsPx,e.gapPx).window(e.viewportHeightPx,e.scrollTopPx,e.overscan)}const Re=96/25.4;function de(e,t=96){const n=t/96*Re;return{widthPx:Math.max(1,Math.round(e.pageWidthMm*n)),heightPx:Math.max(1,Math.round(e.pageHeightMm*n))}}function Be(e,t,n,r=64e6){if(!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)throw new RangeError("Canvas dpr and dpi must be positive finite numbers.");if(!Number.isFinite(r)||r<=0)throw new RangeError("maxCanvasPixels must be positive and finite.");const o=de(e,n),i=Math.round(o.widthPx*t),c=Math.round(o.heightPx*t);if(!Number.isSafeInteger(i)||!Number.isSafeInteger(c)||i*c>r)throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");return{width:i,height:c}}function ze(e,t,n,r){const o=document.createElement("canvas"),{widthPx:i,heightPx:c}=de(e,n),s=Be(e,t,n,r);o.width=s.width,o.height=s.height,o.style.width=`${i}px`,o.style.height=`${c}px`;const a=o.getContext("2d");if(!a)throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");return a.scale(t,t),a.fillStyle="#ffffff",a.fillRect(0,0,i,c),{canvas:o,ctx:a}}function gt(e,t=96){return g.resolveFontSize(e,t).fontSizePx}function ut(e,t,n,r,o,i,c){for(const s of at.resolveGridStrokes(t,n))e.strokeStyle=s.color,e.lineWidth=g.ptToPx(s.widthPt,c),e.beginPath(),s.kind==="v"?(e.moveTo(r+s.pos*i,o+s.from*i),e.lineTo(r+s.pos*i,o+s.to*i)):(e.moveTo(r+s.from*i,o+s.pos*i),e.lineTo(r+s.to*i,o+s.pos*i)),e.stroke()}function ft(e,t,n,r,o,i){e.beginPath(),t.top&&(e.moveTo(n,r),e.lineTo(n+o,r)),t.right&&(e.moveTo(n+o,r),e.lineTo(n+o,r+i)),t.bottom&&(e.moveTo(n+o,r+i),e.lineTo(n,r+i)),t.left&&(e.moveTo(n,r+i),e.lineTo(n,r)),e.stroke()}function ht(e,t,n,r,o,i,c,s,a,l,m,p){const d=g.resolveGridLayout(t,i/s,c/s);for(const u of d.cells){const f=u.cell.style?.backgroundColor??n.style?.backgroundColor;f&&(e.fillStyle=f,e.fillRect(r+u.xMm*s,o+u.yMm*s,u.widthMm*s,u.heightMm*s))}ut(e,d,n,r,o,s,a);for(const u of d.cells)wt(e,u,n,r,o,s,a,l,m,p)}function wt(e,t,n,r,o,i,c,s,a,l){const m=n.grid?.paddingMm??.5,p=t.cell.text??"",d=g.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./diagnostic-collector-wASg6Fzs.cjs"),U=require("./record-bindings-B7djSjNs.cjs"),v=require("./template-registry-BMScUmM4.cjs"),ye=require("./dataset-IrlXbUvh.cjs"),j=require("./textwrap-LhJkHWb1.cjs"),w=require("./json-snapshot-DQdkA_At.cjs"),J=require("./dom-CXWMmwh-.cjs"),ot=require("./data-bar-DzceAVeR.cjs"),it=require("./rich-text-layout-yJGuThtC.cjs"),_=require("./capabilities-D4nfhcvB.cjs"),ee=require("./assets-BYdpkTIt.cjs"),at=require("./grid-strokes-RFMR91jn.cjs"),B=require("./prefill-BvkuwooY.cjs"),A=require("./param-validation-C-8sRJLq.cjs"),te=require("./computed-DK6BruFz.cjs"),ne=require("./template-catalog-C0riwrx7.cjs"),me=require("./template-fragments-CgzPdFKB.cjs"),be=require("./template-serialization-CqQY4zDg.cjs");function ve(e,t,n,r,o,i,c,s="top"){e.font=`${t.italic?"italic ":""}${t.bold?"bold ":""}${t.fontSizePx}px ${c}`,"letterSpacing"in e&&(e.letterSpacing="0px"),e.fillStyle=t.color,e.textBaseline="alphabetic";const a=t.fontSizePx*t.lineHeight,l=t.text===""?[""]:t.text.split(`
|
|
2
|
+
`),m=l.length*a;let p=r;s==="middle"?p=r+(i-m)/2:s==="bottom"&&(p=r+i-m),l.forEach((d,u)=>{const f=p+u*a+t.fontSizePx*.8;st(e,d,t,n,f,o),t.underline&&d&<(e,d,t,n,f,o)}),e.textAlign="left"}function st(e,t,n,r,o,i){const c=Array.from(t),s=n.letterSpacingPx??0;if(!s){e.textAlign=n.align==="center"?"center":n.align==="right"?"right":"left";const p=n.align==="center"?r+i/2:n.align==="right"?r+i:r;e.fillText(t,p,o);return}const a=e.measureText(t).width+Math.max(0,c.length-1)*s,l=n.align==="center"?r+(i-a)/2:n.align==="right"?r+i-a:r;e.textAlign="left";let m="";c.forEach((p,d)=>{e.fillText(p,l+e.measureText(m).width+d*s,o),m+=p})}function lt(e,t,n,r,o,i){const c=e.measureText(t).width+Math.max(0,Array.from(t).length-1)*(n.letterSpacingPx??0),s=n.align==="center"?r+(i-c)/2:n.align==="right"?r+i-c:r;e.strokeStyle=n.color,e.lineWidth=Math.max(.5,n.fontSizePx/20),e.beginPath(),e.moveTo(s,o+1),e.lineTo(s+c,o+1),e.stroke()}function _e(e,t,n,r,o){const i=r/72,c=s=>{e.font=`${s.italic?"italic ":""}${s.bold?"bold ":""}${g.resolveFontSize(s,r).fontSizePx}px ${s.fontFamily??o}`,"letterSpacing"in e&&(e.letterSpacing="0px")};it.drawRichText(t,{x:n.x/i,yTop:-n.y/i,width:n.width/i,height:n.height/i},{measure(s,a){return c(a),e.measureText(s).width/i+(a.letterSpacing??0)},draw(s,a,l,m,p){const d=g.resolveFontSize(a,r).fontSizePx,u=-m*i-d*.8;a.backgroundColor&&(e.fillStyle=a.backgroundColor,e.fillRect(l*i,u,p*i,d*g.resolveLineHeight(a))),ve(e,{text:s,fontSizePx:d,bold:!!a.bold,italic:a.italic,underline:a.underline,color:g.resolveTextColor(a),align:"left",lineHeight:g.resolveLineHeight(a),letterSpacingPx:(a.letterSpacing??0)*i},l*i,u,p*i,d,a.fontFamily??o)}})}function L(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}const ct=(e,t)=>(L(t),/^data:image\/(?:png|jpe?g|webp|gif|svg\+xml)[;,]/i.test(e)?new Promise((n,r)=>{const o=new Image,i=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},c=()=>{i(),o.src="",r(t?.reason??new DOMException("The operation was aborted.","AbortError"))};o.onload=()=>{i(),n(o)},o.onerror=()=>{i(),r(new Error("Image could not be decoded for Canvas output."))},t?.addEventListener("abort",c,{once:!0}),o.src=e}):Promise.reject(new TypeError("Canvas imageData must be an image data URL; provide imageLoader for other sources.")));function mt(e,t,n){return L(n),n?new Promise((r,o)=>{const i=()=>o(n.reason??new DOMException("The operation was aborted.","AbortError"));n.addEventListener("abort",i,{once:!0}),Promise.resolve().then(()=>e(t,n)).then(r,o).finally(()=>n.removeEventListener("abort",i))}):e(t)}function*Me(e){function*t(n,r,o,i){if(i.has(n))throw new TypeError("Cyclic grid children cannot be rendered.");g.isImageBackedComponent(n)&&(yield{component:n,componentIndex:r,componentPath:o});const c=new Set(i).add(n);for(const[s,a]of(n.grid?.cells??[]).entries())for(const[l,m]of a.entries())for(const[p,d]of(m?.children??[]).entries())yield*t(d,r,[...o,s,l,p],c)}for(const[n,r]of e.components.entries())yield*t(r,n,[],new Set)}async function dt(e,t,n){const r=new Map;for(const{component:o}of Me(e))!g.isImageBackedComponent(o)||r.has(o.imageData)||r.set(o.imageData,await mt(t,o.imageData,n));return L(n),r}function pt(e,t,n,r,o,i){const c=t,s=c.naturalWidth??c.width??o,a=c.naturalHeight??c.height??i;if(s<=0||a<=0)throw new RangeError("Decoded Canvas image dimensions must be positive.");const l=Math.min(o/s,i/a),m=s*l,p=a*l;e.drawImage(t,n+(o-m)/2,r+(i-p)/2,m,p)}function je(e){return B.createPageWindowIndex(e.pageHeightsPx,e.gapPx).window(e.viewportHeightPx,e.scrollTopPx,e.overscan)}const Re=96/25.4;function de(e,t=96){const n=t/96*Re;return{widthPx:Math.max(1,Math.round(e.pageWidthMm*n)),heightPx:Math.max(1,Math.round(e.pageHeightMm*n))}}function Be(e,t,n,r=64e6){if(!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)throw new RangeError("Canvas dpr and dpi must be positive finite numbers.");if(!Number.isFinite(r)||r<=0)throw new RangeError("maxCanvasPixels must be positive and finite.");const o=de(e,n),i=Math.round(o.widthPx*t),c=Math.round(o.heightPx*t);if(!Number.isSafeInteger(i)||!Number.isSafeInteger(c)||i*c>r)throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");return{width:i,height:c}}function ze(e,t,n,r){const o=document.createElement("canvas"),{widthPx:i,heightPx:c}=de(e,n),s=Be(e,t,n,r);o.width=s.width,o.height=s.height,o.style.width=`${i}px`,o.style.height=`${c}px`;const a=o.getContext("2d");if(!a)throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");return a.scale(t,t),a.fillStyle="#ffffff",a.fillRect(0,0,i,c),{canvas:o,ctx:a}}function gt(e,t=96){return g.resolveFontSize(e,t).fontSizePx}function ut(e,t,n,r,o,i,c){for(const s of at.resolveGridStrokes(t,n))e.strokeStyle=s.color,e.lineWidth=g.ptToPx(s.widthPt,c),e.beginPath(),s.kind==="v"?(e.moveTo(r+s.pos*i,o+s.from*i),e.lineTo(r+s.pos*i,o+s.to*i)):(e.moveTo(r+s.from*i,o+s.pos*i),e.lineTo(r+s.to*i,o+s.pos*i)),e.stroke()}function ft(e,t,n,r,o,i){e.beginPath(),t.top&&(e.moveTo(n,r),e.lineTo(n+o,r)),t.right&&(e.moveTo(n+o,r),e.lineTo(n+o,r+i)),t.bottom&&(e.moveTo(n+o,r+i),e.lineTo(n,r+i)),t.left&&(e.moveTo(n,r+i),e.lineTo(n,r)),e.stroke()}function ht(e,t,n,r,o,i,c,s,a,l,m,p){const d=g.resolveGridLayout(t,i/s,c/s);for(const u of d.cells){const f=u.cell.style?.backgroundColor??n.style?.backgroundColor;f&&(e.fillStyle=f,e.fillRect(r+u.xMm*s,o+u.yMm*s,u.widthMm*s,u.heightMm*s))}ut(e,d,n,r,o,s,a);for(const u of d.cells)wt(e,u,n,r,o,s,a,l,m,p)}function wt(e,t,n,r,o,i,c,s,a,l){const m=n.grid?.paddingMm??.5,p=t.cell.text??"",d=g.resolveGridCellStyle(n.style,t.cell),u=g.resolveFontSize(d,c),f=t.cell.indentMm??0,x=Math.max(0,t.widthMm-2*m-f),C=j.wrapText(p,x,{fontSizePt:u.fontSizePt,bold:d.bold,italic:d.italic,fontFamily:d.fontFamily??s,letterSpacingPt:d.letterSpacing},a).join(`
|
|
3
3
|
`),M={x:r+(t.xMm+m+f)*i,y:o+(t.yMm+m)*i,width:x*i,height:Math.max(0,t.heightMm-2*m)*i};e.save(),e.beginPath(),e.rect(M.x,M.y,M.width,M.height),e.clip(),t.cell.richParagraphs?.length?_e(e,{...n,richParagraphs:t.cell.richParagraphs,style:{verticalAlign:"middle",...d}},M,c,s):ve(e,{text:C,fontSizePx:u.fontSizePx,bold:d.bold??!1,italic:d.italic,underline:d.underline,color:g.resolveTextColor(d,g.DEFAULT_TEXT_COLOR),align:d.align??"left",lineHeight:g.resolveLineHeight(d),letterSpacingPx:g.ptToPx(d.letterSpacing??0,c)},r+(t.xMm+m+f)*i,o+(t.yMm+m)*i,x*i,Math.max(0,t.heightMm-2*m)*i,d.fontFamily??s,d.verticalAlign??"middle");for(const P of t.cell.children??[])pe(e,{...P,leftMm:P.leftMm+M.x/i,topMm:P.topMm+M.y/i},i,c,s,a,l);e.restore();const E=ot.dataBarBox(t.cell.dataBar,t.widthMm,t.heightMm,m);E&&(e.save(),e.globalAlpha*=.35,e.fillStyle=E.color,e.fillRect(r+(t.xMm+E.x)*i,o+(t.yMm+E.y)*i,E.width*i,E.height*i),e.restore())}function yt(e,t,n,r,o,i,c,s,a){const l=t.style??{},m=g.resolveFontSize(l,c);if(g.isRichText(t)){_e(e,t,{x:n,y:r,width:o,height:i},c,s);return}const p=t.lines?.length?t.lines.join(`
|
|
4
4
|
`):j.wrapText(t.text??"",t.widthMm,{fontSizePt:m.fontSizePt,bold:l.bold,italic:l.italic,fontFamily:l.fontFamily??s,letterSpacingPt:l.letterSpacing},a).join(`
|
|
5
5
|
`);ve(e,{text:p,fontSizePx:m.fontSizePx,bold:l.bold??!1,italic:l.italic,underline:l.underline,color:g.resolveTextColor(l),align:l.align??"left",lineHeight:g.resolveLineHeight(l),letterSpacingPx:g.ptToPx(l.letterSpacing??0,c)},n,r,o,i,l.fontFamily??s,l.verticalAlign)}function pe(e,t,n,r,o,i,c){const s=t.leftMm*n,a=t.topMm*n,l=t.widthMm*n,m=t.heightMm*n,p=t.style??{};if(g.isImageBackedComponent(t)){const d=c?.get(t.imageData);d?pt(e,d,s,a,l,m):Ae(e,t,s,a,l,m);return}if(t.grid){ht(e,t.grid,t,s,a,l,m,n,r,o,i,c);return}switch(t.kind){case"text":{yt(e,t,s,a,l,m,r,o,i);break}case"rect":{const d=g.resolveStroke(p),u=g.resolveBoxBorders(p);p.backgroundColor&&(e.fillStyle=p.backgroundColor,e.fillRect(s,a,l,m)),u.inner&&(e.strokeStyle=d.color,e.lineWidth=g.ptToPx(d.widthPt,r),ft(e,u,s,a,l,m));break}case"line":{const d=g.resolveStroke({...p,borderColor:p.lineColor??p.borderColor});e.strokeStyle=d.color,e.lineWidth=g.ptToPx(d.widthPt,r),e.beginPath();const u=t.lineDirection==="up"?a+m:t.lineDirection==="down"?a:a+m/2,f=t.lineDirection==="up"?a:t.lineDirection==="down"?a+m:a+m/2;e.moveTo(s,u),e.lineTo(s+l,f),e.stroke();break}case"ellipse":{const d=g.resolveStroke(p);e.strokeStyle=d.color,e.lineWidth=g.ptToPx(d.widthPt,r),p.backgroundColor&&(e.fillStyle=p.backgroundColor,e.beginPath(),e.ellipse(s+l/2,a+m/2,l/2,m/2,0,0,Math.PI*2),e.fill()),e.beginPath(),e.ellipse(s+l/2,a+m/2,l/2,m/2,0,0,Math.PI*2),e.stroke();break}default:Ae(e,t,s,a,l,m);break}}function Ae(e,t,n,r,o,i){e.save(),e.strokeStyle="#94a3b8",e.strokeRect(n,r,o,i),e.fillStyle="#64748b",e.font="12px sans-serif",e.fillText(t.fallbackText??`[${t.kind}]`,n+3,r+14),e.restore()}async function bt(e,t={}){if(typeof document>"u")throw new Error("renderPlanToImages 需要浏览器环境(SSR/Node 请在客户端钩子中调用)");const{format:n="png",quality:r=.92,...o}=t;if(n!=="png"&&n!=="jpeg")throw new TypeError("Image format must be png or jpeg.");if(!Number.isFinite(r)||r<0||r>1)throw new RangeError("Image quality must be between 0 and 1.");L(t.signal);const i=await ee.resolvePlanAssets(e,{...t,format:"canvas"});e=i.plan;const c=[...i.diagnostics,..._.reportOutputDiagnostics(e,"canvas",t)],s=n==="jpeg"?"image/jpeg":"image/png",a=[],l=Math.min(e.pages.length-1,t.end??e.pages.length-1);for(let m=Math.max(0,t.start??0);m<=l;m++){L(t.signal);const p=await He(e.pages[m],m,o,c);try{a.push(await vt(p,s,r,t.signal))}finally{p.width=0,p.height=0}await g.outputCheckpoint(t,a.length,l-Math.max(0,t.start??0)+1)}return L(t.signal),{blobs:a,diagnostics:c}}function vt(e,t,n,r){return L(r),new Promise((o,i)=>{const c=()=>i(r?.reason??new DOMException("The operation was aborted.","AbortError"));r?.addEventListener("abort",c,{once:!0});try{e.toBlob(s=>{r?.removeEventListener("abort",c),s?o(s):i(new Error("Canvas encoding failed; no empty image was emitted."))},t,n)}catch(s){r?.removeEventListener("abort",c),i(s)}})}function Mt(e,t={}){if(L(t.signal),typeof document>"u")throw new Error("renderPlanToCanvas 需要浏览器环境(SSR 请在客户端钩子中调用)");const n=t.dpr??(typeof devicePixelRatio=="number"?devicePixelRatio:1),r=t.dpi??96,o=r/96*Re,i=t.fontFamily??g.DEFAULT_FONT_FAMILY,c=t.measurer??j.heuristicMeasurer,s=Math.max(0,t.start??0),a=Math.min(e.pages.length-1,t.end??e.pages.length-1),l=[],m=_.reportOutputDiagnostics(e,"canvas",t),p=Rt(e,s,a);for(const d of p)_.notifyOutputDiagnostic(d,t),m.push(d);if(t.fidelity==="strict"&&p.length)throw new _.OutputFidelityError(m);for(let d=s;d<=a;d++){L(t.signal);const u=e.pages[d],{canvas:f,ctx:x}=ze(u,n,r,t.maxCanvasPixels);for(const C of u.components)pe(x,C,o,r,i,c);l.push(f)}return{canvases:l,diagnostics:m}}function Rt(e,t,n){return n<t?[]:e.pages.slice(t,n+1).flatMap((r,o)=>[...Me(r)].map(({component:i,componentIndex:c,componentPath:s})=>({code:"async-image-required",severity:"warning",format:"canvas",pageIndex:t+o,componentIndex:c,componentPath:s,kind:i.kind,nid:i.nid,message:"Use renderPlanToCanvasAsync or renderPlanToImages to decode and include images."})))}async function Et(e,t={}){if(typeof document>"u")throw new Error("renderPlanToCanvasAsync 需要浏览器环境(Node 请使用 PDF 或 XLSX 输出)");L(t.signal);const n=await ee.resolvePlanAssets(e,{...t,format:"canvas"});e=n.plan;const r=[...n.diagnostics,..._.reportOutputDiagnostics(e,"canvas",t)],o=[],i=Math.min(e.pages.length-1,t.end??e.pages.length-1);for(let c=Math.max(0,t.start??0);c<=i;c++)o.push(await He(e.pages[c],c,t,r));return{canvases:o,diagnostics:r}}async function He(e,t,n,r){const o=n.dpr??(typeof devicePixelRatio=="number"?devicePixelRatio:1),i=n.dpi??96,c=n.fontFamily??g.DEFAULT_FONT_FAMILY,s=await Ue(e,t,n,r);L(n.signal);const{canvas:a,ctx:l}=ze(e,o,i,n.maxCanvasPixels);for(const m of e.components)pe(l,m,i/25.4,i,c,n.measurer??j.heuristicMeasurer,s);return a}async function Ue(e,t,n,r){const o=n.imageLoader??ct;return dt(e,async(i,c)=>{try{return await o(i,c)}catch(s){if(c?.aborted)throw s;const a=[...Me(e)].find(({component:u})=>u.imageData===i),{component:l,componentIndex:m,componentPath:p}=a,d={code:"image-decode-failed",severity:"warning",format:"canvas",pageIndex:t,componentIndex:m,componentPath:p,kind:l.kind,nid:l.nid,message:"Image decoding failed; raster output was cancelled instead of omitting the image."};throw r.push(d),_.notifyOutputDiagnostic(d,n),s}},n.signal)}function Tt(e,t={}){const n=t.dpr??(typeof devicePixelRatio=="number"?devicePixelRatio:1),r=t.dpi??96,o=r/96*Re,i=t.fontFamily??g.DEFAULT_FONT_FAMILY,c=t.measurer??j.heuristicMeasurer,s=t.overscan??1,a=t.gapPx??18,l=t.pagesPerFrame??1,m=e.pages.map(y=>y.pageHeightMm*o),p=Math.max(1,...e.pages.map(y=>y.pageWidthMm*o)),d={start:0,end:-1};let u=null,f=null,x=null,C=null,M=[],E=0,P=[],G=0,z=new AbortController;const xe=[];function et(){const y=u;y.innerHTML="",f=document.createElement("div"),f.style.cssText=`width:${p}px;margin:0 auto;`,x=document.createElement("div"),C=document.createElement("div"),f.appendChild(x),M=[];const O=Math.min(e.pages.length,3+s*2);for(let q=0;q<O;q++){const T=document.createElement("div");T.style.cssText=`margin:0 auto ${a}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`,f.appendChild(T),M.push(T)}f.appendChild(C),y.appendChild(f)}async function tt(y,O){const q=G,T=await ee.resolvePlanAssets(e,{...t,signal:z.signal,format:"canvas",start:O,end:O});xe.push(...T.diagnostics);const $=T.plan.pages[O],ae=await Ue($,O,{...t,signal:z.signal},xe);if(q!==G||!u)return;const{widthPx:fe,heightPx:he}=de($,r);let H=y.firstElementChild;(!H||H.tagName!=="CANVAS")&&(H=document.createElement("canvas"),y.innerHTML="",y.appendChild(H));const Oe=Be($,n,r,t.maxCanvasPixels);H.width=Oe.width,H.height=Oe.height,H.style.width=`${fe}px`,H.style.height=`${he}px`;const K=H.getContext("2d");if(K){K.setTransform(1,0,0,1,0,0),K.scale(n,n),K.fillStyle="#ffffff",K.fillRect(0,0,fe,he);for(const rt of $.components)pe(K,rt,o,r,i,c,ae);H.dataset.canvasPage=String(O),y.style.height=`${he}px`,y.style.width=`${fe}px`}}function nt(y){G++,d.start=y.start,d.end=y.end,x.style.height=`${y.start*a+m.slice(0,y.start).reduce((T,$)=>T+$,0)}px`;const O=e.pages.length-1-y.end;C.style.height=`${O*a+m.slice(y.end+1).reduce((T,$)=>T+$,0)}px`;const q=y.end-y.start+1;M.forEach((T,$)=>{if($<q){T.style.display="";const ae=y.start+$;T.style.height=`${m[ae]??0}px`}else T.style.display="none"}),P=[];for(let T=y.start;T<=y.end;T++){const $=M[T-y.start];if(!$)continue;$.firstElementChild?.dataset?.canvasPage!==String(T)&&P.push(T)}ue()}function ue(){E||P.length===0||(E=requestAnimationFrame(()=>{E=0;let y=Math.max(1,l);for(;P.length>0&&y-- >0;){const O=P.shift(),q=M[O-d.start];q&&tt(q,O).catch(()=>{})}P.length>0&&ue()}))}function oe(){E||(E=requestAnimationFrame(()=>{E=0;const y=u,O=je({pageHeightsPx:m,viewportHeightPx:y.clientHeight,scrollTopPx:y.scrollTop,overscan:s,gapPx:a});O.start!==d.start||O.end!==d.end?nt(O):ue()}))}let ie=null;return{attach(y){if(typeof document>"u")throw new Error("createCanvasPager 需要浏览器环境(SSR 请在客户端钩子中调用 attach)");L(t.signal),z=new AbortController,t.signal?.addEventListener("abort",Pe,{once:!0}),_.reportOutputDiagnostics(e,"canvas",t),u=y,et(),y.addEventListener("scroll",oe,{passive:!0}),typeof ResizeObserver<"u"&&(ie=new ResizeObserver(()=>oe()),ie.observe(y)),oe()},destroy(){G++,z.abort(),t.signal?.removeEventListener("abort",Pe),E&&cancelAnimationFrame(E),E=0,ie?.disconnect(),ie=null,u?.removeEventListener("scroll",oe),P=[],f?.remove(),u=null},window(){return{...d}}};function Pe(){z.abort(t.signal?.reason)}}function Ee(e,t,n){let r,o;if(typeof e=="string"){const i=g.PAPER_SIZES[e];if(!i)throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(g.PAPER_SIZES).join("/")})`);r=i.widthMm,o=i.heightMm}else typeof e=="number"?(r=e,o=t??297):(r=e.widthMm,o=e.heightMm);return n?{widthMm:o,heightMm:r}:{widthMm:r,heightMm:o}}class qe{constructor(){this.pages=[],this.pending=null,this.templateParams=void 0}repeat(t){return this.templateRepeat=t,this}params(t){return this.templateParams=t,this}page(t="a4",n={},r){this.collect();const i=r!=null&&!("margins"in r)&&!("landscape"in r)&&("marginTopMm"in r||"marginBottomMm"in r||"marginLeftMm"in r||"marginRightMm"in r)?{margins:r}:typeof n=="number"?r??{}:n,{widthMm:c,heightMm:s}=Ee(t,typeof n=="number"?n:void 0,i.landscape),a=i.margins??{};return this.pending=new Ve(this,{widthMm:c,heightMm:s,marginTopMm:a.marginTopMm??10,marginBottomMm:a.marginBottomMm??10,marginLeftMm:a.marginLeftMm??10,marginRightMm:a.marginRightMm??10}),this.pending}collect(){this.pending&&(this.pages.push(this.pending.buildPage()),this.pending=null)}build(){if(this.collect(),this.pages.length===0)throw new Error("模板至少需要一页:先调用 .page() 添加内容");return{...this.templateParams?{params:this.templateParams}:{},...this.templateRepeat?{repeat:this.templateRepeat}:{},pages:this.pages}}}class Ve{constructor(t,n){this.parent=t,this.page=n,this.components=[]}text(t,n={},r={}){return this.components.push({kind:"text",leftMm:n.leftMm??0,topMm:n.topMm??0,widthMm:n.widthMm??60,heightMm:n.heightMm??8,text:t,style:r}),this}list(t,n,r,o={}){return this.components.push({kind:"list",leftMm:n.leftMm??10,topMm:n.topMm??30,widthMm:n.widthMm??180,dataset:t,columns:r,...o}),this}rect(t,n={}){return this.components.push({kind:"rect",...t,style:n}),this}line(t,n,r,o={}){return this.components.push({kind:"line",leftMm:t,topMm:n,widthMm:r,heightMm:.5,style:o}),this}barcode(t,n){return this.components.push({kind:"barcode",leftMm:n.leftMm??0,topMm:n.topMm??0,widthMm:n.widthMm??40,heightMm:n.heightMm??12,fallbackText:t}),this}qrcode(t,n,r,o){return this.components.push({kind:"qrcode",leftMm:r,topMm:o,widthMm:n,heightMm:n,fallbackText:t}),this}buildPage(){return{...this.page,components:this.components}}done(){return this.parent}build(){return this.done().build()}}function St(){return new qe}function Ct(e,t={}){return ye.validateDatasetRows([],e),e.fields.map(n=>({field:n.field,header:`${n.label??n.field}${n.unit?` (${n.unit})`:""}`,semanticRole:n.semanticRole??(n.type==="number"||n.type==="decimal"?"measure":n.type==="date"?"date":n.enum?"dimension":"text"),...n.format?{format:{...n.format}}:{},...t[n.field]}))}function I(e,t,n=!1){if(!Number.isFinite(e)||(n?e<0:e<=0))throw new Error(`${t} 必须是有限${n?"非负":"正"}数`)}function le(e,t,n){if(e!==void 0&&!["left","center","right","justify",...n?["auto"]:[]].includes(e))throw new Error(`${t} 必须是 left/center/right/justify${n?"/auto":""}`)}function xt(e){const t=e.layout??"page";if(t!=="page"&&t!=="wide")throw new Error("layout 必须是 page 或 wide");if(t==="wide"&&(e.paper!==void 0||e.landscape!==void 0))throw new Error('宽表布局不能同时指定 paper 或 landscape;标准纸型请使用 layout: "page"');if(t!=="wide"&&e.columnWidthMm!==void 0)throw new Error('columnWidthMm 仅适用于 layout: "wide"');const n=e.columnWidthMm??30;return I(n,"columnWidthMm"),{layout:t,columnWidthMm:n}}function Pt(e){const t=e.paper===void 0?"a4":e.paper;if(typeof t!="string"&&(typeof t!="object"||t===null)||e.landscape!==void 0&&typeof e.landscape!="boolean")throw new Error("paper 必须是纸张预设名或 { widthMm, heightMm } 对象,landscape 必须是布尔值");if(typeof t=="string"&&!Object.prototype.hasOwnProperty.call(g.PAPER_SIZES,t))throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(g.PAPER_SIZES).join("/")})`);const n=Ee(t,void 0,e.landscape),r=n.widthMm,o=n.heightMm;return I(r,"纸张 widthMm"),I(o,"纸张 heightMm"),{widthMm:r,heightMm:o}}function Ot(e){if(e.margins!==void 0&&(!e.margins||typeof e.margins!="object"||Array.isArray(e.margins)))throw new Error("margins 必须是页边距对象");const t=e.margins??{},n={marginTopMm:t.marginTopMm===void 0?10:t.marginTopMm,marginBottomMm:t.marginBottomMm===void 0?10:t.marginBottomMm,marginLeftMm:t.marginLeftMm===void 0?10:t.marginLeftMm,marginRightMm:t.marginRightMm===void 0?10:t.marginRightMm};for(const[r,o]of Object.entries(n))I(o,r,!0);return n}function At(e,t){const n=e.dataset===void 0?"detail":e.dataset;if(typeof n!="string"||!n.trim())throw new Error("dataset 必须是非空字符串");if(e.title!==void 0&&typeof e.title!="string")throw new Error("title 必须是字符串");const r=e.titleHeightMm===void 0?10:e.titleHeightMm,o=e.titleGapMm===void 0?4:e.titleGapMm;I(r,"titleHeightMm"),I(o,"titleGapMm",!0);const i=e.title!==void 0&&e.title.length>0,c=i?r+o:0;if(c>=t)throw new Error("标题高度与间距占满页面,必须为表格保留可用高度");return{dataset:n,titleHeightMm:r,hasTitle:i,titleSpaceMm:c}}function $t(e){if(e.listOptions!==void 0&&(!e.listOptions||typeof e.listOptions!="object"||Array.isArray(e.listOptions)))throw new Error("listOptions 必须是列表配置对象");const t=e.listOptions??{};le(t.align,"listOptions.align",!0),le(t.headerAlign,"listOptions.headerAlign",!1);for(const n of["fontSizePt","rowHeightMm","paddingMm"]){const r=t[n];r!==void 0&&I(r,`listOptions.${n}`,n==="paddingMm")}return t}function Dt(e){let t=0,n=0;for(const[r,o]of e.entries()){if(!o||typeof o.header!="string"||typeof o.field!="string"||!o.field.trim())throw new Error(`columns[${r}] 需要字符串 header 与非空 field`);le(o.align,`columns[${r}].align`,!0),le(o.headerAlign,`columns[${r}].headerAlign`,!1),o.flex!==void 0&&I(o.flex,`columns[${r}].flex`),o.widthMm!==void 0?(I(o.widthMm,`columns[${r}].widthMm`),t+=o.widthMm):n=Math.max(n,o.flex??1)}return{fixedWidthMm:t,maxFlex:n}}function Lt(e,t,n,r){const{fixedWidthMm:o,maxFlex:i}=Dt(e.columns);if(t==="page"&&o>r)throw new Error(`固定列宽 ${o}mm 超出页面可用宽度 ${r}mm`);const c=r-o;if(t==="page"&&i>0&&c<=0)throw new Error("固定列占满页面可用宽度,自动列需要正的剩余宽度");const s=i>0?e.columns.reduce((l,m)=>l+(m.widthMm===void 0?(m.flex??1)/i:0),0):0;return{columns:e.columns.map(({widthMm:l,flex:m,...p},d)=>{const u=l??(t==="wide"?n*(m??1):c*((m??1)/i)/s);return I(u,`columns[${d}] 分配后的 widthMm`),{...p,widthMm:u}}),fixedWidthMm:o,maxFlex:i}}function It(e){if(!e||typeof e!="object")throw new Error("标准明细模板需要 options 对象");if(!Array.isArray(e.columns)||e.columns.length===0)throw new Error("columns 至少需要一列");const{layout:t,columnWidthMm:n}=xt(e),r=Pt(e);let o=r.widthMm;const i=r.heightMm,c=Ot(e);let s=o-c.marginLeftMm-c.marginRightMm;const a=i-c.marginTopMm-c.marginBottomMm;if(t==="page"&&s<=0||a<=0)throw new Error("页边距占满纸张,必须保留正的可用宽度和高度");const{dataset:l,titleHeightMm:m,hasTitle:p,titleSpaceMm:d}=At(e,a),u=$t(e),{columns:f,fixedWidthMm:x,maxFlex:C}=Lt(e,t,n,s);t==="wide"&&(s=f.reduce((E,P)=>E+P.widthMm,0),I(s,"宽表总列宽"),o=s+c.marginLeftMm+c.marginRightMm,I(o,"宽表总宽度"));const M={widthMm:o,heightMm:i,...c,components:[],...t==="wide"?{layout:t}:{}};return p&&M.components.push({kind:"text",text:e.title,leftMm:c.marginLeftMm,topMm:c.marginTopMm,widthMm:s,heightMm:m,style:{fontSize:16,bold:!0,align:"center",verticalAlign:"middle",...e.titleStyle}}),M.components.push({align:"auto",headerAlign:"center",...u,kind:"list",...t==="wide"?{layout:t}:{},...p?{title:e.title}:{},dataset:l,columns:f,leftMm:c.marginLeftMm,topMm:c.marginTopMm+d,widthMm:t==="wide"||C>0?s:x}),e.params===void 0?{pages:[M]}:{params:e.params,pages:[M]}}function Ft(e){if(e.components!==void 0&&e.pages!==void 0)throw new TypeError("标签 components 与 pages 只能选择一种");const{dataset:t,rowKey:n,copies:r,params:o}=e,i=e.pages??[{components:e.components??[]}],c={repeat:{dataset:t,...n===void 0?{}:{rowKey:n},...r===void 0?{}:{copies:r}},...o===void 0?{}:{params:o},pages:i.map(a=>({widthMm:a.widthMm??e.widthMm??80,heightMm:a.heightMm??e.heightMm??55,marginTopMm:0,marginRightMm:0,marginBottomMm:0,marginLeftMm:0,components:a.components,...a.meta===void 0?{}:{meta:a.meta}}))},s=v.validateReportTemplate(c);if(!s.ok)throw new v.ReportTemplateError(s.errors);return JSON.parse(JSON.stringify(c))}function Nt(e){if(!e||typeof e!="object"||!e.repeat)throw new w.ReportSourceError("config","defineLabelReport 需要带 repeat 的固定标签模板");const t=v.validateReportTemplate(e);if(!t.ok)throw new v.ReportTemplateError(t.errors);return e.repeat.dataset}function $e(e,t){if(!Array.isArray(e))throw new w.ReportSourceError("validate","标签数据应为对象数组;请从业务响应中提取行数组");return{[t]:e}}function kt(e){const{template:t,rows:n,load:r,dataSchema:o,params:i,pagination:c,dataValidation:s}=e,a=Nt(t);if(n!==void 0==(r!==void 0)||r!==void 0&&typeof r!="function")throw new w.ReportSourceError("config","标签报表应且只能配置 rows 或 load 其中一种数据来源");const l={template:t,params:i,pagination:c,dataValidation:s,...o===void 0?{}:{dataSchema:{[a]:o}}};return r?w.defineReport({...l,load:r,mapData:m=>$e(m,a)}):{...l,datasets:$e(n,a)}}function _t(e){return e}class k extends Error{constructor(t,n){super(n),this.code=t,this.name="ReportTemplateMigrationError"}}function De(e){let t=e;if(typeof t=="string"){if(t.length>1e7)throw new k("result","模板迁移输入超过预算");try{t=JSON.parse(t)}catch{throw new k("result","模板 JSON 语法无效")}}const n=w.snapshotReportJson(t,{maxBytes:1e7,error:(r,o)=>new k("result",o)});if(!n||typeof n!="object"||Array.isArray(n))throw new k("result","模板迁移应返回文档对象");return n}function jt(e){if(!Array.isArray(e)||e.length>32)throw new k("definition","模板迁移最多声明 32 步");const t=new Map;for(const n of e){if(!n||![n.from,n.to].every(r=>typeof r=="string"&&r.trim()&&r.length<=64)||n.from===n.to||t.has(n.from)||typeof n.migrate!="function"||n.from===v.REPORT_TEMPLATE_DOCUMENT_VERSION)throw new k("definition","迁移起点应唯一,不得从当前版本降级");t.set(n.from,{...n})}for(const n of t.keys()){const r=new Set;let o=n;for(;t.has(o);){if(r.has(o))throw new k("definition","模板迁移链存在循环");r.add(o),o=t.get(o).to}if(o!==v.REPORT_TEMPLATE_DOCUMENT_VERSION)throw new k("definition","每条迁移链应到达当前模板版本")}return t}function We(e=[]){const t=jt(e);return async n=>{let r=De(n);const o=[];for(;r.schemaVersion!==v.REPORT_TEMPLATE_DOCUMENT_VERSION;){const i=typeof r.schemaVersion=="string"?t.get(r.schemaVersion):void 0;if(!i)throw new k("unsupported","未声明此模板版本的迁移路径");const c=r.id,s=De(await i.migrate(r));if(s.schemaVersion!==i.to||typeof c=="string"&&s.id!==c)throw new k("result","迁移结果版本不匹配或改变了模板身份");o.push({from:i.from,to:i.to}),r=s}return{document:v.parseReportTemplate(r),steps:o}}}class F extends Error{constructor(t,n){super(n),this.code=t,this.name="ReportTemplateStoreError"}}function N(e){return JSON.parse(JSON.stringify(e))}function S(e){if(!e?.aborted)return;const t=new Error("模板操作已取消");throw t.name="AbortError",t}function Le(e){const t=e?Number(e.revision):0;if(!Number.isSafeInteger(t)||t<0||t>=Number.MAX_SAFE_INTEGER)throw new F("history","修订号无效或已达上限");return String(t+1)}function Bt(e,t={}){const n=t.migrations?We(t.migrations):void 0,r=async a=>n?(await n(a)).document:v.parseReportTemplate(a),o=async(a,l)=>{S(l);const m=await e.read(a,l);return S(l),m?N(m):void 0},i=async(a,l)=>{const m=await o(a,l.signal);if((m?.revision??null)!==l.expectedRevision)throw new F("conflict","模板已变化,请重新读取后提交");return m},c=async(a,l,m)=>{if(S(l.signal),!await e.compareAndSwap(a.id,l.expectedRevision,N(a),{signal:l.signal,...m?{publication:N(m)}:{}}))throw new F("conflict","模板已被其他请求更新");return N(a)},s=async(a,l,m,p)=>{if(t.beforePublish){S(m.signal);const x=a.published?await r(a.published):void 0;S(m.signal);const C=await t.beforePublish({document:v.parseReportTemplate(l),previous:x,signal:m.signal});if(!C||C.ok!==!0)throw new F("review",C?.issues?.find(M=>M.severity==="error")?.message??"模板发布检查未通过");S(m.signal)}const d=Le(a),u=v.parseReportTemplate({...l,revision:d}),f={revision:d,document:u,publishedAt:(t.now?.()??new Date).toISOString()};return p!==void 0&&(f.restoredFrom=p),c({id:a.id,revision:d,publishedRevision:d,published:u},m,f)};return{list:async a=>{S(a);const l=await e.list(a);return S(a),N(l)},get:async(a,l={})=>{const m=await o(a,l.signal),p=l.draft?m?.draft:m?.published,d=p?await r(p):void 0;return S(l.signal),d},history:async(a,l)=>{S(l);const m=await e.history(a,l);return S(l),N(m)},saveDraft:async(a,l)=>{l={...l},S(l.signal);const m=await r(t.migrate?await t.migrate(a):a),p=await i(m.id,l),d=Le(p);return c({id:m.id,revision:d,draft:{...m,revision:d},...p?.publishedRevision?{publishedRevision:p.publishedRevision,published:p.published}:{}},l)},publish:async(a,l)=>{l={...l};const m=await i(a,l);if(!m)throw new F("missing","模板不存在");if(!m.draft)throw new F("draft","没有可发布的草稿");return s(m,await r(m.draft),l)},rollback:async(a,l,m)=>{m={...m};const p=await i(a,m);if(!p)throw new F("missing","模板不存在");S(m.signal);const d=await e.getVersion(a,l,m.signal);if(!d)throw new F("history","历史修订不存在");return s(p,await r(d.document),m,l)}}}function zt(){const e=new Map,t=new Map;return{read:async(n,r)=>{S(r);const o=e.get(n);return o?N(o):void 0},list:async n=>(S(n),Array.from(e.values(),({id:r,revision:o,publishedRevision:i})=>({id:r,revision:o,...i?{publishedRevision:i}:{}}))),history:async(n,r)=>(S(r),Array.from(t.get(n)?.values()??[],o=>N(o))),getVersion:async(n,r,o)=>{S(o);const i=t.get(n)?.get(r);return i?N(i):void 0},compareAndSwap:async(n,r,o,i)=>{if(S(i.signal),(e.get(n)?.revision??null)!==r)return!1;if(o.id!==n)throw new F("history","状态 ID 与存储 ID 不一致");const c=N(o),s=i.publication;if(s){const a=t.get(n)??new Map;if(a.has(s.revision)||s.revision!==o.revision||s.document.id!==n)throw new F("history","发布修订不可覆盖,且必须与状态修订和模板 ID 一致");a.set(s.revision,N(s)),t.set(n,a)}return e.set(n,c),!0}}}class h extends Error{constructor(t,n,r="$",o){super(n),this.code=t,this.path=r,this.extensionId=o,this.name="ReportComponentExtensionError"}}const Ht=new Set(["__proto__","constructor","prototype"]);function X(e,t="$",n={nodes:0,units:0},r=0){if(++n.nodes>2048||r>16)throw new h("binding","Component extension JSON exceeds its depth/node budget.",t);if(n.units>64*1024)throw new h("binding","Component extension JSON exceeds 64 Ki UTF-16 units.",t);if(e===null||typeof e=="boolean"||typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){if(n.units+=e.length,n.units>64*1024)throw new h("binding","Component extension JSON exceeds 64 Ki UTF-16 units.",t);return e}if(!e||typeof e!="object")throw new h("binding","Component extension values must be finite JSON data.",t);const o=Object.getPrototypeOf(e);if(Array.isArray(e))return Ut(e,t,n,r);if(o!==Object.prototype&&o!==null)throw new h("binding","Component extension values must be plain JSON objects.",t);return qt(e,t,n,r)}function Te(e,t,n){const r=Object.getOwnPropertyDescriptor(e,t);if(typeof t!="string"||Ht.has(t)||!r?.enumerable||r.get||r.set)throw new h("binding","Component extension JSON contains an unsafe key or accessor.",n);return r.value}function Ut(e,t,n,r){if(Object.getPrototypeOf(e)!==Array.prototype||e.length>2048||Reflect.ownKeys(e).length!==e.length+1)throw new h("binding","Component extension arrays must be plain dense JSON arrays.",t);return Object.freeze(Array.from({length:e.length},(o,i)=>X(Te(e,String(i),`${t}[${i}]`),`${t}[${i}]`,n,r+1)))}function qt(e,t,n,r){const o=Reflect.ownKeys(e);if(o.length>2048)throw new h("binding","Component extension JSON exceeds its node budget.",t);const i=o.map(c=>{const s=`${t}.${String(c)}`,a=Te(e,c,s);return n.units+=String(c).length,[c,X(a,s,n,r+1)]});return Object.freeze(Object.fromEntries(i))}function re(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new h("binding","Expected a component extension object.",t);return e}function ge(e,t,n){for(const r of Object.keys(e))if(!t.includes(r))throw new h("binding","Unknown component extension property.",`${n}.${r}`)}function we(e,t,n=160){if(typeof e!="string"||!e.trim()||e.length>n)throw new h("definition","Component extension labels must be bounded nonempty strings.",t)}function Je(e,t){if(typeof e!="string"||!/^[a-z][a-z\d_.-]{0,127}$/i.test(e))throw new h("definition","Invalid component extension id.","$.id");if(typeof t!="string"||t.length>64||!/^\d+\.\d+\.\d+(?:-[\da-z.-]+)?(?:\+[\da-z.-]+)?$/i.test(t))throw new h("definition","Component extension version must be explicit semantic version text.","$.version",e)}function Se(e,t,n){if(!(e===null&&!t.required)){if(typeof e!==t.type||typeof e=="number"&&!Number.isFinite(e))throw new h("binding",`Expected ${t.type} component property.`,n);if(t.options&&!t.options.some(r=>Object.is(r,e)))throw new h("binding","Component property is outside its declared options.",n);if(typeof e=="number"&&(e<(t.min??-1/0)||e>(t.max??1/0)))throw new h("binding","Component property is outside its declared range.",n);if(typeof e=="string"&&e.length>(t.maxLength??64*1024))throw new h("binding","Component property exceeds maxLength.",n)}}function Vt(e,t){const n=re(e,t);ge(n,["label","type","required","default","options","min","max","maxLength"],t);const r=n;if(we(r.label,`${t}.label`),!["string","number","boolean"].includes(r.type))throw new h("definition","Unknown component property type.",t);if(r.required!==void 0&&typeof r.required!="boolean")throw new h("definition","Component property required must be boolean.",t);Wt(r,t),r.default!==void 0&&Se(r.default,r,`${t}.default`)}function Wt(e,t){for(const n of["min","max"])if(e[n]!==void 0&&(e.type!=="number"||!Number.isFinite(e[n])))throw new h("definition","Numeric property bounds must be finite numbers.",t);if((e.min??-1/0)>(e.max??1/0))throw new h("definition","Component property min exceeds max.",t);if(e.maxLength!==void 0&&(e.type!=="string"||!Number.isSafeInteger(e.maxLength)||e.maxLength<0||e.maxLength>64*1024))throw new h("definition","Invalid component property maxLength.",t);if(e.options!==void 0){if(!Array.isArray(e.options)||!e.options.length||e.options.length>64)throw new h("definition","Component property options must contain 1 to 64 values.",t);for(const n of e.options)Se(n,{...e,options:void 0},`${t}.options`)}}function Jt(e){const t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new h("definition","Component extension metadata must be a plain object.");const n=Reflect.ownKeys(e).filter(o=>o!=="load").map(o=>[o,Te(e,o,`$.${String(o)}`)]),r=X(Object.fromEntries(n));if(ge(r,["id","version","kind","label","description","properties"],"$"),Je(r.id,r.version),we(r.label,"$.label"),!["image","chart","barcode","qrcode"].includes(r.kind))throw new h("definition","Extension kind must use the existing image-backed output pipeline.","$.kind");if(r.description!==void 0&&we(r.description,"$.description",2048),r.properties!==void 0){const o=re(r.properties,"$.properties");if(Object.keys(o).length>64)throw new h("definition","Component extension supports at most 64 properties.","$.properties");for(const[i,c]of Object.entries(o))Vt(c,`$.properties.${i}`)}return r}function Ge(e,t){const n=re(X(t??{}),"$.props"),r={};for(const o of Object.keys(n))if(!Object.prototype.hasOwnProperty.call(e.properties??{},o))throw new h("binding","Unknown component property.",`$.props.${o}`,e.id);for(const[o,i]of Object.entries(e.properties??{})){const c=Object.prototype.hasOwnProperty.call(n,o)?n[o]:i.default;if(c===void 0){if(i.required)throw new h("binding","Required component property is missing.",`$.props.${o}`,e.id);continue}Se(c,i,`$.props.${o}`),r[o]=c}return Object.freeze(r)}const V="componentExtension";function Gt(e){const t=Object.getOwnPropertyDescriptor(e,"meta")?.value,n=t&&Object.getOwnPropertyDescriptor(t,V);if(n){if(n.get||n.set)throw new h("binding","Component extension binding cannot be an accessor.",`$.meta.${V}`);return n.value}}function Kt(e,t){const n=re(X(Gt(t)),`$.meta.${V}`);ge(n,["id","version","props","binding"],`$.meta.${V}`),Je(n.id,n.version);const r=e.get(n.id);if(!r)throw new h("binding","Component extension is not registered in this runtime.",`$.meta.${V}.id`,n.id);if(r.metadata.version!==n.version||r.metadata.kind!==t.kind)throw new h("binding","Component extension version or image kind does not match its registration.",`$.meta.${V}`,r.metadata.id);const o=Object.freeze({id:r.metadata.id,version:r.metadata.version,props:Ge(r.metadata,n.props),...n.binding===void 0?{}:{binding:n.binding}});return{entry:r,extension:o}}function Ie(e){return e.released??=Promise.resolve().then(()=>e.renderer?.dispose?.())}function Y(e){if(e)throw new h("disposed","Component registry has been disposed.")}function Yt(e){if(!e||typeof e!="object")throw new h("definition","Component extension definition must be an object.");if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw new h("definition","Component extension definition must be a plain object.");const t=Object.getOwnPropertyDescriptor(e,"load");if(!t||t.get||t.set||typeof t.value!="function")throw new h("definition","Component extension needs a trusted runtime loader.","$.load");return{metadata:Jt(e),load:t.value}}function Zt(e,t){if(!(e&&typeof e.render=="function"&&(e.dispose===void 0||typeof e.dispose=="function"))){if(e&&typeof e.dispose=="function")try{Promise.resolve(e.dispose()).catch(()=>{})}catch{}throw new h("load","Component loader must return render and optional dispose methods.","$.load",t)}}function Xt(e,t){const n=new AbortController,r=()=>n.abort(e.reason),o=()=>n.abort(t.reason);return e.aborted?r():e.addEventListener("abort",r,{once:!0}),t.aborted?o():t.addEventListener("abort",o,{once:!0}),{signal:n.signal,dispose(){e.removeEventListener("abort",r),t.removeEventListener("abort",o)}}}function Qt(e){if(!Array.isArray(e)||e.length>128)throw new h("definition","Register at most 128 component extensions.");const t=new Map,n=new AbortController;let r=!1,o;for(const a of e){const l=Yt(a),m=l.metadata.id;if(t.has(m))throw new h("definition","Component extension id is already registered.","$.id",m);t.set(m,l)}function i(a){return Y(r),a.pending||(a.pending=Promise.resolve().then(()=>(Y(r),a.load(n.signal))).then(async l=>(Zt(l,a.metadata.id),a.renderer=l,r&&(await Ie(a),Y(r)),l)).catch(l=>{throw a.pending=void 0,l instanceof h?l:Object.assign(new h("load","Component extension loader failed.","$.load",a.metadata.id),{cause:l})})),a.pending}const c=async a=>{Y(r);const{entry:l,extension:m}=Kt(t,a.component),p=Xt(a.signal,n.signal);try{const d=await g.waitForOutput(i(l),p.signal);return await g.waitForOutput(d.render({...a,signal:p.signal,extension:m}),p.signal)}finally{p.dispose()}},s={assets:Object.freeze({get assetRegistry(){return s}}),describe(a){return Y(r),Object.freeze([...t.values()].map(l=>l.metadata).filter(l=>!a||l.kind===a))},hasExtension(a,l,m){const p=t.get(a)?.metadata;return!r&&p?.version===l&&p.kind===m},rendererFor(a){const l=Object.getOwnPropertyDescriptor(a,"meta")?.value;return l&&Object.prototype.hasOwnProperty.call(l,V)?c:void 0},createComponent(a,l={}){Y(r);const m=t.get(a);if(!m)throw new h("binding","Component extension is not registered in this runtime.","$.id",a);const p=re(X(l),"$");ge(p,["props","binding"],"$");const d={id:a,version:m.metadata.version,props:Ge(m.metadata,p.props),...p.binding===void 0?{}:{binding:p.binding}};return{kind:m.metadata.kind,meta:{[V]:Object.freeze(d)}}},dispose(){return o||(r=!0,n.abort(new h("disposed","Component registry has been disposed.")),o=Promise.allSettled([...t.values()].filter(a=>a.renderer).map(Ie)).then(a=>{const l=a.find(m=>m.status==="rejected");if(l?.status==="rejected")throw l.reason}),o)}};return s}function en(e){return e.map(t=>t.map(n=>/[\t\r\n"]/.test(n)?`"${n.replace(/"/g,'""')}"`:n).join(" ")).join(`\r
|
package/dist/index.d.cts
CHANGED
|
@@ -749,7 +749,7 @@ export declare type LabelTemplatePage = Pick<TemplatePage, "components" | "meta"
|
|
|
749
749
|
/** 默认行高倍数(基线距 = 字号 × 该系数) */
|
|
750
750
|
export declare const LINE_HEIGHT = 1.35;
|
|
751
751
|
|
|
752
|
-
/** auto
|
|
752
|
+
/** auto:真实数字、显式数值格式、日期与布尔居中,其他内容居左。 */
|
|
753
753
|
export declare type ListAlignment = NonNullable<ComponentStyle["align"]> | "auto";
|
|
754
754
|
|
|
755
755
|
export declare interface ListColumn {
|
|
@@ -808,7 +808,7 @@ export declare interface ListComponent {
|
|
|
808
808
|
paddingMm?: number;
|
|
809
809
|
headerEveryPage?: boolean;
|
|
810
810
|
headerBackgroundColor?: string;
|
|
811
|
-
/**
|
|
811
|
+
/** 内容默认对齐,列配置可覆盖,缺省为 auto。 */
|
|
812
812
|
align?: ListAlignment;
|
|
813
813
|
/** 表头默认对齐,列配置可覆盖。 */
|
|
814
814
|
headerAlign?: ComponentStyle["align"];
|
package/dist/index.d.ts
CHANGED
|
@@ -749,7 +749,7 @@ export declare type LabelTemplatePage = Pick<TemplatePage, "components" | "meta"
|
|
|
749
749
|
/** 默认行高倍数(基线距 = 字号 × 该系数) */
|
|
750
750
|
export declare const LINE_HEIGHT = 1.35;
|
|
751
751
|
|
|
752
|
-
/** auto
|
|
752
|
+
/** auto:真实数字、显式数值格式、日期与布尔居中,其他内容居左。 */
|
|
753
753
|
export declare type ListAlignment = NonNullable<ComponentStyle["align"]> | "auto";
|
|
754
754
|
|
|
755
755
|
export declare interface ListColumn {
|
|
@@ -808,7 +808,7 @@ export declare interface ListComponent {
|
|
|
808
808
|
paddingMm?: number;
|
|
809
809
|
headerEveryPage?: boolean;
|
|
810
810
|
headerBackgroundColor?: string;
|
|
811
|
-
/**
|
|
811
|
+
/** 内容默认对齐,列配置可覆盖,缺省为 auto。 */
|
|
812
812
|
align?: ListAlignment;
|
|
813
813
|
/** 表头默认对齐,列配置可覆盖。 */
|
|
814
814
|
headerAlign?: ComponentStyle["align"];
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { a as V,
|
|
2
|
-
import { C as lr,
|
|
3
|
-
import { P as
|
|
4
|
-
import { v as Fe, R as je, a as me, p as X, b as ct } from "./template-registry-
|
|
5
|
-
import { c as
|
|
1
|
+
import { a as V, c as Q, d as fe, i as he, D as ge, o as nt, e as le, p as _, f as rt, r as it, g as ot, b as at, h as st, P as ee, w as Pe } from "./diagnostic-collector-gB07PHy2.js";
|
|
2
|
+
import { C as lr, j as mr, k as dr, l as fr, L as hr, M as gr, R as ur, S as pr, m as wr, n as br, q as yr, s as Mr, t as vr } from "./diagnostic-collector-gB07PHy2.js";
|
|
3
|
+
import { P as Er, e as Sr, f as Rr, R as Cr, g as Tr, h as Pr, p as $r, b as Or, t as Ar, j as Ir } from "./record-bindings-Cv7lFiof.js";
|
|
4
|
+
import { v as Fe, R as je, a as me, p as X, b as ct } from "./template-registry-DZOtRY7t.js";
|
|
5
|
+
import { c as Lr, d as Nr, e as kr, i as Fr, s as jr, f as zr, g as Hr, h as Br } from "./template-registry-DZOtRY7t.js";
|
|
6
6
|
import { v as lt } from "./dataset-DL83majE.js";
|
|
7
|
-
import { d as
|
|
8
|
-
import { h as ue, w as ze } from "./textwrap-
|
|
9
|
-
import { c as
|
|
10
|
-
import { R as pe, d as mt, s as He, a as dt, p as ft } from "./json-snapshot-
|
|
11
|
-
import { D as
|
|
12
|
-
import { c as
|
|
13
|
-
import { d as ht } from "./data-bar-
|
|
14
|
-
import { d as gt } from "./rich-text-layout-
|
|
15
|
-
import { r as re, n as Be, O as ut } from "./capabilities-
|
|
16
|
-
import { i as
|
|
17
|
-
import { r as we } from "./assets-
|
|
18
|
-
import { O as
|
|
19
|
-
import { r as pt } from "./grid-strokes-
|
|
20
|
-
import { c as wt } from "./prefill-
|
|
21
|
-
import { R as
|
|
22
|
-
import { R as
|
|
23
|
-
import { n as
|
|
24
|
-
import { c as
|
|
25
|
-
import { a as
|
|
26
|
-
import { T as
|
|
7
|
+
import { d as Wr } from "./dataset-DL83majE.js";
|
|
8
|
+
import { h as ue, w as ze } from "./textwrap-BywMBMXM.js";
|
|
9
|
+
import { c as qr, a as Vr, b as Jr, m as Gr } from "./textwrap-BywMBMXM.js";
|
|
10
|
+
import { R as pe, d as mt, s as He, a as dt, p as ft } from "./json-snapshot-x0JpllWL.js";
|
|
11
|
+
import { D as Yr, b as Xr, c as Zr, e as Qr, f as ei, g as ti, h as ni, i as ri, j as ii, k as oi, l as ai, m as si, n as ci, o as li, q as mi, r as di, t as fi, u as hi, v as gi, w as ui, x as pi, y as wi, z as bi, A as yi, B as Mi, C as vi, E as xi, F as Ei, G as Si } from "./json-snapshot-x0JpllWL.js";
|
|
12
|
+
import { c as Ci, a as Ti, b as Pi, i as $i, r as Oi, d as Ai, e as Ii, t as Di } from "./dom-DxdCMLzs.js";
|
|
13
|
+
import { d as ht } from "./data-bar-Bfh54sT4.js";
|
|
14
|
+
import { d as gt } from "./rich-text-layout-Ch_N0Ubu.js";
|
|
15
|
+
import { r as re, n as Be, O as ut } from "./capabilities-CN_kSVjO.js";
|
|
16
|
+
import { i as Ni, a as ki } from "./capabilities-CN_kSVjO.js";
|
|
17
|
+
import { r as we } from "./assets-C4MIvzQ4.js";
|
|
18
|
+
import { O as ji } from "./assets-C4MIvzQ4.js";
|
|
19
|
+
import { r as pt } from "./grid-strokes-DkZEZvcI.js";
|
|
20
|
+
import { c as wt } from "./prefill-BkF9Fw_p.js";
|
|
21
|
+
import { R as Hi, a as Bi, b as _i, d as Wi, e as Ui, m as qi, r as Vi, f as Ji, g as Gi, v as Ki } from "./prefill-BkF9Fw_p.js";
|
|
22
|
+
import { R as Xi, a as Zi, f as Qi, b as eo, c as to, d as no, i as ro, e as io, g as oo, p as ao, h as so, j as co, k as lo, r as mo, v as fo, l as ho } from "./param-validation-CnDEd2l-.js";
|
|
23
|
+
import { n as uo, f as po, o as wo, r as bo, l as yo } from "./computed-f3pOqWLX.js";
|
|
24
|
+
import { c as vo, a as xo, d as Eo, r as So, b as Ro } from "./template-catalog-D_gl93va.js";
|
|
25
|
+
import { a as To, c as Po, i as $o, b as Oo } from "./template-fragments-D94ZZmPc.js";
|
|
26
|
+
import { T as Io, c as Do, a as Lo } from "./template-serialization-CWmHq7lX.js";
|
|
27
27
|
function be(e, t, n, r, i, o, l, s = "top") {
|
|
28
28
|
e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSizePx}px ${l}`, "letterSpacing" in e && (e.letterSpacing = "0px"), e.fillStyle = t.color, e.textBaseline = "alphabetic";
|
|
29
29
|
const a = t.fontSizePx * t.lineHeight, c = t.text === "" ? [""] : t.text.split(`
|
|
@@ -155,7 +155,7 @@ function Tt(e, t, n, r, i, o, l, s, a, c, m, f) {
|
|
|
155
155
|
for (const h of d.cells) Pt(e, h, n, r, i, s, a, c, m, f);
|
|
156
156
|
}
|
|
157
157
|
function Pt(e, t, n, r, i, o, l, s, a, c) {
|
|
158
|
-
const m = n.grid?.paddingMm ?? 0.5, f = t.cell.text ?? "", d = at(n.style, t.cell
|
|
158
|
+
const m = n.grid?.paddingMm ?? 0.5, f = t.cell.text ?? "", d = at(n.style, t.cell), h = V(d, l), g = t.cell.indentMm ?? 0, S = Math.max(0, t.widthMm - 2 * m - g), E = ze(f, S, { fontSizePt: h.fontSizePt, bold: d.bold, italic: d.italic, fontFamily: d.fontFamily ?? s, letterSpacingPt: d.letterSpacing }, a).join(`
|
|
159
159
|
`), b = { x: r + (t.xMm + m + g) * o, y: i + (t.yMm + m) * o, width: S * o, height: Math.max(0, t.heightMm - 2 * m) * o };
|
|
160
160
|
e.save(), e.beginPath(), e.rect(b.x, b.y, b.width, b.height), e.clip(), t.cell.richParagraphs?.length ? _e(e, { ...n, richParagraphs: t.cell.richParagraphs, style: { verticalAlign: "middle", ...d } }, b, l, s) : be(
|
|
161
161
|
e,
|
|
@@ -1516,181 +1516,181 @@ export {
|
|
|
1516
1516
|
mr as DEFAULT_BORDER_PT,
|
|
1517
1517
|
ge as DEFAULT_FONT_FAMILY,
|
|
1518
1518
|
dr as DEFAULT_FONT_PT,
|
|
1519
|
-
|
|
1519
|
+
Yr as DEFAULT_LABEL_PAGE_LIMIT,
|
|
1520
1520
|
fr as DEFAULT_STROKE_COLOR,
|
|
1521
1521
|
st as DEFAULT_TEXT_COLOR,
|
|
1522
1522
|
hr as LINE_HEIGHT,
|
|
1523
1523
|
P as LabelSheetError,
|
|
1524
1524
|
gr as MM_PER_INCH,
|
|
1525
|
-
|
|
1525
|
+
ji as OutputAssetError,
|
|
1526
1526
|
ut as OutputFidelityError,
|
|
1527
1527
|
ee as PAPER_SIZES,
|
|
1528
1528
|
Dt as PageBuilder,
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1529
|
+
Er as PaginateCellLimitError,
|
|
1530
|
+
Sr as PaginateChartComponentLimitError,
|
|
1531
|
+
Rr as PaginatePageLimitError,
|
|
1532
1532
|
ur as RENDER_PLAN_SCHEMA_VERSION,
|
|
1533
1533
|
me as REPORT_TEMPLATE_DOCUMENT_VERSION,
|
|
1534
|
-
|
|
1534
|
+
Cr as ReportBindingError,
|
|
1535
1535
|
y as ReportCalculationError,
|
|
1536
1536
|
dt as ReportCellEditError,
|
|
1537
1537
|
nn as ReportCellFieldError,
|
|
1538
1538
|
u as ReportComponentExtensionError,
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1539
|
+
Hi as ReportDataError,
|
|
1540
|
+
Bi as ReportDrillError,
|
|
1541
|
+
Xi as ReportParamValidationError,
|
|
1542
1542
|
pe as ReportSourceError,
|
|
1543
1543
|
je as ReportTemplateError,
|
|
1544
1544
|
N as ReportTemplateMigrationError,
|
|
1545
1545
|
L as ReportTemplateStoreError,
|
|
1546
|
-
|
|
1546
|
+
Xr as ReportValidationError,
|
|
1547
1547
|
pr as SCHEMA_VERSION_MACH,
|
|
1548
1548
|
It as TemplateBuilder,
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1549
|
+
Io as TreeRowLimitError,
|
|
1550
|
+
Zr as applyReportCellEdit,
|
|
1551
|
+
Qr as applyReportCellEditBatch,
|
|
1552
|
+
To as applyReportDocumentStyle,
|
|
1553
|
+
ei as applyReportEditResult,
|
|
1554
|
+
ti as applyReportSourceMetadata,
|
|
1555
|
+
Lr as assertRenderPlan,
|
|
1556
|
+
Zi as assertReportParams,
|
|
1557
|
+
ni as assertReportValidation,
|
|
1558
1558
|
ar as bindReportTemplateContext,
|
|
1559
1559
|
rr as calculateReportSelection,
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1560
|
+
Po as captureTemplateFragment,
|
|
1561
|
+
qr as charWidthEm,
|
|
1562
|
+
Ci as classOf,
|
|
1563
|
+
vo as cloneReportTemplate,
|
|
1564
|
+
Ti as collectTemplateOutline,
|
|
1565
1565
|
Vn as columnsFromContract,
|
|
1566
|
-
|
|
1567
|
-
|
|
1566
|
+
_i as compareReportData,
|
|
1567
|
+
uo as compileReportPredicate,
|
|
1568
1568
|
St as computePageWindow,
|
|
1569
|
-
|
|
1570
|
-
|
|
1569
|
+
ri as countTemplatePages,
|
|
1570
|
+
Vr as createCanvasMeasurer,
|
|
1571
1571
|
Un as createCanvasPager,
|
|
1572
|
-
|
|
1572
|
+
Jr as createHeuristicMeasurer,
|
|
1573
1573
|
Gn as createLabelTemplate,
|
|
1574
|
-
|
|
1574
|
+
xo as createLocalTemplateCatalog,
|
|
1575
1575
|
Zn as createMemoryTemplateStore,
|
|
1576
|
-
|
|
1576
|
+
Pi as createPageViewportRenderer,
|
|
1577
1577
|
Yn as createProviderReport,
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1578
|
+
ii as createReportCellEdit,
|
|
1579
|
+
oi as createReportCellEditBatch,
|
|
1580
|
+
ai as createReportCellResolver,
|
|
1581
|
+
po as createReportChartData,
|
|
1582
1582
|
Qn as createReportComponentRegistry,
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1583
|
+
Wi as createReportDrillRequest,
|
|
1584
|
+
si as createReportEditSession,
|
|
1585
|
+
Ui as createReportPrefill,
|
|
1586
|
+
ci as createReportSource,
|
|
1587
1587
|
Jn as createTableTemplate,
|
|
1588
1588
|
qn as createTemplate,
|
|
1589
1589
|
Xn as createTemplateManager,
|
|
1590
1590
|
Wt as createTemplateMigrator,
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1591
|
+
Nr as createTemplateRegistry,
|
|
1592
|
+
Do as createTreeTable,
|
|
1593
|
+
Wr as datasetJsonSchema,
|
|
1594
1594
|
Kn as defineLabelReport,
|
|
1595
1595
|
mt as defineReport,
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1596
|
+
kr as defineReportTemplate,
|
|
1597
|
+
Eo as diffReportTemplates,
|
|
1598
|
+
li as estimateListLayoutCells,
|
|
1599
|
+
Tr as evalStyleRule,
|
|
1600
1600
|
Sn as evaluateReportAggregateExpression,
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1601
|
+
wo as evaluateReportPredicate,
|
|
1602
|
+
mi as explainDatasetField,
|
|
1603
|
+
Qi as formatReportCascaderPath,
|
|
1604
|
+
di as formatReportCellEdit,
|
|
1605
1605
|
er as formatReportClipboard,
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1606
|
+
eo as formatReportDateRange,
|
|
1607
|
+
to as formatReportNumberRange,
|
|
1608
|
+
no as formatReportParamSelection,
|
|
1609
|
+
Pr as formatValue,
|
|
1610
|
+
fi as getReportCellContext,
|
|
1611
|
+
hi as getReportEditSession,
|
|
1612
|
+
gi as hasValidDataExplanation,
|
|
1613
1613
|
ue as heuristicMeasurer,
|
|
1614
1614
|
ir as imposeLabelSheets,
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1615
|
+
$o as insertTemplateFragment,
|
|
1616
|
+
Ni as inspectOutputCapabilities,
|
|
1617
|
+
ki as inspectOutputCapabilitiesSummary,
|
|
1618
|
+
Fr as inspectReportTemplateCompatibility,
|
|
1619
|
+
$i as inspectTemplateFieldUsage,
|
|
1620
|
+
Oo as inspectTemplateFragmentBindings,
|
|
1621
1621
|
he as isImageBackedComponent,
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1622
|
+
ui as isReportDataTarget,
|
|
1623
|
+
ro as isReportDate,
|
|
1624
|
+
io as isReportMonth,
|
|
1625
|
+
pi as isReportValueState,
|
|
1626
|
+
oo as isReportYear,
|
|
1627
1627
|
ot as isRichText,
|
|
1628
|
-
|
|
1628
|
+
qi as matchReportDrillActions,
|
|
1629
1629
|
ve as measurePageSizePx,
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1630
|
+
Gr as measureTextMm,
|
|
1631
|
+
wr as mergeComponentStyles,
|
|
1632
|
+
br as mmToPx,
|
|
1633
|
+
yr as mmToPxFactor,
|
|
1634
|
+
wi as paginateTemplate,
|
|
1635
|
+
bi as paginateTemplatePages,
|
|
1636
|
+
$r as parseDateLocal,
|
|
1637
|
+
ao as parseReportCascaderPath,
|
|
1638
1638
|
nr as parseReportCellFieldInput,
|
|
1639
1639
|
ft as parseReportCellInput,
|
|
1640
1640
|
tr as parseReportClipboard,
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1641
|
+
so as parseReportDateRange,
|
|
1642
|
+
co as parseReportNumberRange,
|
|
1643
|
+
lo as parseReportParamSelection,
|
|
1644
1644
|
X as parseReportTemplate,
|
|
1645
1645
|
Hn as planFontSizePx,
|
|
1646
|
-
|
|
1646
|
+
yi as projectListColumns,
|
|
1647
1647
|
_ as ptToPx,
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1648
|
+
Mr as pxToMm,
|
|
1649
|
+
Mi as registerReportEditSession,
|
|
1650
|
+
vi as relocateReportCellEdits,
|
|
1651
|
+
Oi as renderComponent,
|
|
1652
|
+
Ai as renderPage,
|
|
1653
|
+
Ii as renderPlan,
|
|
1654
1654
|
_n as renderPlanToCanvas,
|
|
1655
1655
|
Wn as renderPlanToCanvasAsync,
|
|
1656
1656
|
Bn as renderPlanToImages,
|
|
1657
|
-
|
|
1658
|
-
|
|
1657
|
+
xi as reportCellEditKey,
|
|
1658
|
+
Vi as reportDataSnapshotFromPlan,
|
|
1659
1659
|
or as reportDateDefault,
|
|
1660
1660
|
re as reportOutputDiagnostics,
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1661
|
+
mo as reportParamsJsonSchema,
|
|
1662
|
+
bo as reportPredicateFields,
|
|
1663
|
+
Ji as reportPrefillInputs,
|
|
1664
1664
|
rt as resolveBoxBorders,
|
|
1665
|
-
|
|
1665
|
+
Or as resolveComponentBinding,
|
|
1666
1666
|
V as resolveFontSize,
|
|
1667
1667
|
it as resolveGridLayout,
|
|
1668
1668
|
Q as resolveLineHeight,
|
|
1669
1669
|
Je as resolvePaper,
|
|
1670
1670
|
we as resolvePlanAssets,
|
|
1671
|
-
|
|
1671
|
+
Gi as resolveReportDrillReturn,
|
|
1672
1672
|
le as resolveStroke,
|
|
1673
1673
|
fe as resolveTextColor,
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1674
|
+
So as reviewReportTemplate,
|
|
1675
|
+
Ro as reviewReportTemplateAsync,
|
|
1676
|
+
vr as round,
|
|
1677
|
+
jr as serializeReportTemplate,
|
|
1678
|
+
Ei as summarizeReportCellEdits,
|
|
1679
|
+
Di as templatePathLocation,
|
|
1680
|
+
Ar as toExcelNumberFormat,
|
|
1681
|
+
Ir as toNumber,
|
|
1682
|
+
zr as validateComponent,
|
|
1683
1683
|
lt as validateDatasetRows,
|
|
1684
|
-
|
|
1684
|
+
Hr as validatePage,
|
|
1685
1685
|
ct as validateRenderPlan,
|
|
1686
1686
|
dn as validateReportCellFieldDefinition,
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1687
|
+
yo as validateReportChartBinding,
|
|
1688
|
+
Si as validateReportDataset,
|
|
1689
|
+
Ki as validateReportDrillActions,
|
|
1690
|
+
fo as validateReportParamDefinitions,
|
|
1691
|
+
ho as validateReportParams,
|
|
1692
1692
|
Fe as validateReportTemplate,
|
|
1693
|
-
|
|
1694
|
-
|
|
1693
|
+
Br as validateReportTemplateDocument,
|
|
1694
|
+
Lo as validateTreeOptions,
|
|
1695
1695
|
ze as wrapText
|
|
1696
1696
|
};
|