@agile-team/mach-report 2.5.0 → 2.7.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 +126 -16
- package/dist/ReportPreview-BdvoqdOd.cjs +6 -0
- package/dist/ReportPreview-COFkbeEM.js +3719 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/analytics.cjs +1 -0
- package/dist/analytics.d.cts +276 -0
- package/dist/analytics.d.ts +276 -0
- package/dist/analytics.js +223 -0
- package/dist/assets-B9qJku3V.js +160 -0
- package/dist/assets-RZan7EyL.cjs +1 -0
- package/dist/capabilities-joSutDF8.js +63 -0
- package/dist/capabilities-xGTpnPjJ.cjs +1 -0
- package/dist/designer.cjs +1 -0
- package/dist/designer.d.cts +869 -0
- package/dist/designer.d.ts +869 -0
- package/dist/designer.js +628 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +497 -9
- package/dist/index.d.ts +497 -9
- package/dist/index.js +1088 -1499
- package/dist/param-validation-BWNjLcN0.js +116 -0
- package/dist/param-validation-CiTxFeZ8.cjs +1 -0
- package/dist/pdf.cjs +48 -48
- package/dist/pdf.d.cts +119 -1
- package/dist/pdf.d.ts +119 -1
- package/dist/pdf.js +3932 -3868
- package/dist/{plugin-DMPLDpBY.cjs → plugin-9t_ZFwhz.cjs} +1 -1
- package/dist/{plugin-DDLcFWlk.js → plugin-s8Ay8kKk.js} +2 -2
- package/dist/progress-DD964VAB.js +102 -0
- package/dist/progress-KvhwXZ1Q.cjs +1 -0
- package/dist/render-plan-CckPEQyf.cjs +1 -0
- package/dist/{render-plan-CXBWRog4.js → render-plan-uzZYYSy1.js} +11 -10
- package/dist/report-params-B_VCihAh.js +12 -0
- package/dist/report-params-CjWrjPl6.cjs +1 -0
- package/dist/report-source-BXHNy_AD.js +755 -0
- package/dist/report-source-CCAvFE3t.cjs +1 -0
- package/dist/server/node.d.cts +320 -0
- package/dist/server/node.d.ts +320 -0
- package/dist/server-node.cjs +1 -0
- package/dist/server-node.js +303 -0
- package/dist/server.cjs +1 -0
- package/dist/server.d.cts +668 -0
- package/dist/server.d.ts +668 -0
- package/dist/server.js +245 -0
- package/dist/style-CpwiOPyB.cjs +1 -0
- package/dist/style-Dv5o_x6b.js +67 -0
- package/dist/style.css +1 -1
- package/dist/task-events-DQ276fn2.cjs +1 -0
- package/dist/task-events-Dpsvf_t2.js +47 -0
- package/dist/template-registry-DWExx0gU.cjs +1 -0
- package/dist/template-registry-NpOakidD.js +354 -0
- package/dist/textwrap-CnGsEum6.cjs +4 -0
- package/dist/textwrap-DOl04hCQ.js +110 -0
- package/dist/validate-DfHPD8wX.cjs +1 -0
- package/dist/validate-S6CgIm5d.js +148 -0
- package/dist/vue/async.d.cts +1507 -1538
- package/dist/vue/async.d.ts +1507 -1538
- package/dist/vue/index.d.cts +2376 -2347
- package/dist/vue/index.d.ts +2376 -2347
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +184 -75
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +325 -0
- package/dist/worker.d.ts +325 -0
- package/dist/worker.js +158 -0
- package/dist/xlsx/node.d.cts +47 -0
- package/dist/xlsx/node.d.ts +47 -0
- package/dist/xlsx-node.cjs +221 -0
- package/dist/xlsx-node.js +36409 -0
- package/dist/xlsx.cjs +20 -20
- package/dist/xlsx.d.cts +87 -2
- package/dist/xlsx.d.ts +87 -2
- package/dist/xlsx.js +5987 -5840
- package/package.json +63 -3
- package/dist/ReportPreview-CBKLI--k.js +0 -2188
- package/dist/ReportPreview-ClM8h0pM.cjs +0 -6
- package/dist/grid-geometry-BNIvw52m.cjs +0 -1
- package/dist/grid-geometry-C8hGoe9o.js +0 -130
- package/dist/render-plan-CCTL4F9v.cjs +0 -1
- package/dist/report-params-B3Fia6JO.js +0 -10
- package/dist/report-params-D1gZ1DME.cjs +0 -1
- package/dist/textwrap-nH0UYU6D.js +0 -108
- package/dist/textwrap-oD-t4b4B.cjs +0 -4
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
const E = ["#2563eb", "#0d9488", "#d97706", "#7c3aed", "#dc2626", "#0284c7"];
|
|
2
|
+
function $(e) {
|
|
3
|
+
if (e.type !== "bar" && e.type !== "line") throw new Error("图表 type 应为 bar 或 line");
|
|
4
|
+
if (!Array.isArray(e.categories) || !Array.isArray(e.series) || !e.categories.length || e.categories.length > 200 || !e.series.length || e.series.length > 12) throw new Error("图表支持 1–200 个分类、1–12 个系列;大数据应先聚合");
|
|
5
|
+
if (e.categories.some((r) => typeof r != "string")) throw new Error("图表分类应为字符串");
|
|
6
|
+
z(e);
|
|
7
|
+
for (const r of e.series) L(r, e.categories.length);
|
|
8
|
+
}
|
|
9
|
+
function z(e) {
|
|
10
|
+
for (const r of ["leftMm", "topMm", "widthMm", "heightMm"])
|
|
11
|
+
if (!Number.isFinite(e[r]) || e[r] < 0) throw new Error(`${r} 应为有限非负数`);
|
|
12
|
+
if (e.widthMm < 45 || e.heightMm < 35) throw new Error("图表至少需要 45×35mm");
|
|
13
|
+
if (!Number.isFinite(e.leftMm + e.widthMm) || !Number.isFinite(e.topMm + e.heightMm)) throw new Error("图表几何范围溢出");
|
|
14
|
+
}
|
|
15
|
+
function L(e, r) {
|
|
16
|
+
if (!e || typeof e.name != "string" || !Array.isArray(e.values) || e.values.length !== r || e.values.some((t) => t !== null && !Number.isFinite(t))) throw new Error("图表系列应提供名称及逐分类的有限数字或 null");
|
|
17
|
+
if (e.color !== void 0 && !/^#[\da-f]{6}$/i.test(e.color)) throw new Error("图表颜色应为 #RRGGBB");
|
|
18
|
+
}
|
|
19
|
+
function F(e, r, t, n, i, l = 0.8) {
|
|
20
|
+
return { kind: "line", leftMm: Math.min(e, t), topMm: Math.min(r, n), widthMm: Math.abs(t - e), heightMm: Math.abs(n - r), lineDirection: n < r ? "up" : "down", style: { lineColor: i, lineWidthPt: l } };
|
|
21
|
+
}
|
|
22
|
+
function d(e, r, t, n, i = "center") {
|
|
23
|
+
return { kind: "text", text: e, leftMm: r, topMm: t, widthMm: n, heightMm: 5, style: { fontSize: 8, color: "#475569", align: i, verticalAlign: "middle" } };
|
|
24
|
+
}
|
|
25
|
+
function S(e) {
|
|
26
|
+
return Number(e.toPrecision(5)).toString();
|
|
27
|
+
}
|
|
28
|
+
function j(e) {
|
|
29
|
+
let r = 0, t = 0;
|
|
30
|
+
for (const h of e.series) for (const a of h.values) a !== null && (r = Math.min(r, a), t = Math.max(t, a));
|
|
31
|
+
r === t && (t = r + 1);
|
|
32
|
+
const n = e.leftMm + 13, i = e.topMm + 8, l = e.widthMm - 17, c = e.heightMm - 23, f = Math.max(Math.abs(r), Math.abs(t), 1), o = r / f, u = t / f - o;
|
|
33
|
+
return { left: n, top: i, width: l, height: c, min: r, max: t, y: (h) => i + c * (1 - (h / f - o) / u) };
|
|
34
|
+
}
|
|
35
|
+
function x(e, r) {
|
|
36
|
+
const t = [];
|
|
37
|
+
e.title && t.push({ ...d(e.title, e.leftMm, e.topMm, e.widthMm), style: { fontSize: 10, bold: !0, align: "left" } });
|
|
38
|
+
for (let l = 0; l <= 4; l++) {
|
|
39
|
+
const c = l / 4, f = r.min * (1 - c) + r.max * c, o = r.y(f);
|
|
40
|
+
t.push(F(r.left, o, r.left + r.width, o, "#e2e8f0", 0.4), d(S(f), e.leftMm, o - 2.5, 11, "right"));
|
|
41
|
+
}
|
|
42
|
+
t.push(F(r.left, r.top, r.left, r.top + r.height, "#94a3b8"));
|
|
43
|
+
const n = Math.max(1, Math.ceil(e.categories.length / Math.max(1, Math.floor(r.width / 14))));
|
|
44
|
+
e.categories.forEach((l, c) => {
|
|
45
|
+
c % n === 0 && t.push(d(l, r.left + (c + 0.5) * r.width / e.categories.length - 7, r.top + r.height + 1, 14));
|
|
46
|
+
});
|
|
47
|
+
const i = r.width / e.series.length;
|
|
48
|
+
return e.series.forEach((l, c) => {
|
|
49
|
+
t.push({ ...d(l.name, r.left + c * i, e.topMm + e.heightMm - 5, i), style: { fontSize: 8, color: l.color ?? E[c % E.length], align: "center" } });
|
|
50
|
+
}), t;
|
|
51
|
+
}
|
|
52
|
+
function P(e, r, t, n) {
|
|
53
|
+
const i = [], l = t.color ?? E[n % E.length], c = r.width / e.categories.length, f = c * 0.75 / e.series.length;
|
|
54
|
+
let o;
|
|
55
|
+
return t.values.forEach((u, h) => {
|
|
56
|
+
if (u === null) {
|
|
57
|
+
o = void 0;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const a = r.left + (h + 0.5) * c, m = r.y(u);
|
|
61
|
+
e.type === "bar" ? i.push({ kind: "rect", leftMm: r.left + h * c + c * 0.125 + n * f, topMm: Math.min(m, r.y(0)), widthMm: f, heightMm: Math.abs(r.y(0) - m), style: { backgroundColor: l, borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } }) : (o && i.push(F(o.x, o.y, a, m, l, 1.2)), i.push({ kind: "ellipse", leftMm: a - 0.7, topMm: m - 0.7, widthMm: 1.4, heightMm: 1.4, style: { backgroundColor: l, borderColor: l } }), o = { x: a, y: m }), e.showValues && i.push({ ...d(S(u), a - c / 2, Math.max(r.top, m - 5), c), style: { fontSize: 7, color: l, align: "center" } });
|
|
62
|
+
}), i;
|
|
63
|
+
}
|
|
64
|
+
function U(e) {
|
|
65
|
+
$(e);
|
|
66
|
+
const r = j(e);
|
|
67
|
+
return [...x(e, r), ...e.series.flatMap((t, n) => P(e, r, t, n))];
|
|
68
|
+
}
|
|
69
|
+
function y() {
|
|
70
|
+
return { count: 0, sum: 0, correction: 0, min: 1 / 0, max: -1 / 0 };
|
|
71
|
+
}
|
|
72
|
+
function w(e, r) {
|
|
73
|
+
return Object.prototype.hasOwnProperty.call(e, r) ? e[r] : void 0;
|
|
74
|
+
}
|
|
75
|
+
function A(e) {
|
|
76
|
+
if (e == null) return "null";
|
|
77
|
+
if (typeof e != "string" && typeof e != "boolean" && !(typeof e == "number" && Number.isFinite(e))) throw new Error("交叉表维度应为字符串、布尔、有限数字或空值");
|
|
78
|
+
return JSON.stringify([typeof e, e]);
|
|
79
|
+
}
|
|
80
|
+
function N(e) {
|
|
81
|
+
return e == null ? "" : String(e);
|
|
82
|
+
}
|
|
83
|
+
function W(e, r, t) {
|
|
84
|
+
const n = t === "count";
|
|
85
|
+
if (!n && r == null) return;
|
|
86
|
+
if (!n && (typeof r != "number" || !Number.isFinite(r))) throw new Error("交叉表度量必须是有限数字;编号和小数文本不能隐式转为数字");
|
|
87
|
+
const i = n ? 1 : r;
|
|
88
|
+
(t === "sum" || t === "avg") && _(e, i), e.count++, e.min = Math.min(e.min, i), e.max = Math.max(e.max, i);
|
|
89
|
+
}
|
|
90
|
+
function _(e, r) {
|
|
91
|
+
const t = r - e.correction, n = e.sum + t;
|
|
92
|
+
if (!Number.isFinite(n)) throw new Error("交叉表聚合溢出");
|
|
93
|
+
e.correction = n - e.sum - t, e.sum = n;
|
|
94
|
+
}
|
|
95
|
+
function b(e, r) {
|
|
96
|
+
return e?.count ? r === "count" ? e.count : r === "avg" ? e.sum / e.count : r === "sum" ? e.sum : e[r] : r === "count" ? 0 : null;
|
|
97
|
+
}
|
|
98
|
+
function M(e, r) {
|
|
99
|
+
const t = e ?? r;
|
|
100
|
+
if (!Number.isInteger(t) || t < 1) throw new Error("交叉表预算应为正整数");
|
|
101
|
+
return t;
|
|
102
|
+
}
|
|
103
|
+
function B(e, r, t, n) {
|
|
104
|
+
const i = t ? 1 : 0;
|
|
105
|
+
if ((e + i) * (r + 1 + i) > n) throw new Error("交叉表输出单元格超出 maxCells 预算,请减少维度或服务端预聚合");
|
|
106
|
+
}
|
|
107
|
+
function V(e, r) {
|
|
108
|
+
const t = r.aggregate ?? "sum";
|
|
109
|
+
if (!["sum", "count", "avg", "min", "max"].includes(t)) throw new Error("未知交叉表聚合类型");
|
|
110
|
+
if (!r.rowField || !r.columnField || t !== "count" && !r.valueField) throw new Error("交叉表需要明确的行维度、列维度和度量字段");
|
|
111
|
+
if (e.length > M(r.maxInputRows, 1e5)) throw new Error("交叉表输入超出预算,请在服务端预聚合");
|
|
112
|
+
const n = M(r.maxRows, 1e3), i = M(r.maxColumns, 200), l = M(r.maxCells, 2e6), c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), u = y();
|
|
113
|
+
for (const a of e) {
|
|
114
|
+
const m = A(w(a, r.rowField)), s = A(w(a, r.columnField));
|
|
115
|
+
if (c.has(s) || c.set(s, N(w(a, r.columnField))), f.has(m) || f.set(m, { label: N(w(a, r.rowField)), cells: /* @__PURE__ */ new Map(), total: y() }), c.size > i || f.size > n) throw new Error("交叉表维度数量超出预算");
|
|
116
|
+
B(f.size, c.size, r.totals, l);
|
|
117
|
+
const g = f.get(m);
|
|
118
|
+
g.cells.has(s) || g.cells.set(s, y()), o.has(s) || o.set(s, y());
|
|
119
|
+
const k = r.valueField ? w(a, r.valueField) : void 0;
|
|
120
|
+
for (const R of [g.cells.get(s), g.total, o.get(s), u]) W(R, k, t);
|
|
121
|
+
}
|
|
122
|
+
const h = {
|
|
123
|
+
columns: [{ header: r.rowHeader ?? r.rowField, field: "rowLabel", semanticRole: "dimension" }, ...[...c.values()].map((a, m) => ({ header: a, field: `c${m}`, semanticRole: "measure" }))],
|
|
124
|
+
rows: [...f.values()].map((a) => ({ rowLabel: a.label, ...Object.fromEntries([...c.keys()].map((m, s) => [`c${s}`, b(a.cells.get(m), t)])), ...r.totals ? { total: b(a.total, t) } : {} }))
|
|
125
|
+
};
|
|
126
|
+
return r.totals && (h.columns.push({ header: "合计", field: "total", semanticRole: "measure" }), e.length && h.rows.push({ rowLabel: "合计", ...Object.fromEntries([...c.keys()].map((a, m) => [`c${m}`, b(o.get(a), t)])), total: b(u, t) })), h;
|
|
127
|
+
}
|
|
128
|
+
const G = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
129
|
+
function C(e) {
|
|
130
|
+
if (typeof e != "string" || !e.trim() || G.has(e)) throw new Error("计算字段应为安全的非空字段名");
|
|
131
|
+
}
|
|
132
|
+
function v(e) {
|
|
133
|
+
return e === null || ["string", "boolean"].includes(typeof e) || typeof e == "number" && Number.isFinite(e);
|
|
134
|
+
}
|
|
135
|
+
function I(e) {
|
|
136
|
+
if (e.some((r) => typeof r != "number" || !Number.isFinite(r))) throw new Error("算术参数必须是有限数字;空值和小数文本不会隐式转换");
|
|
137
|
+
return e;
|
|
138
|
+
}
|
|
139
|
+
function J(e, r) {
|
|
140
|
+
const t = I(r);
|
|
141
|
+
let n;
|
|
142
|
+
if (e === "add") n = t.reduce((i, l) => i + l, 0);
|
|
143
|
+
else if (e === "multiply") n = t.reduce((i, l) => i * l, 1);
|
|
144
|
+
else if (e === "subtract") n = t[0] - t[1];
|
|
145
|
+
else {
|
|
146
|
+
if (t[1] === 0) throw new Error("不能除以零");
|
|
147
|
+
n = t[0] / t[1];
|
|
148
|
+
}
|
|
149
|
+
if (!Number.isFinite(n)) throw new Error("计算结果不是有限数字");
|
|
150
|
+
return n;
|
|
151
|
+
}
|
|
152
|
+
function O(e, r, t = 0) {
|
|
153
|
+
if (++r.nodes > 256 || t > 16) throw new Error("计算表达式超出深度或节点预算");
|
|
154
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw new Error("计算表达式应为声明式对象");
|
|
155
|
+
if ("field" in e) {
|
|
156
|
+
C(e.field);
|
|
157
|
+
const i = e.field;
|
|
158
|
+
return (l) => Object.prototype.hasOwnProperty.call(l, i) ? l[i] : void 0;
|
|
159
|
+
}
|
|
160
|
+
if ("value" in e) {
|
|
161
|
+
if (!v(e.value)) throw new Error("常量应为有限 JSON 标量");
|
|
162
|
+
return () => e.value;
|
|
163
|
+
}
|
|
164
|
+
if (!["add", "subtract", "multiply", "divide", "coalesce"].includes(e.op) || !Array.isArray(e.args)) throw new Error("未知计算操作");
|
|
165
|
+
if (e.args.length < 2 || ["subtract", "divide"].includes(e.op) && e.args.length !== 2) throw new Error("运算参数数量不正确");
|
|
166
|
+
const n = e.args.map((i) => O(i, r, t + 1));
|
|
167
|
+
return e.op === "coalesce" ? (i, l) => T(n, i, l) : (i, l) => J(e.op, n.map((c) => c(i, l)));
|
|
168
|
+
}
|
|
169
|
+
function T(e, r, t) {
|
|
170
|
+
for (const n of e) {
|
|
171
|
+
const i = n(r, t);
|
|
172
|
+
if (i != null) return i;
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function D(e) {
|
|
177
|
+
const r = /* @__PURE__ */ new Set();
|
|
178
|
+
return e.fields.map((t) => {
|
|
179
|
+
if (C(t.field), r.has(t.field)) throw new Error(`计算字段重复:${t.field}`);
|
|
180
|
+
r.add(t.field);
|
|
181
|
+
const n = t.expression;
|
|
182
|
+
let i;
|
|
183
|
+
if (typeof n == "string") {
|
|
184
|
+
if (!e.formula) throw new Error("字符串公式需要显式配置 formula adapter");
|
|
185
|
+
i = (l, c) => e.formula.evaluate(n, { row: l, rowIndex: c });
|
|
186
|
+
} else i = O(n, { nodes: 0 });
|
|
187
|
+
return { field: t.field, read: i };
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function H(e, r) {
|
|
191
|
+
const t = r.maxRows ?? 1e5, n = r.maxCells ?? 2e6;
|
|
192
|
+
if (!Array.isArray(e) || !Number.isSafeInteger(t) || t < 1 || e.length > t) throw new Error("计算数据行数超出预算或输入不是数组");
|
|
193
|
+
if (!Array.isArray(r.fields) || r.fields.length > 2048) throw new Error("计算字段应为数组且最多2048项");
|
|
194
|
+
if (!Number.isSafeInteger(n) || n < 1 || e.length * r.fields.length > n) throw new Error("计算单元格超出 maxCells 预算");
|
|
195
|
+
}
|
|
196
|
+
function q(e, r) {
|
|
197
|
+
H(e, r);
|
|
198
|
+
const t = D(r), n = [];
|
|
199
|
+
return { rows: e.map((l, c) => {
|
|
200
|
+
if (!l || typeof l != "object" || Array.isArray(l)) throw new Error(`第 ${c + 1} 行应为对象`);
|
|
201
|
+
if (r.signal?.aborted) {
|
|
202
|
+
const o = new Error("数据计算已取消");
|
|
203
|
+
throw o.name = "AbortError", o;
|
|
204
|
+
}
|
|
205
|
+
const f = { ...l };
|
|
206
|
+
for (const o of t)
|
|
207
|
+
try {
|
|
208
|
+
const u = o.read(f, c);
|
|
209
|
+
if (u !== void 0 && !v(u)) throw new Error("计算结果应为有限 JSON 标量,异步公式请先在数据源中求值");
|
|
210
|
+
f[o.field] = u ?? null;
|
|
211
|
+
} catch (u) {
|
|
212
|
+
const h = u instanceof Error ? u.message : String(u);
|
|
213
|
+
if (r.onError !== "null") throw Object.assign(new Error(`第 ${c + 1} 行 ${o.field}:${h}`), { cause: u });
|
|
214
|
+
f[o.field] = null, n.push({ rowIndex: c, field: o.field, message: h });
|
|
215
|
+
}
|
|
216
|
+
return f;
|
|
217
|
+
}), issues: n };
|
|
218
|
+
}
|
|
219
|
+
export {
|
|
220
|
+
q as computeDataset,
|
|
221
|
+
U as createChartComponents,
|
|
222
|
+
V as createCrossTable
|
|
223
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { d as v, c as k, e as S } from "./style-Dv5o_x6b.js";
|
|
2
|
+
import { n as x } from "./capabilities-joSutDF8.js";
|
|
3
|
+
import { w as y } from "./progress-DD964VAB.js";
|
|
4
|
+
const A = ["borderTop", "borderRight", "borderBottom", "borderLeft", "borderColor", "lineColor", "lineWidthPt"];
|
|
5
|
+
function O(n, e) {
|
|
6
|
+
const t = v(e.style), r = t.inner ? [...n.edges] : [];
|
|
7
|
+
t.top && r.push({ kind: "h", pos: 0, from: 0, to: e.widthMm }), t.bottom && r.push({ kind: "h", pos: e.heightMm, from: 0, to: e.widthMm }), t.left && r.push({ kind: "v", pos: 0, from: 0, to: e.heightMm }), t.right && r.push({ kind: "v", pos: e.widthMm, from: 0, to: e.heightMm });
|
|
8
|
+
const o = k(e.style);
|
|
9
|
+
return r.map((s) => ({ ...s, ...o }));
|
|
10
|
+
}
|
|
11
|
+
function I(n, e, t) {
|
|
12
|
+
const r = n.get(e);
|
|
13
|
+
(!r || t.widthPt > r.widthPt) && n.set(e, t);
|
|
14
|
+
}
|
|
15
|
+
function p(n, e, t, r, o, s) {
|
|
16
|
+
const i = t < e.rows.length ? e.rows[t].pos : e.rows[e.rows.length - 1].pos + e.rows[e.rows.length - 1].size;
|
|
17
|
+
for (let a = r; a < o; a++) {
|
|
18
|
+
const d = e.columns[a];
|
|
19
|
+
I(n, `h:${t}:${a}`, { kind: "h", pos: i, from: d.pos, to: d.pos + d.size, ...s });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function w(n, e, t, r, o, s) {
|
|
23
|
+
const i = t < e.columns.length ? e.columns[t].pos : e.columns[e.columns.length - 1].pos + e.columns[e.columns.length - 1].size;
|
|
24
|
+
for (let a = r; a < o; a++) {
|
|
25
|
+
const d = e.rows[a];
|
|
26
|
+
I(n, `v:${t}:${a}`, { kind: "v", pos: i, from: d.pos, to: d.pos + d.size, ...s });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function b(n, e, t, r) {
|
|
30
|
+
const o = Math.min(e.columns.length, t.ci + (t.cell.colSpan ?? 1)), s = Math.min(e.rows.length, t.ri + (t.cell.rowSpan ?? 1)), i = S(r, t.cell.style), a = v(i), d = k(i);
|
|
31
|
+
a.top && p(n, e, t.ri, t.ci, o, d), a.bottom && p(n, e, s, t.ci, o, d), a.left && w(n, e, t.ci, t.ri, s, d), a.right && w(n, e, o, t.ri, s, d);
|
|
32
|
+
}
|
|
33
|
+
function P(n) {
|
|
34
|
+
const e = [...n.values()].sort((r, o) => r.kind.localeCompare(o.kind) || r.pos - o.pos || r.from - o.from), t = [];
|
|
35
|
+
for (const r of e) {
|
|
36
|
+
const o = t[t.length - 1];
|
|
37
|
+
o && o.kind === r.kind && o.pos === r.pos && Math.abs(o.to - r.from) < 1e-6 && o.color === r.color && o.widthPt === r.widthPt ? o.to = r.to : t.push({ ...r });
|
|
38
|
+
}
|
|
39
|
+
return t;
|
|
40
|
+
}
|
|
41
|
+
function j(n, e) {
|
|
42
|
+
if (!n.cells.some(({ cell: s }) => A.some((i) => s.style?.[i] !== void 0))) return O(n, e);
|
|
43
|
+
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), o = n.columns.length;
|
|
44
|
+
for (const s of n.cells) {
|
|
45
|
+
b(t, n, s, e.style);
|
|
46
|
+
const i = Math.min(n.rows.length, s.ri + (s.cell.rowSpan ?? 1)), a = Math.min(o, s.ci + (s.cell.colSpan ?? 1));
|
|
47
|
+
for (let d = s.ri; d < i; d++) for (let c = s.ci; c < a; c++) r.add(d * o + c);
|
|
48
|
+
}
|
|
49
|
+
for (let s = 0; s < n.rows.length; s++) for (let i = 0; i < o; i++)
|
|
50
|
+
r.has(s * o + i) || b(t, n, { ri: s, ci: i, cell: {} }, e.style);
|
|
51
|
+
return P(t);
|
|
52
|
+
}
|
|
53
|
+
class u extends Error {
|
|
54
|
+
constructor(e, t) {
|
|
55
|
+
super(e.message), this.name = "OutputAssetError", this.diagnostic = e, this.cause = t;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function f(n) {
|
|
59
|
+
if (n.aborted) throw n.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
60
|
+
}
|
|
61
|
+
function B(n) {
|
|
62
|
+
const e = { maxAssets: 1e3, maxImageBytes: 33554432, maxTotalImageBytes: 134217728, maxDurationMs: 3e4, ...n.assetBudget };
|
|
63
|
+
for (const [t, r] of Object.entries(e))
|
|
64
|
+
if (!Number.isSafeInteger(r) || r <= 0 || r > 2147483647) throw new RangeError(`${t} must be a positive safe integer at most 2147483647.`);
|
|
65
|
+
return e;
|
|
66
|
+
}
|
|
67
|
+
function D(n) {
|
|
68
|
+
const e = /^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(n);
|
|
69
|
+
if (!e) throw new TypeError("Asset renderers must return an image data URL.");
|
|
70
|
+
return e[1] ? Math.ceil(e[2].length * 3 / 4) : new TextEncoder().encode(decodeURIComponent(e[2])).byteLength;
|
|
71
|
+
}
|
|
72
|
+
function h(n, e, t, r, o) {
|
|
73
|
+
const s = { code: t, message: r, severity: "warning", format: n.options.format ?? "dom", pageIndex: e.pageIndex, componentIndex: e.componentIndex, componentPath: e.componentPath, kind: e.component.kind, nid: e.component.nid };
|
|
74
|
+
if (n.diagnostics.push(s), x(s, { ...n.options, signal: n.signal }), n.options.assetFailure !== "placeholder") throw new u(s, o);
|
|
75
|
+
}
|
|
76
|
+
async function T(n, e, t) {
|
|
77
|
+
const r = n.options.assetRenderers?.[e.kind];
|
|
78
|
+
if (e.imageData || !r) return e.imageData;
|
|
79
|
+
if (++n.rendered > n.budget.maxAssets) return h(n, t, "asset-budget-exceeded", "Output exceeded the asset count budget.");
|
|
80
|
+
let o;
|
|
81
|
+
try {
|
|
82
|
+
if (n.active = t, o = await y(r({ ...t, signal: n.signal }), n.signal), f(n.signal), o.length > n.budget.maxImageBytes * 4 + 1024) return h(n, t, "asset-budget-exceeded", "Output exceeded the image payload byte budget.");
|
|
83
|
+
const s = D(o);
|
|
84
|
+
if (s > n.budget.maxImageBytes || n.bytes + s > n.budget.maxTotalImageBytes) return h(n, t, "asset-budget-exceeded", "Output exceeded the encoded image byte budget.");
|
|
85
|
+
n.bytes += s;
|
|
86
|
+
} catch (s) {
|
|
87
|
+
if (n.signal.aborted || s instanceof u) throw s;
|
|
88
|
+
return h(n, t, "asset-render-failed", `Asset renderer failed for ${e.kind}; output was not silently omitted.`, s);
|
|
89
|
+
}
|
|
90
|
+
return o;
|
|
91
|
+
}
|
|
92
|
+
function C(n, e) {
|
|
93
|
+
const t = n.active;
|
|
94
|
+
if (!t) {
|
|
95
|
+
e.abort(new Error("Asset rendering exceeded maxDurationMs."));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const r = { code: "asset-budget-exceeded", message: "Asset rendering exceeded maxDurationMs.", severity: "warning", format: n.options.format ?? "dom", pageIndex: t.pageIndex, componentIndex: t.componentIndex, componentPath: t.componentPath, kind: t.component.kind, nid: t.component.nid };
|
|
99
|
+
n.diagnostics.push(r);
|
|
100
|
+
try {
|
|
101
|
+
x(r, { ...n.options, signal: n.signal });
|
|
102
|
+
} catch (o) {
|
|
103
|
+
e.abort(o);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
e.abort(new u(r));
|
|
107
|
+
}
|
|
108
|
+
async function R(n, e, t, r, o) {
|
|
109
|
+
if (!e?.children?.length) return e;
|
|
110
|
+
const s = [];
|
|
111
|
+
for (const [i, a] of e.children.entries())
|
|
112
|
+
s.push(await M(n, a, { ...t, component: a, componentPath: [...r, i] }, o));
|
|
113
|
+
return s.some((i, a) => i !== e.children[a]) ? { ...e, children: s } : e;
|
|
114
|
+
}
|
|
115
|
+
async function M(n, e, t, r) {
|
|
116
|
+
if (f(n.signal), r.has(e)) throw new TypeError("Cyclic grid children cannot be rendered.");
|
|
117
|
+
let o = n.cache.get(e);
|
|
118
|
+
o || (o = T(n, e, t), n.cache.set(e, o));
|
|
119
|
+
const s = await o;
|
|
120
|
+
f(n.signal);
|
|
121
|
+
let i = e.grid;
|
|
122
|
+
if (i) {
|
|
123
|
+
const a = new Set(r).add(e), d = [];
|
|
124
|
+
for (const [c, l] of i.cells.entries()) {
|
|
125
|
+
const g = [];
|
|
126
|
+
for (const [m, E] of l.entries()) g.push(await R(n, E, t, [...t.componentPath, c, m], a));
|
|
127
|
+
d.push(g);
|
|
128
|
+
}
|
|
129
|
+
d.some((c, l) => c.some((g, m) => g !== i.cells[l][m])) && (i = { ...i, cells: d });
|
|
130
|
+
}
|
|
131
|
+
return s !== e.imageData || i !== e.grid ? { ...e, imageData: s, grid: i } : e;
|
|
132
|
+
}
|
|
133
|
+
async function F(n, e = {}) {
|
|
134
|
+
const t = B(e);
|
|
135
|
+
if (e.signal?.aborted) throw e.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
136
|
+
const r = new AbortController(), o = () => r.abort(e.signal?.reason);
|
|
137
|
+
if (e.signal?.addEventListener("abort", o, { once: !0 }), !e.assetRenderers || !Object.keys(e.assetRenderers).length)
|
|
138
|
+
return e.signal?.removeEventListener("abort", o), { plan: n, diagnostics: [] };
|
|
139
|
+
const s = { options: e, signal: r.signal, diagnostics: [], rendered: 0, bytes: 0, budget: t, cache: /* @__PURE__ */ new WeakMap() }, i = setTimeout(() => C(s, r), t.maxDurationMs);
|
|
140
|
+
try {
|
|
141
|
+
const a = [];
|
|
142
|
+
for (const [d, c] of n.pages.entries()) {
|
|
143
|
+
if (d < (e.start ?? 0) || d > (e.end ?? n.pages.length - 1)) {
|
|
144
|
+
a.push(c);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const l = [];
|
|
148
|
+
for (const [g, m] of c.components.entries()) l.push(await M(s, m, { component: m, pageIndex: d, componentIndex: g, componentPath: [] }, /* @__PURE__ */ new Set()));
|
|
149
|
+
a.push(l.some((g, m) => g !== c.components[m]) ? { ...c, components: l } : c);
|
|
150
|
+
}
|
|
151
|
+
return f(s.signal), { plan: a.some((d, c) => d !== n.pages[c]) ? { ...n, pages: a } : n, diagnostics: s.diagnostics };
|
|
152
|
+
} finally {
|
|
153
|
+
clearTimeout(i), e.signal?.removeEventListener("abort", o);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
u as O,
|
|
158
|
+
F as a,
|
|
159
|
+
j as r
|
|
160
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const m=require("./style-CpwiOPyB.cjs"),k=require("./capabilities-xGTpnPjJ.cjs"),E=require("./progress-KvhwXZ1Q.cjs"),S=["borderTop","borderRight","borderBottom","borderLeft","borderColor","lineColor","lineWidthPt"];function y(n,e){const t=m.resolveBoxBorders(e.style),r=t.inner?[...n.edges]:[];t.top&&r.push({kind:"h",pos:0,from:0,to:e.widthMm}),t.bottom&&r.push({kind:"h",pos:e.heightMm,from:0,to:e.widthMm}),t.left&&r.push({kind:"v",pos:0,from:0,to:e.heightMm}),t.right&&r.push({kind:"v",pos:e.widthMm,from:0,to:e.heightMm});const o=m.resolveStroke(e.style);return r.map(s=>({...s,...o}))}function x(n,e,t){const r=n.get(e);(!r||t.widthPt>r.widthPt)&&n.set(e,t)}function w(n,e,t,r,o,s){const i=t<e.rows.length?e.rows[t].pos:e.rows[e.rows.length-1].pos+e.rows[e.rows.length-1].size;for(let c=r;c<o;c++){const d=e.columns[c];x(n,`h:${t}:${c}`,{kind:"h",pos:i,from:d.pos,to:d.pos+d.size,...s})}}function b(n,e,t,r,o,s){const i=t<e.columns.length?e.columns[t].pos:e.columns[e.columns.length-1].pos+e.columns[e.columns.length-1].size;for(let c=r;c<o;c++){const d=e.rows[c];x(n,`v:${t}:${c}`,{kind:"v",pos:i,from:d.pos,to:d.pos+d.size,...s})}}function v(n,e,t,r){const o=Math.min(e.columns.length,t.ci+(t.cell.colSpan??1)),s=Math.min(e.rows.length,t.ri+(t.cell.rowSpan??1)),i=m.mergeComponentStyles(r,t.cell.style),c=m.resolveBoxBorders(i),d=m.resolveStroke(i);c.top&&w(n,e,t.ri,t.ci,o,d),c.bottom&&w(n,e,s,t.ci,o,d),c.left&&b(n,e,t.ci,t.ri,s,d),c.right&&b(n,e,o,t.ri,s,d)}function A(n){const e=[...n.values()].sort((r,o)=>r.kind.localeCompare(o.kind)||r.pos-o.pos||r.from-o.from),t=[];for(const r of e){const o=t[t.length-1];o&&o.kind===r.kind&&o.pos===r.pos&&Math.abs(o.to-r.from)<1e-6&&o.color===r.color&&o.widthPt===r.widthPt?o.to=r.to:t.push({...r})}return t}function B(n,e){if(!n.cells.some(({cell:s})=>S.some(i=>s.style?.[i]!==void 0)))return y(n,e);const t=new Map,r=new Set,o=n.columns.length;for(const s of n.cells){v(t,n,s,e.style);const i=Math.min(n.rows.length,s.ri+(s.cell.rowSpan??1)),c=Math.min(o,s.ci+(s.cell.colSpan??1));for(let d=s.ri;d<i;d++)for(let a=s.ci;a<c;a++)r.add(d*o+a)}for(let s=0;s<n.rows.length;s++)for(let i=0;i<o;i++)r.has(s*o+i)||v(t,n,{ri:s,ci:i,cell:{}},e.style);return A(t)}class p extends Error{constructor(e,t){super(e.message),this.name="OutputAssetError",this.diagnostic=e,this.cause=t}}function f(n){if(n.aborted)throw n.reason??new DOMException("The operation was aborted.","AbortError")}function O(n){const e={maxAssets:1e3,maxImageBytes:33554432,maxTotalImageBytes:134217728,maxDurationMs:3e4,...n.assetBudget};for(const[t,r]of Object.entries(e))if(!Number.isSafeInteger(r)||r<=0||r>2147483647)throw new RangeError(`${t} must be a positive safe integer at most 2147483647.`);return e}function P(n){const e=/^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(n);if(!e)throw new TypeError("Asset renderers must return an image data URL.");return e[1]?Math.ceil(e[2].length*3/4):new TextEncoder().encode(decodeURIComponent(e[2])).byteLength}function h(n,e,t,r,o){const s={code:t,message:r,severity:"warning",format:n.options.format??"dom",pageIndex:e.pageIndex,componentIndex:e.componentIndex,componentPath:e.componentPath,kind:e.component.kind,nid:e.component.nid};if(n.diagnostics.push(s),k.notifyOutputDiagnostic(s,{...n.options,signal:n.signal}),n.options.assetFailure!=="placeholder")throw new p(s,o)}async function D(n,e,t){const r=n.options.assetRenderers?.[e.kind];if(e.imageData||!r)return e.imageData;if(++n.rendered>n.budget.maxAssets)return h(n,t,"asset-budget-exceeded","Output exceeded the asset count budget.");let o;try{if(n.active=t,o=await E.waitForOutput(r({...t,signal:n.signal}),n.signal),f(n.signal),o.length>n.budget.maxImageBytes*4+1024)return h(n,t,"asset-budget-exceeded","Output exceeded the image payload byte budget.");const s=P(o);if(s>n.budget.maxImageBytes||n.bytes+s>n.budget.maxTotalImageBytes)return h(n,t,"asset-budget-exceeded","Output exceeded the encoded image byte budget.");n.bytes+=s}catch(s){if(n.signal.aborted||s instanceof p)throw s;return h(n,t,"asset-render-failed",`Asset renderer failed for ${e.kind}; output was not silently omitted.`,s)}return o}function T(n,e){const t=n.active;if(!t){e.abort(new Error("Asset rendering exceeded maxDurationMs."));return}const r={code:"asset-budget-exceeded",message:"Asset rendering exceeded maxDurationMs.",severity:"warning",format:n.options.format??"dom",pageIndex:t.pageIndex,componentIndex:t.componentIndex,componentPath:t.componentPath,kind:t.component.kind,nid:t.component.nid};n.diagnostics.push(r);try{k.notifyOutputDiagnostic(r,{...n.options,signal:n.signal})}catch(o){e.abort(o);return}e.abort(new p(r))}async function C(n,e,t,r,o){if(!e?.children?.length)return e;const s=[];for(const[i,c]of e.children.entries())s.push(await I(n,c,{...t,component:c,componentPath:[...r,i]},o));return s.some((i,c)=>i!==e.children[c])?{...e,children:s}:e}async function I(n,e,t,r){if(f(n.signal),r.has(e))throw new TypeError("Cyclic grid children cannot be rendered.");let o=n.cache.get(e);o||(o=D(n,e,t),n.cache.set(e,o));const s=await o;f(n.signal);let i=e.grid;if(i){const c=new Set(r).add(e),d=[];for(const[a,u]of i.cells.entries()){const g=[];for(const[l,M]of u.entries())g.push(await C(n,M,t,[...t.componentPath,a,l],c));d.push(g)}d.some((a,u)=>a.some((g,l)=>g!==i.cells[u][l]))&&(i={...i,cells:d})}return s!==e.imageData||i!==e.grid?{...e,imageData:s,grid:i}:e}async function R(n,e={}){const t=O(e);if(e.signal?.aborted)throw e.signal.reason??new DOMException("The operation was aborted.","AbortError");const r=new AbortController,o=()=>r.abort(e.signal?.reason);if(e.signal?.addEventListener("abort",o,{once:!0}),!e.assetRenderers||!Object.keys(e.assetRenderers).length)return e.signal?.removeEventListener("abort",o),{plan:n,diagnostics:[]};const s={options:e,signal:r.signal,diagnostics:[],rendered:0,bytes:0,budget:t,cache:new WeakMap},i=setTimeout(()=>T(s,r),t.maxDurationMs);try{const c=[];for(const[d,a]of n.pages.entries()){if(d<(e.start??0)||d>(e.end??n.pages.length-1)){c.push(a);continue}const u=[];for(const[g,l]of a.components.entries())u.push(await I(s,l,{component:l,pageIndex:d,componentIndex:g,componentPath:[]},new Set));c.push(u.some((g,l)=>g!==a.components[l])?{...a,components:u}:a)}return f(s.signal),{plan:c.some((d,a)=>d!==n.pages[a])?{...n,pages:c}:n,diagnostics:s.diagnostics}}finally{clearTimeout(i),e.signal?.removeEventListener("abort",o)}}exports.OutputAssetError=p;exports.resolveGridStrokes=B;exports.resolvePlanAssets=R;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { a as l } from "./progress-DD964VAB.js";
|
|
2
|
+
import { b as S, i as w } from "./render-plan-uzZYYSy1.js";
|
|
3
|
+
function E(e, t) {
|
|
4
|
+
l(t.signal);
|
|
5
|
+
try {
|
|
6
|
+
t.onDiagnostic?.(e);
|
|
7
|
+
} catch {
|
|
8
|
+
}
|
|
9
|
+
l(t.signal);
|
|
10
|
+
}
|
|
11
|
+
class O extends Error {
|
|
12
|
+
constructor(t) {
|
|
13
|
+
super(`Output contains ${t.length} known fidelity issue(s): ${t[0]?.code}`), this.diagnostics = t, this.code = "output-fidelity", this.name = "OutputFidelityError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const b = /* @__PURE__ */ new Set(["text", "rect", "line", "ellipse"]), $ = /* @__PURE__ */ new Set(["image", "chart", "barcode", "qrcode"]);
|
|
17
|
+
function N(e, t) {
|
|
18
|
+
if (!e.grid) {
|
|
19
|
+
if (w(e))
|
|
20
|
+
return t === "xlsx" ? { code: "unsupported-component", message: "XLSX data export omits image-backed components; use PDF or PNG for visual output." } : t === "pdf" && !/^data:image\/(png|jpe?g);base64,/i.test(e.imageData) ? { code: "unsupported-image-format", message: "PDF accepts PNG or JPEG data URLs; convert this image before exporting." } : void 0;
|
|
21
|
+
if ($.has(e.kind)) return { code: "missing-image", message: `${e.kind} requires imageData or a renderer adapter before output.` };
|
|
22
|
+
if (!b.has(e.kind)) return { code: "unsupported-component", message: `Unsupported component kind: ${e.kind}.` };
|
|
23
|
+
if (t === "xlsx" && e.kind !== "text") return { code: "unsupported-component", message: `XLSX data export omits ${e.kind} geometry.` };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function u(e, t, i, s, n) {
|
|
27
|
+
return { ...n, severity: "warning", format: t, pageIndex: i, componentIndex: s, kind: e.kind, nid: e.nid };
|
|
28
|
+
}
|
|
29
|
+
function h(e, t) {
|
|
30
|
+
if (!e || t === "dom") return;
|
|
31
|
+
const i = [];
|
|
32
|
+
return e.rotateDeg && i.push("rotateDeg"), e.opacity !== void 0 && e.opacity !== 1 && i.push("opacity"), t !== "xlsx" && e.align === "justify" && i.push("justify"), t === "canvas" && e.underline && i.push("underline"), t === "xlsx" && e.letterSpacing && i.push("letterSpacing"), i.length ? `${t} does not preserve these styles: ${i.join(", ")}.` : void 0;
|
|
33
|
+
}
|
|
34
|
+
function y(e, t, i, s, n, r, o) {
|
|
35
|
+
if (o.has(e)) return;
|
|
36
|
+
const v = new Set(o).add(e), p = N(e, t);
|
|
37
|
+
p && r.push({ ...u(e, t, i, s, p), componentPath: n });
|
|
38
|
+
const g = h(e.style, t);
|
|
39
|
+
g && r.push({ ...u(e, t, i, s, { code: "unsupported-style", message: g }), componentPath: n }), S(e) && t !== "dom" && r.push(u(e, t, i, s, { code: "rich-text-flattened", message: "Rich text is exported as plain text; inline styles are not preserved." }));
|
|
40
|
+
for (const [d, x] of (e.grid?.cells ?? []).entries()) for (const [a, c] of x.entries()) {
|
|
41
|
+
const f = h(c?.style, t);
|
|
42
|
+
if (f && r.push({ ...u(e, t, i, s, { code: "unsupported-style", message: f }), componentPath: [...n, d, a] }), c?.children?.length && t !== "dom")
|
|
43
|
+
r.push({ ...u(e, t, i, s, { code: "nested-components-omitted", message: "Nested grid components are omitted; cell text is preserved." }), componentPath: [...n, d, a] });
|
|
44
|
+
else if (t === "dom")
|
|
45
|
+
for (const [k, D] of (c?.children ?? []).entries()) y(D, t, i, s, [...n, d, a, k], r, v);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function j(e, t) {
|
|
49
|
+
const i = [];
|
|
50
|
+
return e.pages.forEach((s, n) => s.components.forEach((r, o) => y(r, t, n, o, [], i, /* @__PURE__ */ new Set()))), i;
|
|
51
|
+
}
|
|
52
|
+
function G(e, t, i) {
|
|
53
|
+
l(i.signal);
|
|
54
|
+
const s = j(e, t);
|
|
55
|
+
if (s.forEach((n) => E(n, i)), i.fidelity === "strict" && s.length) throw new O(s);
|
|
56
|
+
return s;
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
O,
|
|
60
|
+
j as i,
|
|
61
|
+
E as n,
|
|
62
|
+
G as r
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./progress-KvhwXZ1Q.cjs"),y=require("./render-plan-CckPEQyf.cjs");function v(e,t){l.assertOutputActive(t.signal);try{t.onDiagnostic?.(e)}catch{}l.assertOutputActive(t.signal)}class D extends Error{constructor(t){super(`Output contains ${t.length} known fidelity issue(s): ${t[0]?.code}`),this.diagnostics=t,this.code="output-fidelity",this.name="OutputFidelityError"}}const b=new Set(["text","rect","line","ellipse"]),$=new Set(["image","chart","barcode","qrcode"]);function C(e,t){if(!e.grid){if(y.isImageBackedComponent(e))return t==="xlsx"?{code:"unsupported-component",message:"XLSX data export omits image-backed components; use PDF or PNG for visual output."}:t==="pdf"&&!/^data:image\/(png|jpe?g);base64,/i.test(e.imageData)?{code:"unsupported-image-format",message:"PDF accepts PNG or JPEG data URLs; convert this image before exporting."}:void 0;if($.has(e.kind))return{code:"missing-image",message:`${e.kind} requires imageData or a renderer adapter before output.`};if(!b.has(e.kind))return{code:"unsupported-component",message:`Unsupported component kind: ${e.kind}.`};if(t==="xlsx"&&e.kind!=="text")return{code:"unsupported-component",message:`XLSX data export omits ${e.kind} geometry.`}}}function u(e,t,i,s,n){return{...n,severity:"warning",format:t,pageIndex:i,componentIndex:s,kind:e.kind,nid:e.nid}}function h(e,t){if(!e||t==="dom")return;const i=[];return e.rotateDeg&&i.push("rotateDeg"),e.opacity!==void 0&&e.opacity!==1&&i.push("opacity"),t!=="xlsx"&&e.align==="justify"&&i.push("justify"),t==="canvas"&&e.underline&&i.push("underline"),t==="xlsx"&&e.letterSpacing&&i.push("letterSpacing"),i.length?`${t} does not preserve these styles: ${i.join(", ")}.`:void 0}function O(e,t,i,s,n,r,o){if(o.has(e))return;const k=new Set(o).add(e),p=C(e,t);p&&r.push({...u(e,t,i,s,p),componentPath:n});const g=h(e.style,t);g&&r.push({...u(e,t,i,s,{code:"unsupported-style",message:g}),componentPath:n}),y.isRichText(e)&&t!=="dom"&&r.push(u(e,t,i,s,{code:"rich-text-flattened",message:"Rich text is exported as plain text; inline styles are not preserved."}));for(const[d,S]of(e.grid?.cells??[]).entries())for(const[c,a]of S.entries()){const f=h(a?.style,t);if(f&&r.push({...u(e,t,i,s,{code:"unsupported-style",message:f}),componentPath:[...n,d,c]}),a?.children?.length&&t!=="dom")r.push({...u(e,t,i,s,{code:"nested-components-omitted",message:"Nested grid components are omitted; cell text is preserved."}),componentPath:[...n,d,c]});else if(t==="dom")for(const[w,E]of(a?.children??[]).entries())O(E,t,i,s,[...n,d,c,w],r,k)}}function x(e,t){const i=[];return e.pages.forEach((s,n)=>s.components.forEach((r,o)=>O(r,t,n,o,[],i,new Set))),i}function F(e,t,i){l.assertOutputActive(i.signal);const s=x(e,t);if(s.forEach(n=>v(n,i)),i.fidelity==="strict"&&s.length)throw new D(s);return s}exports.OutputFidelityError=D;exports.inspectOutputCapabilities=x;exports.notifyOutputDiagnostic=v;exports.reportOutputDiagnostics=F;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),F=require("@agile-team/mach-report/vue"),p=require("@agile-team/mach-report"),K=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function Q(u,S,i,f){const d=e.ref(0),l=e.ref(""),h=e.ref([]),R=e.computed(()=>u.value.template.pages.flatMap((a,r)=>a.components.flatMap((o,c)=>o.kind==="list"?[{component:o,pageIndex:r,componentIndex:c}]:[]))),b=e.computed(()=>R.value[d.value]?.component),V=e.computed(()=>{const a=b.value;if(!a)return[];const r=a.columns.map(o=>o.headerStyle?.align??o.headerAlign??a.headerStyle?.align??a.headerAlign??o.style?.align??"center");if(a.headerGrid&&S())for(const o of p.resolveGridLayout(a.headerGrid,a.widthMm,100).cells)for(let c=o.ci;c<o.ci+(o.cell.colSpan??1);c++)r[c]=o.cell.style?.align??"left";return r}),E=e.computed(()=>{const a=l.value.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean);return(b.value?.columns??[]).flatMap((r,o)=>{const c=`${r.header} ${r.field}`.toLocaleLowerCase();return a.every(y=>c.includes(y))?[{column:r,index:o}]:[]})});function v(a,r){h.value=r?[...new Set([...h.value,a])]:h.value.filter(o=>o!==a)}function N(a){for(const r of E.value)v(r.index,a)}function m(){h.value=[]}function M(a,r,o){if(!i())return;const c=b.value?.columns[a];c&&(Object.assign(c,{[r]:r==="widthMm"?Number(o):o}),r==="header"&&A(a,String(o)),r==="headerAlign"&&D(a,o),r==="widthMm"&&G(),f())}function G(){const a=R.value[d.value];if(!a)return;const r=a.component,o=u.value.template.pages[a.pageIndex],c=r.columns.map(y=>y.widthMm);r.headerGrid&&(r.headerGrid.colWidthsMm=c),o.layout==="wide"&&c.every(y=>Number.isFinite(y)&&y>0)&&(r.widthMm=c.reduce((y,t)=>y+t,0),o.widthMm=Math.max(...o.components.map(y=>y.leftMm+y.widthMm))+(o.marginRightMm??0))}function A(a,r){const o=b.value;if(!o?.headerGrid)return;const y=p.resolveGridLayout(o.headerGrid,o.widthMm,100).cells.filter(({ci:t,cell:T})=>t<=a&&t+(T.colSpan??1)>a).slice(-1)[0];y&&(Object.assign(y.cell,{text:r,rawText:r,value:r}),o.columns.slice(y.ci,y.ci+(y.cell.colSpan??1)).forEach(t=>{t.header=r}))}function D(a,r){const o=b.value,c=o?.columns[a];if(c?.headerStyle?.align!==void 0&&(c.headerStyle={...c.headerStyle,align:r}),!o?.headerGrid)return;const t=p.resolveGridLayout(o.headerGrid,o.widthMm,100).cells.filter(({ci:T,cell:L})=>T<=a&&T+(L.colSpan??1)>a).slice(-1)[0];t&&(t.cell.style={...t.cell.style,align:r},o.columns.slice(t.ci,t.ci+(t.cell.colSpan??1)).forEach(T=>{T.headerAlign=r,T.headerStyle?.align!==void 0&&(T.headerStyle={...T.headerStyle,align:r})}))}function j(a,r){if(!(!i()||a==="headerAlign"&&r==="auto")){for(const o of h.value){const c=b.value?.columns[o];c&&(Object.assign(c,{[a]:r}),a==="headerAlign"&&D(o,r))}f()}}return{selected:d,query:l,selectedColumns:h,lists:R,activeList:b,headerAlignments:V,visibleColumns:E,toggleColumn:v,selectVisible:N,clearSelection:m,setColumn:M,alignColumns:j}}function X(u,S={entries:100,bytes:16*1024*1024}){const i=e.ref([u]),f=e.ref(0),d=e.computed(()=>f.value>0),l=e.computed(()=>f.value+1<i.value.length),h=e.computed(()=>i.value[f.value]);function R(E){i.value=[E],f.value=0}function b(E){if(i.value[f.value]===E)return;const v=i.value.slice(0,f.value+1);v.push(E);let N=v.reduce((m,M)=>m+M.length*2,0);for(;v.length>1&&(v.length>S.entries||N>S.bytes);)N-=v.shift().length*2;i.value=v,f.value=i.value.length-1}function V(E){if(!(E<0?!d.value:!l.value))return f.value+=E,i.value[f.value]}return{canUndo:d,canRedo:l,current:h,reset:R,record:b,move:V}}function Y(u){const S=e.shallowRef(null),i=e.ref(!1);let f,d=0;function l(b){f?.(b),f=void 0,S.value=null}function h(){d++,l(!1),i.value=!1}async function R(b){h();const V=d,E=u();i.value=!0;try{const v=await new Promise((N,m)=>{if(f=N,!E){S.value=b;return}Promise.resolve().then(()=>d===V?E(b):!1).then(M=>{d===V&&l(M===!0)},M=>{d===V&&(f=void 0,S.value=null,m(M))})});return d===V&&v===!0}finally{d===V&&(i.value=!1)}}return e.onBeforeUnmount(h),{confirmation:S,pending:i,decide:l,request:R,cancel:h}}const Z={title:"报表模板属性编辑器",heading:"模板属性",unpublished:"未发布",dirty:"有未保存修改",reset:"恢复草稿",saving:"正在保存…",save:"保存草稿",name:"模板名称",description:"说明",area:"明细区域",page:"页",header:"表头",field:"业务字段",width:"列宽(mm)",semantic:"字段语义",identifier:"编号",dimension:"分类",measure:"数值",date:"日期",text:"文本",bodyAlign:"正文对齐",headerAlign:"表头对齐",auto:"按字段语义",left:"居左",center:"居中",right:"居右",justify:"两端对齐",editable:"允许编辑",json:"完整模板 JSON",applyJson:"校验并应用 JSON",note:"字段映射应与数据源契约一致。此编辑器维护模板属性;保存由接入方提供的版本服务处理。",invalid:"请先修正模板错误,再预览或保存。"},ee={undo:"撤销",redo:"重做",columnsSearch:"搜索列名或字段",columnsSelected:"已选列",selectVisible:"选择当前结果",clearSelection:"清除选择",noColumns:"没有匹配的列",batchBody:"批量正文对齐",batchHeader:"批量表头对齐",chooseAlignment:"选择对齐方式",discardTitle:"保留当前修改?",discardDescription:"当前包含未保存的属性或尚未应用的 JSON,继续将丢弃这些修改。",keepEditing:"继续编辑",discard:"丢弃修改并继续",jsonPending:"JSON 尚未应用。请先校验并应用,或撤销 JSON 修改后继续属性编辑与保存。"},H={...Z,...ee};function te(u,S){const i=e.ref(p.parseReportTemplate(u.modelValue)),f=e.ref(p.serializeReportTemplate(i.value)),d=e.ref(p.serializeReportTemplate(i.value)),l=e.ref(""),h=e.ref(!1),R=e.computed(()=>({...H,...u.messages})),b=e.computed(()=>({showExport:!1,showPrint:!1,showPdfWindow:!1,...u.preview,theme:{shellBg:"#f1f5f9",shellFg:"#334155",toolbarBg:"#ffffff",toolbarBorder:"#e2e8f0",toolbarFg:"#334155",btnFg:"#475569",btnBorder:"#cbd5e1",btnHoverBg:"#eff6ff",btnHoverFg:"#1d4ed8",btnActiveBg:"#2563eb",...u.preview?.theme}}));F.provideMachReportConfig({get defaults(){return b.value}});let V,E=0;const v=e.computed(()=>p.validateReportTemplateDocument(i.value)),N=e.computed(()=>{try{return p.serializeReportTemplate(i.value)!==f.value}catch{return!0}}),m=e.ref(d.value),M=e.computed(()=>d.value!==m.value),G=e.computed(()=>N.value||d.value!==m.value),A=()=>JSON.stringify({document:i.value,json:d.value,appliedJson:m.value}),D=X(A()),j=Y(()=>u.beforeDiscard),a=e.computed(()=>h.value||j.pending.value),r=()=>!u.readonly&&!a.value&&!M.value,o=Q(i,()=>v.value.ok,r,n),{selected:c,lists:y,activeList:t,headerAlignments:T,setColumn:L}=o;e.watch(c,()=>o.clearSelection());const x=e.computed(()=>v.value.ok?F.createLocalFetcher({draft:{template:i.value.template,datasets:u.datasets??{},params:[]}}):void 0);function P(){E++,V?.abort(),V=void 0,h.value=!1}let J=0;async function w(g="replace",B){if(!G.value)return!0;const _=A();try{return await j.request({reason:g,document:JSON.parse(JSON.stringify(i.value)),replacement:B?p.parseReportTemplate(B):void 0,pendingLocalChanges:!0})&&_===A()}catch(O){return l.value=O instanceof Error?O.message:String(O),!1}}function s(g){P(),i.value=g,f.value=p.serializeReportTemplate(g),d.value=f.value,m.value=d.value,l.value="",c.value=0,o.clearSelection(),D.reset(A())}e.watch(()=>u.modelValue,async g=>{let B;try{B=p.parseReportTemplate(g)}catch(O){l.value=O instanceof Error?O.message:String(O);return}try{if(p.serializeReportTemplate(B)===p.serializeReportTemplate(i.value))return}catch{}const _=++J;if(P(),!await w("replace",B)){_===J&&v.value.ok&&S("update:modelValue",p.parseReportTemplate(i.value));return}_===J&&s(B)}),e.onBeforeUnmount(()=>{J++,P()});function n(){j.cancel(),l.value="",v.value.ok&&(d.value=p.serializeReportTemplate(i.value),m.value=d.value,S("update:modelValue",p.parseReportTemplate(i.value))),D.record(A())}function k(g){r()&&(i.value.name=g,n())}function C(g){r()&&(i.value.description=g,n())}function U(){if(!(u.readonly||a.value))try{const g=p.parseReportTemplate(d.value);if(g.id!==i.value.id)throw new Error("属性编辑不允许更换模板 ID,请另存为新模板");if(g.revision!==i.value.revision)throw new Error("修订号由保存服务管理,不能在 JSON 中修改");i.value=g,c.value=0,o.clearSelection(),n()}catch(g){l.value=g instanceof Error?g.message:String(g)}}async function q(){a.value||u.readonly||!await w("reset")||(s(p.parseReportTemplate(f.value)),S("update:modelValue",p.parseReportTemplate(i.value)))}function I(g){if(a.value||u.readonly)return;D.record(A());const B=D.move(g);if(!B)return;j.cancel();const _=JSON.parse(B);i.value=_.document,d.value=_.json,m.value=_.appliedJson,l.value="",c.value=0,o.clearSelection(),v.value.ok&&S("update:modelValue",p.parseReportTemplate(i.value))}async function z(){if(!u.save||!r()||!v.value.ok)return;const g=++E;V=new AbortController,h.value=!0,l.value="";const B=p.parseReportTemplate(i.value);try{const _=p.parseReportTemplate(await u.save(B,{expectedRevision:B.revision,signal:V.signal}));if(g!==E)return;if(_.id!==B.id)throw new Error("保存服务返回了其他模板的文档");i.value=_,f.value=p.serializeReportTemplate(_),d.value=f.value,m.value=d.value,D.reset(A()),S("saved",p.parseReportTemplate(_)),S("update:modelValue",p.parseReportTemplate(_))}catch(_){g===E&&(l.value=_ instanceof Error?_.message:String(_))}finally{g===E&&(h.value=!1,V=void 0)}}const $=e.computed(()=>D.canUndo.value||A()!==D.current.value),W=e.computed(()=>D.canRedo.value&&A()===D.current.value);return{...o,canUndo:$,canRedo:W,undo:()=>I(-1),redo:()=>I(1),pendingLocalChanges:G,jsonPending:M,blocked:a,confirmation:j.confirmation,decideDiscard:j.decide,guardChanges:w,draft:i,json:d,selected:c,error:l,saving:h,dirty:N,validation:v,lists:y,activeList:t,headerAlignments:T,previewOptions:b,fetcher:x,messages:R,setName:k,setDescription:C,setColumn:L,applyJson:U,reset:q,save:z}}const ne=["aria-label"],le={class:"mr-designer-bar"},oe={key:0},re=["disabled"],ae=["disabled"],ie=["disabled"],se=["disabled"],ue=["aria-label"],ce={class:"mr-designer-body"},de={class:"mr-designer-panel"},fe=["value","disabled"],me=["value","disabled"],pe={key:0},ve=["value"],ge={key:1,class:"mr-designer-columns"},he={class:"mr-designer-column-tools"},ye=["disabled"],be=["disabled"],Ee={role:"status"},Se={key:0,class:"mr-designer-batch"},Ve=["aria-label","disabled"],Ne={value:""},_e={value:"auto"},De={value:"left"},ke={value:"center"},Ce={value:"right"},Te={value:"justify"},we=["aria-label","disabled"],Be={value:""},Re={value:"left"},Me={value:"center"},Ae={value:"right"},je={value:"justify"},xe={key:1,role:"status"},Le=["disabled"],Oe={class:"mr-designer-select-column"},Je=["checked","onChange"],Ge=["value","onInput"],Pe=["value","onChange"],Fe=["value","onChange"],Ie=["value","onChange"],He={value:"identifier"},Ue={value:"dimension"},qe={value:"measure"},ze={value:"date"},$e={value:"text"},We=["value","onChange"],Ke={value:"auto"},Qe={value:"left"},Xe={value:"center"},Ye={value:"right"},Ze={value:"justify"},et=["value","onChange"],tt={value:"left"},nt={value:"center"},lt={value:"right"},ot={value:"justify"},rt={class:"mr-designer-toggle"},at=["checked","onChange"],it=["aria-label","disabled"],st=["disabled"],ut={key:2,role:"status",class:"mr-designer-note"},ct={class:"mr-designer-note"},dt={class:"mr-designer-preview"},ft={key:0,role:"alert",class:"mr-designer-error"},mt={key:1,role:"alert",class:"mr-designer-error"},pt={key:3,class:"mr-designer-note"},vt=e.defineComponent({__name:"ReportTemplateEditor",props:{modelValue:{},datasets:{},readonly:{type:Boolean},messages:{},preview:{},beforeDiscard:{type:Function},save:{type:Function}},emits:["update:modelValue","saved"],setup(u,{expose:S,emit:i}){const f=u,d=i,l=te(f,(w,s)=>{d(w==="saved"?"saved":"update:modelValue",s)}),{draft:h,json:R,selected:b,error:V,saving:E,pendingLocalChanges:v,jsonPending:N,blocked:m,confirmation:M,canUndo:G,canRedo:A,validation:D,lists:j,activeList:a,visibleColumns:r,query:o,selectedColumns:c,fetcher:y,messages:t}=l,T=e.ref(null);let L=null;e.watch(M,async w=>{w?(L=document.activeElement,await e.nextTick(),T.value?.focus()):(await e.nextTick(),L?.isConnected&&L.focus(),L=null)}),S({get pendingLocalChanges(){return v.value},guardChanges:l.guardChanges,reset:l.reset,save:l.save});function x(w){return w.target.value}function P(w){return w.target.checked}function J(w,s){const n=w.target;l.alignColumns(s,n.value),n.value=""}return(w,s)=>(e.openBlock(),e.createElementBlock("section",{class:"mr-designer","aria-label":e.unref(t).title},[e.createElementVNode("header",le,[e.createElementVNode("div",null,[e.createElementVNode("strong",null,e.toDisplayString(e.unref(t).heading),1),e.createElementVNode("span",null,[e.createTextVNode(e.toDisplayString(e.unref(h).id)+" · "+e.toDisplayString(e.unref(h).revision||e.unref(t).unpublished),1),e.unref(v)?(e.openBlock(),e.createElementBlock("b",oe," · "+e.toDisplayString(e.unref(t).dirty),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",null,[e.createElementVNode("button",{type:"button",disabled:u.readonly||e.unref(m)||!e.unref(G),onClick:s[0]||(s[0]=(...n)=>e.unref(l).undo&&e.unref(l).undo(...n))},e.toDisplayString(e.unref(t).undo),9,re),e.createElementVNode("button",{type:"button",disabled:u.readonly||e.unref(m)||!e.unref(A),onClick:s[1]||(s[1]=(...n)=>e.unref(l).redo&&e.unref(l).redo(...n))},e.toDisplayString(e.unref(t).redo),9,ae),e.createElementVNode("button",{type:"button",disabled:u.readonly||e.unref(m)||!e.unref(v),onClick:s[2]||(s[2]=(...n)=>e.unref(l).reset&&e.unref(l).reset(...n))},e.toDisplayString(e.unref(t).reset),9,ie),u.save?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",disabled:u.readonly||e.unref(m)||e.unref(N)||!e.unref(D).ok||!e.unref(v),onClick:s[3]||(s[3]=(...n)=>e.unref(l).save&&e.unref(l).save(...n))},e.toDisplayString(e.unref(E)?e.unref(t).saving:e.unref(t).save),9,se)):e.createCommentVNode("",!0)])]),e.unref(M)?(e.openBlock(),e.createElementBlock("div",{key:0,role:"alertdialog","aria-label":e.unref(t).discardTitle,class:"mr-designer-confirm",onKeydown:s[6]||(s[6]=e.withKeys(e.withModifiers(n=>e.unref(l).decideDiscard(!1),["prevent"]),["esc"]))},[e.createElementVNode("strong",null,e.toDisplayString(e.unref(t).discardTitle),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(t).discardDescription),1),e.createElementVNode("button",{ref_key:"keepButton",ref:T,type:"button",onClick:s[4]||(s[4]=n=>e.unref(l).decideDiscard(!1))},e.toDisplayString(e.unref(t).keepEditing),513),e.createElementVNode("button",{type:"button",onClick:s[5]||(s[5]=n=>e.unref(l).decideDiscard(!0))},e.toDisplayString(e.unref(t).discard),1)],40,ue)):e.createCommentVNode("",!0),e.createElementVNode("div",ce,[e.createElementVNode("aside",de,[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).name),1),e.createElementVNode("input",{value:e.unref(h).name,disabled:u.readonly||e.unref(m)||e.unref(N),onInput:s[7]||(s[7]=n=>e.unref(l).setName(x(n)))},null,40,fe)]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).description),1),e.createElementVNode("textarea",{value:e.unref(h).description,disabled:u.readonly||e.unref(m)||e.unref(N),onInput:s[8]||(s[8]=n=>e.unref(l).setDescription(x(n)))},null,40,me)]),e.unref(j).length?(e.openBlock(),e.createElementBlock("label",pe,[e.createTextVNode(e.toDisplayString(e.unref(t).area),1),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[9]||(s[9]=n=>e.isRef(b)?b.value=n:null)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(j),(n,k)=>(e.openBlock(),e.createElementBlock("option",{key:k,value:k},e.toDisplayString(n.pageIndex+1)+" "+e.toDisplayString(e.unref(t).page)+" · "+e.toDisplayString(n.component.title||n.component.dataset),9,ve))),128))],512),[[e.vModelSelect,e.unref(b)]])])):e.createCommentVNode("",!0),e.unref(a)?(e.openBlock(),e.createElementBlock("div",ge,[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).columnsSearch),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[10]||(s[10]=n=>e.isRef(o)?o.value=n:null),type:"search"},null,512),[[e.vModelText,e.unref(o)]])]),e.createElementVNode("div",he,[e.createElementVNode("button",{type:"button",disabled:u.readonly||e.unref(m)||e.unref(N)||!e.unref(r).length,onClick:s[11]||(s[11]=n=>e.unref(l).selectVisible(!0))},e.toDisplayString(e.unref(t).selectVisible),9,ye),e.createElementVNode("button",{type:"button",disabled:!e.unref(c).length,onClick:s[12]||(s[12]=(...n)=>e.unref(l).clearSelection&&e.unref(l).clearSelection(...n))},e.toDisplayString(e.unref(t).clearSelection),9,be),e.createElementVNode("span",Ee,e.toDisplayString(e.unref(t).columnsSelected)+" "+e.toDisplayString(e.unref(c).length)+" / "+e.toDisplayString(e.unref(a).columns.length),1)]),e.unref(c).length?(e.openBlock(),e.createElementBlock("div",Se,[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).batchBody),1),e.createElementVNode("select",{"aria-label":e.unref(t).batchBody,disabled:u.readonly||e.unref(m)||e.unref(N),onChange:s[13]||(s[13]=n=>J(n,"align"))},[e.createElementVNode("option",Ne,e.toDisplayString(e.unref(t).chooseAlignment),1),e.createElementVNode("option",_e,e.toDisplayString(e.unref(t).auto),1),e.createElementVNode("option",De,e.toDisplayString(e.unref(t).left),1),e.createElementVNode("option",ke,e.toDisplayString(e.unref(t).center),1),e.createElementVNode("option",Ce,e.toDisplayString(e.unref(t).right),1),e.createElementVNode("option",Te,e.toDisplayString(e.unref(t).justify),1)],40,Ve)]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).batchHeader),1),e.createElementVNode("select",{"aria-label":e.unref(t).batchHeader,disabled:u.readonly||e.unref(m)||e.unref(N),onChange:s[14]||(s[14]=n=>J(n,"headerAlign"))},[e.createElementVNode("option",Be,e.toDisplayString(e.unref(t).chooseAlignment),1),e.createElementVNode("option",Re,e.toDisplayString(e.unref(t).left),1),e.createElementVNode("option",Me,e.toDisplayString(e.unref(t).center),1),e.createElementVNode("option",Ae,e.toDisplayString(e.unref(t).right),1),e.createElementVNode("option",je,e.toDisplayString(e.unref(t).justify),1)],40,we)])])):e.createCommentVNode("",!0),e.unref(r).length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",xe,e.toDisplayString(e.unref(t).noColumns),1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),({column:n,index:k})=>(e.openBlock(),e.createElementBlock("fieldset",{key:k,disabled:u.readonly||e.unref(m)||e.unref(N)},[e.createElementVNode("legend",null,[e.createElementVNode("label",Oe,[e.createElementVNode("input",{type:"checkbox",checked:e.unref(c).includes(k),onChange:C=>e.unref(l).toggleColumn(k,P(C))},null,40,Je),e.createTextVNode(e.toDisplayString(k+1)+" · "+e.toDisplayString(n.header),1)])]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).header),1),e.createElementVNode("input",{value:n.header,onInput:C=>e.unref(l).setColumn(k,"header",x(C))},null,40,Ge)]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).field),1),e.createElementVNode("input",{value:n.field,onChange:C=>e.unref(l).setColumn(k,"field",x(C))},null,40,Pe)]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).width),1),e.createElementVNode("input",{type:"number",min:"0.1",step:"0.5",value:n.widthMm,onChange:C=>e.unref(l).setColumn(k,"widthMm",x(C))},null,40,Fe)]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).semantic),1),e.createElementVNode("select",{value:n.semanticRole||"text",onChange:C=>e.unref(l).setColumn(k,"semanticRole",x(C))},[e.createElementVNode("option",He,e.toDisplayString(e.unref(t).identifier),1),e.createElementVNode("option",Ue,e.toDisplayString(e.unref(t).dimension),1),e.createElementVNode("option",qe,e.toDisplayString(e.unref(t).measure),1),e.createElementVNode("option",ze,e.toDisplayString(e.unref(t).date),1),e.createElementVNode("option",$e,e.toDisplayString(e.unref(t).text),1)],40,Ie)]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).bodyAlign),1),e.createElementVNode("select",{value:n.align??n.style?.align??e.unref(a).align??"left",onChange:C=>e.unref(l).setColumn(k,"align",x(C))},[e.createElementVNode("option",Ke,e.toDisplayString(e.unref(t).auto),1),e.createElementVNode("option",Qe,e.toDisplayString(e.unref(t).left),1),e.createElementVNode("option",Xe,e.toDisplayString(e.unref(t).center),1),e.createElementVNode("option",Ye,e.toDisplayString(e.unref(t).right),1),e.createElementVNode("option",Ze,e.toDisplayString(e.unref(t).justify),1)],40,We)]),e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(e.unref(t).headerAlign),1),e.createElementVNode("select",{value:e.unref(l).headerAlignments.value[k],onChange:C=>e.unref(l).setColumn(k,"headerAlign",x(C))},[e.createElementVNode("option",tt,e.toDisplayString(e.unref(t).left),1),e.createElementVNode("option",nt,e.toDisplayString(e.unref(t).center),1),e.createElementVNode("option",lt,e.toDisplayString(e.unref(t).right),1),e.createElementVNode("option",ot,e.toDisplayString(e.unref(t).justify),1)],40,et)]),e.createElementVNode("label",rt,[e.createTextVNode(e.toDisplayString(e.unref(t).editable),1),e.createElementVNode("input",{type:"checkbox",checked:n.editable===!0,onChange:C=>e.unref(l).setColumn(k,"editable",P(C))},null,40,at)])],8,Le))),128))])):e.createCommentVNode("",!0),e.createElementVNode("details",null,[e.createElementVNode("summary",null,e.toDisplayString(e.unref(t).json),1),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":s[15]||(s[15]=n=>e.isRef(R)?R.value=n:null),class:"mr-designer-json","aria-label":e.unref(t).json,disabled:u.readonly||e.unref(m),spellcheck:"false"},null,8,it),[[e.vModelText,e.unref(R)]]),e.createElementVNode("button",{type:"button",disabled:u.readonly||e.unref(m),onClick:s[16]||(s[16]=(...n)=>e.unref(l).applyJson&&e.unref(l).applyJson(...n))},e.toDisplayString(e.unref(t).applyJson),9,st)]),e.unref(N)?(e.openBlock(),e.createElementBlock("p",ut,e.toDisplayString(e.unref(t).jsonPending),1)):e.createCommentVNode("",!0),e.createElementVNode("p",ct,e.toDisplayString(e.unref(t).note),1)]),e.createElementVNode("div",dt,[e.unref(V)?(e.openBlock(),e.createElementBlock("div",ft,e.toDisplayString(e.unref(V)),1)):e.createCommentVNode("",!0),e.unref(D).ok?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("ul",mt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(D).errors,n=>(e.openBlock(),e.createElementBlock("li",{key:n.path},e.toDisplayString(n.path)+":"+e.toDisplayString(n.message),1))),128))])),e.unref(y)&&e.unref(D).ok?(e.openBlock(),e.createBlock(e.unref(F.ReportPreview),{key:2,"report-id":"draft",fetcher:e.unref(y),"show-params":!1,editable:!1,"excel-import":!1},null,8,["fetcher"])):(e.openBlock(),e.createElementBlock("p",pt,e.toDisplayString(e.unref(t).invalid),1))])])],8,ne))}}),gt=K._export_sfc(vt,[["__scopeId","data-v-e2d0e1d5"]]);exports.ReportTemplateEditor=gt;exports.TEMPLATE_EDITOR_MESSAGES=H;
|