@agile-team/mach-report 2.8.1 → 2.8.3

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