@agile-team/mach-report 2.12.0 → 2.14.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.
Files changed (97) hide show
  1. package/README.md +27 -3
  2. package/dist/ExcelBindingWizard-CLT2p7P3.cjs +1 -0
  3. package/dist/ExcelBindingWizard-CvsWR8Ga.js +1485 -0
  4. package/dist/{ParamEditor-BLaE5q5W.js → ParamEditor-CflQV3eQ.js} +191 -187
  5. package/dist/ParamEditor-vIDzvpPV.cjs +1 -0
  6. package/dist/ReportBatchPanel-DkxTzBkD.cjs +1 -0
  7. package/dist/{ReportBatchPanel-B5ClP9tm.js → ReportBatchPanel-LqVgiqp7.js} +3 -3
  8. package/dist/ReportPreview-CvbqLUzM.cjs +6 -0
  9. package/dist/ReportPreview-D_ywJ_-H.js +4533 -0
  10. package/dist/{ReportTemplateLibrary-BZB-XWjj.js → ReportTemplateLibrary-MjWEtc7X.js} +1 -1
  11. package/dist/ReportTemplateLibrary-cQ1sqNYo.cjs +1 -0
  12. package/dist/RuleEditor-BaR6xUiI.cjs +1 -0
  13. package/dist/RuleEditor-ChuXMlei.js +2037 -0
  14. package/dist/TemplateOutlinePanel-BHKP89Xz.cjs +1 -0
  15. package/dist/TemplateOutlinePanel-Dci6aRn1.js +96 -0
  16. package/dist/TemplateReusePanel-B7Gmyc1z.js +388 -0
  17. package/dist/TemplateReusePanel-CY5eO2Sh.cjs +1 -0
  18. package/dist/TemplateReviewPanel-DjlX3xpt.js +592 -0
  19. package/dist/TemplateReviewPanel-JvZe9_4G.cjs +1 -0
  20. package/dist/{batch-mRqhhhjt.js → batch-DzaTNLWI.js} +23 -16
  21. package/dist/batch-xMkqYiTr.cjs +1 -0
  22. package/dist/config-0UIohTS7.cjs +1 -0
  23. package/dist/{config-B612mw0x.js → config-Dt9NtCPl.js} +227 -186
  24. package/dist/data-explanation-BktvER5B.cjs +1 -0
  25. package/dist/data-explanation-C_J6jYNi.js +16 -0
  26. package/dist/designer-Ci1LizA9.js +5020 -0
  27. package/dist/designer-rtmVIIdN.cjs +2 -0
  28. package/dist/designer.cjs +1 -2
  29. package/dist/designer.d.cts +306 -3
  30. package/dist/designer.d.ts +306 -3
  31. package/dist/designer.js +21 -4266
  32. package/dist/font-loader-DHto6Lra.js +297 -0
  33. package/dist/font-loader-vhCT8znW.cjs +1 -0
  34. package/dist/index.cjs +8 -8
  35. package/dist/index.d.cts +182 -1
  36. package/dist/index.d.ts +182 -1
  37. package/dist/index.js +728 -628
  38. package/dist/{template-review-BzpcI-tR.js → json-snapshot-BeFT3Tso.js} +867 -637
  39. package/dist/json-snapshot-D1NTP2oI.cjs +2 -0
  40. package/dist/pdf-8UPQebOE.js +36288 -0
  41. package/dist/pdf-AyJGb22z.cjs +101 -0
  42. package/dist/pdf.cjs +1 -101
  43. package/dist/pdf.js +9 -36579
  44. package/dist/plugin-BGKf-Tqg.js +22 -0
  45. package/dist/{plugin-BDTU4D94.cjs → plugin-CktLH_Iy.cjs} +1 -1
  46. package/dist/{region-binding-workflow-CcUq8W2Q.js → region-binding-workflow-DEJbhpCv.js} +1 -1
  47. package/dist/server/node.d.cts +46 -11
  48. package/dist/server/node.d.ts +46 -11
  49. package/dist/server-node.cjs +1 -1
  50. package/dist/server-node.js +294 -280
  51. package/dist/server.cjs +1 -1
  52. package/dist/server.d.cts +107 -12
  53. package/dist/server.d.ts +107 -12
  54. package/dist/server.js +713 -453
  55. package/dist/style.css +1 -1
  56. package/dist/template-bindings-BJR4k7qZ.cjs +1 -0
  57. package/dist/template-bindings-Daui7hLF.js +252 -0
  58. package/dist/template-fragments-CLkGo6To.js +187 -0
  59. package/dist/template-fragments-DFUpq5QM.cjs +1 -0
  60. package/dist/template-outline-B3xVkzSv.cjs +1 -0
  61. package/dist/template-outline-CFenM1PV.js +88 -0
  62. package/dist/{template-registry-BjE1VS6g.js → template-registry-COXDEJEM.js} +1 -1
  63. package/dist/{useLocalDraft-C07SYRnC.js → useLocalDraft-BnhcxXk_.js} +1 -1
  64. package/dist/{useLocalDraft-Yiw1wFgI.cjs → useLocalDraft-CioIfDb6.cjs} +1 -1
  65. package/dist/{validate-DbgEM1Hh.js → validate-CkQBWCeg.js} +3 -3
  66. package/dist/vue/async.d.cts +72 -2
  67. package/dist/vue/async.d.ts +72 -2
  68. package/dist/vue/index.d.cts +124 -5
  69. package/dist/vue/index.d.ts +124 -5
  70. package/dist/vue-async.cjs +1 -1
  71. package/dist/vue-async.js +5 -5
  72. package/dist/vue.cjs +1 -1
  73. package/dist/vue.js +78 -71
  74. package/dist/{workbook-session-BPb3TMnT.js → workbook-session-BfK1yHOO.js} +1 -1
  75. package/dist/worker.cjs +1 -1
  76. package/dist/worker.d.cts +46 -11
  77. package/dist/worker.d.ts +46 -11
  78. package/dist/worker.js +59 -55
  79. package/dist/xlsx.js +3 -3
  80. package/package.json +1 -1
  81. package/dist/ExcelBindingWizard-CeAf4QSE.js +0 -1465
  82. package/dist/ExcelBindingWizard-y0mT-AHR.cjs +0 -1
  83. package/dist/ParamEditor-MBBC7lUE.cjs +0 -1
  84. package/dist/ReportBatchPanel-Dc-SDkYA.cjs +0 -1
  85. package/dist/ReportPreview-DWXROHBP.cjs +0 -6
  86. package/dist/ReportPreview-DiNXhQI0.js +0 -4138
  87. package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +0 -1
  88. package/dist/RuleEditor-ChRzNQuF.cjs +0 -1
  89. package/dist/RuleEditor-DzAmW5YH.js +0 -2024
  90. package/dist/TemplateReviewPanel-BKofGrV9.js +0 -222
  91. package/dist/TemplateReviewPanel-DwtOcLue.cjs +0 -1
  92. package/dist/batch-Bt3Fd27Z.cjs +0 -1
  93. package/dist/config-BRoLo2oj.cjs +0 -1
  94. package/dist/plugin-Cd5G2QQn.js +0 -22
  95. package/dist/record-bindings-By_UKZ2g.cjs +0 -1
  96. package/dist/record-bindings-D-5jQlTj.js +0 -196
  97. package/dist/template-review-BfCC8Ng9.cjs +0 -2
