@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
package/dist/designer.js
ADDED
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import { ref as x, computed as V, shallowRef as ce, onBeforeUnmount as ae, watch as te, defineComponent as ve, nextTick as le, openBlock as S, createElementBlock as A, unref as e, createElementVNode as n, toDisplayString as l, createTextVNode as D, createCommentVNode as H, withKeys as fe, withModifiers as he, withDirectives as Q, isRef as X, Fragment as Y, renderList as Z, vModelSelect as me, vModelText as oe, createBlock as ge } from "vue";
|
|
2
|
+
import { provideMachReportConfig as pe, createLocalFetcher as be, ReportPreview as ye } from "@agile-team/mach-report/vue";
|
|
3
|
+
import { resolveGridLayout as ee, parseReportTemplate as P, serializeReportTemplate as q, validateReportTemplateDocument as _e } from "@agile-team/mach-report";
|
|
4
|
+
import { _ as Ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
function Se(c, w, u, h) {
|
|
6
|
+
const f = x(0), a = x(""), b = x([]), L = V(() => c.value.template.pages.flatMap((r, i) => r.components.flatMap((s, v) => s.kind === "list" ? [{ component: s, pageIndex: i, componentIndex: v }] : []))), _ = V(() => L.value[f.value]?.component), k = V(() => {
|
|
7
|
+
const r = _.value;
|
|
8
|
+
if (!r) return [];
|
|
9
|
+
const i = r.columns.map((s) => s.headerStyle?.align ?? s.headerAlign ?? r.headerStyle?.align ?? r.headerAlign ?? s.style?.align ?? "center");
|
|
10
|
+
if (r.headerGrid && w())
|
|
11
|
+
for (const s of ee(r.headerGrid, r.widthMm, 100).cells)
|
|
12
|
+
for (let v = s.ci; v < s.ci + (s.cell.colSpan ?? 1); v++) i[v] = s.cell.style?.align ?? "left";
|
|
13
|
+
return i;
|
|
14
|
+
}), C = V(() => {
|
|
15
|
+
const r = a.value.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean);
|
|
16
|
+
return (_.value?.columns ?? []).flatMap((i, s) => {
|
|
17
|
+
const v = `${i.header} ${i.field}`.toLocaleLowerCase();
|
|
18
|
+
return r.every((y) => v.includes(y)) ? [{ column: i, index: s }] : [];
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
function g(r, i) {
|
|
22
|
+
b.value = i ? [.../* @__PURE__ */ new Set([...b.value, r])] : b.value.filter((s) => s !== r);
|
|
23
|
+
}
|
|
24
|
+
function E(r) {
|
|
25
|
+
for (const i of C.value) g(i.index, r);
|
|
26
|
+
}
|
|
27
|
+
function m() {
|
|
28
|
+
b.value = [];
|
|
29
|
+
}
|
|
30
|
+
function N(r, i, s) {
|
|
31
|
+
if (!u()) return;
|
|
32
|
+
const v = _.value?.columns[r];
|
|
33
|
+
v && (Object.assign(v, { [i]: i === "widthMm" ? Number(s) : s }), i === "header" && G(r, String(s)), i === "headerAlign" && j(r, s), i === "widthMm" && K(), h());
|
|
34
|
+
}
|
|
35
|
+
function K() {
|
|
36
|
+
const r = L.value[f.value];
|
|
37
|
+
if (!r) return;
|
|
38
|
+
const i = r.component, s = c.value.template.pages[r.pageIndex], v = i.columns.map((y) => y.widthMm);
|
|
39
|
+
i.headerGrid && (i.headerGrid.colWidthsMm = v), s.layout === "wide" && v.every((y) => Number.isFinite(y) && y > 0) && (i.widthMm = v.reduce((y, t) => y + t, 0), s.widthMm = Math.max(...s.components.map((y) => y.leftMm + y.widthMm)) + (s.marginRightMm ?? 0));
|
|
40
|
+
}
|
|
41
|
+
function G(r, i) {
|
|
42
|
+
const s = _.value;
|
|
43
|
+
if (!s?.headerGrid) return;
|
|
44
|
+
const y = ee(s.headerGrid, s.widthMm, 100).cells.filter(({ ci: t, cell: B }) => t <= r && t + (B.colSpan ?? 1) > r).slice(-1)[0];
|
|
45
|
+
y && (Object.assign(y.cell, { text: i, rawText: i, value: i }), s.columns.slice(y.ci, y.ci + (y.cell.colSpan ?? 1)).forEach((t) => {
|
|
46
|
+
t.header = i;
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
function j(r, i) {
|
|
50
|
+
const s = _.value, v = s?.columns[r];
|
|
51
|
+
if (v?.headerStyle?.align !== void 0 && (v.headerStyle = { ...v.headerStyle, align: i }), !s?.headerGrid) return;
|
|
52
|
+
const t = ee(s.headerGrid, s.widthMm, 100).cells.filter(({ ci: B, cell: U }) => B <= r && B + (U.colSpan ?? 1) > r).slice(-1)[0];
|
|
53
|
+
t && (t.cell.style = { ...t.cell.style, align: i }, s.columns.slice(t.ci, t.ci + (t.cell.colSpan ?? 1)).forEach((B) => {
|
|
54
|
+
B.headerAlign = i, B.headerStyle?.align !== void 0 && (B.headerStyle = { ...B.headerStyle, align: i });
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
function I(r, i) {
|
|
58
|
+
if (!(!u() || r === "headerAlign" && i === "auto")) {
|
|
59
|
+
for (const s of b.value) {
|
|
60
|
+
const v = _.value?.columns[s];
|
|
61
|
+
v && (Object.assign(v, { [r]: i }), r === "headerAlign" && j(s, i));
|
|
62
|
+
}
|
|
63
|
+
h();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return { selected: f, query: a, selectedColumns: b, lists: L, activeList: _, headerAlignments: k, visibleColumns: C, toggleColumn: g, selectVisible: E, clearSelection: m, setColumn: N, alignColumns: I };
|
|
67
|
+
}
|
|
68
|
+
function we(c, w = { entries: 100, bytes: 16 * 1024 * 1024 }) {
|
|
69
|
+
const u = x([c]), h = x(0), f = V(() => h.value > 0), a = V(() => h.value + 1 < u.value.length), b = V(() => u.value[h.value]);
|
|
70
|
+
function L(C) {
|
|
71
|
+
u.value = [C], h.value = 0;
|
|
72
|
+
}
|
|
73
|
+
function _(C) {
|
|
74
|
+
if (u.value[h.value] === C) return;
|
|
75
|
+
const g = u.value.slice(0, h.value + 1);
|
|
76
|
+
g.push(C);
|
|
77
|
+
let E = g.reduce((m, N) => m + N.length * 2, 0);
|
|
78
|
+
for (; g.length > 1 && (g.length > w.entries || E > w.bytes); ) E -= g.shift().length * 2;
|
|
79
|
+
u.value = g, h.value = u.value.length - 1;
|
|
80
|
+
}
|
|
81
|
+
function k(C) {
|
|
82
|
+
if (!(C < 0 ? !f.value : !a.value))
|
|
83
|
+
return h.value += C, u.value[h.value];
|
|
84
|
+
}
|
|
85
|
+
return { canUndo: f, canRedo: a, current: b, reset: L, record: _, move: k };
|
|
86
|
+
}
|
|
87
|
+
function ke(c) {
|
|
88
|
+
const w = ce(null), u = x(!1);
|
|
89
|
+
let h, f = 0;
|
|
90
|
+
function a(_) {
|
|
91
|
+
h?.(_), h = void 0, w.value = null;
|
|
92
|
+
}
|
|
93
|
+
function b() {
|
|
94
|
+
f++, a(!1), u.value = !1;
|
|
95
|
+
}
|
|
96
|
+
async function L(_) {
|
|
97
|
+
b();
|
|
98
|
+
const k = f, C = c();
|
|
99
|
+
u.value = !0;
|
|
100
|
+
try {
|
|
101
|
+
const g = await new Promise((E, m) => {
|
|
102
|
+
if (h = E, !C) {
|
|
103
|
+
w.value = _;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
Promise.resolve().then(() => f === k ? C(_) : !1).then((N) => {
|
|
107
|
+
f === k && a(N === !0);
|
|
108
|
+
}, (N) => {
|
|
109
|
+
f === k && (h = void 0, w.value = null, m(N));
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
return f === k && g === !0;
|
|
113
|
+
} finally {
|
|
114
|
+
f === k && (u.value = !1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return ae(b), { confirmation: w, pending: u, decide: a, request: L, cancel: b };
|
|
118
|
+
}
|
|
119
|
+
const Ee = {
|
|
120
|
+
title: "报表模板属性编辑器",
|
|
121
|
+
heading: "模板属性",
|
|
122
|
+
unpublished: "未发布",
|
|
123
|
+
dirty: "有未保存修改",
|
|
124
|
+
reset: "恢复草稿",
|
|
125
|
+
saving: "正在保存…",
|
|
126
|
+
save: "保存草稿",
|
|
127
|
+
name: "模板名称",
|
|
128
|
+
description: "说明",
|
|
129
|
+
area: "明细区域",
|
|
130
|
+
page: "页",
|
|
131
|
+
header: "表头",
|
|
132
|
+
field: "业务字段",
|
|
133
|
+
width: "列宽(mm)",
|
|
134
|
+
semantic: "字段语义",
|
|
135
|
+
identifier: "编号",
|
|
136
|
+
dimension: "分类",
|
|
137
|
+
measure: "数值",
|
|
138
|
+
date: "日期",
|
|
139
|
+
text: "文本",
|
|
140
|
+
bodyAlign: "正文对齐",
|
|
141
|
+
headerAlign: "表头对齐",
|
|
142
|
+
auto: "按字段语义",
|
|
143
|
+
left: "居左",
|
|
144
|
+
center: "居中",
|
|
145
|
+
right: "居右",
|
|
146
|
+
justify: "两端对齐",
|
|
147
|
+
editable: "允许编辑",
|
|
148
|
+
json: "完整模板 JSON",
|
|
149
|
+
applyJson: "校验并应用 JSON",
|
|
150
|
+
note: "字段映射应与数据源契约一致。此编辑器维护模板属性;保存由接入方提供的版本服务处理。",
|
|
151
|
+
invalid: "请先修正模板错误,再预览或保存。"
|
|
152
|
+
}, Me = {
|
|
153
|
+
undo: "撤销",
|
|
154
|
+
redo: "重做",
|
|
155
|
+
columnsSearch: "搜索列名或字段",
|
|
156
|
+
columnsSelected: "已选列",
|
|
157
|
+
selectVisible: "选择当前结果",
|
|
158
|
+
clearSelection: "清除选择",
|
|
159
|
+
noColumns: "没有匹配的列",
|
|
160
|
+
batchBody: "批量正文对齐",
|
|
161
|
+
batchHeader: "批量表头对齐",
|
|
162
|
+
chooseAlignment: "选择对齐方式",
|
|
163
|
+
discardTitle: "保留当前修改?",
|
|
164
|
+
discardDescription: "当前包含未保存的属性或尚未应用的 JSON,继续将丢弃这些修改。",
|
|
165
|
+
keepEditing: "继续编辑",
|
|
166
|
+
discard: "丢弃修改并继续",
|
|
167
|
+
jsonPending: "JSON 尚未应用。请先校验并应用,或撤销 JSON 修改后继续属性编辑与保存。"
|
|
168
|
+
}, Ae = { ...Ee, ...Me };
|
|
169
|
+
function je(c, w) {
|
|
170
|
+
const u = x(P(c.modelValue)), h = x(q(u.value)), f = x(q(u.value)), a = x(""), b = x(!1), L = V(() => ({ ...Ae, ...c.messages })), _ = V(() => ({
|
|
171
|
+
showExport: !1,
|
|
172
|
+
showPrint: !1,
|
|
173
|
+
showPdfWindow: !1,
|
|
174
|
+
...c.preview,
|
|
175
|
+
theme: {
|
|
176
|
+
shellBg: "#f1f5f9",
|
|
177
|
+
shellFg: "#334155",
|
|
178
|
+
toolbarBg: "#ffffff",
|
|
179
|
+
toolbarBorder: "#e2e8f0",
|
|
180
|
+
toolbarFg: "#334155",
|
|
181
|
+
btnFg: "#475569",
|
|
182
|
+
btnBorder: "#cbd5e1",
|
|
183
|
+
btnHoverBg: "#eff6ff",
|
|
184
|
+
btnHoverFg: "#1d4ed8",
|
|
185
|
+
btnActiveBg: "#2563eb",
|
|
186
|
+
...c.preview?.theme
|
|
187
|
+
}
|
|
188
|
+
}));
|
|
189
|
+
pe({ get defaults() {
|
|
190
|
+
return _.value;
|
|
191
|
+
} });
|
|
192
|
+
let k, C = 0;
|
|
193
|
+
const g = V(() => _e(u.value)), E = V(() => {
|
|
194
|
+
try {
|
|
195
|
+
return q(u.value) !== h.value;
|
|
196
|
+
} catch {
|
|
197
|
+
return !0;
|
|
198
|
+
}
|
|
199
|
+
}), m = x(f.value), N = V(() => f.value !== m.value), K = V(() => E.value || f.value !== m.value), G = () => JSON.stringify({ document: u.value, json: f.value, appliedJson: m.value }), j = we(G()), I = ke(() => c.beforeDiscard), r = V(() => b.value || I.pending.value), i = () => !c.readonly && !r.value && !N.value, s = Se(u, () => g.value.ok, i, o), { selected: v, lists: y, activeList: t, headerAlignments: B, setColumn: U } = s;
|
|
200
|
+
te(v, () => s.clearSelection());
|
|
201
|
+
const F = V(() => g.value.ok ? be({ draft: { template: u.value.template, datasets: c.datasets ?? {}, params: [] } }) : void 0);
|
|
202
|
+
function z() {
|
|
203
|
+
C++, k?.abort(), k = void 0, b.value = !1;
|
|
204
|
+
}
|
|
205
|
+
let W = 0;
|
|
206
|
+
async function J(p = "replace", O) {
|
|
207
|
+
if (!K.value) return !0;
|
|
208
|
+
const M = G();
|
|
209
|
+
try {
|
|
210
|
+
return await I.request({
|
|
211
|
+
reason: p,
|
|
212
|
+
document: JSON.parse(JSON.stringify(u.value)),
|
|
213
|
+
replacement: O ? P(O) : void 0,
|
|
214
|
+
pendingLocalChanges: !0
|
|
215
|
+
}) && M === G();
|
|
216
|
+
} catch ($) {
|
|
217
|
+
return a.value = $ instanceof Error ? $.message : String($), !1;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function d(p) {
|
|
221
|
+
z(), u.value = p, h.value = q(p), f.value = h.value, m.value = f.value, a.value = "", v.value = 0, s.clearSelection(), j.reset(G());
|
|
222
|
+
}
|
|
223
|
+
te(() => c.modelValue, async (p) => {
|
|
224
|
+
let O;
|
|
225
|
+
try {
|
|
226
|
+
O = P(p);
|
|
227
|
+
} catch ($) {
|
|
228
|
+
a.value = $ instanceof Error ? $.message : String($);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
if (q(O) === q(u.value)) return;
|
|
233
|
+
} catch {
|
|
234
|
+
}
|
|
235
|
+
const M = ++W;
|
|
236
|
+
if (z(), !await J("replace", O)) {
|
|
237
|
+
M === W && g.value.ok && w("update:modelValue", P(u.value));
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
M === W && d(O);
|
|
241
|
+
}), ae(() => {
|
|
242
|
+
W++, z();
|
|
243
|
+
});
|
|
244
|
+
function o() {
|
|
245
|
+
I.cancel(), a.value = "", g.value.ok && (f.value = q(u.value), m.value = f.value, w("update:modelValue", P(u.value))), j.record(G());
|
|
246
|
+
}
|
|
247
|
+
function T(p) {
|
|
248
|
+
i() && (u.value.name = p, o());
|
|
249
|
+
}
|
|
250
|
+
function R(p) {
|
|
251
|
+
i() && (u.value.description = p, o());
|
|
252
|
+
}
|
|
253
|
+
function se() {
|
|
254
|
+
if (!(c.readonly || r.value))
|
|
255
|
+
try {
|
|
256
|
+
const p = P(f.value);
|
|
257
|
+
if (p.id !== u.value.id) throw new Error("属性编辑不允许更换模板 ID,请另存为新模板");
|
|
258
|
+
if (p.revision !== u.value.revision) throw new Error("修订号由保存服务管理,不能在 JSON 中修改");
|
|
259
|
+
u.value = p, v.value = 0, s.clearSelection(), o();
|
|
260
|
+
} catch (p) {
|
|
261
|
+
a.value = p instanceof Error ? p.message : String(p);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async function ie() {
|
|
265
|
+
r.value || c.readonly || !await J("reset") || (d(P(h.value)), w("update:modelValue", P(u.value)));
|
|
266
|
+
}
|
|
267
|
+
function ne(p) {
|
|
268
|
+
if (r.value || c.readonly) return;
|
|
269
|
+
j.record(G());
|
|
270
|
+
const O = j.move(p);
|
|
271
|
+
if (!O) return;
|
|
272
|
+
I.cancel();
|
|
273
|
+
const M = JSON.parse(O);
|
|
274
|
+
u.value = M.document, f.value = M.json, m.value = M.appliedJson, a.value = "", v.value = 0, s.clearSelection(), g.value.ok && w("update:modelValue", P(u.value));
|
|
275
|
+
}
|
|
276
|
+
async function re() {
|
|
277
|
+
if (!c.save || !i() || !g.value.ok) return;
|
|
278
|
+
const p = ++C;
|
|
279
|
+
k = new AbortController(), b.value = !0, a.value = "";
|
|
280
|
+
const O = P(u.value);
|
|
281
|
+
try {
|
|
282
|
+
const M = P(await c.save(O, { expectedRevision: O.revision, signal: k.signal }));
|
|
283
|
+
if (p !== C) return;
|
|
284
|
+
if (M.id !== O.id) throw new Error("保存服务返回了其他模板的文档");
|
|
285
|
+
u.value = M, h.value = q(M), f.value = h.value, m.value = f.value, j.reset(G()), w("saved", P(M)), w("update:modelValue", P(M));
|
|
286
|
+
} catch (M) {
|
|
287
|
+
p === C && (a.value = M instanceof Error ? M.message : String(M));
|
|
288
|
+
} finally {
|
|
289
|
+
p === C && (b.value = !1, k = void 0);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const ue = V(() => j.canUndo.value || G() !== j.current.value), de = V(() => j.canRedo.value && G() === j.current.value);
|
|
293
|
+
return { ...s, canUndo: ue, canRedo: de, undo: () => ne(-1), redo: () => ne(1), pendingLocalChanges: K, jsonPending: N, blocked: r, confirmation: I.confirmation, decideDiscard: I.decide, guardChanges: J, draft: u, json: f, selected: v, error: a, saving: b, dirty: E, validation: g, lists: y, activeList: t, headerAlignments: B, previewOptions: _, fetcher: F, messages: L, setName: T, setDescription: R, setColumn: U, applyJson: se, reset: ie, save: re };
|
|
294
|
+
}
|
|
295
|
+
const Te = ["aria-label"], Re = { class: "mr-designer-bar" }, Ve = { key: 0 }, De = ["disabled"], Be = ["disabled"], Je = ["disabled"], Oe = ["disabled"], Le = ["aria-label"], Ne = { class: "mr-designer-body" }, Ge = { class: "mr-designer-panel" }, Pe = ["value", "disabled"], xe = ["value", "disabled"], Ie = { key: 0 }, Fe = ["value"], He = {
|
|
296
|
+
key: 1,
|
|
297
|
+
class: "mr-designer-columns"
|
|
298
|
+
}, Ue = { class: "mr-designer-column-tools" }, $e = ["disabled"], qe = ["disabled"], We = { role: "status" }, Ke = {
|
|
299
|
+
key: 0,
|
|
300
|
+
class: "mr-designer-batch"
|
|
301
|
+
}, ze = ["aria-label", "disabled"], Qe = { value: "" }, Xe = { value: "auto" }, Ye = { value: "left" }, Ze = { value: "center" }, et = { value: "right" }, tt = { value: "justify" }, nt = ["aria-label", "disabled"], lt = { value: "" }, ot = { value: "left" }, at = { value: "center" }, st = { value: "right" }, it = { value: "justify" }, rt = {
|
|
302
|
+
key: 1,
|
|
303
|
+
role: "status"
|
|
304
|
+
}, ut = ["disabled"], dt = { class: "mr-designer-select-column" }, ct = ["checked", "onChange"], vt = ["value", "onInput"], ft = ["value", "onChange"], ht = ["value", "onChange"], mt = ["value", "onChange"], gt = { value: "identifier" }, pt = { value: "dimension" }, bt = { value: "measure" }, yt = { value: "date" }, _t = { value: "text" }, Ct = ["value", "onChange"], St = { value: "auto" }, wt = { value: "left" }, kt = { value: "center" }, Et = { value: "right" }, Mt = { value: "justify" }, At = ["value", "onChange"], jt = { value: "left" }, Tt = { value: "center" }, Rt = { value: "right" }, Vt = { value: "justify" }, Dt = { class: "mr-designer-toggle" }, Bt = ["checked", "onChange"], Jt = ["aria-label", "disabled"], Ot = ["disabled"], Lt = {
|
|
305
|
+
key: 2,
|
|
306
|
+
role: "status",
|
|
307
|
+
class: "mr-designer-note"
|
|
308
|
+
}, Nt = { class: "mr-designer-note" }, Gt = { class: "mr-designer-preview" }, Pt = {
|
|
309
|
+
key: 0,
|
|
310
|
+
role: "alert",
|
|
311
|
+
class: "mr-designer-error"
|
|
312
|
+
}, xt = {
|
|
313
|
+
key: 1,
|
|
314
|
+
role: "alert",
|
|
315
|
+
class: "mr-designer-error"
|
|
316
|
+
}, It = {
|
|
317
|
+
key: 3,
|
|
318
|
+
class: "mr-designer-note"
|
|
319
|
+
}, Ft = /* @__PURE__ */ ve({
|
|
320
|
+
__name: "ReportTemplateEditor",
|
|
321
|
+
props: {
|
|
322
|
+
modelValue: {},
|
|
323
|
+
datasets: {},
|
|
324
|
+
readonly: { type: Boolean },
|
|
325
|
+
messages: {},
|
|
326
|
+
preview: {},
|
|
327
|
+
beforeDiscard: { type: Function },
|
|
328
|
+
save: { type: Function }
|
|
329
|
+
},
|
|
330
|
+
emits: ["update:modelValue", "saved"],
|
|
331
|
+
setup(c, { expose: w, emit: u }) {
|
|
332
|
+
const h = c, f = u, a = je(h, (J, d) => {
|
|
333
|
+
f(J === "saved" ? "saved" : "update:modelValue", d);
|
|
334
|
+
}), { draft: b, json: L, selected: _, error: k, saving: C, pendingLocalChanges: g, jsonPending: E, blocked: m, confirmation: N, canUndo: K, canRedo: G, validation: j, lists: I, activeList: r, visibleColumns: i, query: s, selectedColumns: v, fetcher: y, messages: t } = a, B = x(null);
|
|
335
|
+
let U = null;
|
|
336
|
+
te(N, async (J) => {
|
|
337
|
+
J ? (U = document.activeElement, await le(), B.value?.focus()) : (await le(), U?.isConnected && U.focus(), U = null);
|
|
338
|
+
}), w({ get pendingLocalChanges() {
|
|
339
|
+
return g.value;
|
|
340
|
+
}, guardChanges: a.guardChanges, reset: a.reset, save: a.save });
|
|
341
|
+
function F(J) {
|
|
342
|
+
return J.target.value;
|
|
343
|
+
}
|
|
344
|
+
function z(J) {
|
|
345
|
+
return J.target.checked;
|
|
346
|
+
}
|
|
347
|
+
function W(J, d) {
|
|
348
|
+
const o = J.target;
|
|
349
|
+
a.alignColumns(d, o.value), o.value = "";
|
|
350
|
+
}
|
|
351
|
+
return (J, d) => (S(), A("section", {
|
|
352
|
+
class: "mr-designer",
|
|
353
|
+
"aria-label": e(t).title
|
|
354
|
+
}, [
|
|
355
|
+
n("header", Re, [
|
|
356
|
+
n("div", null, [
|
|
357
|
+
n("strong", null, l(e(t).heading), 1),
|
|
358
|
+
n("span", null, [
|
|
359
|
+
D(l(e(b).id) + " · " + l(e(b).revision || e(t).unpublished), 1),
|
|
360
|
+
e(g) ? (S(), A("b", Ve, " · " + l(e(t).dirty), 1)) : H("", !0)
|
|
361
|
+
])
|
|
362
|
+
]),
|
|
363
|
+
n("div", null, [
|
|
364
|
+
n("button", {
|
|
365
|
+
type: "button",
|
|
366
|
+
disabled: c.readonly || e(m) || !e(K),
|
|
367
|
+
onClick: d[0] || (d[0] = //@ts-ignore
|
|
368
|
+
(...o) => e(a).undo && e(a).undo(...o))
|
|
369
|
+
}, l(e(t).undo), 9, De),
|
|
370
|
+
n("button", {
|
|
371
|
+
type: "button",
|
|
372
|
+
disabled: c.readonly || e(m) || !e(G),
|
|
373
|
+
onClick: d[1] || (d[1] = //@ts-ignore
|
|
374
|
+
(...o) => e(a).redo && e(a).redo(...o))
|
|
375
|
+
}, l(e(t).redo), 9, Be),
|
|
376
|
+
n("button", {
|
|
377
|
+
type: "button",
|
|
378
|
+
disabled: c.readonly || e(m) || !e(g),
|
|
379
|
+
onClick: d[2] || (d[2] = //@ts-ignore
|
|
380
|
+
(...o) => e(a).reset && e(a).reset(...o))
|
|
381
|
+
}, l(e(t).reset), 9, Je),
|
|
382
|
+
c.save ? (S(), A("button", {
|
|
383
|
+
key: 0,
|
|
384
|
+
type: "button",
|
|
385
|
+
disabled: c.readonly || e(m) || e(E) || !e(j).ok || !e(g),
|
|
386
|
+
onClick: d[3] || (d[3] = //@ts-ignore
|
|
387
|
+
(...o) => e(a).save && e(a).save(...o))
|
|
388
|
+
}, l(e(C) ? e(t).saving : e(t).save), 9, Oe)) : H("", !0)
|
|
389
|
+
])
|
|
390
|
+
]),
|
|
391
|
+
e(N) ? (S(), A("div", {
|
|
392
|
+
key: 0,
|
|
393
|
+
role: "alertdialog",
|
|
394
|
+
"aria-label": e(t).discardTitle,
|
|
395
|
+
class: "mr-designer-confirm",
|
|
396
|
+
onKeydown: d[6] || (d[6] = fe(he((o) => e(a).decideDiscard(!1), ["prevent"]), ["esc"]))
|
|
397
|
+
}, [
|
|
398
|
+
n("strong", null, l(e(t).discardTitle), 1),
|
|
399
|
+
n("p", null, l(e(t).discardDescription), 1),
|
|
400
|
+
n("button", {
|
|
401
|
+
ref_key: "keepButton",
|
|
402
|
+
ref: B,
|
|
403
|
+
type: "button",
|
|
404
|
+
onClick: d[4] || (d[4] = (o) => e(a).decideDiscard(!1))
|
|
405
|
+
}, l(e(t).keepEditing), 513),
|
|
406
|
+
n("button", {
|
|
407
|
+
type: "button",
|
|
408
|
+
onClick: d[5] || (d[5] = (o) => e(a).decideDiscard(!0))
|
|
409
|
+
}, l(e(t).discard), 1)
|
|
410
|
+
], 40, Le)) : H("", !0),
|
|
411
|
+
n("div", Ne, [
|
|
412
|
+
n("aside", Ge, [
|
|
413
|
+
n("label", null, [
|
|
414
|
+
D(l(e(t).name), 1),
|
|
415
|
+
n("input", {
|
|
416
|
+
value: e(b).name,
|
|
417
|
+
disabled: c.readonly || e(m) || e(E),
|
|
418
|
+
onInput: d[7] || (d[7] = (o) => e(a).setName(F(o)))
|
|
419
|
+
}, null, 40, Pe)
|
|
420
|
+
]),
|
|
421
|
+
n("label", null, [
|
|
422
|
+
D(l(e(t).description), 1),
|
|
423
|
+
n("textarea", {
|
|
424
|
+
value: e(b).description,
|
|
425
|
+
disabled: c.readonly || e(m) || e(E),
|
|
426
|
+
onInput: d[8] || (d[8] = (o) => e(a).setDescription(F(o)))
|
|
427
|
+
}, null, 40, xe)
|
|
428
|
+
]),
|
|
429
|
+
e(I).length ? (S(), A("label", Ie, [
|
|
430
|
+
D(l(e(t).area), 1),
|
|
431
|
+
Q(n("select", {
|
|
432
|
+
"onUpdate:modelValue": d[9] || (d[9] = (o) => X(_) ? _.value = o : null)
|
|
433
|
+
}, [
|
|
434
|
+
(S(!0), A(Y, null, Z(e(I), (o, T) => (S(), A("option", {
|
|
435
|
+
key: T,
|
|
436
|
+
value: T
|
|
437
|
+
}, l(o.pageIndex + 1) + " " + l(e(t).page) + " · " + l(o.component.title || o.component.dataset), 9, Fe))), 128))
|
|
438
|
+
], 512), [
|
|
439
|
+
[me, e(_)]
|
|
440
|
+
])
|
|
441
|
+
])) : H("", !0),
|
|
442
|
+
e(r) ? (S(), A("div", He, [
|
|
443
|
+
n("label", null, [
|
|
444
|
+
D(l(e(t).columnsSearch), 1),
|
|
445
|
+
Q(n("input", {
|
|
446
|
+
"onUpdate:modelValue": d[10] || (d[10] = (o) => X(s) ? s.value = o : null),
|
|
447
|
+
type: "search"
|
|
448
|
+
}, null, 512), [
|
|
449
|
+
[oe, e(s)]
|
|
450
|
+
])
|
|
451
|
+
]),
|
|
452
|
+
n("div", Ue, [
|
|
453
|
+
n("button", {
|
|
454
|
+
type: "button",
|
|
455
|
+
disabled: c.readonly || e(m) || e(E) || !e(i).length,
|
|
456
|
+
onClick: d[11] || (d[11] = (o) => e(a).selectVisible(!0))
|
|
457
|
+
}, l(e(t).selectVisible), 9, $e),
|
|
458
|
+
n("button", {
|
|
459
|
+
type: "button",
|
|
460
|
+
disabled: !e(v).length,
|
|
461
|
+
onClick: d[12] || (d[12] = //@ts-ignore
|
|
462
|
+
(...o) => e(a).clearSelection && e(a).clearSelection(...o))
|
|
463
|
+
}, l(e(t).clearSelection), 9, qe),
|
|
464
|
+
n("span", We, l(e(t).columnsSelected) + " " + l(e(v).length) + " / " + l(e(r).columns.length), 1)
|
|
465
|
+
]),
|
|
466
|
+
e(v).length ? (S(), A("div", Ke, [
|
|
467
|
+
n("label", null, [
|
|
468
|
+
D(l(e(t).batchBody), 1),
|
|
469
|
+
n("select", {
|
|
470
|
+
"aria-label": e(t).batchBody,
|
|
471
|
+
disabled: c.readonly || e(m) || e(E),
|
|
472
|
+
onChange: d[13] || (d[13] = (o) => W(o, "align"))
|
|
473
|
+
}, [
|
|
474
|
+
n("option", Qe, l(e(t).chooseAlignment), 1),
|
|
475
|
+
n("option", Xe, l(e(t).auto), 1),
|
|
476
|
+
n("option", Ye, l(e(t).left), 1),
|
|
477
|
+
n("option", Ze, l(e(t).center), 1),
|
|
478
|
+
n("option", et, l(e(t).right), 1),
|
|
479
|
+
n("option", tt, l(e(t).justify), 1)
|
|
480
|
+
], 40, ze)
|
|
481
|
+
]),
|
|
482
|
+
n("label", null, [
|
|
483
|
+
D(l(e(t).batchHeader), 1),
|
|
484
|
+
n("select", {
|
|
485
|
+
"aria-label": e(t).batchHeader,
|
|
486
|
+
disabled: c.readonly || e(m) || e(E),
|
|
487
|
+
onChange: d[14] || (d[14] = (o) => W(o, "headerAlign"))
|
|
488
|
+
}, [
|
|
489
|
+
n("option", lt, l(e(t).chooseAlignment), 1),
|
|
490
|
+
n("option", ot, l(e(t).left), 1),
|
|
491
|
+
n("option", at, l(e(t).center), 1),
|
|
492
|
+
n("option", st, l(e(t).right), 1),
|
|
493
|
+
n("option", it, l(e(t).justify), 1)
|
|
494
|
+
], 40, nt)
|
|
495
|
+
])
|
|
496
|
+
])) : H("", !0),
|
|
497
|
+
e(i).length ? H("", !0) : (S(), A("p", rt, l(e(t).noColumns), 1)),
|
|
498
|
+
(S(!0), A(Y, null, Z(e(i), ({ column: o, index: T }) => (S(), A("fieldset", {
|
|
499
|
+
key: T,
|
|
500
|
+
disabled: c.readonly || e(m) || e(E)
|
|
501
|
+
}, [
|
|
502
|
+
n("legend", null, [
|
|
503
|
+
n("label", dt, [
|
|
504
|
+
n("input", {
|
|
505
|
+
type: "checkbox",
|
|
506
|
+
checked: e(v).includes(T),
|
|
507
|
+
onChange: (R) => e(a).toggleColumn(T, z(R))
|
|
508
|
+
}, null, 40, ct),
|
|
509
|
+
D(l(T + 1) + " · " + l(o.header), 1)
|
|
510
|
+
])
|
|
511
|
+
]),
|
|
512
|
+
n("label", null, [
|
|
513
|
+
D(l(e(t).header), 1),
|
|
514
|
+
n("input", {
|
|
515
|
+
value: o.header,
|
|
516
|
+
onInput: (R) => e(a).setColumn(T, "header", F(R))
|
|
517
|
+
}, null, 40, vt)
|
|
518
|
+
]),
|
|
519
|
+
n("label", null, [
|
|
520
|
+
D(l(e(t).field), 1),
|
|
521
|
+
n("input", {
|
|
522
|
+
value: o.field,
|
|
523
|
+
onChange: (R) => e(a).setColumn(T, "field", F(R))
|
|
524
|
+
}, null, 40, ft)
|
|
525
|
+
]),
|
|
526
|
+
n("label", null, [
|
|
527
|
+
D(l(e(t).width), 1),
|
|
528
|
+
n("input", {
|
|
529
|
+
type: "number",
|
|
530
|
+
min: "0.1",
|
|
531
|
+
step: "0.5",
|
|
532
|
+
value: o.widthMm,
|
|
533
|
+
onChange: (R) => e(a).setColumn(T, "widthMm", F(R))
|
|
534
|
+
}, null, 40, ht)
|
|
535
|
+
]),
|
|
536
|
+
n("label", null, [
|
|
537
|
+
D(l(e(t).semantic), 1),
|
|
538
|
+
n("select", {
|
|
539
|
+
value: o.semanticRole || "text",
|
|
540
|
+
onChange: (R) => e(a).setColumn(T, "semanticRole", F(R))
|
|
541
|
+
}, [
|
|
542
|
+
n("option", gt, l(e(t).identifier), 1),
|
|
543
|
+
n("option", pt, l(e(t).dimension), 1),
|
|
544
|
+
n("option", bt, l(e(t).measure), 1),
|
|
545
|
+
n("option", yt, l(e(t).date), 1),
|
|
546
|
+
n("option", _t, l(e(t).text), 1)
|
|
547
|
+
], 40, mt)
|
|
548
|
+
]),
|
|
549
|
+
n("label", null, [
|
|
550
|
+
D(l(e(t).bodyAlign), 1),
|
|
551
|
+
n("select", {
|
|
552
|
+
value: o.align ?? o.style?.align ?? e(r).align ?? "left",
|
|
553
|
+
onChange: (R) => e(a).setColumn(T, "align", F(R))
|
|
554
|
+
}, [
|
|
555
|
+
n("option", St, l(e(t).auto), 1),
|
|
556
|
+
n("option", wt, l(e(t).left), 1),
|
|
557
|
+
n("option", kt, l(e(t).center), 1),
|
|
558
|
+
n("option", Et, l(e(t).right), 1),
|
|
559
|
+
n("option", Mt, l(e(t).justify), 1)
|
|
560
|
+
], 40, Ct)
|
|
561
|
+
]),
|
|
562
|
+
n("label", null, [
|
|
563
|
+
D(l(e(t).headerAlign), 1),
|
|
564
|
+
n("select", {
|
|
565
|
+
value: e(a).headerAlignments.value[T],
|
|
566
|
+
onChange: (R) => e(a).setColumn(T, "headerAlign", F(R))
|
|
567
|
+
}, [
|
|
568
|
+
n("option", jt, l(e(t).left), 1),
|
|
569
|
+
n("option", Tt, l(e(t).center), 1),
|
|
570
|
+
n("option", Rt, l(e(t).right), 1),
|
|
571
|
+
n("option", Vt, l(e(t).justify), 1)
|
|
572
|
+
], 40, At)
|
|
573
|
+
]),
|
|
574
|
+
n("label", Dt, [
|
|
575
|
+
D(l(e(t).editable), 1),
|
|
576
|
+
n("input", {
|
|
577
|
+
type: "checkbox",
|
|
578
|
+
checked: o.editable === !0,
|
|
579
|
+
onChange: (R) => e(a).setColumn(T, "editable", z(R))
|
|
580
|
+
}, null, 40, Bt)
|
|
581
|
+
])
|
|
582
|
+
], 8, ut))), 128))
|
|
583
|
+
])) : H("", !0),
|
|
584
|
+
n("details", null, [
|
|
585
|
+
n("summary", null, l(e(t).json), 1),
|
|
586
|
+
Q(n("textarea", {
|
|
587
|
+
"onUpdate:modelValue": d[15] || (d[15] = (o) => X(L) ? L.value = o : null),
|
|
588
|
+
class: "mr-designer-json",
|
|
589
|
+
"aria-label": e(t).json,
|
|
590
|
+
disabled: c.readonly || e(m),
|
|
591
|
+
spellcheck: "false"
|
|
592
|
+
}, null, 8, Jt), [
|
|
593
|
+
[oe, e(L)]
|
|
594
|
+
]),
|
|
595
|
+
n("button", {
|
|
596
|
+
type: "button",
|
|
597
|
+
disabled: c.readonly || e(m),
|
|
598
|
+
onClick: d[16] || (d[16] = //@ts-ignore
|
|
599
|
+
(...o) => e(a).applyJson && e(a).applyJson(...o))
|
|
600
|
+
}, l(e(t).applyJson), 9, Ot)
|
|
601
|
+
]),
|
|
602
|
+
e(E) ? (S(), A("p", Lt, l(e(t).jsonPending), 1)) : H("", !0),
|
|
603
|
+
n("p", Nt, l(e(t).note), 1)
|
|
604
|
+
]),
|
|
605
|
+
n("div", Gt, [
|
|
606
|
+
e(k) ? (S(), A("div", Pt, l(e(k)), 1)) : H("", !0),
|
|
607
|
+
e(j).ok ? H("", !0) : (S(), A("ul", xt, [
|
|
608
|
+
(S(!0), A(Y, null, Z(e(j).errors, (o) => (S(), A("li", {
|
|
609
|
+
key: o.path
|
|
610
|
+
}, l(o.path) + ":" + l(o.message), 1))), 128))
|
|
611
|
+
])),
|
|
612
|
+
e(y) && e(j).ok ? (S(), ge(e(ye), {
|
|
613
|
+
key: 2,
|
|
614
|
+
"report-id": "draft",
|
|
615
|
+
fetcher: e(y),
|
|
616
|
+
"show-params": !1,
|
|
617
|
+
editable: !1,
|
|
618
|
+
"excel-import": !1
|
|
619
|
+
}, null, 8, ["fetcher"])) : (S(), A("p", It, l(e(t).invalid), 1))
|
|
620
|
+
])
|
|
621
|
+
])
|
|
622
|
+
], 8, Te));
|
|
623
|
+
}
|
|
624
|
+
}), Wt = /* @__PURE__ */ Ce(Ft, [["__scopeId", "data-v-e2d0e1d5"]]);
|
|
625
|
+
export {
|
|
626
|
+
Wt as ReportTemplateEditor,
|
|
627
|
+
Ae as TEMPLATE_EDITOR_MESSAGES
|
|
628
|
+
};
|