@agile-team/mach-report 2.8.0 → 2.8.2

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/dist/designer.js CHANGED
@@ -1,122 +1,122 @@
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 }] : [];
1
+ import { ref as $, computed as A, shallowRef as pe, onBeforeUnmount as he, watch as W, defineComponent as be, getCurrentInstance as ye, nextTick as te, openBlock as y, createElementBlock as k, unref as e, createElementVNode as n, createVNode as ne, toDisplayString as a, normalizeClass as me, createTextVNode as R, createCommentVNode as P, withKeys as _e, withModifiers as ke, Fragment as K, renderList as se, withDirectives as de, isRef as ue, vModelSelect as Ce, vModelText as fe, createBlock as ge } from "vue";
2
+ import { provideMachReportConfig as we, createLocalFetcher as Se, ReportPreview as xe } from "@agile-team/mach-report/vue";
3
+ import { _ as Y, a as Ee } from "./_plugin-vue_export-helper-DPbiz14D.js";
4
+ import { resolveGridLayout as ce, parseReportTemplate as J, serializeReportTemplate as U, validateReportTemplateDocument as Me } from "@agile-team/mach-report";
5
+ function Te(c, M, u, b) {
6
+ const f = $(0), s = $(""), C = $([]), B = A(() => c.value.template.pages.flatMap((d, r) => d.components.flatMap((i, m) => i.kind === "list" ? [{ component: i, pageIndex: r, componentIndex: m }] : []))), w = A(() => B.value[f.value]?.component), p = A(() => {
7
+ const d = w.value;
8
+ if (!d) return [];
9
+ const r = d.columns.map((i) => i.headerStyle?.align ?? i.headerAlign ?? d.headerStyle?.align ?? d.headerAlign ?? i.style?.align ?? "center");
10
+ if (d.headerGrid && M())
11
+ for (const i of ce(d.headerGrid, d.widthMm, 100).cells)
12
+ for (let m = i.ci; m < i.ci + (i.cell.colSpan ?? 1); m++) r[m] = i.cell.style?.align ?? "left";
13
+ return r;
14
+ }), g = A(() => {
15
+ const d = s.value.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean);
16
+ return (w.value?.columns ?? []).flatMap((r, i) => {
17
+ const m = `${r.header} ${r.field}`.toLocaleLowerCase();
18
+ return d.every((x) => m.includes(x)) ? [{ column: r, index: i }] : [];
19
19
  });
20
20
  });
