@agile-team/mach-report 2.5.0 → 2.6.1
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 +91 -14
- package/dist/ReportPreview-Dk-28QAi.js +2946 -0
- package/dist/ReportPreview-FSvcBLjH.cjs +6 -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-66UBlhES.cjs +1 -0
- package/dist/assets-NVA_sftu.js +163 -0
- package/dist/capabilities-CNjIirfo.js +36 -0
- package/dist/capabilities-D4xeVYSR.cjs +1 -0
- package/dist/designer.cjs +1 -0
- package/dist/designer.d.cts +753 -0
- package/dist/designer.d.ts +753 -0
- package/dist/designer.js +372 -0
- package/dist/grid-geometry-BNptEcMm.js +65 -0
- package/dist/grid-geometry-CZ_cYB6O.cjs +1 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +413 -8
- package/dist/index.d.ts +413 -8
- package/dist/index.js +1016 -1501
- 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 +111 -1
- package/dist/pdf.d.ts +111 -1
- package/dist/pdf.js +3931 -3868
- package/dist/{plugin-DMPLDpBY.cjs → plugin-BqBkn_kI.cjs} +1 -1
- package/dist/{plugin-DDLcFWlk.js → plugin-Ds10VnQO.js} +2 -2
- 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-B9bENO0F.js +750 -0
- package/dist/report-source-BbNkkBDy.cjs +1 -0
- package/dist/server/node.d.cts +297 -0
- package/dist/server/node.d.ts +297 -0
- package/dist/server-node.cjs +1 -0
- package/dist/server-node.js +270 -0
- package/dist/server.cjs +1 -0
- package/dist/server.d.cts +643 -0
- package/dist/server.d.ts +643 -0
- package/dist/server.js +237 -0
- package/dist/style-CpwiOPyB.cjs +1 -0
- package/dist/style-Dv5o_x6b.js +67 -0
- package/dist/style.css +1 -1
- 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 +602 -57
- package/dist/vue/async.d.ts +602 -57
- package/dist/vue/index.d.cts +1074 -111
- package/dist/vue/index.d.ts +1074 -111
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +167 -82
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +302 -0
- package/dist/worker.d.ts +302 -0
- package/dist/worker.js +133 -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 +78 -1
- package/dist/xlsx.d.ts +78 -1
- package/dist/xlsx.js +5974 -5831
- package/package.json +62 -2
- 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
package/dist/designer.js
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { ref as I, computed as B, watch as $, onBeforeUnmount as ee, defineComponent as te, openBlock as g, createElementBlock as b, unref as e, createElementVNode as t, toDisplayString as o, createTextVNode as C, createCommentVNode as F, withDirectives as U, isRef as W, Fragment as L, renderList as H, vModelSelect as le, vModelText as ae, createBlock as ne } from "vue";
|
|
2
|
+
import { provideMachReportConfig as oe, createLocalFetcher as se, ReportPreview as ie } from "@agile-team/mach-report/vue";
|
|
3
|
+
import { parseReportTemplate as A, serializeReportTemplate as G, validateReportTemplateDocument as re, resolveGridLayout as P } from "@agile-team/mach-report";
|
|
4
|
+
import { _ as de } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
const ue = {
|
|
6
|
+
title: "报表模板属性编辑器",
|
|
7
|
+
heading: "模板属性",
|
|
8
|
+
unpublished: "未发布",
|
|
9
|
+
dirty: "有未保存修改",
|
|
10
|
+
reset: "恢复草稿",
|
|
11
|
+
saving: "正在保存…",
|
|
12
|
+
save: "保存草稿",
|
|
13
|
+
name: "模板名称",
|
|
14
|
+
description: "说明",
|
|
15
|
+
area: "明细区域",
|
|
16
|
+
page: "页",
|
|
17
|
+
header: "表头",
|
|
18
|
+
field: "业务字段",
|
|
19
|
+
width: "列宽(mm)",
|
|
20
|
+
semantic: "字段语义",
|
|
21
|
+
identifier: "编号",
|
|
22
|
+
dimension: "分类",
|
|
23
|
+
measure: "数值",
|
|
24
|
+
date: "日期",
|
|
25
|
+
text: "文本",
|
|
26
|
+
bodyAlign: "正文对齐",
|
|
27
|
+
headerAlign: "表头对齐",
|
|
28
|
+
auto: "按字段语义",
|
|
29
|
+
left: "居左",
|
|
30
|
+
center: "居中",
|
|
31
|
+
right: "居右",
|
|
32
|
+
justify: "两端对齐",
|
|
33
|
+
editable: "允许编辑",
|
|
34
|
+
json: "完整模板 JSON",
|
|
35
|
+
applyJson: "校验并应用 JSON",
|
|
36
|
+
note: "字段映射应与数据源契约一致。此编辑器维护模板属性;保存由接入方提供的版本服务处理。",
|
|
37
|
+
invalid: "请先修正模板错误,再预览或保存。"
|
|
38
|
+
};
|
|
39
|
+
function ce(r, N) {
|
|
40
|
+
const d = I(A(r.modelValue)), S = I(G(d.value)), u = I(0), _ = I(G(d.value)), w = I(""), p = I(!1), D = B(() => ({ ...ue, ...r.messages })), k = B(() => ({
|
|
41
|
+
showExport: !1,
|
|
42
|
+
showPrint: !1,
|
|
43
|
+
showPdfWindow: !1,
|
|
44
|
+
...r.preview,
|
|
45
|
+
theme: {
|
|
46
|
+
shellBg: "#f1f5f9",
|
|
47
|
+
shellFg: "#334155",
|
|
48
|
+
toolbarBg: "#ffffff",
|
|
49
|
+
toolbarBorder: "#e2e8f0",
|
|
50
|
+
toolbarFg: "#334155",
|
|
51
|
+
btnFg: "#475569",
|
|
52
|
+
btnBorder: "#cbd5e1",
|
|
53
|
+
btnHoverBg: "#eff6ff",
|
|
54
|
+
btnHoverFg: "#1d4ed8",
|
|
55
|
+
btnActiveBg: "#2563eb",
|
|
56
|
+
...r.preview?.theme
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
oe({ get defaults() {
|
|
60
|
+
return k.value;
|
|
61
|
+
} });
|
|
62
|
+
let j, M = 0;
|
|
63
|
+
const T = B(() => re(d.value)), J = B(() => {
|
|
64
|
+
try {
|
|
65
|
+
return G(d.value) !== S.value;
|
|
66
|
+
} catch {
|
|
67
|
+
return !0;
|
|
68
|
+
}
|
|
69
|
+
}), x = B(() => d.value.template.pages.flatMap((a, s) => a.components.flatMap((n, v) => n.kind === "list" ? [{ component: n, pageIndex: s, componentIndex: v }] : []))), l = B(() => x.value[u.value]?.component), E = B(() => {
|
|
70
|
+
const a = l.value;
|
|
71
|
+
if (!a) return [];
|
|
72
|
+
const s = a.columns.map((n) => n.headerStyle?.align ?? n.headerAlign ?? a.headerStyle?.align ?? a.headerAlign ?? n.style?.align ?? "center");
|
|
73
|
+
if (a.headerGrid && T.value.ok)
|
|
74
|
+
for (const n of P(a.headerGrid, a.widthMm, 100).cells)
|
|
75
|
+
for (let v = n.ci; v < n.ci + (n.cell.colSpan ?? 1); v++) s[v] = n.cell.style?.align ?? "left";
|
|
76
|
+
return s;
|
|
77
|
+
}), O = B(() => T.value.ok ? se({ draft: { template: d.value.template, datasets: r.datasets ?? {}, params: [] } }) : void 0);
|
|
78
|
+
function R() {
|
|
79
|
+
M++, j?.abort(), j = void 0, p.value = !1;
|
|
80
|
+
}
|
|
81
|
+
$(() => r.modelValue, (a) => {
|
|
82
|
+
const s = A(a);
|
|
83
|
+
try {
|
|
84
|
+
if (G(s) === G(d.value)) return;
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
R(), d.value = s, S.value = G(s), _.value = S.value, w.value = "", u.value = 0;
|
|
88
|
+
}), ee(R);
|
|
89
|
+
function c() {
|
|
90
|
+
w.value = "", T.value.ok && (_.value = G(d.value), N("update:modelValue", A(d.value)));
|
|
91
|
+
}
|
|
92
|
+
function i(a) {
|
|
93
|
+
r.readonly || p.value || (d.value.name = a, c());
|
|
94
|
+
}
|
|
95
|
+
function f(a) {
|
|
96
|
+
r.readonly || p.value || (d.value.description = a, c());
|
|
97
|
+
}
|
|
98
|
+
function m(a, s, n) {
|
|
99
|
+
if (r.readonly || p.value) return;
|
|
100
|
+
const v = l.value?.columns[a];
|
|
101
|
+
v && (Object.assign(v, { [s]: s === "widthMm" ? Number(n) : n }), s === "header" && q(a, String(n)), s === "headerAlign" && K(a, n), s === "widthMm" && z(), c());
|
|
102
|
+
}
|
|
103
|
+
function z() {
|
|
104
|
+
const a = x.value[u.value];
|
|
105
|
+
if (!a) return;
|
|
106
|
+
const s = a.component, n = d.value.template.pages[a.pageIndex], v = s.columns.map((h) => h.widthMm);
|
|
107
|
+
s.headerGrid && (s.headerGrid.colWidthsMm = v), n.layout === "wide" && v.every((h) => Number.isFinite(h) && h > 0) && (s.widthMm = v.reduce((h, y) => h + y, 0), n.widthMm = Math.max(...n.components.map((h) => h.leftMm + h.widthMm)) + (n.marginRightMm ?? 0));
|
|
108
|
+
}
|
|
109
|
+
function q(a, s) {
|
|
110
|
+
const n = l.value;
|
|
111
|
+
if (!n?.headerGrid) return;
|
|
112
|
+
const h = P(n.headerGrid, n.widthMm, 100).cells.filter(({ ci: y, cell: V }) => y <= a && y + (V.colSpan ?? 1) > a).slice(-1)[0];
|
|
113
|
+
h && (Object.assign(h.cell, { text: s, rawText: s, value: s }), n.columns.slice(h.ci, h.ci + (h.cell.colSpan ?? 1)).forEach((y) => {
|
|
114
|
+
y.header = s;
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
function K(a, s) {
|
|
118
|
+
const n = l.value, v = n?.columns[a];
|
|
119
|
+
if (v?.headerStyle?.align !== void 0 && (v.headerStyle = { ...v.headerStyle, align: s }), !n?.headerGrid) return;
|
|
120
|
+
const y = P(n.headerGrid, n.widthMm, 100).cells.filter(({ ci: V, cell: Z }) => V <= a && V + (Z.colSpan ?? 1) > a).slice(-1)[0];
|
|
121
|
+
y && (y.cell.style = { ...y.cell.style, align: s }, n.columns.slice(y.ci, y.ci + (y.cell.colSpan ?? 1)).forEach((V) => {
|
|
122
|
+
V.headerAlign = s, V.headerStyle?.align !== void 0 && (V.headerStyle = { ...V.headerStyle, align: s });
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
function Q() {
|
|
126
|
+
if (!(r.readonly || p.value))
|
|
127
|
+
try {
|
|
128
|
+
const a = A(_.value);
|
|
129
|
+
if (a.id !== d.value.id) throw new Error("属性编辑不允许更换模板 ID,请另存为新模板");
|
|
130
|
+
if (a.revision !== d.value.revision) throw new Error("修订号由保存服务管理,不能在 JSON 中修改");
|
|
131
|
+
d.value = a, u.value = 0, c();
|
|
132
|
+
} catch (a) {
|
|
133
|
+
w.value = a instanceof Error ? a.message : String(a);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function X() {
|
|
137
|
+
p.value || r.readonly || (d.value = A(S.value), _.value = S.value, w.value = "", N("update:modelValue", A(d.value)));
|
|
138
|
+
}
|
|
139
|
+
async function Y() {
|
|
140
|
+
if (!r.save || r.readonly || p.value || !T.value.ok) return;
|
|
141
|
+
const a = ++M;
|
|
142
|
+
j = new AbortController(), p.value = !0, w.value = "";
|
|
143
|
+
const s = A(d.value);
|
|
144
|
+
try {
|
|
145
|
+
const n = A(await r.save(s, { expectedRevision: s.revision, signal: j.signal }));
|
|
146
|
+
if (a !== M) return;
|
|
147
|
+
if (n.id !== s.id) throw new Error("保存服务返回了其他模板的文档");
|
|
148
|
+
d.value = n, S.value = G(n), _.value = S.value, N("saved", A(n)), N("update:modelValue", A(n));
|
|
149
|
+
} catch (n) {
|
|
150
|
+
a === M && (w.value = n instanceof Error ? n.message : String(n));
|
|
151
|
+
} finally {
|
|
152
|
+
a === M && (p.value = !1, j = void 0);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return { draft: d, json: _, selected: u, error: w, saving: p, dirty: J, validation: T, lists: x, activeList: l, headerAlignments: E, previewOptions: k, fetcher: O, messages: D, setName: i, setDescription: f, setColumn: m, applyJson: Q, reset: X, save: Y };
|
|
156
|
+
}
|
|
157
|
+
const ve = ["aria-label"], he = { class: "mr-designer-bar" }, fe = { key: 0 }, me = ["disabled"], ge = ["disabled"], pe = { class: "mr-designer-body" }, be = { class: "mr-designer-panel" }, ye = ["value", "disabled"], _e = ["value", "disabled"], we = { key: 0 }, ke = ["value"], Ce = {
|
|
158
|
+
key: 1,
|
|
159
|
+
class: "mr-designer-columns"
|
|
160
|
+
}, Se = ["disabled"], Me = ["value", "onInput"], Ee = ["value", "onChange"], Ae = ["value", "onChange"], je = ["value", "onChange"], Re = { value: "identifier" }, Ve = { value: "dimension" }, Te = { value: "measure" }, Be = { value: "date" }, Ge = { value: "text" }, Ne = ["value", "onChange"], xe = { value: "auto" }, Ie = { value: "left" }, Fe = { value: "center" }, Je = { value: "right" }, De = { value: "justify" }, Oe = ["value", "onChange"], Le = { value: "left" }, He = { value: "center" }, Pe = { value: "right" }, Ue = { value: "justify" }, We = { class: "mr-designer-toggle" }, ze = ["checked", "onChange"], qe = ["aria-label", "disabled"], Ke = ["disabled"], Qe = { class: "mr-designer-note" }, Xe = { class: "mr-designer-preview" }, Ye = {
|
|
161
|
+
key: 0,
|
|
162
|
+
role: "alert",
|
|
163
|
+
class: "mr-designer-error"
|
|
164
|
+
}, Ze = {
|
|
165
|
+
key: 1,
|
|
166
|
+
role: "alert",
|
|
167
|
+
class: "mr-designer-error"
|
|
168
|
+
}, $e = {
|
|
169
|
+
key: 3,
|
|
170
|
+
class: "mr-designer-note"
|
|
171
|
+
}, et = /* @__PURE__ */ te({
|
|
172
|
+
__name: "ReportTemplateEditor",
|
|
173
|
+
props: {
|
|
174
|
+
modelValue: {},
|
|
175
|
+
datasets: {},
|
|
176
|
+
readonly: { type: Boolean },
|
|
177
|
+
messages: {},
|
|
178
|
+
preview: {},
|
|
179
|
+
save: { type: Function }
|
|
180
|
+
},
|
|
181
|
+
emits: ["update:modelValue", "saved"],
|
|
182
|
+
setup(r, { emit: N }) {
|
|
183
|
+
const d = r, S = N, u = ce(d, (R, c) => {
|
|
184
|
+
S(R === "saved" ? "saved" : "update:modelValue", c);
|
|
185
|
+
}), { draft: _, json: w, selected: p, error: D, saving: k, dirty: j, validation: M, lists: T, activeList: J, fetcher: x, messages: l } = u;
|
|
186
|
+
function E(R) {
|
|
187
|
+
return R.target.value;
|
|
188
|
+
}
|
|
189
|
+
function O(R) {
|
|
190
|
+
return R.target.checked;
|
|
191
|
+
}
|
|
192
|
+
return (R, c) => (g(), b("section", {
|
|
193
|
+
class: "mr-designer",
|
|
194
|
+
"aria-label": e(l).title
|
|
195
|
+
}, [
|
|
196
|
+
t("header", he, [
|
|
197
|
+
t("div", null, [
|
|
198
|
+
t("strong", null, o(e(l).heading), 1),
|
|
199
|
+
t("span", null, [
|
|
200
|
+
C(o(e(_).id) + " · " + o(e(_).revision || e(l).unpublished), 1),
|
|
201
|
+
e(j) ? (g(), b("b", fe, " · " + o(e(l).dirty), 1)) : F("", !0)
|
|
202
|
+
])
|
|
203
|
+
]),
|
|
204
|
+
t("div", null, [
|
|
205
|
+
t("button", {
|
|
206
|
+
type: "button",
|
|
207
|
+
disabled: r.readonly || e(k) || !e(j),
|
|
208
|
+
onClick: c[0] || (c[0] = //@ts-ignore
|
|
209
|
+
(...i) => e(u).reset && e(u).reset(...i))
|
|
210
|
+
}, o(e(l).reset), 9, me),
|
|
211
|
+
r.save ? (g(), b("button", {
|
|
212
|
+
key: 0,
|
|
213
|
+
type: "button",
|
|
214
|
+
disabled: r.readonly || e(k) || !e(M).ok || !e(j),
|
|
215
|
+
onClick: c[1] || (c[1] = //@ts-ignore
|
|
216
|
+
(...i) => e(u).save && e(u).save(...i))
|
|
217
|
+
}, o(e(k) ? e(l).saving : e(l).save), 9, ge)) : F("", !0)
|
|
218
|
+
])
|
|
219
|
+
]),
|
|
220
|
+
t("div", pe, [
|
|
221
|
+
t("aside", be, [
|
|
222
|
+
t("label", null, [
|
|
223
|
+
C(o(e(l).name), 1),
|
|
224
|
+
t("input", {
|
|
225
|
+
value: e(_).name,
|
|
226
|
+
disabled: r.readonly || e(k),
|
|
227
|
+
onInput: c[2] || (c[2] = (i) => e(u).setName(E(i)))
|
|
228
|
+
}, null, 40, ye)
|
|
229
|
+
]),
|
|
230
|
+
t("label", null, [
|
|
231
|
+
C(o(e(l).description), 1),
|
|
232
|
+
t("textarea", {
|
|
233
|
+
value: e(_).description,
|
|
234
|
+
disabled: r.readonly || e(k),
|
|
235
|
+
onInput: c[3] || (c[3] = (i) => e(u).setDescription(E(i)))
|
|
236
|
+
}, null, 40, _e)
|
|
237
|
+
]),
|
|
238
|
+
e(T).length ? (g(), b("label", we, [
|
|
239
|
+
C(o(e(l).area), 1),
|
|
240
|
+
U(t("select", {
|
|
241
|
+
"onUpdate:modelValue": c[4] || (c[4] = (i) => W(p) ? p.value = i : null)
|
|
242
|
+
}, [
|
|
243
|
+
(g(!0), b(L, null, H(e(T), (i, f) => (g(), b("option", {
|
|
244
|
+
key: f,
|
|
245
|
+
value: f
|
|
246
|
+
}, o(i.pageIndex + 1) + " " + o(e(l).page) + " · " + o(i.component.title || i.component.dataset), 9, ke))), 128))
|
|
247
|
+
], 512), [
|
|
248
|
+
[le, e(p)]
|
|
249
|
+
])
|
|
250
|
+
])) : F("", !0),
|
|
251
|
+
e(J) ? (g(), b("div", Ce, [
|
|
252
|
+
(g(!0), b(L, null, H(e(J).columns, (i, f) => (g(), b("fieldset", {
|
|
253
|
+
key: f,
|
|
254
|
+
disabled: r.readonly || e(k)
|
|
255
|
+
}, [
|
|
256
|
+
t("legend", null, o(f + 1) + " · " + o(i.header), 1),
|
|
257
|
+
t("label", null, [
|
|
258
|
+
C(o(e(l).header), 1),
|
|
259
|
+
t("input", {
|
|
260
|
+
value: i.header,
|
|
261
|
+
onInput: (m) => e(u).setColumn(f, "header", E(m))
|
|
262
|
+
}, null, 40, Me)
|
|
263
|
+
]),
|
|
264
|
+
t("label", null, [
|
|
265
|
+
C(o(e(l).field), 1),
|
|
266
|
+
t("input", {
|
|
267
|
+
value: i.field,
|
|
268
|
+
onChange: (m) => e(u).setColumn(f, "field", E(m))
|
|
269
|
+
}, null, 40, Ee)
|
|
270
|
+
]),
|
|
271
|
+
t("label", null, [
|
|
272
|
+
C(o(e(l).width), 1),
|
|
273
|
+
t("input", {
|
|
274
|
+
type: "number",
|
|
275
|
+
min: "0.1",
|
|
276
|
+
step: "0.5",
|
|
277
|
+
value: i.widthMm,
|
|
278
|
+
onChange: (m) => e(u).setColumn(f, "widthMm", E(m))
|
|
279
|
+
}, null, 40, Ae)
|
|
280
|
+
]),
|
|
281
|
+
t("label", null, [
|
|
282
|
+
C(o(e(l).semantic), 1),
|
|
283
|
+
t("select", {
|
|
284
|
+
value: i.semanticRole || "text",
|
|
285
|
+
onChange: (m) => e(u).setColumn(f, "semanticRole", E(m))
|
|
286
|
+
}, [
|
|
287
|
+
t("option", Re, o(e(l).identifier), 1),
|
|
288
|
+
t("option", Ve, o(e(l).dimension), 1),
|
|
289
|
+
t("option", Te, o(e(l).measure), 1),
|
|
290
|
+
t("option", Be, o(e(l).date), 1),
|
|
291
|
+
t("option", Ge, o(e(l).text), 1)
|
|
292
|
+
], 40, je)
|
|
293
|
+
]),
|
|
294
|
+
t("label", null, [
|
|
295
|
+
C(o(e(l).bodyAlign), 1),
|
|
296
|
+
t("select", {
|
|
297
|
+
value: i.align ?? i.style?.align ?? e(J).align ?? "left",
|
|
298
|
+
onChange: (m) => e(u).setColumn(f, "align", E(m))
|
|
299
|
+
}, [
|
|
300
|
+
t("option", xe, o(e(l).auto), 1),
|
|
301
|
+
t("option", Ie, o(e(l).left), 1),
|
|
302
|
+
t("option", Fe, o(e(l).center), 1),
|
|
303
|
+
t("option", Je, o(e(l).right), 1),
|
|
304
|
+
t("option", De, o(e(l).justify), 1)
|
|
305
|
+
], 40, Ne)
|
|
306
|
+
]),
|
|
307
|
+
t("label", null, [
|
|
308
|
+
C(o(e(l).headerAlign), 1),
|
|
309
|
+
t("select", {
|
|
310
|
+
value: e(u).headerAlignments.value[f],
|
|
311
|
+
onChange: (m) => e(u).setColumn(f, "headerAlign", E(m))
|
|
312
|
+
}, [
|
|
313
|
+
t("option", Le, o(e(l).left), 1),
|
|
314
|
+
t("option", He, o(e(l).center), 1),
|
|
315
|
+
t("option", Pe, o(e(l).right), 1),
|
|
316
|
+
t("option", Ue, o(e(l).justify), 1)
|
|
317
|
+
], 40, Oe)
|
|
318
|
+
]),
|
|
319
|
+
t("label", We, [
|
|
320
|
+
C(o(e(l).editable), 1),
|
|
321
|
+
t("input", {
|
|
322
|
+
type: "checkbox",
|
|
323
|
+
checked: i.editable === !0,
|
|
324
|
+
onChange: (m) => e(u).setColumn(f, "editable", O(m))
|
|
325
|
+
}, null, 40, ze)
|
|
326
|
+
])
|
|
327
|
+
], 8, Se))), 128))
|
|
328
|
+
])) : F("", !0),
|
|
329
|
+
t("details", null, [
|
|
330
|
+
t("summary", null, o(e(l).json), 1),
|
|
331
|
+
U(t("textarea", {
|
|
332
|
+
"onUpdate:modelValue": c[5] || (c[5] = (i) => W(w) ? w.value = i : null),
|
|
333
|
+
class: "mr-designer-json",
|
|
334
|
+
"aria-label": e(l).json,
|
|
335
|
+
disabled: r.readonly || e(k),
|
|
336
|
+
spellcheck: "false"
|
|
337
|
+
}, null, 8, qe), [
|
|
338
|
+
[ae, e(w)]
|
|
339
|
+
]),
|
|
340
|
+
t("button", {
|
|
341
|
+
type: "button",
|
|
342
|
+
disabled: r.readonly || e(k),
|
|
343
|
+
onClick: c[6] || (c[6] = //@ts-ignore
|
|
344
|
+
(...i) => e(u).applyJson && e(u).applyJson(...i))
|
|
345
|
+
}, o(e(l).applyJson), 9, Ke)
|
|
346
|
+
]),
|
|
347
|
+
t("p", Qe, o(e(l).note), 1)
|
|
348
|
+
]),
|
|
349
|
+
t("div", Xe, [
|
|
350
|
+
e(D) ? (g(), b("div", Ye, o(e(D)), 1)) : F("", !0),
|
|
351
|
+
e(M).ok ? F("", !0) : (g(), b("ul", Ze, [
|
|
352
|
+
(g(!0), b(L, null, H(e(M).errors, (i) => (g(), b("li", {
|
|
353
|
+
key: i.path
|
|
354
|
+
}, o(i.path) + ":" + o(i.message), 1))), 128))
|
|
355
|
+
])),
|
|
356
|
+
e(x) && e(M).ok ? (g(), ne(e(ie), {
|
|
357
|
+
key: 2,
|
|
358
|
+
"report-id": "draft",
|
|
359
|
+
fetcher: e(x),
|
|
360
|
+
"show-params": !1,
|
|
361
|
+
editable: !1,
|
|
362
|
+
"excel-import": !1
|
|
363
|
+
}, null, 8, ["fetcher"])) : (g(), b("p", $e, o(e(l).invalid), 1))
|
|
364
|
+
])
|
|
365
|
+
])
|
|
366
|
+
], 8, ve));
|
|
367
|
+
}
|
|
368
|
+
}), ot = /* @__PURE__ */ de(et, [["__scopeId", "data-v-5c39594b"]]);
|
|
369
|
+
export {
|
|
370
|
+
ot as ReportTemplateEditor,
|
|
371
|
+
ue as TEMPLATE_EDITOR_MESSAGES
|
|
372
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function W(s, p) {
|
|
2
|
+
const i = s.length;
|
|
3
|
+
if (i === 0) return [];
|
|
4
|
+
const d = s.reduce((c, r) => c + r, 0), a = d > 0 && p > 0 ? p / d : 1, e = [];
|
|
5
|
+
let f = 0;
|
|
6
|
+
for (let c = 0; c < i; c++) {
|
|
7
|
+
const r = Math.max(0, s[c] * a);
|
|
8
|
+
e.push({ pos: f, size: r }), f += r;
|
|
9
|
+
}
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
function C(s, p, i) {
|
|
13
|
+
return s?.length ? W(s, p) : Array.from({ length: i }, (d, a) => ({
|
|
14
|
+
pos: p * a / i,
|
|
15
|
+
size: p / i
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
function b(s, p, i) {
|
|
19
|
+
const d = s.cells ?? [], a = Math.max(d.length, 1), e = s.colWidthsMm?.length ?? Math.max(1, ...d.map((t) => Array.isArray(t) ? t.length : 0)), f = C(s.colWidthsMm, p, e), c = (t) => t <= 0 ? 0 : t >= e ? f[f.length - 1].pos + f[f.length - 1].size : f[t].pos, r = C(s.rowHeightsMm, i, a), m = (t) => t <= 0 ? 0 : t >= a ? r[r.length - 1].pos + r[r.length - 1].size : r[t].pos, M = /* @__PURE__ */ new Set(), S = (t, n) => `${t}:${n}`, x = [], v = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set(), $ = (t, n) => `v${t}:${n}`, k = (t, n) => `h${t}:${n}`;
|
|
20
|
+
d.forEach((t, n) => {
|
|
21
|
+
if (!Array.isArray(t)) return;
|
|
22
|
+
let o = 0;
|
|
23
|
+
for (const u of t) {
|
|
24
|
+
for (; o < e && M.has(S(n, o)); ) o++;
|
|
25
|
+
if (o >= e) break;
|
|
26
|
+
const K = Math.max(1, Math.min(u?.colSpan ?? 1, e - o)), P = Math.max(1, u?.rowSpan ?? 1), g = Math.min(a, n + P), w = Math.min(e, o + K);
|
|
27
|
+
for (let l = n; l < g; l++)
|
|
28
|
+
for (let h = o; h < w; h++)
|
|
29
|
+
M.add(S(l, h));
|
|
30
|
+
for (let l = o + 1; l < w; l++)
|
|
31
|
+
for (let h = n; h < g; h++) v.add($(l, h));
|
|
32
|
+
for (let l = n + 1; l < g; l++)
|
|
33
|
+
for (let h = o; h < w; h++) A.add(k(l, h));
|
|
34
|
+
const E = c(o), B = m(n);
|
|
35
|
+
x.push({
|
|
36
|
+
ri: n,
|
|
37
|
+
ci: o,
|
|
38
|
+
cell: u ?? {},
|
|
39
|
+
xMm: E,
|
|
40
|
+
yMm: B,
|
|
41
|
+
widthMm: c(w) - E,
|
|
42
|
+
heightMm: m(g) - B
|
|
43
|
+
}), o = w;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const y = [];
|
|
47
|
+
for (let t = 1; t < e; t++) {
|
|
48
|
+
let n = -1;
|
|
49
|
+
for (let o = 0; o <= a; o++) {
|
|
50
|
+
const u = o < a && !v.has($(t, o));
|
|
51
|
+
u && n < 0 && (n = o), !u && n >= 0 && (y.push({ kind: "v", pos: c(t), from: m(n), to: m(o) }), n = -1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (let t = 1; t < a; t++) {
|
|
55
|
+
let n = -1;
|
|
56
|
+
for (let o = 0; o <= e; o++) {
|
|
57
|
+
const u = o < e && !A.has(k(t, o));
|
|
58
|
+
u && n < 0 && (n = o), !u && n >= 0 && (y.push({ kind: "h", pos: m(t), from: c(n), to: c(o) }), n = -1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { columns: f, rows: r, cells: x, edges: y };
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
b as r
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function L(s,i){const d=s.length;if(d===0)return[];const p=s.reduce((c,r)=>c+r,0),a=p>0&&i>0?i/p:1,e=[];let f=0;for(let c=0;c<d;c++){const r=Math.max(0,s[c]*a);e.push({pos:f,size:r}),f+=r}return e}function C(s,i,d){return s?.length?L(s,i):Array.from({length:d},(p,a)=>({pos:i*a/d,size:i/d}))}function P(s,i,d){const p=s.cells??[],a=Math.max(p.length,1),e=s.colWidthsMm?.length??Math.max(1,...p.map(t=>Array.isArray(t)?t.length:0)),f=C(s.colWidthsMm,i,e),c=t=>t<=0?0:t>=e?f[f.length-1].pos+f[f.length-1].size:f[t].pos,r=C(s.rowHeightsMm,d,a),m=t=>t<=0?0:t>=a?r[r.length-1].pos+r[r.length-1].size:r[t].pos,M=new Set,S=(t,n)=>`${t}:${n}`,v=[],x=new Set,A=new Set,$=(t,n)=>`v${t}:${n}`,k=(t,n)=>`h${t}:${n}`;p.forEach((t,n)=>{if(!Array.isArray(t))return;let o=0;for(const u of t){for(;o<e&&M.has(S(n,o));)o++;if(o>=e)break;const G=Math.max(1,Math.min(u?.colSpan??1,e-o)),K=Math.max(1,u?.rowSpan??1),g=Math.min(a,n+K),w=Math.min(e,o+G);for(let l=n;l<g;l++)for(let h=o;h<w;h++)M.add(S(l,h));for(let l=o+1;l<w;l++)for(let h=n;h<g;h++)x.add($(l,h));for(let l=n+1;l<g;l++)for(let h=o;h<w;h++)A.add(k(l,h));const E=c(o),B=m(n);v.push({ri:n,ci:o,cell:u??{},xMm:E,yMm:B,widthMm:c(w)-E,heightMm:m(g)-B}),o=w}});const y=[];for(let t=1;t<e;t++){let n=-1;for(let o=0;o<=a;o++){const u=o<a&&!x.has($(t,o));u&&n<0&&(n=o),!u&&n>=0&&(y.push({kind:"v",pos:c(t),from:m(n),to:m(o)}),n=-1)}}for(let t=1;t<a;t++){let n=-1;for(let o=0;o<=e;o++){const u=o<e&&!A.has(k(t,o));u&&n<0&&(n=o),!u&&n>=0&&(y.push({kind:"h",pos:m(t),from:c(n),to:c(o)}),n=-1)}}return{columns:f,rows:r,cells:v,edges:y}}exports.resolveGridLayout=P;
|