@@ -0,0 +1 @@
1
+ "use strict";const h=require("./defaults-xhmcLLrf.cjs"),c=require("./style-UgIJSA1F.cjs"),p=require("./computed-CGV2a809.cjs");function A(e){if(!e||e.kind==="date")return;const r=e.digits;if(!(r!==void 0&&(!Number.isInteger(r)||r<0||r>100))){if(e.kind==="percent"){const t=r??2;return`0${t?`.${"0".repeat(t)}`:""}%`}return r===void 0?e.thousands?"#,##0.###############":void 0:`${e.thousands?"#,##0":"0"}${r?`.${"0".repeat(r)}`:""}`}}function T(e){const r=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());if(r){const i=new Date(Number(r[1]),Number(r[2])-1,Number(r[3]));return Number.isNaN(i.getTime())?null:i}const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function m(e,r){return e.toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}function M(e,r){const t=i=>String(i).padStart(2,"0");return r.replace(/YYYY/g,String(e.getFullYear())).replace(/MM/g,t(e.getMonth()+1)).replace(/DD/g,t(e.getDate())).replace(/hh/g,t(e.getHours())).replace(/mm/g,t(e.getMinutes())).replace(/ss/g,t(e.getSeconds()))}function k(e,r,t){return t!=null?r?m(e,t):e.toFixed(t):r?m(e):String(e)}function $(e){const r=typeof e=="number"?e:Number(String(e).replace(/,/g,""));return Number.isFinite(r)?r:null}function F(e,r){if(e==null||e===""||!r)return String(e??"");switch(r.kind){case"number":{if(typeof e=="string")try{return p.formatDecimal(e,r.digits,r.thousands===!0)}catch{return e}const t=$(e);return t==null?String(e):k(t,r.thousands===!0,r.digits)}case"percent":{if(typeof e=="string")try{return p.formatDecimal(e,r.digits??2,!0,!0)}catch{return e}const t=$(e);return t==null?String(e):`${m(t*100,r.digits??2)}%`}case"date":{const t=r.pattern??"YYYY-MM-DD",i=e instanceof Date?e:T(String(e));return i?M(i,t):String(e)}default:return String(e)}}function b(e,r){const t=e[r.field];if(t==null||t==="")return!1;if(typeof r.value=="number"||r.numeric!==void 0){let s;try{s=p.compareDecimal(p.parseDecimal(t),p.parseDecimal(r.value))}catch{return!1}if(!Number.isFinite(s))return!1;switch(r.op){case">":return s>0;case">=":return s>=0;case"<":return s<0;case"<=":return s<=0;case"==":return s===0;case"!=":return s!==0}}const i=String(t),n=String(r.value);switch(r.op){case"==":return i===n;case"!=":return i!==n;case">":return i>n;case">=":return i>=n;case"<":return i<n;case"<=":return i<=n}return!1}function D(e,r,t,i=e.paddingMm??1){return r.field!==e.tree.labelField?0:Math.min(t.depth*(e.tree.indentMm??3),Math.max(0,r.widthMm-i*2-4))}function w(e,r,t,i){const n=i.tree;(n.input==="nested"||[n.idField,n.parentField].includes(r.field))&&(e.editable=!1),t.hasChildren&&n.parentValues==="leaf-aggregate"&&n.aggregates?.some(s=>s.field===r.field)&&(e.derived=!0,e.editable=!1)}function N(e,r,t){return t==="identifier"||t==="dimension"||t==="date"?"center":t==="measure"?"right":t==="text"?"left":r?.kind==="number"||r?.kind==="percent"?"right":r?.kind==="date"||e instanceof Date||typeof e=="boolean"?"center":typeof e=="number"&&Number.isFinite(e)?"right":"left"}function x(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="boolean")return e?"是":"否";if(e instanceof Date)return e.toISOString().slice(0,10);try{return JSON.stringify(e)}catch{return String(e)}}function E(e,r){let t=c.mergeComponentStyles({fontSize:e.fontSizePt??h.DEFAULT_FONT_PT,bold:e.headerBold??!0,align:"center",verticalAlign:"middle",backgroundColor:e.headerBackgroundColor},r.style);return e.headerAlign!==void 0&&(t.align=e.headerAlign),t=c.mergeComponentStyles(t,e.headerStyle),r.headerAlign!==void 0&&(t.align=r.headerAlign),c.mergeComponentStyles(t,r.headerStyle)}function B(e,r,t){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t))&&(e.value=t);const i=r.format?.kind==="number"||r.format?.kind==="percent";r.valueType!==void 0?e.valueType=r.valueType:i&&(e.valueType="number"),r.editable!==void 0&&(e.editable=r.editable);const n=A(r.format);(typeof e.value=="number"||e.value==null)&&n!==void 0&&(e.numberFormat=n)}function L(e,r,t){const i=!!r.visibleWhen&&!b(t,r.visibleWhen),n=i?null:t[r.field],s=r.align??r.style?.align??e.align??"left";let l=c.mergeComponentStyles({fontSize:e.fontSizePt??h.DEFAULT_FONT_PT,verticalAlign:"middle"},r.style);l.align=s==="auto"?N(n,r.format,r.semanticRole):s;const f=r.rules?.find(g=>b(t,g.when));f&&(l=c.mergeComponentStyles(l,f.style));const d={text:r.format?F(n,r.format):x(n),style:l};return B(d,r,n),e.computed?.some(g=>g.field===r.field)&&(d.derived=!0,d.editable=!1),i&&(d.editable=!1),d}function O(e,r,t){const i=L(e,r,t.row),n=D(e,r,t);return r.field===e.tree.labelField&&(i.style={...i.style,align:"left"}),n&&(i.indentMm=n),w(i,r,t,e),i}function I(e){return typeof e=="string"&&/^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e)}class S extends Error{constructor(r,t,i,n){super(`${r}: ${t}`),this.path=r,this.rowIndex=i,this.field=n,this.code="report-binding",this.name="ReportBindingError"}}function C(e,r,t={}){const i=t.rowIndex??0,s=`$.datasets.${t.dataset??"label"}[${i}].${r}`,l=Object.getOwnPropertyDescriptor(e,r);if(!l||l.get||l.set)throw new S(s,"字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承",i,r);const f=l.value;if(f==null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"&&Number.isFinite(f))return f;throw new S(s,"绑定值应为字符串、有限数字、布尔值或空值",i,r)}function K(e,r,t={}){const i=C(r,e.field,t);return i==null||i===""?e.emptyText??"":`${e.prefix??""}${F(i,e.format)}${e.suffix??""}`}function a(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function o(e,r,t){typeof e=="string"?t.push({field:e,path:r}):Array.isArray(e)&&e.forEach((i,n)=>o(i,`${r}[${n}]`,t))}function u(e,r,t){if(Array.isArray(e)){e.forEach((i,n)=>u(i,`${r}[${n}]`,t));return}if(a(e))for(const[i,n]of Object.entries(e))["field","weightField"].includes(i)?o(n,`${r}.${i}`,t):i!=="value"&&i!=="style"&&u(n,`${r}.${i}`,t)}function y(e,r,t){Array.isArray(e)&&e.forEach((i,n)=>{if(!a(i))return;typeof i.field=="string"&&i.valueField!==void 0&&i.valueField!==i.field&&t.summaries.add(i.field);const s=i.valueField===void 0?"field":"valueField";o(i[s],`${r}[${n}].${s}`,t.fields),i.valueField!==void 0&&i.valueField===i.field&&o(i.field,`${r}[${n}].field`,t.fields),o(i.weightField,`${r}[${n}].weightField`,t.fields)})}function R(e,r,t){for(const n of["rowKey","revisionField","sourceTokenField"])o(e[n],`${r}.${n}`,t.fields);if(!e.matrix&&Array.isArray(e.columns)&&e.columns.forEach((n,s)=>{a(n)&&(typeof n.field=="string"&&t.fields.push({field:n.field,path:`${r}.columns[${s}].field`,summary:!0}),u(n.rules,`${r}.columns[${s}].rules`,t.fields),u(n.visibleWhen,`${r}.columns[${s}].visibleWhen`,t.fields))}),u(e.rowVisibleWhen,`${r}.rowVisibleWhen`,t.fields),Array.isArray(e.computed)&&e.computed.forEach((n,s)=>{a(n)&&(typeof n.field=="string"&&t.generated.add(n.field),u(n.expression,`${r}.computed[${s}].expression`,t.fields),o(n.dependsOn,`${r}.computed[${s}].dependsOn`,t.fields),o(n.groupBy,`${r}.computed[${s}].groupBy`,t.fields))}),(Array.isArray(e.groups)?e.groups.map((n,s)=>({group:n,path:`${r}.groups[${s}]`})):e.groupBy?[{group:e.groupBy,path:`${r}.groupBy`}]:[]).forEach(({group:n,path:s})=>{a(n)&&(o(n.field,`${s}.field`,t.fields),o(n.subtotal,`${s}.subtotal`,t.fields),y(n.aggregates,`${s}.aggregates`,t))}),a(e.grandTotal)&&(o(e.grandTotal.fields,`${r}.grandTotal.fields`,t.fields),y(e.grandTotal.aggregates,`${r}.grandTotal.aggregates`,t)),a(e.matrix)&&(o(e.matrix.rowFields,`${r}.matrix.rowFields`,t.fields),o(e.matrix.columnFields,`${r}.matrix.columnFields`,t.fields),y(e.matrix.measures,`${r}.matrix.measures`,t)),a(e.tree)){for(const n of["idField","parentField","labelField"])o(e.tree[n],`${r}.tree.${n}`,t.fields);y(e.tree.aggregates,`${r}.tree.aggregates`,t)}a(e.detail)&&o(e.detail.parentKey,`${r}.detail.parentKey`,t.fields)}function Y(e){const r=[],t=e.repeat,i=t?{dataset:t.dataset,path:"$.template.repeat",fields:[],generated:new Set,summaries:new Set}:void 0;i&&t&&(o(t.rowKey,"$.template.repeat.rowKey",i.fields),typeof t.copies=="object"&&o(t.copies.field,"$.template.repeat.copies.field",i.fields),r.push(i));function n(s,l){if(Array.isArray(s)){s.forEach((f,d)=>n(f,`${l}[${d}]`));return}if(a(s)){if(i&&a(s.binding)&&o(s.binding.field,`${l}.binding.field`,i.fields),typeof s.dataset=="string"&&Array.isArray(s.columns)){const f={dataset:s.dataset,path:l,fields:[],generated:new Set,summaries:new Set};R(s,l,f),typeof s.foreignKey=="string"&&o(s.foreignKey,`${l}.foreignKey`,f.fields),r.push(f)}for(const[f,d]of Object.entries(s))n(d,`${l}.${f}`)}}return n(e,"$.template"),r}exports.ReportBindingError=S;exports.applyListTreeMetadata=w;exports.collectTemplateDatasetBindings=Y;exports.evalStyleRule=b;exports.formatValue=F;exports.isLabelImageData=I;exports.listCellText=x;exports.listTreeIndent=D;exports.parseDateLocal=T;exports.readRecordScalar=C;exports.resolveComponentBinding=K;exports.resolveListAutoAlignment=N;exports.resolveListHeaderStyle=E;exports.resolveListSampleCell=L;exports.resolveTreeListSampleCell=O;exports.toExcelNumberFormat=A;exports.toNumber=$;
@@ -0,0 +1,252 @@
1
+ import { c as F } from "./defaults-DXhiM1ZD.js";
2
+ import { e as c } from "./style-CQ1PK8ZB.js";
3
+ import { c as w, p as g, h as m } from "./computed-Bvk0W15F.js";
4
+ function T(e) {
5
+ if (!e || e.kind === "date") return;
6
+ const r = e.digits;
7
+ if (!(r !== void 0 && (!Number.isInteger(r) || r < 0 || r > 100))) {
8
+ if (e.kind === "percent") {
9
+ const t = r ?? 2;
10
+ return `0${t ? `.${"0".repeat(t)}` : ""}%`;
11
+ }
12
+ return r === void 0 ? e.thousands ? "#,##0.###############" : void 0 : `${e.thousands ? "#,##0" : "0"}${r ? `.${"0".repeat(r)}` : ""}`;
13
+ }
14
+ }
15
+ function D(e) {
16
+ const r = /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());
17
+ if (r) {
18
+ const i = new Date(Number(r[1]), Number(r[2]) - 1, Number(r[3]));
19
+ return Number.isNaN(i.getTime()) ? null : i;
20
+ }
21
+ const t = new Date(e);
22
+ return Number.isNaN(t.getTime()) ? null : t;
23
+ }
24
+ function $(e, r) {
25
+ return e.toLocaleString("en-US", {
26
+ minimumFractionDigits: r,
27
+ maximumFractionDigits: r
28
+ });
29
+ }
30
+ function N(e, r) {
31
+ const t = (i) => String(i).padStart(2, "0");
32
+ return r.replace(/YYYY/g, String(e.getFullYear())).replace(/MM/g, t(e.getMonth() + 1)).replace(/DD/g, t(e.getDate())).replace(/hh/g, t(e.getHours())).replace(/mm/g, t(e.getMinutes())).replace(/ss/g, t(e.getSeconds()));
33
+ }
34
+ function x(e, r, t) {
35
+ return t != null ? r ? $(e, t) : e.toFixed(t) : r ? $(e) : String(e);
36
+ }
37
+ function b(e) {
38
+ const r = typeof e == "number" ? e : Number(String(e).replace(/,/g, ""));
39
+ return Number.isFinite(r) ? r : null;
40
+ }
41
+ function A(e, r) {
42
+ if (e == null || e === "" || !r) return String(e ?? "");
43
+ switch (r.kind) {
44
+ case "number": {
45
+ if (typeof e == "string")
46
+ try {
47
+ return m(e, r.digits, r.thousands === !0);
48
+ } catch {
49
+ return e;
50
+ }
51
+ const t = b(e);
52
+ return t == null ? String(e) : x(t, r.thousands === !0, r.digits);
53
+ }
54
+ case "percent": {
55
+ if (typeof e == "string")
56
+ try {
57
+ return m(e, r.digits ?? 2, !0, !0);
58
+ } catch {
59
+ return e;
60
+ }
61
+ const t = b(e);
62
+ return t == null ? String(e) : `${$(t * 100, r.digits ?? 2)}%`;
63
+ }
64
+ case "date": {
65
+ const t = r.pattern ?? "YYYY-MM-DD", i = e instanceof Date ? e : D(String(e));
66
+ return i ? N(i, t) : String(e);
67
+ }
68
+ default:
69
+ return String(e);
70
+ }
71
+ }
72
+ function S(e, r) {
73
+ const t = e[r.field];
74
+ if (t == null || t === "") return !1;
75
+ if (typeof r.value == "number" || r.numeric !== void 0) {
76
+ let s;
77
+ try {
78
+ s = w(g(t), g(r.value));
79
+ } catch {
80
+ return !1;
81
+ }
82
+ if (!Number.isFinite(s)) return !1;
83
+ switch (r.op) {
84
+ case ">":
85
+ return s > 0;
86
+ case ">=":
87
+ return s >= 0;
88
+ case "<":
89
+ return s < 0;
90
+ case "<=":
91
+ return s <= 0;
92
+ case "==":
93
+ return s === 0;
94
+ case "!=":
95
+ return s !== 0;
96
+ }
97
+ }
98
+ const i = String(t), n = String(r.value);
99
+ switch (r.op) {
100
+ case "==":
101
+ return i === n;
102
+ case "!=":
103
+ return i !== n;
104
+ case ">":
105
+ return i > n;
106
+ case ">=":
107
+ return i >= n;
108
+ case "<":
109
+ return i < n;
110
+ case "<=":
111
+ return i <= n;
112
+ }
113
+ return !1;
114
+ }
115
+ function k(e, r, t, i = e.paddingMm ?? 1) {
116
+ return r.field !== e.tree.labelField ? 0 : Math.min(t.depth * (e.tree.indentMm ?? 3), Math.max(0, r.widthMm - i * 2 - 4));
117
+ }
118
+ function M(e, r, t, i) {
119
+ const n = i.tree;
120
+ (n.input === "nested" || [n.idField, n.parentField].includes(r.field)) && (e.editable = !1), t.hasChildren && n.parentValues === "leaf-aggregate" && n.aggregates?.some((s) => s.field === r.field) && (e.derived = !0, e.editable = !1);
121
+ }
122
+ function E(e, r, t) {
123
+ return t === "identifier" || t === "dimension" || t === "date" ? "center" : t === "measure" ? "right" : t === "text" ? "left" : r?.kind === "number" || r?.kind === "percent" ? "right" : r?.kind === "date" || e instanceof Date || typeof e == "boolean" ? "center" : typeof e == "number" && Number.isFinite(e) ? "right" : "left";
124
+ }
125
+ function B(e) {
126
+ if (e == null) return "";
127
+ if (typeof e == "string" || typeof e == "number") return String(e);
128
+ if (typeof e == "boolean") return e ? "是" : "否";
129
+ if (e instanceof Date) return e.toISOString().slice(0, 10);
130
+ try {
131
+ return JSON.stringify(e);
132
+ } catch {
133
+ return String(e);
134
+ }
135
+ }
136
+ function R(e, r) {
137
+ let t = c({ fontSize: e.fontSizePt ?? F, bold: e.headerBold ?? !0, align: "center", verticalAlign: "middle", backgroundColor: e.headerBackgroundColor }, r.style);
138
+ return e.headerAlign !== void 0 && (t.align = e.headerAlign), t = c(t, e.headerStyle), r.headerAlign !== void 0 && (t.align = r.headerAlign), c(t, r.headerStyle);
139
+ }
140
+ function K(e, r, t) {
141
+ (t === null || typeof t == "string" || typeof t == "boolean" || typeof t == "number" && Number.isFinite(t)) && (e.value = t);
142
+ const i = r.format?.kind === "number" || r.format?.kind === "percent";
143
+ r.valueType !== void 0 ? e.valueType = r.valueType : i && (e.valueType = "number"), r.editable !== void 0 && (e.editable = r.editable);
144
+ const n = T(r.format);
145
+ (typeof e.value == "number" || e.value == null) && n !== void 0 && (e.numberFormat = n);
146
+ }
147
+ function L(e, r, t) {
148
+ const i = !!r.visibleWhen && !S(t, r.visibleWhen), n = i ? null : t[r.field], s = r.align ?? r.style?.align ?? e.align ?? "left";
149
+ let a = c({ fontSize: e.fontSizePt ?? F, verticalAlign: "middle" }, r.style);
150
+ a.align = s === "auto" ? E(n, r.format, r.semanticRole) : s;
151
+ const o = r.rules?.find((y) => S(t, y.when));
152
+ o && (a = c(a, o.style));
153
+ const l = { text: r.format ? A(n, r.format) : B(n), style: a };
154
+ return K(l, r, n), e.computed?.some((y) => y.field === r.field) && (l.derived = !0, l.editable = !1), i && (l.editable = !1), l;
155
+ }
156
+ function W(e, r, t) {
157
+ const i = L(e, r, t.row), n = k(e, r, t);
158
+ return r.field === e.tree.labelField && (i.style = { ...i.style, align: "left" }), n && (i.indentMm = n), M(i, r, t, e), i;
159
+ }
160
+ function z(e) {
161
+ return typeof e == "string" && /^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e);
162
+ }
163
+ class h extends Error {
164
+ constructor(r, t, i, n) {
165
+ super(`${r}: ${t}`), this.path = r, this.rowIndex = i, this.field = n, this.code = "report-binding", this.name = "ReportBindingError";
166
+ }
167
+ }
168
+ function O(e, r, t = {}) {
169
+ const i = t.rowIndex ?? 0, s = `$.datasets.${t.dataset ?? "label"}[${i}].${r}`, a = Object.getOwnPropertyDescriptor(e, r);
170
+ if (!a || a.get || a.set) throw new h(s, "字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承", i, r);
171
+ const o = a.value;
172
+ if (o == null || typeof o == "string" || typeof o == "boolean" || typeof o == "number" && Number.isFinite(o)) return o;
173
+ throw new h(s, "绑定值应为字符串、有限数字、布尔值或空值", i, r);
174
+ }
175
+ function V(e, r, t = {}) {
176
+ const i = O(r, e.field, t);
177
+ return i == null || i === "" ? e.emptyText ?? "" : `${e.prefix ?? ""}${A(i, e.format)}${e.suffix ?? ""}`;
178
+ }
179
+ function d(e) {
180
+ return !!e && typeof e == "object" && !Array.isArray(e);
181
+ }
182
+ function f(e, r, t) {
183
+ typeof e == "string" ? t.push({ field: e, path: r }) : Array.isArray(e) && e.forEach((i, n) => f(i, `${r}[${n}]`, t));
184
+ }
185
+ function u(e, r, t) {
186
+ if (Array.isArray(e)) {
187
+ e.forEach((i, n) => u(i, `${r}[${n}]`, t));
188
+ return;
189
+ }
190
+ if (d(e))
191
+ for (const [i, n] of Object.entries(e))
192
+ ["field", "weightField"].includes(i) ? f(n, `${r}.${i}`, t) : i !== "value" && i !== "style" && u(n, `${r}.${i}`, t);
193
+ }
194
+ function p(e, r, t) {
195
+ Array.isArray(e) && e.forEach((i, n) => {
196
+ if (!d(i)) return;
197
+ typeof i.field == "string" && i.valueField !== void 0 && i.valueField !== i.field && t.summaries.add(i.field);
198
+ const s = i.valueField === void 0 ? "field" : "valueField";
199
+ f(i[s], `${r}[${n}].${s}`, t.fields), i.valueField !== void 0 && i.valueField === i.field && f(i.field, `${r}[${n}].field`, t.fields), f(i.weightField, `${r}[${n}].weightField`, t.fields);
200
+ });
201
+ }
202
+ function Y(e, r, t) {
203
+ for (const n of ["rowKey", "revisionField", "sourceTokenField"]) f(e[n], `${r}.${n}`, t.fields);
204
+ if (!e.matrix && Array.isArray(e.columns) && e.columns.forEach((n, s) => {
205
+ d(n) && (typeof n.field == "string" && t.fields.push({ field: n.field, path: `${r}.columns[${s}].field`, summary: !0 }), u(n.rules, `${r}.columns[${s}].rules`, t.fields), u(n.visibleWhen, `${r}.columns[${s}].visibleWhen`, t.fields));
206
+ }), u(e.rowVisibleWhen, `${r}.rowVisibleWhen`, t.fields), Array.isArray(e.computed) && e.computed.forEach((n, s) => {
207
+ d(n) && (typeof n.field == "string" && t.generated.add(n.field), u(n.expression, `${r}.computed[${s}].expression`, t.fields), f(n.dependsOn, `${r}.computed[${s}].dependsOn`, t.fields), f(n.groupBy, `${r}.computed[${s}].groupBy`, t.fields));
208
+ }), (Array.isArray(e.groups) ? e.groups.map((n, s) => ({ group: n, path: `${r}.groups[${s}]` })) : e.groupBy ? [{ group: e.groupBy, path: `${r}.groupBy` }] : []).forEach(({ group: n, path: s }) => {
209
+ d(n) && (f(n.field, `${s}.field`, t.fields), f(n.subtotal, `${s}.subtotal`, t.fields), p(n.aggregates, `${s}.aggregates`, t));
210
+ }), d(e.grandTotal) && (f(e.grandTotal.fields, `${r}.grandTotal.fields`, t.fields), p(e.grandTotal.aggregates, `${r}.grandTotal.aggregates`, t)), d(e.matrix) && (f(e.matrix.rowFields, `${r}.matrix.rowFields`, t.fields), f(e.matrix.columnFields, `${r}.matrix.columnFields`, t.fields), p(e.matrix.measures, `${r}.matrix.measures`, t)), d(e.tree)) {
211
+ for (const n of ["idField", "parentField", "labelField"]) f(e.tree[n], `${r}.tree.${n}`, t.fields);
212
+ p(e.tree.aggregates, `${r}.tree.aggregates`, t);
213
+ }
214
+ d(e.detail) && f(e.detail.parentKey, `${r}.detail.parentKey`, t.fields);
215
+ }
216
+ function P(e) {
217
+ const r = [], t = e.repeat, i = t ? { dataset: t.dataset, path: "$.template.repeat", fields: [], generated: /* @__PURE__ */ new Set(), summaries: /* @__PURE__ */ new Set() } : void 0;
218
+ i && t && (f(t.rowKey, "$.template.repeat.rowKey", i.fields), typeof t.copies == "object" && f(t.copies.field, "$.template.repeat.copies.field", i.fields), r.push(i));
219
+ function n(s, a) {
220
+ if (Array.isArray(s)) {
221
+ s.forEach((o, l) => n(o, `${a}[${l}]`));
222
+ return;
223
+ }
224
+ if (d(s)) {
225
+ if (i && d(s.binding) && f(s.binding.field, `${a}.binding.field`, i.fields), typeof s.dataset == "string" && Array.isArray(s.columns)) {
226
+ const o = { dataset: s.dataset, path: a, fields: [], generated: /* @__PURE__ */ new Set(), summaries: /* @__PURE__ */ new Set() };
227
+ Y(s, a, o), typeof s.foreignKey == "string" && f(s.foreignKey, `${a}.foreignKey`, o.fields), r.push(o);
228
+ }
229
+ for (const [o, l] of Object.entries(s)) n(l, `${a}.${o}`);
230
+ }
231
+ }
232
+ return n(e, "$.template"), r;
233
+ }
234
+ export {
235
+ h as R,
236
+ W as a,
237
+ V as b,
238
+ R as c,
239
+ b as d,
240
+ S as e,
241
+ A as f,
242
+ P as g,
243
+ O as h,
244
+ z as i,
245
+ E as j,
246
+ k,
247
+ B as l,
248
+ M as m,
249
+ D as p,
250
+ L as r,
251
+ T as t
252
+ };
@@ -0,0 +1,187 @@
1
+ import { p } from "./template-registry-COXDEJEM.js";
2
+ import { g as S } from "./template-bindings-Daui7hLF.js";
3
+ import { e as g } from "./style-CQ1PK8ZB.js";
4
+ function c(t) {
5
+ return JSON.parse(JSON.stringify(t));
6
+ }
7
+ function u(t) {
8
+ return {
9
+ ...t.repeatDataset ? { repeat: { dataset: t.repeatDataset } } : {},
10
+ pages: [{ widthMm: 4999, heightMm: 4999, components: t.components }]
11
+ };
12
+ }
13
+ function M(t) {
14
+ if (!t.id.trim() || !t.name.trim() || !t.revision.trim())
15
+ throw new Error("Fragment identity, name and revision are required");
16
+ if (!t.components.length || t.components.length > 200)
17
+ throw new RangeError("A fragment must contain 1–200 components");
18
+ p({
19
+ schemaVersion: "1.0",
20
+ id: t.id,
21
+ name: t.name,
22
+ template: u(t)
23
+ });
24
+ }
25
+ function j(t, a, e, n) {
26
+ const r = p(t).template.pages[a];
27
+ if (!r || !e.length || e.some(
28
+ (o) => !Number.isSafeInteger(o) || !r.components[o]
29
+ ))
30
+ throw new Error("Select existing components to capture a fragment");
31
+ const s = [...new Set(e)].map(
32
+ (o) => r.components[o]
33
+ ), l = Math.min(...s.map((o) => o.leftMm)), i = Math.min(...s.map((o) => o.topMm)), m = {
34
+ ...n,
35
+ ...t.template.repeat ? { repeatDataset: t.template.repeat.dataset } : {},
36
+ components: c(s).map((o) => ({
37
+ ...o,
38
+ leftMm: o.leftMm - l,
39
+ topMm: o.topMm - i
40
+ }))
41
+ };
42
+ return M(m), m;
43
+ }
44
+ function $(t) {
45
+ M(t);
46
+ const a = /* @__PURE__ */ new Map();
47
+ for (const e of S(
48
+ u(t)
49
+ )) {
50
+ const n = a.get(e.dataset) ?? /* @__PURE__ */ new Set();
51
+ for (const r of e.fields)
52
+ !e.generated.has(r.field) && !e.summaries.has(r.field) && n.add(r.field);
53
+ a.set(e.dataset, n);
54
+ }
55
+ return [...a].map(([e, n]) => ({
56
+ dataset: e,
57
+ fields: [...n]
58
+ }));
59
+ }
60
+ function E(t, a, e) {
61
+ const n = a.replace(/^\$\.template\./, "").replace(/\[(\d+)\]/g, ".$1").split(".");
62
+ let r = t;
63
+ for (const s of n.slice(0, -1))
64
+ r = r[s];
65
+ r[n[n.length - 1]] = e;
66
+ }
67
+ function b(t, a, e = {}) {
68
+ const n = u({ ...t, components: a });
69
+ for (const r of S(n)) {
70
+ for (const l of r.fields) {
71
+ const i = e.fields?.[r.dataset]?.[l.field];
72
+ i !== void 0 && E(n, l.path, i);
73
+ }
74
+ const s = e.datasets?.[r.dataset];
75
+ s !== void 0 && E(n, `${r.path}.dataset`, s);
76
+ }
77
+ }
78
+ function h(t) {
79
+ if (!t || typeof t != "object") return;
80
+ if (Array.isArray(t)) {
81
+ t.forEach(h);
82
+ return;
83
+ }
84
+ const a = t;
85
+ for (const e of ["nid", "rkey", "table", "source"]) delete a[e];
86
+ if (a.kind === "list" && delete a.id, a.meta && typeof a.meta == "object")
87
+ for (const e of ["fragment", "labelSource", "record"])
88
+ delete a.meta[e];
89
+ Object.values(a).forEach(h);
90
+ }
91
+ function x(t) {
92
+ const a = new Set(
93
+ t.template.pages.flatMap(
94
+ (n) => n.components.map(
95
+ (r) => r.meta?.fragment?.instance
96
+ )
97
+ )
98
+ );
99
+ let e = 1;
100
+ for (; a.has(`fragment-${e}`); ) e++;
101
+ return `fragment-${e}`;
102
+ }
103
+ function F(t, a, e) {
104
+ const n = e ? t.components.flatMap(
105
+ (s, l) => s.meta?.fragment?.instance === e ? [l] : []
106
+ ) : [];
107
+ if (e && !n.length)
108
+ throw new Error("Fragment instance no longer exists");
109
+ const r = n.map((s) => t.components[s]);
110
+ if (r.some(
111
+ (s) => s.meta?.fragment?.id !== a.id
112
+ ))
113
+ throw new Error("An upgrade must use the same fragment identity");
114
+ return {
115
+ replacing: n,
116
+ left: r.length ? Math.min(...r.map((s) => s.leftMm)) : t.marginLeftMm ?? 0,
117
+ top: r.length ? Math.min(...r.map((s) => s.topMm)) : t.marginTopMm ?? 0
118
+ };
119
+ }
120
+ function k(t, a) {
121
+ if (a.some(
122
+ (e) => e.leftMm < 0 || e.topMm < 0 || e.leftMm + e.widthMm > t.widthMm + 1e-3 || e.topMm + (e.kind === "list" ? e.rowHeightMm ?? 7 : e.heightMm) > t.heightMm + 1e-3
123
+ ))
124
+ throw new Error(
125
+ "Fragment exceeds the target page; choose a larger page or adjust its placement"
126
+ );
127
+ }
128
+ function v(t, a, e) {
129
+ M(a);
130
+ const n = p(t), r = n.template.pages[e.pageIndex];
131
+ if (!r || r.flow)
132
+ throw new Error("Choose a fixed page before inserting a fragment");
133
+ const s = F(r, a, e.replaceInstance), l = s.replacing, i = e.leftMm ?? s.left, m = e.topMm ?? s.top, o = c(a.components), w = e.replaceInstance ?? x(n);
134
+ if (a.repeatDataset && n.template.repeat?.dataset !== (e.bindings?.datasets?.[a.repeatDataset] ?? a.repeatDataset))
135
+ throw new Error("Bind this label fragment to the current record dataset");
136
+ b(a, o, e.bindings), o.forEach(h), o.forEach((f, d) => {
137
+ f.leftMm += i, f.topMm += m, f.meta = {
138
+ ...f.meta,
139
+ fragment: {
140
+ id: a.id,
141
+ revision: a.revision,
142
+ instance: w,
143
+ slot: d
144
+ }
145
+ };
146
+ }), k(r, o);
147
+ const y = l[0] ?? r.components.length;
148
+ return r.components = r.components.filter(
149
+ (f, d) => !l.includes(d)
150
+ ), r.components.splice(y, 0, ...o), {
151
+ document: p(n),
152
+ componentIndices: o.map((f, d) => y + d),
153
+ instance: w
154
+ };
155
+ }
156
+ function B(t, a, e, n) {
157
+ const r = p(t), s = r.template.pages[a];
158
+ if (!s) throw new Error("Page no longer exists");
159
+ for (const l of e) {
160
+ const i = s.components[l];
161
+ if (!i) throw new Error("Component no longer exists");
162
+ i.kind === "list" ? n.target === "header" ? D(i, n.style) : i.columns.forEach((m) => {
163
+ m.style = g(m.style, c(n.style)), n.style.align && (m.align = n.style.align);
164
+ }) : i.style = g(
165
+ i.style,
166
+ c(n.style)
167
+ );
168
+ }
169
+ return p(r);
170
+ }
171
+ function D(t, a) {
172
+ if (t.headerStyle = g(
173
+ t.headerStyle,
174
+ c(a)
175
+ ), t.columns.forEach((e) => {
176
+ e.headerStyle = g(e.headerStyle, c(a)), a.align && (e.headerAlign = a.align);
177
+ }), t.headerGrid)
178
+ for (const e of t.headerGrid.cells)
179
+ for (const n of e)
180
+ n && (n.style = g(n.style, c(a)));
181
+ }
182
+ export {
183
+ B as a,
184
+ $ as b,
185
+ j as c,
186
+ v as i
187
+ };
@@ -0,0 +1 @@
1
+ "use strict";const f=require("./template-registry-D3SjENi6.cjs"),T=require("./template-bindings-BJR4k7qZ.cjs"),g=require("./style-UgIJSA1F.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;
@@ -0,0 +1 @@
1
+ "use strict";const u=require("./template-bindings-BJR4k7qZ.cjs");function $(e){const a=/\.pages\[(\d+)\](?:\.components\[(\d+)\])?/.exec(e);return a?{pageIndex:Number(a[1]),...a[2]===void 0?{}:{componentIndex:Number(a[2])}}:{}}function m(e,a,l){return u.collectTemplateDatasetBindings(e).filter(s=>s.dataset===a).flatMap(s=>s.fields.filter(t=>t.field===l).map(t=>({...t,...$(t.path),dataset:a,kind:/\.computed\[/.test(t.path)?"calculation":/\.columns\[\d+\]\.field$/.test(t.path)?"display":"binding"})))}function g(e,a){const l=e.kind==="list"?e.title||e.dataset:e.binding?.field||e.text||e.nid;return`${e.kind} · ${(l||String(a+1)).replace(/\s+/g," ").slice(0,80)}`}function k(e){const a=u.collectTemplateDatasetBindings(e),l=new Map;for(const t of a)for(const d of t.fields){const c=/^\$\.template\.pages\[\d+\]\.components\[\d+\]/.exec(d.path)?.[0];if(!c)continue;const n=l.get(c)??[];n.push({...d,dataset:t.dataset}),l.set(c,n)}const s=[];return e.pages.forEach((t,d)=>{const c=`$.template.pages[${d}]`;s.push({path:c,pageIndex:d,kind:"page",depth:0,title:typeof t.meta?.title=="string"?t.meta.title:`${d+1} · ${t.widthMm} × ${t.heightMm} mm`}),t.components.forEach((n,p)=>{const o=`${c}.components[${p}]`,f={pageIndex:d,componentIndex:p};s.push({path:o,...f,depth:1,kind:"component",title:g(n,p)}),n.kind==="list"&&(n.columns.forEach((i,h)=>s.push({path:`${o}.columns[${h}].field`,...f,depth:2,kind:"field",title:`${i.header} · ${i.field}`,field:i.field,dataset:n.dataset})),n.computed?.forEach((i,h)=>s.push({path:`${o}.computed[${h}]`,...f,depth:2,kind:"calculation",title:i.field,field:i.field,dataset:n.dataset})));const r=new Set;for(const i of l.get(o)??[])/\.columns\[\d+\]\.field$/.test(i.path)||r.has(i.path)||(r.add(i.path),s.push({...i,...f,depth:2,kind:"binding",title:i.field}))})}),s}exports.collectTemplateOutline=k;exports.inspectTemplateFieldUsage=m;exports.templatePathLocation=$;
@@ -0,0 +1,88 @@
1
+ import { g as u } from "./template-bindings-Daui7hLF.js";
2
+ function $(e) {
3
+ const s = /\.pages\[(\d+)\](?:\.components\[(\d+)\])?/.exec(e);
4
+ return s ? {
5
+ pageIndex: Number(s[1]),
6
+ ...s[2] === void 0 ? {} : { componentIndex: Number(s[2]) }
7
+ } : {};
8
+ }
9
+ function k(e, s, n) {
10
+ return u(e).filter((a) => a.dataset === s).flatMap(
11
+ (a) => a.fields.filter((t) => t.field === n).map((t) => ({
12
+ ...t,
13
+ ...$(t.path),
14
+ dataset: s,
15
+ kind: /\.computed\[/.test(t.path) ? "calculation" : /\.columns\[\d+\]\.field$/.test(t.path) ? "display" : "binding"
16
+ }))
17
+ );
18
+ }
19
+ function g(e, s) {
20
+ const n = e.kind === "list" ? e.title || e.dataset : e.binding?.field || e.text || e.nid;
21
+ return `${e.kind} · ${(n || String(s + 1)).replace(/\s+/g, " ").slice(0, 80)}`;
22
+ }
23
+ function b(e) {
24
+ const s = u(e), n = /* @__PURE__ */ new Map();
25
+ for (const t of s)
26
+ for (const l of t.fields) {
27
+ const c = /^\$\.template\.pages\[\d+\]\.components\[\d+\]/.exec(
28
+ l.path
29
+ )?.[0];
30
+ if (!c) continue;
31
+ const d = n.get(c) ?? [];
32
+ d.push({ ...l, dataset: t.dataset }), n.set(c, d);
33
+ }
34
+ const a = [];
35
+ return e.pages.forEach((t, l) => {
36
+ const c = `$.template.pages[${l}]`;
37
+ a.push({
38
+ path: c,
39
+ pageIndex: l,
40
+ kind: "page",
41
+ depth: 0,
42
+ title: typeof t.meta?.title == "string" ? t.meta.title : `${l + 1} · ${t.widthMm} × ${t.heightMm} mm`
43
+ }), t.components.forEach((d, h) => {
44
+ const f = `${c}.components[${h}]`, o = { pageIndex: l, componentIndex: h };
45
+ a.push({
46
+ path: f,
47
+ ...o,
48
+ depth: 1,
49
+ kind: "component",
50
+ title: g(d, h)
51
+ }), d.kind === "list" && (d.columns.forEach(
52
+ (i, p) => a.push({
53
+ path: `${f}.columns[${p}].field`,
54
+ ...o,
55
+ depth: 2,
56
+ kind: "field",
57
+ title: `${i.header} · ${i.field}`,
58
+ field: i.field,
59
+ dataset: d.dataset
60
+ })
61
+ ), d.computed?.forEach(
62
+ (i, p) => a.push({
63
+ path: `${f}.computed[${p}]`,
64
+ ...o,
65
+ depth: 2,
66
+ kind: "calculation",
67
+ title: i.field,
68
+ field: i.field,
69
+ dataset: d.dataset
70
+ })
71
+ ));
72
+ const r = /* @__PURE__ */ new Set();
73
+ for (const i of n.get(f) ?? [])
74
+ /\.columns\[\d+\]\.field$/.test(i.path) || r.has(i.path) || (r.add(i.path), a.push({
75
+ ...i,
76
+ ...o,
77
+ depth: 2,
78
+ kind: "binding",
79
+ title: i.field
80
+ }));
81
+ });
82
+ }), a;
83
+ }
84
+ export {
85
+ b as c,
86
+ k as i,
87
+ $ as t
88
+ };
@@ -1,7 +1,7 @@
1
1
  import { v as J } from "./matrix-yZsGnldA.js";
2
2
  import { v as j, e as D } from "./computed-Bvk0W15F.js";
3
3
  import { R as H } from "./render-plan-Ck6koX9L.js";
4
- import { v as L, d as K } from "./validate-DbgEM1Hh.js";
4
+ import { b as L, d as K } from "./validate-CkQBWCeg.js";
5
5
  import { v as U, e as W } from "./param-validation-BlHHXs6u.js";
6
6
  import { v as G, a as z } from "./tree-CqcQ99NM.js";
7
7
  function x(e) {
@@ -4,7 +4,7 @@ function r(o) {
4
4
  function e() {
5
5
  n.value = t();
6
6
  }
7
- return e(), { pending: a, snapshot: t, accept: e };
7
+ return e(), { pending: a, snapshot: t, accept: e, baseline: n };
8
8
  }
9
9
  export {
10
10
  r as u
@@ -1 +1 @@
1
- "use strict";const c=require("vue");function a(s){const e=c.ref(""),t=()=>JSON.stringify(s()),u=c.computed(()=>e.value!==""&&t()!==e.value);function n(){e.value=t()}return n(),{pending:u,snapshot:t,accept:n}}exports.useLocalDraft=a;
1
+ "use strict";const c=require("vue");function a(s){const e=c.ref(""),t=()=>JSON.stringify(s()),u=c.computed(()=>e.value!==""&&t()!==e.value);function n(){e.value=t()}return n(),{pending:u,snapshot:t,accept:n,baseline:e}}exports.useLocalDraft=a;
@@ -156,8 +156,8 @@ function I(e) {
156
156
  }
157
157
  export {
158
158
  I as a,
159
- N as b,
160
- E as c,
159
+ g as b,
160
+ N as c,
161
161
  $ as d,
162
- g as v
162
+ E as v
163
163
  };