@agile-team/mach-report 2.21.1 → 2.22.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 +16 -2
- package/dist/{ExcelBindingWizard-Bu0LUlzl.cjs → ExcelBindingWizard-CW79I6Gl.cjs} +1 -1
- package/dist/{ExcelBindingWizard-mnAO2qOX.js → ExcelBindingWizard-CZyppD7I.js} +3 -3
- package/dist/{ParamEditor-38ZfNrPU.cjs → ParamEditor-CiYCJI0b.cjs} +1 -1
- package/dist/{ParamEditor-C8l0EC8m.js → ParamEditor-DQit-Gdf.js} +2 -2
- package/dist/{ReportBatchPanel-CfUVhvkO.js → ReportBatchPanel-DKTpV7MU.js} +2 -2
- package/dist/{ReportBatchPanel-nCC06Nfp.cjs → ReportBatchPanel-Db6TAfG5.cjs} +1 -1
- package/dist/ReportLabelStudio-B0i9ohQj.cjs +1 -0
- package/dist/ReportLabelStudio-BYnRqmje.js +780 -0
- package/dist/{ReportParamPanel-peB-KEmm.js → ReportParamPanel-BHSKVL8k.js} +231 -224
- package/dist/ReportParamPanel-lngONOEz.cjs +1 -0
- package/dist/ReportPreview-BDgKssYR.js +5887 -0
- package/dist/ReportPreview-Dw-4icG6.cjs +6 -0
- package/dist/{ReportTemplateLibrary-B5t_EcIs.js → ReportTemplateLibrary-BZuKn0YK.js} +1 -1
- package/dist/{ReportTemplateLibrary-DVlsf72p.cjs → ReportTemplateLibrary-DEXH07ND.cjs} +1 -1
- package/dist/{RuleEditor-kT1JsZ9f.js → RuleEditor-CIQn547x.js} +3 -3
- package/dist/{RuleEditor-xFkCVlii.cjs → RuleEditor-zSUmPjKa.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-CDI6mfWx.cjs → TemplateOutlinePanel-B5SfGYVN.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-BesgGR1P.js → TemplateOutlinePanel-D0PgOSQE.js} +2 -2
- package/dist/{TemplateReusePanel-BNFU6V-W.js → TemplateReusePanel-BKlAEF8-.js} +2 -2
- package/dist/{TemplateReusePanel-BG9Or5-P.cjs → TemplateReusePanel-DAy_Hwqz.cjs} +1 -1
- package/dist/TemplateReviewPanel-CowmHaQQ.cjs +1 -0
- package/dist/{TemplateReviewPanel-CwvwyCSs.js → TemplateReviewPanel-div-EH_m.js} +2 -2
- package/dist/artifact-integrity.json +76 -76
- package/dist/{auto-Tq7ReIC1.cjs → auto-DcUHlKob.cjs} +1 -1
- package/dist/{auto-BkdGiNtr.js → auto-moShblh1.js} +4 -4
- package/dist/{designer-HQi-03R6.js → designer-B7jJeAeG.js} +1500 -1455
- package/dist/{designer-DU3yDWgs.cjs → designer-BWQVpJeN.cjs} +2 -2
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +149 -2
- package/dist/designer.d.ts +149 -2
- package/dist/designer.js +13 -12
- package/dist/{encoding-BSeUwrN7.js → encoding-DbnhbwI8.js} +2 -2
- package/dist/{encoding-B79hW4zq.cjs → encoding-ncQAvyOv.cjs} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +299 -279
- package/dist/{json-snapshot-Kgn459Oj.js → json-snapshot-DvQbZlD7.js} +2 -2
- package/dist/{json-snapshot-I5VI84Vp.cjs → json-snapshot-nyV63AbB.cjs} +1 -1
- package/dist/{plugin-BaRUGORD.cjs → plugin-AcAQ2m9X.cjs} +1 -1
- package/dist/{plugin-D4kAxfLG.js → plugin-w5Nyt08U.js} +1 -1
- package/dist/{prefill-CJSazcVY.js → prefill-BXBxx5We.js} +1 -1
- package/dist/{prefill-Bpyn58AZ.cjs → prefill-DUvejVt1.cjs} +1 -1
- package/dist/prepared-YXy-fVLw.cjs +1 -0
- package/dist/{prepared-BwjwEzFz.js → prepared-rXCKqdHY.js} +35 -34
- package/dist/{protocol-C8VWF9An.cjs → protocol-C9ZaylID.cjs} +1 -1
- package/dist/{protocol-Bs9-ohHN.js → protocol-fjaeKkjf.js} +3 -3
- package/dist/{region-binding-workflow-JNowHd0A.cjs → region-binding-workflow-BiJQ7NU6.cjs} +1 -1
- package/dist/{region-binding-workflow-Cy4GIOUo.js → region-binding-workflow-aA8nxmkZ.js} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{runtime-BDf5x1i1.js → runtime-BTtpjF3D.js} +4 -4
- package/dist/{runtime-DsJt1PIf.cjs → runtime-Dq0LUsyS.cjs} +1 -1
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +9 -0
- package/dist/server/node.d.ts +9 -0
- package/dist/server-node.cjs +5 -4
- package/dist/server-node.js +1838 -1760
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +81 -0
- package/dist/server.d.ts +81 -0
- package/dist/server.js +6 -6
- package/dist/style.css +1 -1
- package/dist/template-catalog-CLAM4w7H.cjs +1 -0
- package/dist/{template-catalog-DFwIS9aN.js → template-catalog-JSxSqk5y.js} +3 -3
- package/dist/template-fragments-Ca25Jt7e.cjs +1 -0
- package/dist/{template-fragments-Dng-AlHk.js → template-fragments-D2JFj7Du.js} +18 -18
- package/dist/{template-outline-DiADphlq.js → template-outline-CDWXptuj.js} +1 -1
- package/dist/template-outline-K4jGhATu.cjs +1 -0
- package/dist/template-registry-CWnuGqyP.cjs +1 -0
- package/dist/{template-registry-DhBqoD7W.js → template-registry-Do1Uav2Z.js} +333 -261
- package/dist/template-serialization-CU4n_Miu.js +307 -0
- package/dist/template-serialization-CgqBo6s-.cjs +1 -0
- package/dist/vue/async.d.cts +97 -2
- package/dist/vue/async.d.ts +97 -2
- package/dist/vue/index.d.cts +197 -4
- package/dist/vue/index.d.ts +197 -4
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +75 -70
- package/dist/{workbook-session-NYv01LHe.cjs → workbook-session-BvEBRRMz.cjs} +1 -1
- package/dist/{workbook-session-oinxX3qo.js → workbook-session-f0wVlzst.js} +1 -1
- package/dist/workbook-sheets-CaPAulQ6.cjs +2 -0
- package/dist/workbook-sheets-D4M7XXBh.js +44 -0
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +9 -0
- package/dist/worker.d.ts +9 -0
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +39 -2
- package/dist/xlsx.d.ts +39 -2
- package/dist/xlsx.js +290 -270
- package/package.json +1 -1
- package/dist/ReportLabelStudio-CaEvYuSK.cjs +0 -1
- package/dist/ReportLabelStudio-DQPBmh4v.js +0 -765
- package/dist/ReportParamPanel-CVpK8mFc.cjs +0 -1
- package/dist/ReportPreview-BBJNlu2U.js +0 -5740
- package/dist/ReportPreview-nf4Dk1Jc.cjs +0 -6
- package/dist/TemplateReviewPanel-BmBrjt6P.cjs +0 -1
- package/dist/prepared-BiSz_9vN.cjs +0 -1
- package/dist/template-bindings-Cg5oBLFT.cjs +0 -1
- package/dist/template-bindings-TKnXM7ll.js +0 -62
- package/dist/template-catalog-D_2jdnkL.cjs +0 -1
- package/dist/template-fragments-DZVUBhuB.cjs +0 -1
- package/dist/template-outline-DWkzZXVC.cjs +0 -1
- package/dist/template-registry-DpLUSLwF.cjs +0 -1
- package/dist/template-serialization-Cc3h-miv.js +0 -247
- package/dist/template-serialization-D1R5oAqh.cjs +0 -1
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { e as V, c as v } from "./computed-C8NRZQss.js";
|
|
2
|
+
function c(e) {
|
|
3
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
4
|
+
}
|
|
5
|
+
function a(e, r, i) {
|
|
6
|
+
typeof e == "string" ? i.push({ field: e, path: r }) : Array.isArray(e) && e.forEach((n, t) => a(n, `${r}[${t}]`, i));
|
|
7
|
+
}
|
|
8
|
+
function w(e, r, i) {
|
|
9
|
+
if (Array.isArray(e)) {
|
|
10
|
+
e.forEach((n, t) => w(n, `${r}[${t}]`, i));
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (c(e))
|
|
14
|
+
for (const [n, t] of Object.entries(e))
|
|
15
|
+
["field", "weightField"].includes(n) ? a(t, `${r}.${n}`, i) : n !== "value" && n !== "style" && w(t, `${r}.${n}`, i);
|
|
16
|
+
}
|
|
17
|
+
function p(e, r, i) {
|
|
18
|
+
Array.isArray(e) && e.forEach((n, t) => {
|
|
19
|
+
if (!c(n)) return;
|
|
20
|
+
typeof n.field == "string" && n.valueField !== void 0 && n.valueField !== n.field && i.summaries.add(n.field);
|
|
21
|
+
const o = n.valueField === void 0 ? "field" : "valueField";
|
|
22
|
+
a(n[o], `${r}[${t}].${o}`, i.fields), n.valueField !== void 0 && n.valueField === n.field && a(n.field, `${r}[${t}].field`, i.fields), a(n.weightField, `${r}[${t}].weightField`, i.fields);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function j(e, r, i) {
|
|
26
|
+
for (const t of ["rowKey", "revisionField", "sourceTokenField"]) a(e[t], `${r}.${t}`, i.fields);
|
|
27
|
+
if (!e.matrix && Array.isArray(e.columns) && e.columns.forEach((t, o) => {
|
|
28
|
+
c(t) && (typeof t.field == "string" && i.fields.push({ field: t.field, path: `${r}.columns[${o}].field`, summary: !0 }), w(t.rules, `${r}.columns[${o}].rules`, i.fields), w(t.visibleWhen, `${r}.columns[${o}].visibleWhen`, i.fields));
|
|
29
|
+
}), w(e.rowVisibleWhen, `${r}.rowVisibleWhen`, i.fields), Array.isArray(e.computed) && e.computed.forEach((t, o) => {
|
|
30
|
+
c(t) && (typeof t.field == "string" && i.generated.add(t.field), w(t.expression, `${r}.computed[${o}].expression`, i.fields), a(t.dependsOn, `${r}.computed[${o}].dependsOn`, i.fields), a(t.groupBy, `${r}.computed[${o}].groupBy`, i.fields));
|
|
31
|
+
}), (Array.isArray(e.groups) ? e.groups.map((t, o) => ({ group: t, path: `${r}.groups[${o}]` })) : e.groupBy ? [{ group: e.groupBy, path: `${r}.groupBy` }] : []).forEach(({ group: t, path: o }) => {
|
|
32
|
+
c(t) && (a(t.field, `${o}.field`, i.fields), a(t.subtotal, `${o}.subtotal`, i.fields), p(t.aggregates, `${o}.aggregates`, i));
|
|
33
|
+
}), c(e.grandTotal) && (a(e.grandTotal.fields, `${r}.grandTotal.fields`, i.fields), p(e.grandTotal.aggregates, `${r}.grandTotal.aggregates`, i)), c(e.matrix) && (a(e.matrix.rowFields, `${r}.matrix.rowFields`, i.fields), a(e.matrix.columnFields, `${r}.matrix.columnFields`, i.fields), p(e.matrix.measures, `${r}.matrix.measures`, i)), c(e.tree)) {
|
|
34
|
+
for (const t of ["idField", "parentField", "labelField"]) a(e.tree[t], `${r}.tree.${t}`, i.fields);
|
|
35
|
+
p(e.tree.aggregates, `${r}.tree.aggregates`, i);
|
|
36
|
+
}
|
|
37
|
+
c(e.detail) && a(e.detail.parentKey, `${r}.detail.parentKey`, i.fields);
|
|
38
|
+
}
|
|
39
|
+
function U(e) {
|
|
40
|
+
const r = [], i = e.repeat, n = i ? { dataset: i.dataset, path: "$.template.repeat", fields: [], generated: /* @__PURE__ */ new Set(), summaries: /* @__PURE__ */ new Set() } : void 0;
|
|
41
|
+
n && i && (a(i.rowKey, "$.template.repeat.rowKey", n.fields), typeof i.copies == "object" && a(i.copies.field, "$.template.repeat.copies.field", n.fields), r.push(n));
|
|
42
|
+
function t(o, s) {
|
|
43
|
+
if (Array.isArray(o)) {
|
|
44
|
+
o.forEach((f, l) => t(f, `${s}[${l}]`));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (c(o)) {
|
|
48
|
+
if (n && c(o.binding) && a(o.binding.field, `${s}.binding.field`, n.fields), c(o.chartBinding) && typeof o.chartBinding.dataset == "string") {
|
|
49
|
+
const f = `${s}.chartBinding`, l = o.chartBinding, d = { dataset: l.dataset, path: f, fields: [], generated: /* @__PURE__ */ new Set(), summaries: /* @__PURE__ */ new Set() };
|
|
50
|
+
a(l.categoryField, `${f}.categoryField`, d.fields), w(l.measures, `${f}.measures`, d.fields), r.push(d);
|
|
51
|
+
}
|
|
52
|
+
if (typeof o.dataset == "string" && Array.isArray(o.columns)) {
|
|
53
|
+
const f = { dataset: o.dataset, path: s, fields: [], generated: /* @__PURE__ */ new Set(), summaries: /* @__PURE__ */ new Set() };
|
|
54
|
+
j(o, s, f), typeof o.foreignKey == "string" && a(o.foreignKey, `${s}.foreignKey`, f.fields), r.push(f);
|
|
55
|
+
}
|
|
56
|
+
for (const [f, l] of Object.entries(o)) t(l, `${s}.${f}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return t(e, "$.template"), r;
|
|
60
|
+
}
|
|
61
|
+
class K extends Error {
|
|
62
|
+
constructor(r) {
|
|
63
|
+
super(`树节点超出行数预算 ${r}`), this.limit = r, this.code = "tree-row-limit", this.name = "TreeRowLimitError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function E(e, r, i, n) {
|
|
67
|
+
const t = e ?? r;
|
|
68
|
+
if (!Number.isInteger(t) || t < 1 || t > i) throw new Error(`${n}应为 1–${i} 的整数`);
|
|
69
|
+
return t;
|
|
70
|
+
}
|
|
71
|
+
function b(e) {
|
|
72
|
+
return { rows: E(e.maxRows, 1e5, 1e6, "树行数预算"), depth: E(e.maxDepth, 64, 256, "树深度预算"), visits: E(e.maxAggregationVisits, 1e6, 1e7, "树聚合访问预算") };
|
|
73
|
+
}
|
|
74
|
+
function M(e) {
|
|
75
|
+
return typeof e == "string" && !!e.trim();
|
|
76
|
+
}
|
|
77
|
+
function g(e) {
|
|
78
|
+
return M(e) && !["__proto__", "prototype", "constructor"].includes(e);
|
|
79
|
+
}
|
|
80
|
+
function N(e) {
|
|
81
|
+
if (M(e) || typeof e == "number" && Number.isFinite(e)) return e;
|
|
82
|
+
throw new Error("树节点业务键应为非空字符串或有限数字");
|
|
83
|
+
}
|
|
84
|
+
function S(e) {
|
|
85
|
+
return JSON.stringify([typeof e, e]);
|
|
86
|
+
}
|
|
87
|
+
function x(e) {
|
|
88
|
+
return [e.idField, ...e.input === "flat" ? [e.parentField ?? ""] : [e.childrenField ?? "children"]];
|
|
89
|
+
}
|
|
90
|
+
function R(e, r) {
|
|
91
|
+
const i = x(e);
|
|
92
|
+
if (r?.some((n) => n.scope && n.scope !== "row" || i.includes(n.field))) throw new Error("树形布局仅支持不覆盖结构键的当前行计算");
|
|
93
|
+
}
|
|
94
|
+
function m(e) {
|
|
95
|
+
if (!e?.aborted) return;
|
|
96
|
+
const r = new Error("树报表处理已取消");
|
|
97
|
+
throw r.name = "AbortError", r;
|
|
98
|
+
}
|
|
99
|
+
function I(e) {
|
|
100
|
+
const r = e.aggregates ?? [];
|
|
101
|
+
if (!Array.isArray(r) || r.length > 32) throw new Error("树聚合最多 32 项");
|
|
102
|
+
if (e.parentValues !== "leaf-aggregate" && r.length) throw new Error("树聚合需显式选择 leaf-aggregate 父级取值策略");
|
|
103
|
+
if (e.parentValues === "leaf-aggregate" && !r.length) throw new Error("叶子聚合策略至少需要一个聚合字段");
|
|
104
|
+
const i = /* @__PURE__ */ new Set();
|
|
105
|
+
for (const n of r) {
|
|
106
|
+
if (!n || !g(n.field) || i.has(n.field)) throw new Error("树聚合输出字段应安全、非空且唯一");
|
|
107
|
+
for (const t of [n.valueField, n.weightField]) if (t !== void 0 && !g(t)) throw new Error("树聚合来源字段应安全且非空");
|
|
108
|
+
if ([...x(e), e.labelField].includes(n.field)) throw new Error("树聚合不能覆盖结构键或标签字段");
|
|
109
|
+
i.add(n.field), v({ ...n, field: n.valueField ?? n.field });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function _(e) {
|
|
113
|
+
if (!g(e.idField) || !g(e.labelField)) throw new Error("树需要安全的业务键和标签字段");
|
|
114
|
+
if (e.input === "flat" && (!g(e.parentField) || e.parentField === e.idField)) throw new Error("扁平树需要独立的父键字段");
|
|
115
|
+
if (e.childrenField !== void 0 && !g(e.childrenField)) throw new Error("子节点字段应安全且非空");
|
|
116
|
+
if (e.input === "nested" && [e.idField, e.labelField].includes(e.childrenField ?? "children")) throw new Error("子节点字段不能覆盖业务键或标签字段");
|
|
117
|
+
}
|
|
118
|
+
function W(e) {
|
|
119
|
+
if (!e || typeof e != "object" || !["flat", "nested"].includes(e.input)) throw new Error("树输入应为 flat 或 nested");
|
|
120
|
+
if (_(e), e.orphan !== void 0 && !["error", "root"].includes(e.orphan)) throw new Error("树孤儿策略应为 error 或 root");
|
|
121
|
+
if (e.parentValues !== void 0 && !["source", "leaf-aggregate"].includes(e.parentValues)) throw new Error("未知树父级取值策略");
|
|
122
|
+
if (e.indentMm !== void 0 && (!Number.isFinite(e.indentMm) || e.indentMm < 0 || e.indentMm > 20)) throw new Error("树每级缩进应为 0–20 mm");
|
|
123
|
+
b(e), I(e);
|
|
124
|
+
}
|
|
125
|
+
function C(e, r, i, n) {
|
|
126
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw new Error("树节点应为对象");
|
|
127
|
+
if (i.size >= n.rows) throw new K(n.rows);
|
|
128
|
+
const t = N(e[r.idField]), o = S(t);
|
|
129
|
+
if (i.has(o)) throw new Error(`树节点业务键重复:${String(t)}`);
|
|
130
|
+
const s = { original: e, row: e, key: t, depth: 0, children: [] };
|
|
131
|
+
return i.set(o, s), s;
|
|
132
|
+
}
|
|
133
|
+
function D(e, r, i, n, t) {
|
|
134
|
+
for (const s of e)
|
|
135
|
+
m(t), C(s, r, i, n);
|
|
136
|
+
const o = [];
|
|
137
|
+
for (const s of i.values()) {
|
|
138
|
+
m(t);
|
|
139
|
+
const f = s.row[r.parentField];
|
|
140
|
+
if (f == null) {
|
|
141
|
+
o.push(s);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const l = i.get(S(N(f)));
|
|
145
|
+
if (!l) {
|
|
146
|
+
if (r.orphan !== "root") throw new Error(`树节点 ${String(s.key)} 的父节点不存在`);
|
|
147
|
+
o.push(s);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (l === s) throw new Error("树节点不能以自身为父节点");
|
|
151
|
+
s.parent = l, l.children.push(s);
|
|
152
|
+
}
|
|
153
|
+
return o;
|
|
154
|
+
}
|
|
155
|
+
function J(e, r, i, n, t) {
|
|
156
|
+
const o = [], s = [{ rows: e, next: 0 }];
|
|
157
|
+
for (; s.length; ) {
|
|
158
|
+
m(t);
|
|
159
|
+
const f = s[s.length - 1];
|
|
160
|
+
if (f.next >= f.rows.length) {
|
|
161
|
+
s.pop();
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const l = C(f.rows[f.next++], r, i, n);
|
|
165
|
+
if (l.parent = f.parent, l.depth = s.length - 1, s.length > n.depth) throw new Error(`树节点超出深度预算 ${n.depth}`);
|
|
166
|
+
(f.parent?.children ?? o).push(l);
|
|
167
|
+
const d = l.row[r.childrenField ?? "children"];
|
|
168
|
+
if (d != null) {
|
|
169
|
+
if (!Array.isArray(d)) throw new Error("嵌套树 children 字段应为数组");
|
|
170
|
+
d.length && s.push({ rows: d, next: 0, parent: l });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return o;
|
|
174
|
+
}
|
|
175
|
+
function L(e, r, i, n) {
|
|
176
|
+
const t = [], o = [{ nodes: e, next: 0 }];
|
|
177
|
+
for (; o.length; ) {
|
|
178
|
+
m(n);
|
|
179
|
+
const s = o[o.length - 1];
|
|
180
|
+
if (s.next >= s.nodes.length) {
|
|
181
|
+
o.pop();
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (o.length > i.depth) throw new Error(`树节点超出深度预算 ${i.depth}`);
|
|
185
|
+
const f = s.nodes[s.next++];
|
|
186
|
+
f.depth = o.length - 1, t.push(f), f.children.length && o.push({ nodes: f.children, next: 0 });
|
|
187
|
+
}
|
|
188
|
+
if (t.length !== r) throw new Error("树父子关系存在循环");
|
|
189
|
+
return t;
|
|
190
|
+
}
|
|
191
|
+
function z(e, r, i, n) {
|
|
192
|
+
if (r.parentValues !== "leaf-aggregate") return;
|
|
193
|
+
const t = r.aggregates, o = /* @__PURE__ */ new Map();
|
|
194
|
+
for (const f of e) f.children.length && o.set(f, t.map((l) => v({ ...l, field: l.valueField ?? l.field })));
|
|
195
|
+
let s = 0;
|
|
196
|
+
for (const f of e)
|
|
197
|
+
if (!f.children.length)
|
|
198
|
+
for (let l = f.parent; l; l = l.parent) {
|
|
199
|
+
if (m(n), s += t.length, s > i.visits) throw new Error(`树聚合超出访问预算 ${i.visits}`);
|
|
200
|
+
for (const d of o.get(l)) d.add(f.row);
|
|
201
|
+
}
|
|
202
|
+
for (const [f, l] of o)
|
|
203
|
+
f.row = { ...f.row }, t.forEach((d, u) => {
|
|
204
|
+
f.row[d.field] = l[u].value();
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function O(e, r, i) {
|
|
208
|
+
if (W(r), m(i), !Array.isArray(e)) throw new Error("树数据应为节点数组");
|
|
209
|
+
const n = b(r), t = /* @__PURE__ */ new Map(), o = r.input === "flat" ? D(e, r, t, n, i) : J(e, r, t, n, i);
|
|
210
|
+
return L(o, t.size, n, i);
|
|
211
|
+
}
|
|
212
|
+
function Y(e, r, i) {
|
|
213
|
+
return O(e, r, i).map((n) => n.original);
|
|
214
|
+
}
|
|
215
|
+
function Z(e, r, i = {}) {
|
|
216
|
+
const n = O(e, r, i.signal);
|
|
217
|
+
if (R(r, i.computed?.fields), i.computed?.fields.length) {
|
|
218
|
+
const t = V(n.map((o) => o.row), { ...i.computed, signal: i.signal }).rows;
|
|
219
|
+
n.forEach((o, s) => {
|
|
220
|
+
o.row = t[s];
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return z(n, r, b(r), i.signal), { rows: n.map((t) => t.row), entries: n.map((t) => ({ row: t.row, original: t.original, key: t.key, depth: t.depth, hasChildren: !!t.children.length })), leaves: n.filter((t) => !t.children.length).map((t) => t.row) };
|
|
224
|
+
}
|
|
225
|
+
const H = /^#[0-9a-f]{6}$/i;
|
|
226
|
+
function X(e) {
|
|
227
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
228
|
+
const r = e;
|
|
229
|
+
return r.kind !== "colorScale" && r.kind !== "dataBar" || r.field !== void 0 && (typeof r.field != "string" || !r.field.trim()) || r.numeric !== void 0 && !["number", "decimal"].includes(r.numeric) || [r.min, r.max].some((i) => i !== void 0 && (typeof i != "number" || !Number.isFinite(i))) || r.min !== void 0 && r.max !== void 0 && r.min > r.max ? !1 : Object.entries(r).every(([i, n]) => !["color", "negativeColor", "lowColor", "highColor"].includes(i) || typeof n == "string" && H.test(n));
|
|
230
|
+
}
|
|
231
|
+
function B(e, r) {
|
|
232
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
|
|
233
|
+
if (r !== "decimal" || typeof e != "string" || e.length > 1024 || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(e)) return;
|
|
234
|
+
const i = Number(e);
|
|
235
|
+
return Number.isFinite(i) ? i : void 0;
|
|
236
|
+
}
|
|
237
|
+
function q(e, r, i) {
|
|
238
|
+
let n = "#";
|
|
239
|
+
for (const t of [1, 3, 5]) {
|
|
240
|
+
const o = parseInt(e.slice(t, t + 2), 16), s = parseInt(r.slice(t, t + 2), 16);
|
|
241
|
+
n += Math.round(o + (s - o) * i).toString(16).padStart(2, "0");
|
|
242
|
+
}
|
|
243
|
+
return n;
|
|
244
|
+
}
|
|
245
|
+
function A(e, r, i) {
|
|
246
|
+
if (r === i) return e < r ? 0 : e > i ? 1 : 0.5;
|
|
247
|
+
if (e <= r) return 0;
|
|
248
|
+
if (e >= i) return 1;
|
|
249
|
+
const n = i - r;
|
|
250
|
+
return Number.isFinite(n) ? (e - r) / n : (e / 2 - r / 2) / (i / 2 - r / 2);
|
|
251
|
+
}
|
|
252
|
+
function G(e, r, i, n) {
|
|
253
|
+
const t = /* @__PURE__ */ new WeakMap();
|
|
254
|
+
return { apply(o, s) {
|
|
255
|
+
const f = B(s[r], e.numeric);
|
|
256
|
+
if (f === void 0) return;
|
|
257
|
+
if (e.kind === "dataBar") {
|
|
258
|
+
const h = Math.min(i, 0), $ = Math.max(n, 0), F = A(0, h, $), k = h === $ ? F : A(f, h, $);
|
|
259
|
+
o.dataBar = { start: Math.min(F, k), end: Math.max(F, k), color: f < 0 ? e.negativeColor ?? "#f3bcc3" : e.color ?? "#bad8fa" };
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const l = q(e.lowColor ?? "#f0f7ff", e.highColor ?? "#8bbcf1", A(f, i, n)), d = o.style ?? {}, u = t.get(d) ?? /* @__PURE__ */ new Map();
|
|
263
|
+
t.set(d, u);
|
|
264
|
+
let y = u.get(l);
|
|
265
|
+
y || (y = { ...d, backgroundColor: l }, u.set(l, y)), o.style = y;
|
|
266
|
+
} };
|
|
267
|
+
}
|
|
268
|
+
function ee(e, r, i) {
|
|
269
|
+
return e.map((n) => {
|
|
270
|
+
T(i);
|
|
271
|
+
const t = n.visual;
|
|
272
|
+
if (!t) return;
|
|
273
|
+
if (!X(t)) throw new TypeError("Invalid column visual rule");
|
|
274
|
+
const o = t.field ?? n.field;
|
|
275
|
+
let s = 1 / 0, f = -1 / 0, l = 0;
|
|
276
|
+
if (t.min === void 0 || t.max === void 0) for (const y of r) {
|
|
277
|
+
(l++ & 1023) === 0 && T(i);
|
|
278
|
+
const h = B(y[o], t.numeric);
|
|
279
|
+
h !== void 0 && (s = Math.min(s, h), f = Math.max(f, h));
|
|
280
|
+
}
|
|
281
|
+
let d = t.min ?? s, u = t.max ?? f;
|
|
282
|
+
if (!(!Number.isFinite(d) || !Number.isFinite(u)))
|
|
283
|
+
return d > u && (t.min !== void 0 ? u = d : d = u), G(t, o, d, u);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function T(e) {
|
|
287
|
+
if (e?.aborted) throw e.reason ?? new DOMException("Aborted", "AbortError");
|
|
288
|
+
}
|
|
289
|
+
const P = 1e7;
|
|
290
|
+
function re(e) {
|
|
291
|
+
const r = JSON.stringify(e, null, 2);
|
|
292
|
+
if (r.length > P)
|
|
293
|
+
throw new RangeError("模板 JSON 超过 1000 万字符的导出/导入上限");
|
|
294
|
+
return r;
|
|
295
|
+
}
|
|
296
|
+
export {
|
|
297
|
+
P as M,
|
|
298
|
+
K as T,
|
|
299
|
+
W as a,
|
|
300
|
+
U as b,
|
|
301
|
+
Z as c,
|
|
302
|
+
R as d,
|
|
303
|
+
ee as e,
|
|
304
|
+
Y as f,
|
|
305
|
+
re as s,
|
|
306
|
+
X as v
|
|
307
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const b=require("./computed-4TnxzgIh.cjs");function c(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function a(e,r,i){typeof e=="string"?i.push({field:e,path:r}):Array.isArray(e)&&e.forEach((n,t)=>a(n,`${r}[${t}]`,i))}function w(e,r,i){if(Array.isArray(e)){e.forEach((n,t)=>w(n,`${r}[${t}]`,i));return}if(c(e))for(const[n,t]of Object.entries(e))["field","weightField"].includes(n)?a(t,`${r}.${n}`,i):n!=="value"&&n!=="style"&&w(t,`${r}.${n}`,i)}function p(e,r,i){Array.isArray(e)&&e.forEach((n,t)=>{if(!c(n))return;typeof n.field=="string"&&n.valueField!==void 0&&n.valueField!==n.field&&i.summaries.add(n.field);const o=n.valueField===void 0?"field":"valueField";a(n[o],`${r}[${t}].${o}`,i.fields),n.valueField!==void 0&&n.valueField===n.field&&a(n.field,`${r}[${t}].field`,i.fields),a(n.weightField,`${r}[${t}].weightField`,i.fields)})}function I(e,r,i){for(const t of["rowKey","revisionField","sourceTokenField"])a(e[t],`${r}.${t}`,i.fields);if(!e.matrix&&Array.isArray(e.columns)&&e.columns.forEach((t,o)=>{c(t)&&(typeof t.field=="string"&&i.fields.push({field:t.field,path:`${r}.columns[${o}].field`,summary:!0}),w(t.rules,`${r}.columns[${o}].rules`,i.fields),w(t.visibleWhen,`${r}.columns[${o}].visibleWhen`,i.fields))}),w(e.rowVisibleWhen,`${r}.rowVisibleWhen`,i.fields),Array.isArray(e.computed)&&e.computed.forEach((t,o)=>{c(t)&&(typeof t.field=="string"&&i.generated.add(t.field),w(t.expression,`${r}.computed[${o}].expression`,i.fields),a(t.dependsOn,`${r}.computed[${o}].dependsOn`,i.fields),a(t.groupBy,`${r}.computed[${o}].groupBy`,i.fields))}),(Array.isArray(e.groups)?e.groups.map((t,o)=>({group:t,path:`${r}.groups[${o}]`})):e.groupBy?[{group:e.groupBy,path:`${r}.groupBy`}]:[]).forEach(({group:t,path:o})=>{c(t)&&(a(t.field,`${o}.field`,i.fields),a(t.subtotal,`${o}.subtotal`,i.fields),p(t.aggregates,`${o}.aggregates`,i))}),c(e.grandTotal)&&(a(e.grandTotal.fields,`${r}.grandTotal.fields`,i.fields),p(e.grandTotal.aggregates,`${r}.grandTotal.aggregates`,i)),c(e.matrix)&&(a(e.matrix.rowFields,`${r}.matrix.rowFields`,i.fields),a(e.matrix.columnFields,`${r}.matrix.columnFields`,i.fields),p(e.matrix.measures,`${r}.matrix.measures`,i)),c(e.tree)){for(const t of["idField","parentField","labelField"])a(e.tree[t],`${r}.tree.${t}`,i.fields);p(e.tree.aggregates,`${r}.tree.aggregates`,i)}c(e.detail)&&a(e.detail.parentKey,`${r}.detail.parentKey`,i.fields)}function L(e){const r=[],i=e.repeat,n=i?{dataset:i.dataset,path:"$.template.repeat",fields:[],generated:new Set,summaries:new Set}:void 0;n&&i&&(a(i.rowKey,"$.template.repeat.rowKey",n.fields),typeof i.copies=="object"&&a(i.copies.field,"$.template.repeat.copies.field",n.fields),r.push(n));function t(o,s){if(Array.isArray(o)){o.forEach((f,l)=>t(f,`${s}[${l}]`));return}if(c(o)){if(n&&c(o.binding)&&a(o.binding.field,`${s}.binding.field`,n.fields),c(o.chartBinding)&&typeof o.chartBinding.dataset=="string"){const f=`${s}.chartBinding`,l=o.chartBinding,d={dataset:l.dataset,path:f,fields:[],generated:new Set,summaries:new Set};a(l.categoryField,`${f}.categoryField`,d.fields),w(l.measures,`${f}.measures`,d.fields),r.push(d)}if(typeof o.dataset=="string"&&Array.isArray(o.columns)){const f={dataset:o.dataset,path:s,fields:[],generated:new Set,summaries:new Set};I(o,s,f),typeof o.foreignKey=="string"&&a(o.foreignKey,`${s}.foreignKey`,f.fields),r.push(f)}for(const[f,l]of Object.entries(o))t(l,`${s}.${f}`)}}return t(e,"$.template"),r}class M extends Error{constructor(r){super(`树节点超出行数预算 ${r}`),this.limit=r,this.code="tree-row-limit",this.name="TreeRowLimitError"}}function F(e,r,i,n){const t=e??r;if(!Number.isInteger(t)||t<1||t>i)throw new Error(`${n}应为 1–${i} 的整数`);return t}function T(e){return{rows:F(e.maxRows,1e5,1e6,"树行数预算"),depth:F(e.maxDepth,64,256,"树深度预算"),visits:F(e.maxAggregationVisits,1e6,1e7,"树聚合访问预算")}}function S(e){return typeof e=="string"&&!!e.trim()}function m(e){return S(e)&&!["__proto__","prototype","constructor"].includes(e)}function C(e){if(S(e)||typeof e=="number"&&Number.isFinite(e))return e;throw new Error("树节点业务键应为非空字符串或有限数字")}function N(e){return JSON.stringify([typeof e,e])}function O(e){return[e.idField,...e.input==="flat"?[e.parentField??""]:[e.childrenField??"children"]]}function V(e,r){const i=O(e);if(r?.some(n=>n.scope&&n.scope!=="row"||i.includes(n.field)))throw new Error("树形布局仅支持不覆盖结构键的当前行计算")}function g(e){if(!e?.aborted)return;const r=new Error("树报表处理已取消");throw r.name="AbortError",r}function D(e){const r=e.aggregates??[];if(!Array.isArray(r)||r.length>32)throw new Error("树聚合最多 32 项");if(e.parentValues!=="leaf-aggregate"&&r.length)throw new Error("树聚合需显式选择 leaf-aggregate 父级取值策略");if(e.parentValues==="leaf-aggregate"&&!r.length)throw new Error("叶子聚合策略至少需要一个聚合字段");const i=new Set;for(const n of r){if(!n||!m(n.field)||i.has(n.field))throw new Error("树聚合输出字段应安全、非空且唯一");for(const t of[n.valueField,n.weightField])if(t!==void 0&&!m(t))throw new Error("树聚合来源字段应安全且非空");if([...O(e),e.labelField].includes(n.field))throw new Error("树聚合不能覆盖结构键或标签字段");i.add(n.field),b.createAggregateAccumulator({...n,field:n.valueField??n.field})}}function J(e){if(!m(e.idField)||!m(e.labelField))throw new Error("树需要安全的业务键和标签字段");if(e.input==="flat"&&(!m(e.parentField)||e.parentField===e.idField))throw new Error("扁平树需要独立的父键字段");if(e.childrenField!==void 0&&!m(e.childrenField))throw new Error("子节点字段应安全且非空");if(e.input==="nested"&&[e.idField,e.labelField].includes(e.childrenField??"children"))throw new Error("子节点字段不能覆盖业务键或标签字段")}function x(e){if(!e||typeof e!="object"||!["flat","nested"].includes(e.input))throw new Error("树输入应为 flat 或 nested");if(J(e),e.orphan!==void 0&&!["error","root"].includes(e.orphan))throw new Error("树孤儿策略应为 error 或 root");if(e.parentValues!==void 0&&!["source","leaf-aggregate"].includes(e.parentValues))throw new Error("未知树父级取值策略");if(e.indentMm!==void 0&&(!Number.isFinite(e.indentMm)||e.indentMm<0||e.indentMm>20))throw new Error("树每级缩进应为 0–20 mm");T(e),D(e)}function B(e,r,i,n){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("树节点应为对象");if(i.size>=n.rows)throw new M(n.rows);const t=C(e[r.idField]),o=N(t);if(i.has(o))throw new Error(`树节点业务键重复:${String(t)}`);const s={original:e,row:e,key:t,depth:0,children:[]};return i.set(o,s),s}function W(e,r,i,n,t){for(const s of e)g(t),B(s,r,i,n);const o=[];for(const s of i.values()){g(t);const f=s.row[r.parentField];if(f==null){o.push(s);continue}const l=i.get(N(C(f)));if(!l){if(r.orphan!=="root")throw new Error(`树节点 ${String(s.key)} 的父节点不存在`);o.push(s);continue}if(l===s)throw new Error("树节点不能以自身为父节点");s.parent=l,l.children.push(s)}return o}function z(e,r,i,n,t){const o=[],s=[{rows:e,next:0}];for(;s.length;){g(t);const f=s[s.length-1];if(f.next>=f.rows.length){s.pop();continue}const l=B(f.rows[f.next++],r,i,n);if(l.parent=f.parent,l.depth=s.length-1,s.length>n.depth)throw new Error(`树节点超出深度预算 ${n.depth}`);(f.parent?.children??o).push(l);const d=l.row[r.childrenField??"children"];if(d!=null){if(!Array.isArray(d))throw new Error("嵌套树 children 字段应为数组");d.length&&s.push({rows:d,next:0,parent:l})}}return o}function H(e,r,i,n){const t=[],o=[{nodes:e,next:0}];for(;o.length;){g(n);const s=o[o.length-1];if(s.next>=s.nodes.length){o.pop();continue}if(o.length>i.depth)throw new Error(`树节点超出深度预算 ${i.depth}`);const f=s.nodes[s.next++];f.depth=o.length-1,t.push(f),f.children.length&&o.push({nodes:f.children,next:0})}if(t.length!==r)throw new Error("树父子关系存在循环");return t}function X(e,r,i,n){if(r.parentValues!=="leaf-aggregate")return;const t=r.aggregates,o=new Map;for(const f of e)f.children.length&&o.set(f,t.map(l=>b.createAggregateAccumulator({...l,field:l.valueField??l.field})));let s=0;for(const f of e)if(!f.children.length)for(let l=f.parent;l;l=l.parent){if(g(n),s+=t.length,s>i.visits)throw new Error(`树聚合超出访问预算 ${i.visits}`);for(const d of o.get(l))d.add(f.row)}for(const[f,l]of o)f.row={...f.row},t.forEach((d,u)=>{f.row[d.field]=l[u].value()})}function R(e,r,i){if(x(r),g(i),!Array.isArray(e))throw new Error("树数据应为节点数组");const n=T(r),t=new Map,o=r.input==="flat"?W(e,r,t,n,i):z(e,r,t,n,i);return H(o,t.size,n,i)}function q(e,r,i){return R(e,r,i).map(n=>n.original)}function P(e,r,i={}){const n=R(e,r,i.signal);if(V(r,i.computed?.fields),i.computed?.fields.length){const t=b.computeDataset(n.map(o=>o.row),{...i.computed,signal:i.signal}).rows;n.forEach((o,s)=>{o.row=t[s]})}return X(n,r,T(r),i.signal),{rows:n.map(t=>t.row),entries:n.map(t=>({row:t.row,original:t.original,key:t.key,depth:t.depth,hasChildren:!!t.children.length})),leaves:n.filter(t=>!t.children.length).map(t=>t.row)}}const G=/^#[0-9a-f]{6}$/i;function j(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const r=e;return r.kind!=="colorScale"&&r.kind!=="dataBar"||r.field!==void 0&&(typeof r.field!="string"||!r.field.trim())||r.numeric!==void 0&&!["number","decimal"].includes(r.numeric)||[r.min,r.max].some(i=>i!==void 0&&(typeof i!="number"||!Number.isFinite(i)))||r.min!==void 0&&r.max!==void 0&&r.min>r.max?!1:Object.entries(r).every(([i,n])=>!["color","negativeColor","lowColor","highColor"].includes(i)||typeof n=="string"&&G.test(n))}function _(e,r){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(r!=="decimal"||typeof e!="string"||e.length>1024||!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(e))return;const i=Number(e);return Number.isFinite(i)?i:void 0}function Q(e,r,i){let n="#";for(const t of[1,3,5]){const o=parseInt(e.slice(t,t+2),16),s=parseInt(r.slice(t,t+2),16);n+=Math.round(o+(s-o)*i).toString(16).padStart(2,"0")}return n}function A(e,r,i){if(r===i)return e<r?0:e>i?1:.5;if(e<=r)return 0;if(e>=i)return 1;const n=i-r;return Number.isFinite(n)?(e-r)/n:(e/2-r/2)/(i/2-r/2)}function U(e,r,i,n){const t=new WeakMap;return{apply(o,s){const f=_(s[r],e.numeric);if(f===void 0)return;if(e.kind==="dataBar"){const h=Math.min(i,0),$=Math.max(n,0),E=A(0,h,$),v=h===$?E:A(f,h,$);o.dataBar={start:Math.min(E,v),end:Math.max(E,v),color:f<0?e.negativeColor??"#f3bcc3":e.color??"#bad8fa"};return}const l=Q(e.lowColor??"#f0f7ff",e.highColor??"#8bbcf1",A(f,i,n)),d=o.style??{},u=t.get(d)??new Map;t.set(d,u);let y=u.get(l);y||(y={...d,backgroundColor:l},u.set(l,y)),o.style=y}}}function Y(e,r,i){return e.map(n=>{k(i);const t=n.visual;if(!t)return;if(!j(t))throw new TypeError("Invalid column visual rule");const o=t.field??n.field;let s=1/0,f=-1/0,l=0;if(t.min===void 0||t.max===void 0)for(const y of r){(l++&1023)===0&&k(i);const h=_(y[o],t.numeric);h!==void 0&&(s=Math.min(s,h),f=Math.max(f,h))}let d=t.min??s,u=t.max??f;if(!(!Number.isFinite(d)||!Number.isFinite(u)))return d>u&&(t.min!==void 0?u=d:d=u),U(t,o,d,u)})}function k(e){if(e?.aborted)throw e.reason??new DOMException("Aborted","AbortError")}const K=1e7;function Z(e){const r=JSON.stringify(e,null,2);if(r.length>K)throw new RangeError("模板 JSON 超过 1000 万字符的导出/导入上限");return r}exports.MAX_TEMPLATE_JSON_CHARACTERS=K;exports.TreeRowLimitError=M;exports.collectTemplateDatasetBindings=L;exports.createColumnVisualResolvers=Y;exports.createTreeTable=P;exports.flattenTreeInput=q;exports.stringifyValidatedTemplate=Z;exports.validColumnVisual=j;exports.validateTreeComputed=V;exports.validateTreeOptions=x;
|
package/dist/vue/async.d.cts
CHANGED
|
@@ -878,6 +878,7 @@ declare interface MachReportDefaults {
|
|
|
878
878
|
toolbar?: MachReportToolbarOptions;
|
|
879
879
|
interaction?: ReportInteractionOptions;
|
|
880
880
|
preferences?: ReportPreferencesOptions;
|
|
881
|
+
refresh?: ReportRefreshOptions;
|
|
881
882
|
/** Protect local input and drafts before replacing a report. Default true. */
|
|
882
883
|
guardChanges?: boolean;
|
|
883
884
|
beforeDiscard?: ReportBeforeDiscard;
|
|
@@ -921,6 +922,7 @@ declare type MachReportLogger = Pick<Console, "warn" | "info">;
|
|
|
921
922
|
*/
|
|
922
923
|
/** 工具栏与状态文案(默认简体中文;出海场景覆写) */
|
|
923
924
|
declare interface MachReportMessages extends Partial<ReportCalculationMessages>, Partial<ReportDataReviewMessages>, ReportPrintMessages, ReportParamOptionsMessages {
|
|
925
|
+
previousSnapshot?: string;
|
|
924
926
|
reviewTools?: string;
|
|
925
927
|
validationTitle?: string;
|
|
926
928
|
validationError?: string;
|
|
@@ -1129,6 +1131,8 @@ declare interface MachReportPreviewOptions {
|
|
|
1129
1131
|
/** 只读快照,由组件的同一套状态驱动;无需通过事件另建状态。 */
|
|
1130
1132
|
declare interface MachReportState {
|
|
1131
1133
|
readonly loading: boolean;
|
|
1134
|
+
/** A retained previous snapshot is readable while writes/output remain blocked. */
|
|
1135
|
+
readonly stale?: boolean;
|
|
1132
1136
|
readonly hasPlan: boolean;
|
|
1133
1137
|
readonly pageCount: number;
|
|
1134
1138
|
readonly currentPage: number;
|
|
@@ -1175,6 +1179,8 @@ declare interface MachReportTheme {
|
|
|
1175
1179
|
btnActiveBg: string;
|
|
1176
1180
|
}
|
|
1177
1181
|
declare interface MachReportToolbarOptions {
|
|
1182
|
+
/** Reasons explain host restrictions without granting capabilities. */
|
|
1183
|
+
unavailableReasons?: Partial<Record<ReportPreviewTool, string>>;
|
|
1178
1184
|
search?: boolean;
|
|
1179
1185
|
thumbnails?: boolean;
|
|
1180
1186
|
zoom?: boolean;
|
|
@@ -2188,11 +2194,17 @@ declare interface ReportFetchInput extends ReportTaskMonitoring {
|
|
|
2188
2194
|
onQueryResult?: (reportId: string, result: ReportQueryResult, reportIndex?: number) => void;
|
|
2189
2195
|
}
|
|
2190
2196
|
declare type ReportFieldAggregation = "sum" | "avg" | "min" | "max" | "count" | "none";
|
|
2197
|
+
declare type ReportFieldAggregation_2 = "sum" | "avg" | "min" | "max" | "count" | "none";
|
|
2191
2198
|
declare interface ReportFieldCalculation {
|
|
2192
2199
|
/** Business-owned explanation, never executable JavaScript or an inferred business formula. */
|
|
2193
2200
|
description: string;
|
|
2194
2201
|
dependsOn: readonly string[];
|
|
2195
2202
|
}
|
|
2203
|
+
declare interface ReportFieldCalculation_2 {
|
|
2204
|
+
/** Business-owned explanation, never executable JavaScript or an inferred business formula. */
|
|
2205
|
+
description: string;
|
|
2206
|
+
dependsOn: readonly string[];
|
|
2207
|
+
}
|
|
2196
2208
|
declare interface ReportFieldContract extends ReportFieldSemantics {
|
|
2197
2209
|
field: string;
|
|
2198
2210
|
label?: string;
|
|
@@ -2207,6 +2219,20 @@ declare interface ReportFieldContract extends ReportFieldSemantics {
|
|
|
2207
2219
|
semanticRole?: "identifier" | "dimension" | "measure" | "date" | "text";
|
|
2208
2220
|
unit?: string;
|
|
2209
2221
|
}
|
|
2222
|
+
declare interface ReportFieldContract_2 extends ReportFieldSemantics_2 {
|
|
2223
|
+
field: string;
|
|
2224
|
+
label?: string;
|
|
2225
|
+
type: "text" | "number" | "boolean" | "date" | "decimal";
|
|
2226
|
+
required?: boolean;
|
|
2227
|
+
nullable?: boolean;
|
|
2228
|
+
enum?: readonly (string | number | boolean)[];
|
|
2229
|
+
min?: number;
|
|
2230
|
+
max?: number;
|
|
2231
|
+
minLength?: number;
|
|
2232
|
+
maxLength?: number;
|
|
2233
|
+
semanticRole?: "identifier" | "dimension" | "measure" | "date" | "text";
|
|
2234
|
+
unit?: string;
|
|
2235
|
+
}
|
|
2210
2236
|
declare interface ReportFieldSemantics {
|
|
2211
2237
|
description?: string;
|
|
2212
2238
|
/** Explicit meaning of null/missing; does not convert blanks into zero. */
|
|
@@ -2217,6 +2243,16 @@ declare interface ReportFieldSemantics {
|
|
|
2217
2243
|
format?: ColumnFormat;
|
|
2218
2244
|
calculation?: ReportFieldCalculation;
|
|
2219
2245
|
}
|
|
2246
|
+
declare interface ReportFieldSemantics_2 {
|
|
2247
|
+
description?: string;
|
|
2248
|
+
/** Explicit meaning of null/missing; does not convert blanks into zero. */
|
|
2249
|
+
missingMeaning?: string;
|
|
2250
|
+
/** Recommended aggregation; none marks non-additive measures such as ratios. No aggregation runs implicitly. */
|
|
2251
|
+
aggregation?: ReportFieldAggregation_2;
|
|
2252
|
+
/** Shared presentation only; raw values and calculation precision remain unchanged. */
|
|
2253
|
+
format?: ColumnFormat_3;
|
|
2254
|
+
calculation?: ReportFieldCalculation_2;
|
|
2255
|
+
}
|
|
2220
2256
|
declare interface ReportFieldTarget {
|
|
2221
2257
|
field: string;
|
|
2222
2258
|
datasetId?: string;
|
|
@@ -2410,8 +2446,8 @@ declare type ReportPredicateScalar = string | number | boolean | null;
|
|
|
2410
2446
|
declare type ReportPredicateScalar_2 = string | number | boolean | null;
|
|
2411
2447
|
declare type ReportPredicateScalar_3 = string | number | boolean | null;
|
|
2412
2448
|
declare interface ReportPreferencesAdapter {
|
|
2413
|
-
load(key: string):
|
|
2414
|
-
save(key: string, value: Readonly<
|
|
2449
|
+
load(key: string): ReportStoredPreferences | null | Promise<ReportStoredPreferences | null>;
|
|
2450
|
+
save(key: string, value: Readonly<ReportStoredPreferences>): void | Promise<void>;
|
|
2415
2451
|
remove?(key: string): void | Promise<void>;
|
|
2416
2452
|
}
|
|
2417
2453
|
declare interface ReportPreferencesOptions {
|
|
@@ -2509,6 +2545,17 @@ declare interface ReportQueryResult {
|
|
|
2509
2545
|
sourceToken?: string;
|
|
2510
2546
|
diagnostics?: ReportDiagnostic[];
|
|
2511
2547
|
}
|
|
2548
|
+
/** Explicit refresh policy. The key identifies template/layout revisions outside query parameters. */
|
|
2549
|
+
declare interface ReportRefreshOptions {
|
|
2550
|
+
retainPrevious?: boolean;
|
|
2551
|
+
key?: string;
|
|
2552
|
+
/** Host API request preceding the preview reload. Blocks edits and output without discarding drafts. */
|
|
2553
|
+
pending?: boolean;
|
|
2554
|
+
/** The host retained an earlier snapshot after its own query failed or was cancelled. */
|
|
2555
|
+
stale?: boolean;
|
|
2556
|
+
/** Retry the host HTTP query when it owns the stale snapshot. The host updates its own state. */
|
|
2557
|
+
retry?(): void | Promise<void>;
|
|
2558
|
+
}
|
|
2512
2559
|
declare type ReportRegistry = Record<string, ReportDefinition>;
|
|
2513
2560
|
declare interface ReportRuntimeBudget {
|
|
2514
2561
|
maxRows?: number;
|
|
@@ -2538,6 +2585,10 @@ declare interface ReportSaveResult {
|
|
|
2538
2585
|
}>;
|
|
2539
2586
|
diagnostics?: ReportDiagnostic[];
|
|
2540
2587
|
}
|
|
2588
|
+
declare interface ReportStoredPreferences extends Partial<ReportPreviewPreferences> {
|
|
2589
|
+
zoomMode?: "fit" | number;
|
|
2590
|
+
wideZoomMode?: "fit" | number;
|
|
2591
|
+
}
|
|
2541
2592
|
/** 阶段事件只包含可序列化值;不表示估算百分比,也不包含业务数据。 */
|
|
2542
2593
|
declare interface ReportTaskEvent {
|
|
2543
2594
|
taskId: string;
|
|
@@ -2556,6 +2607,8 @@ declare interface ReportTaskMonitoring {
|
|
|
2556
2607
|
declare type ReportTaskObserver = (event: ReportTaskEvent) => void;
|
|
2557
2608
|
declare interface ReportTemplate {
|
|
2558
2609
|
schemaVersion?: string;
|
|
2610
|
+
/** Optional source identity and stable field meanings for safe stored-template reuse. */
|
|
2611
|
+
dataContract?: ReportTemplateDataContract;
|
|
2559
2612
|
/** 参数定义(可选;宿主也可经 ReportPreview 的 paramDefs prop 提供,prop 优先) */
|
|
2560
2613
|
params?: ReportParamDef[];
|
|
2561
2614
|
/** Fixed label pages repeat in record → copy → template-page order. */
|
|
@@ -2564,12 +2617,28 @@ declare interface ReportTemplate {
|
|
|
2564
2617
|
}
|
|
2565
2618
|
declare interface ReportTemplate_2 {
|
|
2566
2619
|
schemaVersion?: string;
|
|
2620
|
+
/** Optional source identity and stable field meanings for safe stored-template reuse. */
|
|
2621
|
+
dataContract?: ReportTemplateDataContract_2;
|
|
2567
2622
|
/** 参数定义(可选;宿主也可经 ReportPreview 的 paramDefs prop 提供,prop 优先) */
|
|
2568
2623
|
params?: ReportParamDef_2[];
|
|
2569
2624
|
/** Fixed label pages repeat in record → copy → template-page order. */
|
|
2570
2625
|
repeat?: ReportTemplateRepeat_2;
|
|
2571
2626
|
pages: TemplatePage_2[];
|
|
2572
2627
|
}
|
|
2628
|
+
declare interface ReportTemplateDataContract {
|
|
2629
|
+
/** Host-owned report/domain identity, without a query date or tenant credentials. */
|
|
2630
|
+
source?: string;
|
|
2631
|
+
datasets: Readonly<Record<string, {
|
|
2632
|
+
fields: readonly ReportTemplateFieldBinding[];
|
|
2633
|
+
}>>;
|
|
2634
|
+
}
|
|
2635
|
+
declare interface ReportTemplateDataContract_2 {
|
|
2636
|
+
/** Host-owned report/domain identity, without a query date or tenant credentials. */
|
|
2637
|
+
source?: string;
|
|
2638
|
+
datasets: Readonly<Record<string, {
|
|
2639
|
+
fields: readonly ReportTemplateFieldBinding_2[];
|
|
2640
|
+
}>>;
|
|
2641
|
+
}
|
|
2573
2642
|
/** 可存入数据库/文件的纯 JSON 模板;数据、接口与鉴权仍由宿主提供。 */
|
|
2574
2643
|
declare interface ReportTemplateDocument {
|
|
2575
2644
|
schemaVersion: "1.0";
|
|
@@ -2580,6 +2649,22 @@ declare interface ReportTemplateDocument {
|
|
|
2580
2649
|
description?: string;
|
|
2581
2650
|
template: ReportTemplate;
|
|
2582
2651
|
}
|
|
2652
|
+
/** Stable business meaning is independent of a column's position and editable caption. */
|
|
2653
|
+
declare interface ReportTemplateFieldBinding {
|
|
2654
|
+
field: string;
|
|
2655
|
+
label?: string;
|
|
2656
|
+
semanticKey?: string;
|
|
2657
|
+
type?: ReportFieldContract["type"];
|
|
2658
|
+
unit?: string;
|
|
2659
|
+
}
|
|
2660
|
+
/** Stable business meaning is independent of a column's position and editable caption. */
|
|
2661
|
+
declare interface ReportTemplateFieldBinding_2 {
|
|
2662
|
+
field: string;
|
|
2663
|
+
label?: string;
|
|
2664
|
+
semanticKey?: string;
|
|
2665
|
+
type?: ReportFieldContract_2["type"];
|
|
2666
|
+
unit?: string;
|
|
2667
|
+
}
|
|
2583
2668
|
declare type ReportTemplateLoader = (context: ReportLoadContext) => ReportTemplate | Promise<ReportTemplate>;
|
|
2584
2669
|
declare interface ReportTemplateProvider {
|
|
2585
2670
|
list(context: {
|
|
@@ -2800,6 +2885,12 @@ declare type ValueFormat = ColumnFormat;
|
|
|
2800
2885
|
declare type ValueFormat_2 = ColumnFormat_2;
|
|
2801
2886
|
/** The same declarative formatting used by list columns, before any output backend. */
|
|
2802
2887
|
declare type ValueFormat_3 = ColumnFormat_3;
|
|
2888
|
+
/** 可序列化的附加工作表在编码前写入,浏览器与 Worker 共用同一声明。 */
|
|
2889
|
+
declare interface XlsxAdditionalSheet {
|
|
2890
|
+
name: string;
|
|
2891
|
+
rows: readonly (readonly (string | number | boolean | null)[])[];
|
|
2892
|
+
columnWidths?: readonly number[];
|
|
2893
|
+
}
|
|
2803
2894
|
declare type XlsxImageOptions = ImageMediaOptions_2;
|
|
2804
2895
|
/**
|
|
2805
2896
|
* RenderPlan → xlsx 导出(B 端第二出口,对齐家族 @agile-team/mach-table-xlsx 路线):
|
|
@@ -2812,6 +2903,8 @@ declare type XlsxImageOptions = ImageMediaOptions_2;
|
|
|
2812
2903
|
declare interface XlsxRenderOptions extends AssetRenderOptions_2, XlsxImageOptions {
|
|
2813
2904
|
/** 工作表命名(连续表默认使用标题,其余默认 "Sheet1" 起序)。 */
|
|
2814
2905
|
sheetName?: (sheetIndex: number) => string;
|
|
2906
|
+
/** 可序列化命名,用于 Worker;未提供的项沿用默认名称。 */
|
|
2907
|
+
sheetNames?: readonly string[];
|
|
2815
2908
|
/** auto 默认将 wide 逻辑表合并为连续 Sheet;pages 保留逐页;continuous 要求明确的表来源。 */
|
|
2816
2909
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
2817
2910
|
/** 宽表或连续表默认 raw,其余默认 text;显式配置可覆盖默认值。 */
|
|
@@ -2820,5 +2913,7 @@ declare interface XlsxRenderOptions extends AssetRenderOptions_2, XlsxImageOptio
|
|
|
2820
2913
|
maxDataBars?: number;
|
|
2821
2914
|
/** 连续表默认不限制打印纸型;显式 A3/A4/A5 仅设置打印适配,不改变 Excel 列宽。 */
|
|
2822
2915
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
2916
|
+
/** 在最终编码前追加说明、审计等标量工作表,可直接交给 Worker。 */
|
|
2917
|
+
additionalSheets?: readonly XlsxAdditionalSheet[];
|
|
2823
2918
|
}
|
|
2824
2919
|
export {};
|