21
- function g(r, i) {
22
- b.value = i ? [.../* @__PURE__ */ new Set([...b.value, r])] : b.value.filter((s) => s !== r);
21
+ function _(d, r) {
22
+ C.value = r ? [.../* @__PURE__ */ new Set([...C.value, d])] : C.value.filter((i) => i !== d);
23
23
  }
24
- function E(r) {
25
- for (const i of C.value) g(i.index, r);
24
+ function T(d) {
25
+ for (const r of g.value) _(r.index, d);
26
26
  }
27
- function m() {
28
- b.value = [];
27
+ function h() {
28
+ C.value = [];
29
29
  }
30
- function N(r, i, s) {
30
+ function L(d, r, i) {
31
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());
32
+ const m = w.value?.columns[d];
33
+ m && (Object.assign(m, { [r]: r === "widthMm" ? Number(i) : i }), r === "header" && I(d, String(i)), r === "headerAlign" && j(d, i), r === "widthMm" && Q(), b());
34
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));
35
+ function Q() {
36
+ const d = B.value[f.value];
37
+ if (!d) return;
38
+ const r = d.component, i = c.value.template.pages[d.pageIndex], m = r.columns.map((x) => x.widthMm);
39
+ r.headerGrid && (r.headerGrid.colWidthsMm = m), i.layout === "wide" && m.every((x) => Number.isFinite(x) && x > 0) && (r.widthMm = m.reduce((x, t) => x + t, 0), i.widthMm = Math.max(...i.components.map((x) => x.leftMm + x.widthMm)) + (i.marginRightMm ?? 0));
40
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;
41
+ function I(d, r) {
42
+ const i = w.value;
43
+ if (!i?.headerGrid) return;
44
+ const x = ce(i.headerGrid, i.widthMm, 100).cells.filter(({ ci: t, cell: V }) => t <= d && t + (V.colSpan ?? 1) > d).slice(-1)[0];
45
+ x && (Object.assign(x.cell, { text: r, rawText: r, value: r }), i.columns.slice(x.ci, x.ci + (x.cell.colSpan ?? 1)).forEach((t) => {
46
+ t.header = r;
47
47
  }));
48
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 });
49
+ function j(d, r) {
50
+ const i = w.value, m = i?.columns[d];
51
+ if (m?.headerStyle?.align !== void 0 && (m.headerStyle = { ...m.headerStyle, align: r }), !i?.headerGrid) return;
52
+ const t = ce(i.headerGrid, i.widthMm, 100).cells.filter(({ ci: V, cell: O }) => V <= d && V + (O.colSpan ?? 1) > d).slice(-1)[0];
53
+ t && (t.cell.style = { ...t.cell.style, align: r }, i.columns.slice(t.ci, t.ci + (t.cell.colSpan ?? 1)).forEach((V) => {
54
+ V.headerAlign = r, V.headerStyle?.align !== void 0 && (V.headerStyle = { ...V.headerStyle, align: r });
55
55
  }));
56
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));
57
+ function H(d, r) {
58
+ if (!(!u() || d === "headerAlign" && r === "auto")) {
59
+ for (const i of C.value) {
60
+ const m = w.value?.columns[i];
61
+ m && (Object.assign(m, { [d]: r }), d === "headerAlign" && j(i, r));
62
62
  }
63
- h();
63
+ b();
64
64
  }
65
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 };
66
+ return { selected: f, query: s, selectedColumns: C, lists: B, activeList: w, headerAlignments: p, visibleColumns: g, toggleColumn: _, selectVisible: T, clearSelection: h, setColumn: L, alignColumns: H };
67
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;
68
+ function Ae(c, M = { entries: 100, bytes: 16 * 1024 * 1024 }) {
69
+ const u = $([c]), b = $(0), f = A(() => b.value > 0), s = A(() => b.value + 1 < u.value.length), C = A(() => u.value[b.value]);
70
+ function B(g) {
71
+ u.value = [g], b.value = 0;
72
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;
73
+ function w(g) {
74
+ if (u.value[b.value] === g) return;
75
+ const _ = u.value.slice(0, b.value + 1);
76
+ _.push(g);
77
+ let T = _.reduce((h, L) => h + L.length * 2, 0);
78
+ for (; _.length > 1 && (_.length > M.entries || T > M.bytes); ) T -= _.shift().length * 2;
79
+ u.value = _, b.value = u.value.length - 1;
80
80
  }
81
- function k(C) {
82
- if (!(C < 0 ? !f.value : !a.value))
83
- return h.value += C, u.value[h.value];
81
+ function p(g) {
82
+ if (!(g < 0 ? !f.value : !s.value))
83
+ return b.value += g, u.value[b.value];
84
84
  }
85
- return { canUndo: f, canRedo: a, current: b, reset: L, record: _, move: k };
85
+ return { canUndo: f, canRedo: s, current: C, reset: B, record: w, move: p };
86
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;
87
+ function De(c) {
88
+ const M = pe(null), u = $(!1);
89
+ let b, f = 0;
90
+ function s(w) {
91
+ b?.(w), b = void 0, M.value = null;
92
92
  }
93
- function b() {
94
- f++, a(!1), u.value = !1;
93
+ function C() {
94
+ f++, s(!1), u.value = !1;
95
95
  }
96
- async function L(_) {
97
- b();
98
- const k = f, C = c();
96
+ async function B(w) {
97
+ C();
98
+ const p = f, g = c();
99
99
  u.value = !0;
100
100
  try {
101
- const g = await new Promise((E, m) => {
102
- if (h = E, !C) {
103
- w.value = _;
101
+ const _ = await new Promise((T, h) => {
102
+ if (b = T, !g) {
103
+ M.value = w;
104
104
  return;
105
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));
106
+ Promise.resolve().then(() => f === p ? g(w) : !1).then((L) => {
107
+ f === p && s(L === !0);
108
+ }, (L) => {
109
+ f === p && (b = void 0, M.value = null, h(L));
110
110
  });
111
111
  });
112
- return f === k && g === !0;
112
+ return f === p && _ === !0;
113
113
  } finally {
114
- f === k && (u.value = !1);
114
+ f === p && (u.value = !1);
115
115
  }
116
116
  }
117
- return ae(b), { confirmation: w, pending: u, decide: a, request: L, cancel: b };
117
+ return he(C), { confirmation: M, pending: u, decide: s, request: B, cancel: C };
118
118
  }
119
- const Ee = {
119
+ const je = {
120
120
  title: "报表模板属性编辑器",
121
121
  heading: "模板属性",
122
122
  unpublished: "未发布",
@@ -149,7 +149,7 @@ const Ee = {
149
149
  applyJson: "校验并应用 JSON",
150
150
  note: "字段映射应与数据源契约一致。此编辑器维护模板属性;保存由接入方提供的版本服务处理。",
151
151
  invalid: "请先修正模板错误,再预览或保存。"
152
- }, Me = {
152
+ }, Re = {
153
153
  undo: "撤销",
154
154
  redo: "重做",
155
155
  columnsSearch: "搜索列名或字段",
@@ -164,10 +164,27 @@ const Ee = {
164
164
  discardDescription: "当前包含未保存的属性或尚未应用的 JSON,继续将丢弃这些修改。",
165
165
  keepEditing: "继续编辑",
166
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(() => ({
167
+ jsonPending: "JSON 尚未应用。请先校验并应用,或撤销 JSON 修改后继续属性编辑与保存。",
168
+ fieldsSection: "字段",
169
+ templateSection: "模板",
170
+ advancedSection: "高级",
171
+ sectionsLabel: "模板设置分区",
172
+ columnDirectory: "字段目录",
173
+ columnProperties: "字段属性",
174
+ selectColumn: "选择字段",
175
+ clearSearch: "清除搜索",
176
+ fieldsCount: "个字段",
177
+ templateDetails: "模板信息",
178
+ advancedTitle: "完整配置",
179
+ advancedDescription: "用于批量迁移或配置复杂模板。应用前会校验;未应用的内容会受到草稿保护。",
180
+ templateIdentity: "模板标识",
181
+ templateRevision: "当前修订",
182
+ readonly: "只读",
183
+ ready: "可编辑",
184
+ previewTitle: "实时预览"
185
+ }, $e = { ...je, ...Re };
186
+ function Be(c, M) {
187
+ const u = $(J(c.modelValue)), b = $(U(u.value)), f = $(U(u.value)), s = $(""), C = $(!1), B = A(() => ({ ...$e, ...c.messages })), w = A(() => ({
171
188
  showExport: !1,
172
189
  showPrint: !1,
173
190
  showPdfWindow: !1,
@@ -186,137 +203,180 @@ function je(c, w) {
186
203
  ...c.preview?.theme
187
204
  }
188
205
  }));
189
- pe({ get defaults() {
190
- return _.value;
206
+ we({ get defaults() {
207
+ return w.value;
191
208
  } });
192
- let k, C = 0;
193
- const g = V(() => _e(u.value)), E = V(() => {
209
+ let p, g = 0;
210
+ const _ = A(() => Me(u.value)), T = A(() => {
194
211
  try {
195
- return q(u.value) !== h.value;
212
+ return U(u.value) !== b.value;
196
213
  } catch {
197
214
  return !0;
198
215
  }
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;
216
+ }), h = $(f.value), L = A(() => f.value !== h.value), Q = A(() => T.value || f.value !== h.value), I = () => JSON.stringify({ document: u.value, json: f.value, appliedJson: h.value }), j = Ae(I()), H = De(() => c.beforeDiscard), d = A(() => C.value || H.pending.value), r = () => !c.readonly && !d.value && !L.value, i = Te(u, () => _.value.ok, r, q), { selected: m, lists: x, activeList: t, headerAlignments: V, setColumn: O } = i;
217
+ W(m, () => i.clearSelection());
218
+ const z = A(() => _.value.ok ? Se({ draft: { template: u.value.template, datasets: c.datasets ?? {}, params: [] } }) : void 0);
219
+ function E() {
220
+ g++, p?.abort(), p = void 0, C.value = !1;
204
221
  }
205
- let W = 0;
206
- async function J(p = "replace", O) {
207
- if (!K.value) return !0;
208
- const M = G();
222
+ let G = 0;
223
+ async function N(l = "replace", o) {
224
+ if (!Q.value) return !0;
225
+ const v = I();
209
226
  try {
210
- return await I.request({
211
- reason: p,
227
+ return await H.request({
228
+ reason: l,
212
229
  document: JSON.parse(JSON.stringify(u.value)),
213
- replacement: O ? P(O) : void 0,
230
+ replacement: o ? J(o) : void 0,
214
231
  pendingLocalChanges: !0
215
- }) && M === G();
216
- } catch ($) {
217
- return a.value = $ instanceof Error ? $.message : String($), !1;
232
+ }) && v === I();
233
+ } catch (D) {
234
+ return s.value = D instanceof Error ? D.message : String(D), !1;
218
235
  }
219
236
  }
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());
237
+ function le(l) {
238
+ E(), u.value = l, b.value = U(l), f.value = b.value, h.value = f.value, s.value = "", m.value = 0, i.clearSelection(), j.reset(I());
222
239
  }
223
- te(() => c.modelValue, async (p) => {
224
- let O;
240
+ W(() => c.modelValue, async (l) => {
241
+ let o;
225
242
  try {
226
- O = P(p);
227
- } catch ($) {
228
- a.value = $ instanceof Error ? $.message : String($);
243
+ o = J(l);
244
+ } catch (D) {
245
+ s.value = D instanceof Error ? D.message : String(D);
229
246
  return;
230
247
  }
231
248
  try {
232
- if (q(O) === q(u.value)) return;
249
+ if (U(o) === U(u.value)) return;
233
250
  } catch {
234
251
  }
235
- const M = ++W;
236
- if (z(), !await J("replace", O)) {
237
- M === W && g.value.ok && w("update:modelValue", P(u.value));
252
+ const v = ++G;
253
+ if (E(), !await N("replace", o)) {
254
+ v === G && _.value.ok && M("update:modelValue", J(u.value));
238
255
  return;
239
256
  }
240
- M === W && d(O);
241
- }), ae(() => {
242
- W++, z();
257
+ v === G && le(o);
258
+ }), he(() => {
259
+ G++, E();
243
260
  });
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());
261
+ function q() {
262
+ H.cancel(), s.value = "", _.value.ok && (f.value = U(u.value), h.value = f.value, M("update:modelValue", J(u.value))), j.record(I());
246
263
  }
247
- function T(p) {
248
- i() && (u.value.name = p, o());
264
+ function oe(l) {
265
+ r() && (u.value.name = l, q());
249
266
  }
250
- function R(p) {
251
- i() && (u.value.description = p, o());
267
+ function X(l) {
268
+ r() && (u.value.description = l, q());
252
269
  }
253
- function se() {
254
- if (!(c.readonly || r.value))
270
+ function F() {
271
+ if (!(c.readonly || d.value))
255
272
  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);
273
+ const l = J(f.value);
274
+ if (l.id !== u.value.id) throw new Error("属性编辑不允许更换模板 ID,请另存为新模板");
275
+ if (l.revision !== u.value.revision) throw new Error("修订号由保存服务管理,不能在 JSON 中修改");
276
+ u.value = l, m.value = 0, i.clearSelection(), q();
277
+ } catch (l) {
278
+ s.value = l instanceof Error ? l.message : String(l);
262
279
  }
263
280
  }
264
- async function ie() {
265
- r.value || c.readonly || !await J("reset") || (d(P(h.value)), w("update:modelValue", P(u.value)));
281
+ async function ae() {
282
+ d.value || c.readonly || !await N("reset") || (le(J(b.value)), M("update:modelValue", J(u.value)));
266
283
  }
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));
284
+ function Z(l) {
285
+ if (d.value || c.readonly) return;
286
+ j.record(I());
287
+ const o = j.move(l);
288
+ if (!o) return;
289
+ H.cancel();
290
+ const v = JSON.parse(o);
291
+ u.value = v.document, f.value = v.json, h.value = v.appliedJson, s.value = "", m.value = 0, i.clearSelection(), _.value.ok && M("update:modelValue", J(u.value));
275
292
  }
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);
293
+ async function ie() {
294
+ if (!c.save || !r() || !_.value.ok) return;
295
+ const l = ++g;
296
+ p = new AbortController(), C.value = !0, s.value = "";
297
+ const o = J(u.value);
281
298
  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));
299
+ const v = J(await c.save(o, { expectedRevision: o.revision, signal: p.signal }));
300
+ if (l !== g) return;
301
+ if (v.id !== o.id) throw new Error("保存服务返回了其他模板的文档");
302
+ u.value = v, b.value = U(v), f.value = b.value, h.value = f.value, j.reset(I()), M("saved", J(v)), M("update:modelValue", J(v));
303
+ } catch (v) {
304
+ l === g && (s.value = v instanceof Error ? v.message : String(v));
288
305
  } finally {
289
- p === C && (b.value = !1, k = void 0);
306
+ l === g && (C.value = !1, p = void 0);
290
307
  }
291
308
  }
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 };
309
+ const re = A(() => j.canUndo.value || I() !== j.current.value), S = A(() => j.canRedo.value && I() === j.current.value);
310
+ return { ...i, canUndo: re, canRedo: S, undo: () => Z(-1), redo: () => Z(1), pendingLocalChanges: Q, jsonPending: L, blocked: d, confirmation: H.confirmation, decideDiscard: H.decide, guardChanges: N, draft: u, json: f, selected: m, error: s, saving: C, dirty: T, validation: _, lists: x, activeList: t, headerAlignments: V, previewOptions: w, fetcher: z, messages: B, setName: oe, setDescription: X, setColumn: O, applyJson: F, reset: ae, save: ie };
294
311
  }
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 = {
312
+ function Le(c, M, u, b) {
313
+ const f = $("fields"), s = $(c.value[0]?.index ?? -1), C = A(() => {
314
+ const p = u.value?.columns[s.value];
315
+ return p ? { column: p, index: s.value } : void 0;
316
+ });
317
+ W(b, () => {
318
+ c.value.some((p) => p.index === s.value) || (s.value = c.value[0]?.index ?? -1);
319
+ }), W(M, () => {
320
+ s.value = c.value[0]?.index ?? -1;
321
+ }), W(u, (p) => {
322
+ p?.columns[s.value] || (s.value = c.value[0]?.index ?? -1);
323
+ });
324
+ function B(p) {
325
+ c.value.some((g) => g.index === p) && (s.value = p);
326
+ }
327
+ function w(p) {
328
+ const g = c.value;
329
+ if (!g.length) return;
330
+ const _ = Math.max(
331
+ 0,
332
+ g.findIndex((L) => L.index === s.value)
333
+ ), h = {
334
+ ArrowDown: Math.min(_ + 1, g.length - 1),
335
+ ArrowUp: Math.max(_ - 1, 0),
336
+ Home: 0,
337
+ End: g.length - 1
338
+ }[p];
339
+ if (h !== void 0)
340
+ return s.value = g[h].index, s.value;
341
+ }
342
+ return { section: f, activeIndex: s, activeColumn: C, activate: B, moveColumn: w };
343
+ }
344
+ const Ve = ["aria-label", "aria-busy"], Oe = { class: "mr-designer-bar" }, Ie = { class: "mr-designer-heading" }, Je = { class: "mr-designer-actions" }, Ne = { class: "mr-designer-history" }, Pe = ["aria-label", "title", "disabled"], He = ["aria-label", "title", "disabled"], Ge = ["disabled"], Fe = ["disabled"], Ue = ["aria-label"], ze = { class: "mr-designer-body" }, qe = { class: "mr-designer-inspector" }, Ke = ["aria-label"], We = ["id", "aria-selected", "aria-controls", "tabindex", "onClick"], Qe = ["id", "aria-labelledby"], Xe = {
345
+ key: 0,
346
+ class: "mr-designer-area"
347
+ }, Ye = ["value"], Ze = {
296
348
  key: 1,
297
349
  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 = {
350
+ }, et = { class: "mr-designer-directory-heading" }, tt = { class: "mr-designer-search" }, nt = ["aria-label", "placeholder"], lt = ["aria-label", "title"], ot = { class: "mr-designer-column-tools" }, at = ["disabled"], st = {
302
351
  key: 1,
303
352
  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 = {
353
+ }, it = { key: 2 }, rt = ["aria-label"], dt = ["aria-label", "checked", "disabled", "onChange"], ut = ["data-column-index", "aria-pressed", "tabindex", "onClick"], ct = { class: "mr-designer-column-number" }, vt = { class: "mr-designer-column-name" }, mt = {
354
+ key: 0,
355
+ role: "status",
356
+ class: "mr-designer-empty"
357
+ }, ft = {
358
+ key: 0,
359
+ class: "mr-designer-batch"
360
+ }, gt = ["aria-label", "disabled"], ht = { value: "" }, pt = { value: "auto" }, bt = { value: "left" }, yt = { value: "center" }, _t = { value: "right" }, kt = { value: "justify" }, Ct = ["aria-label", "disabled"], wt = { value: "" }, St = { value: "left" }, xt = { value: "center" }, Et = { value: "right" }, Mt = { value: "justify" }, Tt = ["disabled"], At = ["value"], Dt = ["value"], jt = ["value"], Rt = ["value"], $t = { value: "identifier" }, Bt = { value: "dimension" }, Lt = { value: "measure" }, Vt = { value: "date" }, Ot = { value: "text" }, It = ["value"], Jt = { value: "auto" }, Nt = { value: "left" }, Pt = { value: "center" }, Ht = { value: "right" }, Gt = { value: "justify" }, Ft = ["value"], Ut = { value: "left" }, zt = { value: "center" }, qt = { value: "right" }, Kt = { value: "justify" }, Wt = { class: "mr-designer-toggle" }, Qt = ["checked"], Xt = {
305
361
  key: 2,
306
362
  role: "status",
307
- class: "mr-designer-note"
308
- }, Nt = { class: "mr-designer-note" }, Gt = { class: "mr-designer-preview" }, Pt = {
363
+ class: "mr-designer-empty"
364
+ }, Yt = { class: "mr-designer-stacked" }, Zt = ["value", "disabled"], en = { class: "mr-designer-stacked" }, tn = ["value", "disabled"], nn = { class: "mr-designer-identity" }, ln = { class: "mr-designer-note" }, on = { class: "mr-designer-note" }, an = { class: "mr-designer-stacked" }, sn = ["aria-label", "disabled"], rn = ["disabled"], dn = {
365
+ key: 3,
366
+ role: "status",
367
+ class: "mr-designer-note mr-designer-pending"
368
+ }, un = ["aria-label"], cn = {
309
369
  key: 0,
310
370
  role: "alert",
311
371
  class: "mr-designer-error"
312
- }, xt = {
372
+ }, vn = {
313
373
  key: 1,
314
374
  role: "alert",
315
375
  class: "mr-designer-error"
316
- }, It = {
376
+ }, mn = {
317
377
  key: 3,
318
- class: "mr-designer-note"
319
- }, Ft = /* @__PURE__ */ ve({
378
+ class: "mr-designer-note mr-designer-invalid"
379
+ }, fn = /* @__PURE__ */ be({
320
380
  __name: "ReportTemplateEditor",
321
381
  props: {
322
382
  modelValue: {},
@@ -328,301 +388,554 @@ const Te = ["aria-label"], Re = { class: "mr-designer-bar" }, Ve = { key: 0 }, D
328
388
  save: { type: Function }
329
389
  },
330
390
  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;
391
+ setup(c, { expose: M, emit: u }) {
392
+ const b = c, f = u, s = Be(b, (S, l) => {
393
+ f(S === "saved" ? "saved" : "update:modelValue", l);
394
+ }), {
395
+ draft: C,
396
+ json: B,
397
+ selected: w,
398
+ error: p,
399
+ saving: g,
400
+ pendingLocalChanges: _,
401
+ jsonPending: T,
402
+ blocked: h,
403
+ confirmation: L,
404
+ canUndo: Q,
405
+ canRedo: I,
406
+ validation: j,
407
+ lists: H,
408
+ activeList: d,
409
+ visibleColumns: r,
410
+ query: i,
411
+ selectedColumns: m,
412
+ fetcher: x,
413
+ messages: t
414
+ } = s, V = Le(
415
+ r,
416
+ w,
417
+ d,
418
+ i
419
+ ), { section: O, activeIndex: z, activeColumn: E } = V, G = `mr-designer-${ye()?.uid ?? 0}`, N = ["fields", "template", "advanced"], le = A(
420
+ () => g.value ? t.value.saving : b.readonly ? t.value.readonly : _.value ? t.value.dirty : t.value.ready
421
+ ), q = $(null), oe = $(null);
422
+ W(O, async (S) => {
423
+ if (S !== "fields") return;
424
+ await te();
425
+ const l = oe.value, o = l?.querySelector(
426
+ `button[data-column-index="${z.value}"]`
427
+ );
428
+ if (!l || !o) return;
429
+ const v = l.getBoundingClientRect(), D = o.getBoundingClientRect(), ee = v.top + l.clientTop, ve = ee + l.clientHeight;
430
+ D.top < ee ? l.scrollTop += D.top - ee : D.bottom > ve && (l.scrollTop += D.bottom - ve);
431
+ });
432
+ let X = null;
433
+ W(L, async (S) => {
434
+ S ? (X = document.activeElement, await te(), q.value?.focus()) : (await te(), X?.isConnected && X.focus(), X = null);
435
+ }), M({
436
+ get pendingLocalChanges() {
437
+ return _.value;
438
+ },
439
+ get saving() {
440
+ return g.value;
441
+ },
442
+ get blocked() {
443
+ return h.value;
444
+ },
445
+ guardChanges: s.guardChanges,
446
+ reset: s.reset,
447
+ save: s.save
448
+ });
449
+ function F(S) {
450
+ return S.target.value;
451
+ }
452
+ function ae(S) {
453
+ return S.target.checked;
343
454
  }
344
- function z(J) {
345
- return J.target.checked;
455
+ function Z(S, l) {
456
+ const o = S.target;
457
+ s.alignColumns(
458
+ l,
459
+ o.value
460
+ ), o.value = "";
346
461
  }
347
- function W(J, d) {
348
- const o = J.target;
349
- a.alignColumns(d, o.value), o.value = "";
462
+ async function ie(S) {
463
+ const l = V.moveColumn(S.key);
464
+ if (l === void 0) return;
465
+ S.preventDefault();
466
+ const o = S.currentTarget.closest(
467
+ ".mr-designer-column-list"
468
+ );
469
+ await te();
470
+ const v = o?.querySelector(
471
+ `button[data-column-index="${l}"]`
472
+ );
473
+ v?.focus({ preventScroll: !0 }), v?.scrollIntoView({ block: "nearest" });
350
474
  }
351
- return (J, d) => (S(), A("section", {
475
+ async function re(S) {
476
+ const o = {
477
+ ArrowRight: 1,
478
+ ArrowLeft: -1,
479
+ Home: -N.length,
480
+ End: N.length
481
+ }[S.key];
482
+ if (o === void 0) return;
483
+ S.preventDefault();
484
+ const v = N.indexOf(O.value), D = S.key === "Home" ? 0 : S.key === "End" ? N.length - 1 : (v + o + N.length) % N.length;
485
+ O.value = N[D];
486
+ const ee = S.currentTarget.parentElement;
487
+ await te(), ee?.querySelector(`#${G}-tab-${O.value}`)?.focus();
488
+ }
489
+ return (S, l) => (y(), k("section", {
352
490
  class: "mr-designer",
353
- "aria-label": e(t).title
491
+ "aria-label": e(t).title,
492
+ "aria-busy": e(g)
354
493
  }, [
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)
494
+ n("header", Oe, [
495
+ n("div", Ie, [
496
+ ne(Y, {
497
+ name: "columns",
498
+ size: 18
499
+ }),
500
+ n("div", null, [
501
+ n("strong", null, a(e(t).heading), 1),
502
+ n("span", {
503
+ class: me({ "mr-designer-dirty": e(_) })
504
+ }, a(le.value), 3)
361
505
  ])
362
506
  ]),
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),
507
+ n("div", Je, [
508
+ n("div", Ne, [
509
+ n("button", {
510
+ type: "button",
511
+ class: "mr-designer-icon-button",
512
+ "aria-label": e(t).undo,
513
+ title: e(t).undo,
514
+ disabled: c.readonly || e(h) || !e(Q),
515
+ onClick: l[0] || (l[0] = //@ts-ignore
516
+ (...o) => e(s).undo && e(s).undo(...o))
517
+ }, [...l[25] || (l[25] = [
518
+ n("svg", {
519
+ viewBox: "0 0 24 24",
520
+ fill: "none",
521
+ "aria-hidden": "true"
522
+ }, [
523
+ n("path", { d: "M4 10h10a6 6 0 0 1 0 12M4 10l5-5M4 10l5 5" })
524
+ ], -1)
525
+ ])], 8, Pe),
526
+ n("button", {
527
+ type: "button",
528
+ class: "mr-designer-icon-button",
529
+ "aria-label": e(t).redo,
530
+ title: e(t).redo,
531
+ disabled: c.readonly || e(h) || !e(I),
532
+ onClick: l[1] || (l[1] = //@ts-ignore
533
+ (...o) => e(s).redo && e(s).redo(...o))
534
+ }, [...l[26] || (l[26] = [
535
+ n("svg", {
536
+ viewBox: "0 0 24 24",
537
+ fill: "none",
538
+ "aria-hidden": "true"
539
+ }, [
540
+ n("path", { d: "M20 10H10a6 6 0 0 0 0 12m10-12-5-5m5 5-5 5" })
541
+ ], -1)
542
+ ])], 8, He)
543
+ ]),
376
544
  n("button", {
377
545
  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", {
546
+ class: "mr-designer-reset",
547
+ disabled: c.readonly || e(h) || !e(_),
548
+ onClick: l[2] || (l[2] = //@ts-ignore
549
+ (...o) => e(s).reset && e(s).reset(...o))
550
+ }, a(e(t).reset), 9, Ge),
551
+ c.save ? (y(), k("button", {
383
552
  key: 0,
384
553
  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)
554
+ class: "mr-designer-save",
555
+ disabled: c.readonly || e(h) || e(T) || !e(j).ok || !e(_),
556
+ onClick: l[3] || (l[3] = //@ts-ignore
557
+ (...o) => e(s).save && e(s).save(...o))
558
+ }, [
559
+ ne(Y, {
560
+ name: "file",
561
+ size: 14
562
+ }),
563
+ R(a(e(g) ? e(t).saving : e(t).save), 1)
564
+ ], 8, Fe)) : P("", !0)
389
565
  ])
390
566
  ]),
391
- e(N) ? (S(), A("div", {
567
+ e(L) ? (y(), k("div", {
392
568
  key: 0,
393
569
  role: "alertdialog",
394
570
  "aria-label": e(t).discardTitle,
395
571
  class: "mr-designer-confirm",
396
- onKeydown: d[6] || (d[6] = fe(he((o) => e(a).decideDiscard(!1), ["prevent"]), ["esc"]))
572
+ onKeydown: l[6] || (l[6] = _e(ke((o) => e(s).decideDiscard(!1), ["prevent"]), ["esc"]))
397
573
  }, [
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"))
574
+ n("div", null, [
575
+ n("strong", null, a(e(t).discardTitle), 1),
576
+ n("p", null, a(e(t).discardDescription), 1)
577
+ ]),
578
+ n("div", null, [
579
+ n("button", {
580
+ ref_key: "keepButton",
581
+ ref: q,
582
+ type: "button",
583
+ onClick: l[4] || (l[4] = (o) => e(s).decideDiscard(!1))
584
+ }, a(e(t).keepEditing), 513),
585
+ n("button", {
586
+ type: "button",
587
+ onClick: l[5] || (l[5] = (o) => e(s).decideDiscard(!0))
588
+ }, a(e(t).discard), 1)
589
+ ])
590
+ ], 40, Ue)) : P("", !0),
591
+ n("div", ze, [
592
+ n("aside", qe, [
593
+ n("nav", {
594
+ class: "mr-designer-tabs",
595
+ role: "tablist",
596
+ "aria-label": e(t).sectionsLabel
597
+ }, [
598
+ (y(), k(K, null, se(N, (o) => n("button", {
599
+ id: `${G}-tab-${o}`,
600
+ key: o,
601
+ type: "button",
602
+ role: "tab",
603
+ "aria-selected": e(O) === o,
604
+ "aria-controls": `${G}-panel-${o}`,
605
+ tabindex: e(O) === o ? 0 : -1,
606
+ onClick: (v) => O.value = o,
607
+ onKeydown: re
608
+ }, a(e(t)[`${o}Section`]), 41, We)), 64))
609
+ ], 8, Ke),
610
+ n("div", {
611
+ id: `${G}-panel-${e(O)}`,
612
+ class: "mr-designer-panel",
613
+ role: "tabpanel",
614
+ "aria-labelledby": `${G}-tab-${e(O)}`
615
+ }, [
616
+ e(O) === "fields" ? (y(), k(K, { key: 0 }, [
617
+ e(H).length > 1 ? (y(), k("label", Xe, [
618
+ R(a(e(t).area), 1),
619
+ de(n("select", {
620
+ "onUpdate:modelValue": l[7] || (l[7] = (o) => ue(w) ? w.value = o : null)
488
621
  }, [
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)
622
+ (y(!0), k(K, null, se(e(H), (o, v) => (y(), k("option", {
623
+ key: v,
624
+ value: v
625
+ }, a(o.pageIndex + 1) + " " + a(e(t).page) + " · " + a(o.component.title || o.component.dataset), 9, Ye))), 128))
626
+ ], 512), [
627
+ [Ce, e(w)]
510
628
  ])
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),
629
+ ])) : P("", !0),
630
+ e(d) ? (y(), k("div", Ze, [
631
+ n("div", et, [
632
+ n("strong", null, a(e(t).columnDirectory), 1),
633
+ n("span", null, a(e(d).columns.length) + " " + a(e(t).fieldsCount), 1)
634
+ ]),
635
+ n("div", tt, [
636
+ ne(Y, {
637
+ name: "search",
638
+ size: 15
639
+ }),
640
+ de(n("input", {
641
+ "onUpdate:modelValue": l[8] || (l[8] = (o) => ue(i) ? i.value = o : null),
642
+ type: "search",
643
+ "aria-label": e(t).columnsSearch,
644
+ placeholder: e(t).columnsSearch
645
+ }, null, 8, nt), [
646
+ [fe, e(i)]
647
+ ]),
648
+ e(i) ? (y(), k("button", {
649
+ key: 0,
650
+ type: "button",
651
+ class: "mr-designer-icon-button",
652
+ "aria-label": e(t).clearSearch,
653
+ title: e(t).clearSearch,
654
+ onClick: l[9] || (l[9] = (o) => i.value = "")
655
+ }, [
656
+ ne(Y, {
657
+ name: "close",
658
+ size: 14
659
+ })
660
+ ], 8, lt)) : P("", !0)
661
+ ]),
662
+ n("div", ot, [
663
+ n("button", {
664
+ type: "button",
665
+ disabled: c.readonly || e(h) || e(T) || !e(r).length,
666
+ onClick: l[10] || (l[10] = (o) => e(s).selectVisible(!0))
667
+ }, a(e(t).selectVisible), 9, at),
668
+ e(m).length ? (y(), k("button", {
669
+ key: 0,
670
+ type: "button",
671
+ onClick: l[11] || (l[11] = //@ts-ignore
672
+ (...o) => e(s).clearSelection && e(s).clearSelection(...o))
673
+ }, a(e(t).clearSelection), 1)) : P("", !0),
674
+ e(m).length ? (y(), k("span", st, a(e(t).columnsSelected) + " " + a(e(m).length), 1)) : (y(), k("span", it, a(e(r).length) + " / " + a(e(d).columns.length), 1))
675
+ ]),
676
+ n("div", {
677
+ ref_key: "columnList",
678
+ ref: oe,
679
+ class: "mr-designer-column-list",
680
+ "aria-label": e(t).columnDirectory,
681
+ role: "group"
682
+ }, [
683
+ (y(!0), k(K, null, se(e(r), ({ column: o, index: v }) => (y(), k("div", {
684
+ key: v,
685
+ class: me(["mr-designer-column-row", { "is-active": e(z) === v }])
686
+ }, [
687
+ n("input", {
688
+ type: "checkbox",
689
+ "aria-label": `${e(t).selectColumn} ${o.header}`,
690
+ checked: e(m).includes(v),
691
+ disabled: c.readonly || e(h) || e(T),
692
+ onChange: (D) => e(s).toggleColumn(v, ae(D))
693
+ }, null, 40, dt),
694
+ n("button", {
695
+ type: "button",
696
+ "data-column-index": v,
697
+ "aria-pressed": e(z) === v,
698
+ tabindex: e(z) === v ? 0 : -1,
699
+ onClick: (D) => e(V).activate(v),
700
+ onKeydown: ie
701
+ }, [
702
+ n("span", ct, a(v + 1), 1),
703
+ n("span", vt, [
704
+ n("strong", null, a(o.header), 1),
705
+ n("small", null, a(o.field), 1)
706
+ ]),
707
+ e(z) === v ? (y(), ge(Y, {
708
+ key: 0,
709
+ name: "chevron-right",
710
+ size: 14
711
+ })) : P("", !0)
712
+ ], 40, ut)
713
+ ], 2))), 128)),
714
+ e(r).length ? P("", !0) : (y(), k("p", mt, [
715
+ ne(Y, {
716
+ name: "search",
717
+ size: 20
718
+ }),
719
+ R(a(e(t).noColumns), 1)
720
+ ]))
721
+ ], 8, rt),
722
+ e(m).length ? (y(), k("div", ft, [
723
+ n("label", null, [
724
+ R(a(e(t).batchBody), 1),
725
+ n("select", {
726
+ "aria-label": e(t).batchBody,
727
+ disabled: c.readonly || e(h) || e(T),
728
+ onChange: l[12] || (l[12] = (o) => Z(o, "align"))
729
+ }, [
730
+ n("option", ht, a(e(t).chooseAlignment), 1),
731
+ n("option", pt, a(e(t).auto), 1),
732
+ n("option", bt, a(e(t).left), 1),
733
+ n("option", yt, a(e(t).center), 1),
734
+ n("option", _t, a(e(t).right), 1),
735
+ n("option", kt, a(e(t).justify), 1)
736
+ ], 40, gt)
737
+ ]),
738
+ n("label", null, [
739
+ R(a(e(t).batchHeader), 1),
740
+ n("select", {
741
+ "aria-label": e(t).batchHeader,
742
+ disabled: c.readonly || e(h) || e(T),
743
+ onChange: l[13] || (l[13] = (o) => Z(o, "headerAlign"))
744
+ }, [
745
+ n("option", wt, a(e(t).chooseAlignment), 1),
746
+ n("option", St, a(e(t).left), 1),
747
+ n("option", xt, a(e(t).center), 1),
748
+ n("option", Et, a(e(t).right), 1),
749
+ n("option", Mt, a(e(t).justify), 1)
750
+ ], 40, Ct)
751
+ ])
752
+ ])) : P("", !0),
753
+ e(E) ? (y(), k("fieldset", {
754
+ key: 1,
755
+ class: "mr-designer-properties",
756
+ disabled: c.readonly || e(h) || e(T)
757
+ }, [
758
+ n("legend", null, [
759
+ R(a(e(t).columnProperties) + " ", 1),
760
+ n("span", null, a(e(E).index + 1) + " · " + a(e(E).column.header), 1)
761
+ ]),
762
+ n("label", null, [
763
+ R(a(e(t).header), 1),
764
+ n("input", {
765
+ value: e(E).column.header,
766
+ onInput: l[14] || (l[14] = (o) => e(s).setColumn(
767
+ e(E).index,
768
+ "header",
769
+ F(o)
770
+ ))
771
+ }, null, 40, At)
772
+ ]),
773
+ n("label", null, [
774
+ R(a(e(t).field), 1),
775
+ n("input", {
776
+ value: e(E).column.field,
777
+ onChange: l[15] || (l[15] = (o) => e(s).setColumn(
778
+ e(E).index,
779
+ "field",
780
+ F(o)
781
+ ))
782
+ }, null, 40, Dt)
783
+ ]),
784
+ n("label", null, [
785
+ R(a(e(t).width), 1),
786
+ n("input", {
787
+ type: "number",
788
+ min: "0.1",
789
+ step: "0.5",
790
+ value: e(E).column.widthMm,
791
+ onChange: l[16] || (l[16] = (o) => e(s).setColumn(
792
+ e(E).index,
793
+ "widthMm",
794
+ F(o)
795
+ ))
796
+ }, null, 40, jt)
797
+ ]),
798
+ n("label", null, [
799
+ R(a(e(t).semantic), 1),
800
+ n("select", {
801
+ value: e(E).column.semanticRole || "text",
802
+ onChange: l[17] || (l[17] = (o) => e(s).setColumn(
803
+ e(E).index,
804
+ "semanticRole",
805
+ F(o)
806
+ ))
807
+ }, [
808
+ n("option", $t, a(e(t).identifier), 1),
809
+ n("option", Bt, a(e(t).dimension), 1),
810
+ n("option", Lt, a(e(t).measure), 1),
811
+ n("option", Vt, a(e(t).date), 1),
812
+ n("option", Ot, a(e(t).text), 1)
813
+ ], 40, Rt)
814
+ ]),
815
+ n("label", null, [
816
+ R(a(e(t).bodyAlign), 1),
817
+ n("select", {
818
+ value: e(E).column.align ?? e(E).column.style?.align ?? e(d).align ?? "left",
819
+ onChange: l[18] || (l[18] = (o) => e(s).setColumn(
820
+ e(E).index,
821
+ "align",
822
+ F(o)
823
+ ))
824
+ }, [
825
+ n("option", Jt, a(e(t).auto), 1),
826
+ n("option", Nt, a(e(t).left), 1),
827
+ n("option", Pt, a(e(t).center), 1),
828
+ n("option", Ht, a(e(t).right), 1),
829
+ n("option", Gt, a(e(t).justify), 1)
830
+ ], 40, It)
831
+ ]),
832
+ n("label", null, [
833
+ R(a(e(t).headerAlign), 1),
834
+ n("select", {
835
+ value: e(s).headerAlignments.value[e(E).index],
836
+ onChange: l[19] || (l[19] = (o) => e(s).setColumn(
837
+ e(E).index,
838
+ "headerAlign",
839
+ F(o)
840
+ ))
841
+ }, [
842
+ n("option", Ut, a(e(t).left), 1),
843
+ n("option", zt, a(e(t).center), 1),
844
+ n("option", qt, a(e(t).right), 1),
845
+ n("option", Kt, a(e(t).justify), 1)
846
+ ], 40, Ft)
847
+ ]),
848
+ n("label", Wt, [
849
+ R(a(e(t).editable), 1),
850
+ n("input", {
851
+ type: "checkbox",
852
+ checked: e(E).column.editable === !0,
853
+ onChange: l[20] || (l[20] = (o) => e(s).setColumn(
854
+ e(E).index,
855
+ "editable",
856
+ ae(o)
857
+ ))
858
+ }, null, 40, Qt)
859
+ ])
860
+ ], 8, Tt)) : P("", !0)
861
+ ])) : (y(), k("p", Xt, a(e(t).noColumns), 1))
862
+ ], 64)) : e(O) === "template" ? (y(), k(K, { key: 1 }, [
863
+ n("h3", null, a(e(t).templateDetails), 1),
864
+ n("label", Yt, [
865
+ R(a(e(t).name), 1),
528
866
  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)
867
+ value: e(C).name,
868
+ disabled: c.readonly || e(h) || e(T),
869
+ onInput: l[21] || (l[21] = (o) => e(s).setName(F(o)))
870
+ }, null, 40, Zt)
535
871
  ]),
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)
872
+ n("label", en, [
873
+ R(a(e(t).description), 1),
874
+ n("textarea", {
875
+ rows: "4",
876
+ value: e(C).description,
877
+ disabled: c.readonly || e(h) || e(T),
878
+ onInput: l[22] || (l[22] = (o) => e(s).setDescription(F(o)))
879
+ }, null, 40, tn)
548
880
  ]),
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)
881
+ n("dl", nn, [
882
+ n("dt", null, a(e(t).templateIdentity), 1),
883
+ n("dd", null, a(e(C).id), 1),
884
+ n("dt", null, a(e(t).templateRevision), 1),
885
+ n("dd", null, a(e(C).revision || e(t).unpublished), 1)
561
886
  ]),
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)
887
+ n("p", ln, a(e(t).note), 1)
888
+ ], 64)) : (y(), k(K, { key: 2 }, [
889
+ n("h3", null, a(e(t).advancedTitle), 1),
890
+ n("p", on, a(e(t).advancedDescription), 1),
891
+ n("label", an, [
892
+ R(a(e(t).json), 1),
893
+ de(n("textarea", {
894
+ "onUpdate:modelValue": l[23] || (l[23] = (o) => ue(B) ? B.value = o : null),
895
+ class: "mr-designer-json",
896
+ "aria-label": e(t).json,
897
+ disabled: c.readonly || e(h),
898
+ spellcheck: "false"
899
+ }, null, 8, sn), [
900
+ [fe, e(B)]
901
+ ])
573
902
  ]),
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)
903
+ n("button", {
904
+ type: "button",
905
+ class: "mr-designer-apply-json",
906
+ disabled: c.readonly || e(h),
907
+ onClick: l[24] || (l[24] = //@ts-ignore
908
+ (...o) => e(s).applyJson && e(s).applyJson(...o))
909
+ }, a(e(t).applyJson), 9, rn)
910
+ ], 64)),
911
+ e(T) ? (y(), k("p", dn, a(e(t).jsonPending), 1)) : P("", !0)
912
+ ], 8, Qe)
604
913
  ]),
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", {
914
+ n("div", {
915
+ class: "mr-designer-preview",
916
+ "aria-label": e(t).previewTitle
917
+ }, [
918
+ e(p) ? (y(), k("div", cn, a(e(p)), 1)) : P("", !0),
919
+ e(j).ok ? P("", !0) : (y(), k("ul", vn, [
920
+ (y(!0), k(K, null, se(e(j).errors, (o) => (y(), k("li", {
609
921
  key: o.path
610
- }, l(o.path) + ":" + l(o.message), 1))), 128))
922
+ }, a(o.path) + ":" + a(o.message), 1))), 128))
611
923
  ])),
612
- e(y) && e(j).ok ? (S(), ge(e(ye), {
924
+ e(x) && e(j).ok ? (y(), ge(e(xe), {
613
925
  key: 2,
614
926
  "report-id": "draft",
615
- fetcher: e(y),
927
+ fetcher: e(x),
616
928
  "show-params": !1,
617
929
  editable: !1,
618
- "excel-import": !1
619
- }, null, 8, ["fetcher"])) : (S(), A("p", It, l(e(t).invalid), 1))
620
- ])
930
+ "excel-import": !1,
931
+ height: "100%"
932
+ }, null, 8, ["fetcher"])) : (y(), k("p", mn, a(e(t).invalid), 1))
933
+ ], 8, un)
621
934
  ])
622
- ], 8, Te));
935
+ ], 8, Ve));
623
936
  }
624
- }), Wt = /* @__PURE__ */ Ce(Ft, [["__scopeId", "data-v-e2d0e1d5"]]);
937
+ }), yn = /* @__PURE__ */ Ee(fn, [["__scopeId", "data-v-8bbff75e"]]);
625
938
  export {
626
- Wt as ReportTemplateEditor,
627
- Ae as TEMPLATE_EDITOR_MESSAGES
939
+ yn as ReportTemplateEditor,
940
+ $e as TEMPLATE_EDITOR_MESSAGES
628
941
  };