@agile-team/mach-report 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +6 -2
  2. package/dist/ExcelBindingWizard-CjIiVox-.cjs +1 -0
  3. package/dist/ExcelBindingWizard-Dxm-K5HL.js +1240 -0
  4. package/dist/ParamEditor-D-Hf5xfO.cjs +1 -0
  5. package/dist/ParamEditor-DRGxzxeO.js +381 -0
  6. package/dist/ReportBatchPanel-BYgg0EDB.cjs +1 -0
  7. package/dist/ReportBatchPanel-Bby5yLzU.js +287 -0
  8. package/dist/ReportPreview-DWXROHBP.cjs +6 -0
  9. package/dist/ReportPreview-DiNXhQI0.js +4138 -0
  10. package/dist/ReportTemplateLibrary-C6CO7YCT.cjs +1 -0
  11. package/dist/ReportTemplateLibrary-DfzDXRvr.js +260 -0
  12. package/dist/RuleEditor-C2QsOHOs.cjs +1 -0
  13. package/dist/RuleEditor-D9wQHrkf.js +2024 -0
  14. package/dist/TemplateReviewPanel-BKofGrV9.js +222 -0
  15. package/dist/TemplateReviewPanel-DwtOcLue.cjs +1 -0
  16. package/dist/analytics.cjs +1 -1
  17. package/dist/analytics.d.cts +2 -0
  18. package/dist/analytics.d.ts +2 -0
  19. package/dist/analytics.js +29 -29
  20. package/dist/batch-Bt3Fd27Z.cjs +1 -0
  21. package/dist/batch-mRqhhhjt.js +364 -0
  22. package/dist/computed-Bvk0W15F.js +521 -0
  23. package/dist/computed-CGV2a809.cjs +1 -0
  24. package/dist/config-B612mw0x.js +525 -0
  25. package/dist/config-BRoLo2oj.cjs +1 -0
  26. package/dist/designer.cjs +2 -2
  27. package/dist/designer.d.cts +659 -9
  28. package/dist/designer.d.ts +659 -9
  29. package/dist/designer.js +2030 -1824
  30. package/dist/index.cjs +8 -8
  31. package/dist/index.d.cts +147 -3
  32. package/dist/index.d.ts +147 -3
  33. package/dist/index.js +639 -592
  34. package/dist/injection-keys-Db_DyLkm.cjs +1 -0
  35. package/dist/injection-keys-e85udZCp.js +7 -0
  36. package/dist/list-cell-BuYn4tGF.cjs +1 -0
  37. package/dist/{list-cell-Dxyi7DOw.js → list-cell-ClFra1zS.js} +54 -40
  38. package/dist/matrix-DVyWiYsd.cjs +1 -0
  39. package/dist/matrix-yZsGnldA.js +227 -0
  40. package/dist/param-validation-BlHHXs6u.js +153 -0
  41. package/dist/param-validation-DCK039V1.cjs +1 -0
  42. package/dist/pdf.cjs +25 -25
  43. package/dist/pdf.d.cts +3 -0
  44. package/dist/pdf.d.ts +3 -0
  45. package/dist/pdf.js +677 -677
  46. package/dist/plugin-BDTU4D94.cjs +1 -0
  47. package/dist/plugin-Cd5G2QQn.js +22 -0
  48. package/dist/region-binding-workflow-CXDmt9Bs.js +977 -0
  49. package/dist/region-binding-workflow-DhQvu1co.cjs +3 -0
  50. package/dist/{report-params-B_VCihAh.js → report-params-B44imUd4.js} +1 -1
  51. package/dist/{report-params-CjWrjPl6.cjs → report-params-SJfhKgaX.cjs} +1 -1
  52. package/dist/server/node.d.cts +5 -2
  53. package/dist/server/node.d.ts +5 -2
  54. package/dist/server-node.cjs +1 -1
  55. package/dist/server-node.js +87 -87
  56. package/dist/server.cjs +1 -1
  57. package/dist/server.d.cts +201 -2
  58. package/dist/server.d.ts +201 -2
  59. package/dist/server.js +557 -658
  60. package/dist/style.css +1 -1
  61. package/dist/template-registry-WNXdkiET.js +506 -0
  62. package/dist/template-registry-ukBGlm8N.cjs +1 -0
  63. package/dist/template-review-BXp2oyqg.cjs +1 -0
  64. package/dist/template-review-BdcXSYbx.js +1616 -0
  65. package/dist/tree-BX380Rr7.cjs +1 -0
  66. package/dist/tree-CqcQ99NM.js +172 -0
  67. package/dist/{validate-UUy9yP4K.js → validate-7s0yn6ii.js} +44 -44
  68. package/dist/validate-DsRiNw8h.cjs +1 -0
  69. package/dist/vue/async.d.cts +93 -4
  70. package/dist/vue/async.d.ts +93 -4
  71. package/dist/vue/index.d.cts +145 -7
  72. package/dist/vue/index.d.ts +145 -7
  73. package/dist/vue-async.cjs +1 -1
  74. package/dist/vue-async.js +5 -5
  75. package/dist/vue.cjs +1 -1
  76. package/dist/vue.js +116 -113
  77. package/dist/{workbook-session-B-bW5_yR.js → workbook-session-BKOTwcoq.js} +1 -1
  78. package/dist/{workbook-session-D7RtdNo0.cjs → workbook-session-CLYLhZWu.cjs} +1 -1
  79. package/dist/worker.cjs +1 -1
  80. package/dist/worker.d.cts +5 -2
  81. package/dist/worker.d.ts +5 -2
  82. package/dist/worker.js +1 -1
  83. package/dist/xlsx.cjs +3 -3
  84. package/dist/xlsx.d.cts +129 -2
  85. package/dist/xlsx.d.ts +129 -2
  86. package/dist/xlsx.js +336 -242
  87. package/package.json +1 -1
  88. package/dist/ExcelBindingWizard-CF7RplWm.cjs +0 -1
  89. package/dist/ExcelBindingWizard-qhwEderR.js +0 -842
  90. package/dist/ReportPreview-BE1tCHqE.js +0 -4604
  91. package/dist/ReportPreview-QKRKQOe3.cjs +0 -6
  92. package/dist/RuleEditor-BA36yIV6.js +0 -1723
  93. package/dist/RuleEditor-CczJ6mJm.cjs +0 -1
  94. package/dist/TemplateReviewPanel-CHi4Alqa.cjs +0 -1
  95. package/dist/TemplateReviewPanel-Dz0G5o83.js +0 -217
  96. package/dist/binding-preview-BWsdf_z2.cjs +0 -2
  97. package/dist/binding-preview-DILq0-0f.js +0 -649
  98. package/dist/decimal-CI1OAczk.js +0 -87
  99. package/dist/decimal-CQA0xJex.cjs +0 -1
  100. package/dist/list-cell-CyM1ZlRN.cjs +0 -1
  101. package/dist/matrix-BbXarwyk.js +0 -661
  102. package/dist/matrix-Cm65WLLP.cjs +0 -1
  103. package/dist/param-validation-BWNjLcN0.js +0 -116
  104. package/dist/param-validation-CiTxFeZ8.cjs +0 -1
  105. package/dist/plugin-CThk42vJ.cjs +0 -1
  106. package/dist/plugin-tGn7-5oF.js +0 -25
  107. package/dist/template-registry-CGWTLtIA.cjs +0 -1
  108. package/dist/template-registry-DzlQs3OF.js +0 -434
  109. package/dist/template-review-D1RoNCPw.cjs +0 -1
  110. package/dist/template-review-fnteXRng.js +0 -1473
  111. package/dist/validate-Bf6ccFr2.cjs +0 -1
@@ -1,1723 +0,0 @@
1
- import { ref as G, computed as J, watch as P, defineComponent as re, openBlock as s, createElementBlock as d, createElementVNode as a, withDirectives as U, isRef as ne, vModelCheckbox as le, unref as l, createTextVNode as k, toDisplayString as t, Fragment as w, renderList as M, vModelSelect as N, vModelText as Z, createCommentVNode as F, resolveComponent as Ue, normalizeClass as be, createVNode as ge, createBlock as xe, vShow as Me } from "vue";
2
- import { e as Se, g as ce, v as Fe, c as De } from "./matrix-BbXarwyk.js";
3
- import { u as de } from "./useLocalDraft-C07SYRnC.js";
4
- import { v as fe } from "./template-registry-DzlQs3OF.js";
5
- import { _ as me } from "./_plugin-vue_export-helper-8SL1F89S.js";
6
- import { RULE_EDITOR_MESSAGES as Ee } from "./designer.js";
7
- function ye(e, K = /* @__PURE__ */ new Set()) {
8
- return typeof e == "string" || ("field" in e && e.field && K.add(e.field), "weightField" in e && e.weightField && K.add(e.weightField), "args" in e && e.args.forEach((C) => ye(C, K))), K;
9
- }
10
- function he(e, K) {
11
- return typeof e == "string" ? e : "value" in e ? e.value === null ? K.null : String(e.value) : "aggregate" in e ? `${K[e.aggregate]}(${e.field ?? K.allRows})` : "field" in e ? e.field : `${K[e.op]}(${e.args.map((C) => he(C, K)).join(", ")})`;
12
- }
13
- function Re(e, K, C) {
14
- const W = G("");
15
- function $(h) {
16
- const y = e.list.columns.find((p) => p.field === h)?.format;
17
- return y && "digits" in y && y.digits !== void 0 ? `${y.digits} ${C.value.digits}` : void 0;
18
- }
19
- const m = J(() => {
20
- const h = /* @__PURE__ */ new Map();
21
- for (const y of e.datasetSchema?.fields ?? []) h.set(y.field, {
22
- field: y.field,
23
- label: y.label ?? y.field,
24
- meta: [y.type, y.unit, $(y.field)].filter(Boolean).join(" · ")
25
- });
26
- for (const y of e.list.columns) h.has(y.field) || h.set(y.field, { field: y.field, label: y.header || y.field, meta: y.semanticRole ?? "" });
27
- return [...h.values()];
28
- }), n = J(() => {
29
- const h = W.value.trim().toLocaleLowerCase();
30
- return m.value.filter((y) => `${y.field} ${y.label} ${y.meta}`.toLocaleLowerCase().includes(h));
31
- }), g = J(() => he(K.value.expression, C.value)), R = J(() => {
32
- const h = [...ye(K.value.expression)];
33
- return (e.datasets?.[e.list.dataset] ?? []).slice(0, 5).map((y, p) => ({
34
- row: p + 1,
35
- values: h.map((V) => `${V} = ${y[V] == null ? C.value.null : String(y[V])}`).join(" · ")
36
- }));
37
- });
38
- return { query: W, matches: n, fieldWindow: J(() => n.value.slice(0, 50)), expression: g, sources: R };
39
- }
40
- const te = (e) => JSON.parse(JSON.stringify(e));
41
- function pe(e, K) {
42
- const C = G(!1), W = G(""), $ = G({
43
- dataset: "",
44
- parentKey: "",
45
- foreignKey: "",
46
- columns: []
47
- }), m = G({
48
- rowFields: [],
49
- columnFields: [],
50
- measures: []
51
- }), n = de(() => ({ enabled: C.value, detail: $.value, matrix: m.value }));
52
- let g;
53
- const R = G(), h = J(() => [
54
- .../* @__PURE__ */ new Set([
55
- ...Object.keys(e.datasets ?? {}),
56
- ...Object.keys(e.datasetSchemas ?? {})
57
- ])
58
- ]), y = J(
59
- () => V(e.list.dataset, e.datasetSchema)
60
- ), p = J(() => V($.value.dataset));
61
- function V(f, L) {
62
- const S = /* @__PURE__ */ new Map();
63
- for (const T of (L ?? e.datasetSchemas?.[f])?.fields ?? [])
64
- S.set(T.field, T.label ?? T.field);
65
- const j = e.datasets?.[f]?.[0];
66
- for (const T of Object.keys(j ?? {}))
67
- S.has(T) || S.set(T, T);
68
- if (f === e.list.dataset)
69
- for (const T of e.list.columns)
70
- S.has(T.field) || S.set(T.field, T.header || T.field);
71
- return [...S].map(([T, q]) => ({ field: T, label: q }));
72
- }
73
- function _() {
74
- if (g === JSON.stringify(e.list)) {
75
- g = void 0;
76
- return;
77
- }
78
- C.value = e.mode === "detail" ? !!e.list.detail : !!e.list.matrix;
79
- const f = h.value.find((L) => L !== e.list.dataset) ?? "";
80
- $.value = te(
81
- e.list.detail ?? {
82
- dataset: f,
83
- parentKey: e.list.rowKey ?? e.datasetSchema?.rowKey ?? y.value[0]?.field ?? "",
84
- foreignKey: "",
85
- columns: [],
86
- header: !0,
87
- unmatched: "error"
88
- }
89
- ), m.value = te(
90
- e.list.matrix ?? {
91
- rowFields: [],
92
- columnFields: [],
93
- measures: [],
94
- totals: !0
95
- }
96
- ), m.value.measures = m.value.measures.map((L) => ({ ...L, numeric: L.numeric ?? "number" })), W.value = "", R.value = void 0, n.accept();
97
- }
98
- P(() => [e.mode, e.list.dataset, e.mode === "detail" ? e.list.detail : e.list.matrix], _, { immediate: !0 });
99
- function A(f) {
100
- $.value.dataset = f, $.value.columns = [], $.value.foreignKey = p.value[0]?.field ?? "", $.value.rowKey = e.datasetSchemas?.[f]?.rowKey;
101
- }
102
- function c(f, L) {
103
- if (L && !$.value.columns.some((S) => S.field === f)) {
104
- const S = e.datasetSchemas?.[$.value.dataset]?.fields.find((j) => j.field === f);
105
- $.value.columns.push({
106
- field: f,
107
- header: p.value.find((j) => j.field === f)?.label ?? f,
108
- widthMm: 30,
109
- align: "auto",
110
- semanticRole: S?.semanticRole,
111
- editable: !1
112
- });
113
- } else L || ($.value.columns = $.value.columns.filter(
114
- (S) => S.field !== f
115
- ));
116
- }
117
- function o(f, L, S) {
118
- const j = m.value[f];
119
- m.value[f] = S ? [.../* @__PURE__ */ new Set([...j, L])] : j.filter((T) => T !== L);
120
- }
121
- function x() {
122
- m.value.measures = [
123
- ...m.value.measures,
124
- { field: y.value[0]?.field ?? "", op: "sum", numeric: "number" }
125
- ];
126
- }
127
- function u(f) {
128
- m.value.measures = m.value.measures.filter(
129
- (L, S) => S !== f
130
- );
131
- }
132
- function B() {
133
- W.value = "", R.value = void 0;
134
- try {
135
- const f = e.datasets?.[e.list.dataset] ?? [];
136
- if (!f.length) throw new Error(e.messages.noData);
137
- const L = Se(f.slice(0, 1e3), {
138
- ...m.value,
139
- maxInputRows: 1e3
140
- });
141
- R.value = {
142
- columns: L.columns.slice(0, 5).map((S) => S.header),
143
- rows: L.rows.slice(0, 5).map(
144
- (S) => L.columns.slice(0, 5).map((j) => S[j.field])
145
- )
146
- };
147
- } catch (f) {
148
- W.value = f instanceof Error ? f.message : String(f);
149
- }
150
- }
151
- function H() {
152
- if (e.readonly) return;
153
- const f = te(e.list);
154
- e.mode === "detail" ? C.value ? (f.detail = te($.value), delete f.matrix) : delete f.detail : C.value ? (f.matrix = te(m.value), delete f.detail, delete f.groups, delete f.groupBy, delete f.grandTotal) : delete f.matrix;
155
- const L = fe({ pages: [{ widthMm: Math.max(1, f.leftMm + f.widthMm), heightMm: 297, components: [f] }] });
156
- if (!L.ok) {
157
- W.value = L.errors.slice(0, 3).map((S) => S.message).join(";");
158
- return;
159
- }
160
- e.accept && !e.accept(f) || (g = JSON.stringify(f), e.accept || K(f), n.accept());
161
- }
162
- return {
163
- enabled: C,
164
- pendingLocalChanges: n.pending,
165
- detail: $,
166
- matrix: m,
167
- datasets: h,
168
- sourceFields: y,
169
- childFields: p,
170
- error: W,
171
- preview: R,
172
- chooseDataset: A,
173
- toggleChildColumn: c,
174
- toggleDimension: o,
175
- addMeasure: x,
176
- removeMeasure: u,
177
- checkMatrix: B,
178
- apply: H
179
- };
180
- }
181
- const Le = { class: "mr-data-layout" }, Ke = { class: "mr-data-layout__check" }, Ne = ["disabled"], Ge = { class: "mr-data-layout__hint" }, Be = ["aria-label", "value", "disabled"], Te = {
182
- value: "",
183
- disabled: ""
184
- }, Oe = ["value"], We = { class: "mr-data-layout__pair" }, _e = ["aria-label", "disabled"], Ae = ["value"], je = ["aria-label", "disabled"], Ie = {
185
- value: "",
186
- disabled: ""
187
- }, Je = ["value"], He = ["aria-label", "disabled"], ze = { value: void 0 }, qe = ["value"], Ze = { class: "mr-data-layout__choices" }, Qe = ["checked", "disabled", "onChange"], Pe = ["aria-label", "disabled"], Xe = { class: "mr-data-layout__pair" }, Ye = ["aria-label", "disabled"], el = { value: "error" }, ll = { value: "ignore" }, al = { class: "mr-data-layout__check" }, tl = ["disabled"], nl = { class: "mr-data-layout__hint" }, il = ["checked", "disabled", "onChange"], sl = { class: "mr-data-layout__pair" }, dl = ["aria-label", "onUpdate:modelValue", "disabled"], ol = ["value"], ul = ["aria-label", "onUpdate:modelValue", "disabled"], rl = ["value"], cl = ["aria-label", "onUpdate:modelValue", "disabled", "placeholder"], ml = { key: 0 }, vl = ["aria-label", "onUpdate:modelValue", "disabled"], bl = ["value"], gl = { class: "mr-data-layout__pair" }, fl = ["aria-label", "onUpdate:modelValue", "disabled"], yl = { value: "number" }, hl = { value: "decimal" }, kl = ["aria-label", "onUpdate:modelValue", "disabled"], $l = ["disabled", "onClick"], wl = ["disabled"], Vl = { class: "mr-data-layout__check" }, Cl = ["disabled"], Ul = { class: "mr-data-layout__pair" }, xl = ["disabled"], Ml = ["disabled"], Sl = { class: "mr-data-layout__actions" }, Fl = ["disabled"], Dl = ["disabled"], El = {
188
- key: 2,
189
- class: "mr-data-layout__preview"
190
- }, Rl = {
191
- key: 3,
192
- class: "mr-data-layout__error",
193
- role: "alert"
194
- }, pl = /* @__PURE__ */ re({
195
- __name: "RuleDataLayout",
196
- props: {
197
- list: {},
198
- accept: { type: Function },
199
- mode: {},
200
- datasets: {},
201
- datasetSchema: {},
202
- datasetSchemas: {},
203
- readonly: { type: Boolean },
204
- messages: {}
205
- },
206
- emits: ["change", "dirty"],
207
- setup(e, { emit: K }) {
208
- const C = e, W = K, $ = pe(C, (A) => W("change", A)), {
209
- enabled: m,
210
- detail: n,
211
- matrix: g,
212
- datasets: R,
213
- sourceFields: h,
214
- childFields: y,
215
- error: p,
216
- preview: V
217
- } = $;
218
- P([$.pendingLocalChanges, m, n, g], () => W("dirty", $.pendingLocalChanges.value), { immediate: !0, deep: !0, flush: "sync" });
219
- const _ = ce();
220
- return (A, c) => (s(), d("div", Le, [
221
- a("label", Ke, [
222
- U(a("input", {
223
- "onUpdate:modelValue": c[0] || (c[0] = (o) => ne(m) ? m.value = o : null),
224
- type: "checkbox",
225
- disabled: e.readonly
226
- }, null, 8, Ne), [
227
- [le, l(m)]
228
- ]),
229
- k(t(e.messages.enabled) + t(e.mode === "detail" ? e.messages.detail : e.messages.matrix), 1)
230
- ]),
231
- l(m) && e.mode === "detail" ? (s(), d(w, { key: 0 }, [
232
- a("p", Ge, t(e.messages.detailHint), 1),
233
- a("label", null, [
234
- k(t(e.messages.childDataset), 1),
235
- a("select", {
236
- "aria-label": e.messages.childDataset,
237
- value: l(n).dataset,
238
- disabled: e.readonly,
239
- onChange: c[1] || (c[1] = (o) => l($).chooseDataset(o.target.value))
240
- }, [
241
- a("option", Te, t(e.messages.select), 1),
242
- (s(!0), d(w, null, M(l(R), (o) => (s(), d("option", {
243
- key: o,
244
- value: o
245
- }, t(o), 9, Oe))), 128))
246
- ], 40, Be)
247
- ]),
248
- a("div", We, [
249
- a("label", null, [
250
- k(t(e.messages.parentKey), 1),
251
- U(a("select", {
252
- "aria-label": e.messages.parentKey,
253
- "onUpdate:modelValue": c[2] || (c[2] = (o) => l(n).parentKey = o),
254
- disabled: e.readonly
255
- }, [
256
- (s(!0), d(w, null, M(l(h), (o) => (s(), d("option", {
257
- key: o.field,
258
- value: o.field
259
- }, t(o.label), 9, Ae))), 128))
260
- ], 8, _e), [
261
- [N, l(n).parentKey]
262
- ])
263
- ]),
264
- a("label", null, [
265
- k(t(e.messages.foreignKey), 1),
266
- U(a("select", {
267
- "aria-label": e.messages.foreignKey,
268
- "onUpdate:modelValue": c[3] || (c[3] = (o) => l(n).foreignKey = o),
269
- disabled: e.readonly
270
- }, [
271
- a("option", Ie, t(e.messages.select), 1),
272
- (s(!0), d(w, null, M(l(y), (o) => (s(), d("option", {
273
- key: o.field,
274
- value: o.field
275
- }, t(o.label), 9, Je))), 128))
276
- ], 8, je), [
277
- [N, l(n).foreignKey]
278
- ])
279
- ])
280
- ]),
281
- a("label", null, [
282
- k(t(e.messages.rowKey), 1),
283
- U(a("select", {
284
- "aria-label": e.messages.rowKey,
285
- "onUpdate:modelValue": c[4] || (c[4] = (o) => l(n).rowKey = o),
286
- disabled: e.readonly
287
- }, [
288
- a("option", ze, t(e.messages.noRowKey), 1),
289
- (s(!0), d(w, null, M(l(y), (o) => (s(), d("option", {
290
- key: o.field,
291
- value: o.field
292
- }, t(o.label), 9, qe))), 128))
293
- ], 8, He), [
294
- [N, l(n).rowKey]
295
- ])
296
- ]),
297
- a("fieldset", Ze, [
298
- a("legend", null, t(e.messages.childColumns), 1),
299
- (s(!0), d(w, null, M(l(y), (o) => (s(), d("label", {
300
- key: o.field
301
- }, [
302
- a("input", {
303
- type: "checkbox",
304
- checked: l(n).columns.some((x) => x.field === o.field),
305
- disabled: e.readonly,
306
- onChange: (x) => l($).toggleChildColumn(
307
- o.field,
308
- x.target.checked
309
- )
310
- }, null, 40, Qe),
311
- k(t(o.label), 1)
312
- ]))), 128))
313
- ]),
314
- a("label", null, [
315
- k(t(e.messages.title), 1),
316
- U(a("input", {
317
- "aria-label": e.messages.title,
318
- "onUpdate:modelValue": c[5] || (c[5] = (o) => l(n).label = o),
319
- disabled: e.readonly
320
- }, null, 8, Pe), [
321
- [Z, l(n).label]
322
- ])
323
- ]),
324
- a("div", Xe, [
325
- a("label", null, [
326
- k(t(e.messages.unmatched), 1),
327
- U(a("select", {
328
- "aria-label": e.messages.unmatched,
329
- "onUpdate:modelValue": c[6] || (c[6] = (o) => l(n).unmatched = o),
330
- disabled: e.readonly
331
- }, [
332
- a("option", el, t(e.messages.error), 1),
333
- a("option", ll, t(e.messages.ignore), 1)
334
- ], 8, Ye), [
335
- [N, l(n).unmatched]
336
- ])
337
- ]),
338
- a("label", al, [
339
- U(a("input", {
340
- "onUpdate:modelValue": c[7] || (c[7] = (o) => l(n).header = o),
341
- type: "checkbox",
342
- disabled: e.readonly
343
- }, null, 8, tl), [
344
- [le, l(n).header]
345
- ]),
346
- k(t(e.messages.childHeader), 1)
347
- ])
348
- ])
349
- ], 64)) : l(m) ? (s(), d(w, { key: 1 }, [
350
- a("p", nl, t(e.messages.matrixHint), 1),
351
- (s(), d(w, null, M(["rowFields", "columnFields"], (o) => a("fieldset", {
352
- key: o,
353
- class: "mr-data-layout__choices"
354
- }, [
355
- a("legend", null, t(e.messages[o]), 1),
356
- (s(!0), d(w, null, M(l(h), (x) => (s(), d("label", {
357
- key: x.field
358
- }, [
359
- a("input", {
360
- type: "checkbox",
361
- checked: l(g)[o].includes(x.field),
362
- disabled: e.readonly,
363
- onChange: (u) => l($).toggleDimension(
364
- o,
365
- x.field,
366
- u.target.checked
367
- )
368
- }, null, 40, il),
369
- k(t(x.label), 1)
370
- ]))), 128))
371
- ])), 64)),
372
- (s(!0), d(w, null, M(l(g).measures, (o, x) => (s(), d("div", {
373
- key: x,
374
- class: "mr-data-layout__measure"
375
- }, [
376
- a("div", sl, [
377
- a("label", null, [
378
- k(t(e.messages.measure), 1),
379
- U(a("select", {
380
- "aria-label": e.messages.measure,
381
- "onUpdate:modelValue": (u) => o.field = u,
382
- disabled: e.readonly
383
- }, [
384
- (s(!0), d(w, null, M(l(h), (u) => (s(), d("option", {
385
- key: u.field,
386
- value: u.field
387
- }, t(u.label), 9, ol))), 128))
388
- ], 8, dl), [
389
- [N, o.field]
390
- ])
391
- ]),
392
- a("label", null, [
393
- k(t(e.messages.aggregate), 1),
394
- U(a("select", {
395
- "aria-label": e.messages.aggregate,
396
- "onUpdate:modelValue": (u) => o.op = u,
397
- disabled: e.readonly
398
- }, [
399
- (s(!0), d(w, null, M(l(_).aggregates, (u) => (s(), d("option", {
400
- key: u,
401
- value: u
402
- }, t(e.messages[u]), 9, rl))), 128))
403
- ], 8, ul), [
404
- [N, o.op]
405
- ])
406
- ])
407
- ]),
408
- a("label", null, [
409
- k(t(e.messages.measureLabel), 1),
410
- U(a("input", {
411
- "aria-label": e.messages.measureLabel,
412
- "onUpdate:modelValue": (u) => o.label = u,
413
- disabled: e.readonly,
414
- placeholder: o.field
415
- }, null, 8, cl), [
416
- [Z, o.label]
417
- ])
418
- ]),
419
- o.op === "weightedAvg" ? (s(), d("label", ml, [
420
- k(t(e.messages.weight), 1),
421
- U(a("select", {
422
- "aria-label": e.messages.weight,
423
- "onUpdate:modelValue": (u) => o.weightField = u,
424
- disabled: e.readonly
425
- }, [
426
- (s(!0), d(w, null, M(l(h), (u) => (s(), d("option", {
427
- key: u.field,
428
- value: u.field
429
- }, t(u.label), 9, bl))), 128))
430
- ], 8, vl), [
431
- [N, o.weightField]
432
- ])
433
- ])) : F("", !0),
434
- a("div", gl, [
435
- a("label", null, [
436
- k(t(e.messages.numeric), 1),
437
- U(a("select", {
438
- "aria-label": e.messages.numeric,
439
- "onUpdate:modelValue": (u) => o.numeric = u,
440
- disabled: e.readonly
441
- }, [
442
- a("option", yl, t(e.messages.number), 1),
443
- a("option", hl, t(e.messages.decimal), 1)
444
- ], 8, fl), [
445
- [N, o.numeric]
446
- ])
447
- ]),
448
- a("label", null, [
449
- k(t(e.messages.digits), 1),
450
- U(a("input", {
451
- "aria-label": e.messages.digits,
452
- "onUpdate:modelValue": (u) => o.digits = u,
453
- type: "number",
454
- min: "0",
455
- max: "100",
456
- disabled: e.readonly
457
- }, null, 8, kl), [
458
- [
459
- Z,
460
- o.digits,
461
- void 0,
462
- { number: !0 }
463
- ]
464
- ])
465
- ])
466
- ]),
467
- a("button", {
468
- type: "button",
469
- disabled: e.readonly,
470
- onClick: (u) => l($).removeMeasure(x)
471
- }, t(e.messages.remove), 9, $l)
472
- ]))), 128)),
473
- a("button", {
474
- type: "button",
475
- disabled: e.readonly || l(g).measures.length >= 32,
476
- onClick: c[8] || (c[8] = //@ts-ignore
477
- (...o) => l($).addMeasure && l($).addMeasure(...o))
478
- }, " + " + t(e.messages.addAggregate), 9, wl),
479
- a("label", Vl, [
480
- U(a("input", {
481
- "onUpdate:modelValue": c[9] || (c[9] = (o) => l(g).totals = o),
482
- type: "checkbox",
483
- disabled: e.readonly
484
- }, null, 8, Cl), [
485
- [le, l(g).totals]
486
- ]),
487
- k(t(e.messages.totals), 1)
488
- ]),
489
- a("details", null, [
490
- a("summary", null, t(e.messages.widthSettings), 1),
491
- a("div", Ul, [
492
- a("label", null, [
493
- k(t(e.messages.dimensionWidth), 1),
494
- U(a("input", {
495
- "onUpdate:modelValue": c[10] || (c[10] = (o) => l(g).rowWidthMm = o),
496
- type: "number",
497
- min: "1",
498
- disabled: e.readonly,
499
- placeholder: "40"
500
- }, null, 8, xl), [
501
- [
502
- Z,
503
- l(g).rowWidthMm,
504
- void 0,
505
- { number: !0 }
506
- ]
507
- ])
508
- ]),
509
- a("label", null, [
510
- k(t(e.messages.measureWidth), 1),
511
- U(a("input", {
512
- "onUpdate:modelValue": c[11] || (c[11] = (o) => l(g).columnWidthMm = o),
513
- type: "number",
514
- min: "1",
515
- disabled: e.readonly,
516
- placeholder: "28"
517
- }, null, 8, Ml), [
518
- [
519
- Z,
520
- l(g).columnWidthMm,
521
- void 0,
522
- { number: !0 }
523
- ]
524
- ])
525
- ])
526
- ])
527
- ])
528
- ], 64)) : F("", !0),
529
- a("div", Sl, [
530
- l(m) && e.mode === "matrix" ? (s(), d("button", {
531
- key: 0,
532
- type: "button",
533
- disabled: e.readonly,
534
- onClick: c[12] || (c[12] = //@ts-ignore
535
- (...o) => l($).checkMatrix && l($).checkMatrix(...o))
536
- }, t(e.messages.check), 9, Fl)) : F("", !0),
537
- a("button", {
538
- type: "button",
539
- class: "mr-data-layout__primary",
540
- disabled: e.readonly,
541
- onClick: c[13] || (c[13] = //@ts-ignore
542
- (...o) => l($).apply && l($).apply(...o))
543
- }, t(e.messages.apply), 9, Dl)
544
- ]),
545
- l(V) ? (s(), d("div", El, [
546
- a("p", null, t(e.messages.sample), 1),
547
- a("table", null, [
548
- a("thead", null, [
549
- a("tr", null, [
550
- (s(!0), d(w, null, M(l(V).columns, (o, x) => (s(), d("th", { key: x }, t(o), 1))), 128))
551
- ])
552
- ]),
553
- a("tbody", null, [
554
- (s(!0), d(w, null, M(l(V).rows, (o, x) => (s(), d("tr", { key: x }, [
555
- (s(!0), d(w, null, M(o, (u, B) => (s(), d("td", { key: B }, t(u ?? "—"), 1))), 128))
556
- ]))), 128))
557
- ])
558
- ])
559
- ])) : F("", !0),
560
- l(p) ? (s(), d("p", Rl, t(l(p)), 1)) : F("", !0)
561
- ]));
562
- }
563
- }), Ll = /* @__PURE__ */ me(pl, [["__scopeId", "data-v-744aabaf"]]), Kl = { class: "mr-expression__row" }, Nl = ["value", "disabled", "aria-label"], Gl = { value: "field" }, Bl = { value: "constant" }, Tl = {
564
- key: 0,
565
- value: "operation"
566
- }, Ol = { value: "aggregate" }, Wl = ["value", "disabled", "aria-label"], _l = ["value"], Al = ["value", "disabled", "aria-label"], jl = ["value"], Il = ["value", "disabled", "aria-label"], Jl = ["value"], Hl = ["value", "disabled", "aria-label"], zl = { value: "text" }, ql = { value: "number" }, Zl = { value: "boolean" }, Ql = { value: "null" }, Pl = ["value", "disabled", "aria-label"], Xl = {
567
- key: 0,
568
- value: ""
569
- }, Yl = ["value"], ea = ["value", "disabled", "aria-label"], la = {
570
- value: "",
571
- disabled: ""
572
- }, aa = ["value"], ta = ["value", "disabled", "aria-label"], na = { value: "true" }, ia = { value: "false" }, sa = ["type", "value", "disabled", "aria-label"], da = ["disabled", "aria-label", "onClick"], oa = ["disabled"], ua = /* @__PURE__ */ re({
573
- __name: "ReportExpressionEditor",
574
- props: {
575
- modelValue: {},
576
- fields: {},
577
- messages: {},
578
- readonly: { type: Boolean },
579
- depth: {}
580
- },
581
- emits: ["update:modelValue"],
582
- setup(e, { emit: K }) {
583
- const C = e, W = K, $ = ce(), m = J(
584
- () => "aggregate" in C.modelValue ? "aggregate" : "field" in C.modelValue ? "field" : "value" in C.modelValue ? "constant" : "operation"
585
- ), n = G("text");
586
- P(
587
- () => C.modelValue,
588
- (c) => {
589
- "value" in c && (n.value = c.value === null ? "null" : typeof c.value == "string" ? "text" : typeof c.value);
590
- },
591
- { immediate: !0 }
592
- );
593
- function g(c) {
594
- C.readonly || W("update:modelValue", c);
595
- }
596
- function R(c) {
597
- g(c === "aggregate" ? { aggregate: "sum", field: C.fields[0]?.field ?? "" } : c === "field" ? { field: C.fields[0]?.field ?? "" } : c === "constant" ? { value: "" } : {
598
- op: "add",
599
- args: [{ field: C.fields[0]?.field ?? "" }, { value: 0 }]
600
- });
601
- }
602
- function h(c) {
603
- const o = c, x = "args" in C.modelValue ? C.modelValue.args : [{ value: 0 }, { value: 0 }];
604
- g({
605
- op: o,
606
- args: o === "divide" || o === "subtract" ? x.slice(0, 2) : x
607
- });
608
- }
609
- function y(c, o) {
610
- "args" in C.modelValue && g({
611
- ...C.modelValue,
612
- args: C.modelValue.args.map(
613
- (x, u) => u === c ? o : x
614
- )
615
- });
616
- }
617
- function p(c) {
618
- if (!("args" in C.modelValue)) return;
619
- const o = c === void 0 ? [...C.modelValue.args, { value: 0 }] : C.modelValue.args.filter((x, u) => u !== c);
620
- g({ ...C.modelValue, args: o });
621
- }
622
- function V(c) {
623
- n.value = c, g({
624
- value: c === "null" ? null : c === "boolean" ? !1 : c === "number" ? 0 : ""
625
- });
626
- }
627
- function _(c) {
628
- n.value === "number" ? c.trim() && Number.isFinite(Number(c)) && g({ value: Number(c) }) : g({ value: c });
629
- }
630
- function A(c, o) {
631
- if (!("aggregate" in C.modelValue)) return;
632
- const x = { ...C.modelValue, [c]: o };
633
- c === "aggregate" && (x.aggregate = o), c === "field" && !o && delete x.field, g(x);
634
- }
635
- return (c, o) => {
636
- const x = Ue("ReportExpressionEditor", !0);
637
- return s(), d("div", {
638
- class: be(["mr-expression", { "mr-expression--nested": (e.depth ?? 0) > 0 }])
639
- }, [
640
- a("div", Kl, [
641
- a("select", {
642
- value: m.value,
643
- disabled: e.readonly,
644
- "aria-label": e.messages.argument,
645
- onChange: o[0] || (o[0] = (u) => R(u.target.value))
646
- }, [
647
- a("option", Gl, t(e.messages.field), 1),
648
- a("option", Bl, t(e.messages.constant), 1),
649
- (e.depth ?? 0) < 12 ? (s(), d("option", Tl, t(e.messages.operation), 1)) : F("", !0),
650
- a("option", Ol, t(e.messages.aggregate), 1)
651
- ], 40, Nl),
652
- "field" in e.modelValue && !("aggregate" in e.modelValue) ? (s(), d("select", {
653
- key: 0,
654
- value: e.modelValue.field,
655
- disabled: e.readonly,
656
- "aria-label": e.messages.field,
657
- onChange: o[1] || (o[1] = (u) => g({ field: u.target.value }))
658
- }, [
659
- (s(!0), d(w, null, M(e.fields, (u) => (s(), d("option", {
660
- key: u.field,
661
- value: u.field
662
- }, t(u.label), 9, _l))), 128))
663
- ], 40, Wl)) : "op" in e.modelValue ? (s(), d("select", {
664
- key: 1,
665
- value: e.modelValue.op,
666
- disabled: e.readonly,
667
- "aria-label": e.messages.operation,
668
- onChange: o[2] || (o[2] = (u) => h(u.target.value))
669
- }, [
670
- (s(!0), d(w, null, M(l($).operations, (u) => (s(), d("option", {
671
- key: u,
672
- value: u
673
- }, t(e.messages[u]), 9, jl))), 128))
674
- ], 40, Al)) : "aggregate" in e.modelValue ? (s(), d("select", {
675
- key: 2,
676
- value: e.modelValue.aggregate,
677
- disabled: e.readonly,
678
- "aria-label": e.messages.aggregate,
679
- onChange: o[3] || (o[3] = (u) => A("aggregate", u.target.value))
680
- }, [
681
- (s(!0), d(w, null, M(l($).aggregates, (u) => (s(), d("option", {
682
- key: u,
683
- value: u
684
- }, t(e.messages[u]), 9, Jl))), 128))
685
- ], 40, Il)) : (s(), d("select", {
686
- key: 3,
687
- value: n.value,
688
- disabled: e.readonly,
689
- "aria-label": e.messages.resultType,
690
- onChange: o[4] || (o[4] = (u) => V(u.target.value))
691
- }, [
692
- a("option", zl, t(e.messages.text), 1),
693
- a("option", ql, t(e.messages.number), 1),
694
- a("option", Zl, t(e.messages.boolean), 1),
695
- a("option", Ql, t(e.messages.null), 1)
696
- ], 40, Hl))
697
- ]),
698
- "aggregate" in e.modelValue ? (s(), d(w, { key: 0 }, [
699
- a("select", {
700
- value: e.modelValue.field ?? "",
701
- disabled: e.readonly,
702
- "aria-label": e.messages.measure,
703
- onChange: o[5] || (o[5] = (u) => A("field", u.target.value))
704
- }, [
705
- e.modelValue.aggregate === "count" ? (s(), d("option", Xl, t(e.messages.allRows), 1)) : F("", !0),
706
- (s(!0), d(w, null, M(e.fields, (u) => (s(), d("option", {
707
- key: u.field,
708
- value: u.field
709
- }, t(u.label), 9, Yl))), 128))
710
- ], 40, Pl),
711
- e.modelValue.aggregate === "weightedAvg" ? (s(), d("select", {
712
- key: 0,
713
- value: e.modelValue.weightField ?? "",
714
- disabled: e.readonly,
715
- "aria-label": e.messages.weight,
716
- onChange: o[6] || (o[6] = (u) => A(
717
- "weightField",
718
- u.target.value
719
- ))
720
- }, [
721
- a("option", la, t(e.messages.weight), 1),
722
- (s(!0), d(w, null, M(e.fields, (u) => (s(), d("option", {
723
- key: u.field,
724
- value: u.field
725
- }, t(u.label), 9, aa))), 128))
726
- ], 40, ea)) : F("", !0)
727
- ], 64)) : "value" in e.modelValue ? (s(), d(w, { key: 1 }, [
728
- n.value === "boolean" ? (s(), d("select", {
729
- key: 0,
730
- value: String(e.modelValue.value),
731
- disabled: e.readonly,
732
- "aria-label": e.messages.constant,
733
- onChange: o[7] || (o[7] = (u) => g({
734
- value: u.target.value === "true"
735
- }))
736
- }, [
737
- a("option", na, t(e.messages.true), 1),
738
- a("option", ia, t(e.messages.false), 1)
739
- ], 40, ta)) : n.value !== "null" ? (s(), d("input", {
740
- key: 1,
741
- type: n.value === "number" ? "number" : "text",
742
- value: e.modelValue.value ?? "",
743
- disabled: e.readonly,
744
- "aria-label": e.messages.constant,
745
- onInput: o[8] || (o[8] = (u) => _(u.target.value))
746
- }, null, 40, sa)) : F("", !0)
747
- ], 64)) : "args" in e.modelValue ? (s(), d(w, { key: 2 }, [
748
- (s(!0), d(w, null, M(e.modelValue.args, (u, B) => (s(), d("div", {
749
- key: B,
750
- class: "mr-expression__argument"
751
- }, [
752
- ge(x, {
753
- "model-value": u,
754
- fields: e.fields,
755
- messages: e.messages,
756
- readonly: e.readonly,
757
- depth: (e.depth ?? 0) + 1,
758
- "onUpdate:modelValue": (H) => y(B, H)
759
- }, null, 8, ["model-value", "fields", "messages", "readonly", "depth", "onUpdate:modelValue"]),
760
- e.modelValue.args.length > 2 ? (s(), d("button", {
761
- key: 0,
762
- type: "button",
763
- disabled: e.readonly,
764
- "aria-label": `${e.messages.remove} ${e.messages.argument} ${B + 1}`,
765
- onClick: (H) => p(B)
766
- }, " × ", 8, da)) : F("", !0)
767
- ]))), 128)),
768
- !["subtract", "divide"].includes(e.modelValue.op) && e.modelValue.args.length < 16 ? (s(), d("button", {
769
- key: 0,
770
- type: "button",
771
- disabled: e.readonly,
772
- onClick: o[9] || (o[9] = (u) => p())
773
- }, " + " + t(e.messages.addArgument), 9, oa)) : F("", !0)
774
- ], 64)) : F("", !0)
775
- ], 2);
776
- };
777
- }
778
- }), ra = /* @__PURE__ */ me(ua, [["__scopeId", "data-v-84e5c0e5"]]), I = (e) => JSON.parse(JSON.stringify(e));
779
- function ca(e, K) {
780
- const C = J(() => ({
781
- ...Ee,
782
- ...e.messages
783
- })), W = G("computations"), $ = G(""), m = G(""), n = G({
784
- field: "",
785
- expression: { field: "" },
786
- scope: "row"
787
- }), g = G([]), R = G(0), h = G(""), y = G(-1), p = G("style"), V = G({ field: "", op: ">", value: 0 }), _ = G({
788
- color: "#b91c1c",
789
- backgroundColor: "#fff1f2",
790
- bold: !1
791
- }), A = G([]), c = de(() => n.value), o = de(() => g.value), x = de(() => ({ when: V.value, style: _.value })), u = G(/* @__PURE__ */ new Map()), B = G(/* @__PURE__ */ new Map());
792
- let H = "", f = !1;
793
- const L = J(() => c.pending.value || o.pending.value || x.pending.value || u.value.size > 0 || B.value.size > 0);
794
- let S;
795
- const j = J(() => {
796
- const v = /* @__PURE__ */ new Map();
797
- for (const b of e.datasetSchema?.fields ?? [])
798
- v.set(b.field, b.label ?? b.field);
799
- for (const b of e.list.columns)
800
- v.has(b.field) || v.set(b.field, b.header || b.field);
801
- for (const b of Object.keys(
802
- e.datasets?.[e.list.dataset]?.[0] ?? {}
803
- ))
804
- v.has(b) || v.set(b, b);
805
- return [...v].map(([b, D]) => ({ field: b, label: D }));
806
- }), T = J(() => g.value[R.value]), q = J(
807
- () => e.list.columns.find((v) => v.field === h.value)
808
- ), oe = J(() => Fe(ae()));
809
- function X() {
810
- if (S === JSON.stringify(e.list)) {
811
- S = void 0;
812
- return;
813
- }
814
- f = !0, u.value = /* @__PURE__ */ new Map(), B.value = /* @__PURE__ */ new Map(), g.value = I(
815
- e.list.groups ?? (e.list.groupBy ? [e.list.groupBy] : [])
816
- );
817
- for (const v of g.value) for (const b of v.aggregates ?? []) b.numeric ??= "number";
818
- e.list.columns.some((v) => v.field === h.value) || (h.value = e.list.columns[0]?.field ?? ""), $.value = "", A.value = [], Y(m.value), ve(-1), o.accept(), f = !1;
819
- }
820
- P(() => e.list, X, { immediate: !0 }), P(n, () => {
821
- A.value = [];
822
- }, { deep: !0 }), P(() => e.datasets, () => {
823
- A.value = [];
824
- }, { deep: !0 });
825
- function Y(v) {
826
- !f && c.pending.value && (u.value = new Map(u.value).set(m.value, I(n.value))), m.value = v, n.value = I(
827
- e.list.computed?.find((D) => D.field === v) ?? {
828
- field: "",
829
- expression: { field: j.value[0]?.field ?? "" },
830
- scope: "row"
831
- }
832
- ), n.value.numeric ??= "number", A.value = [], $.value = "", c.accept();
833
- const b = u.value.get(v);
834
- if (b) {
835
- n.value = I(b);
836
- const D = new Map(u.value);
837
- D.delete(v), u.value = D;
838
- }
839
- }
840
- function ae() {
841
- return [
842
- ...(e.list.computed ?? []).filter((b) => b.field !== m.value),
843
- I(n.value)
844
- ];
845
- }
846
- function Q(v) {
847
- if (e.readonly) return !1;
848
- const b = fe({
849
- pages: [
850
- {
851
- widthMm: Math.max(1, v.leftMm + v.widthMm),
852
- heightMm: 297,
853
- components: [v]
854
- }
855
- ]
856
- });
857
- return b.ok ? ($.value = "", S = JSON.stringify(v), K(v), !0) : ($.value = b.errors.map((D) => D.message).slice(0, 3).join(";"), !1);
858
- }
859
- function ue() {
860
- if (!n.value.field.trim()) {
861
- $.value = C.value.missingTarget;
862
- return;
863
- }
864
- const v = I(e.list);
865
- if (v.computed = ae(), v.columns.some((b) => b.field === n.value.field) || v.columns.push({
866
- field: n.value.field,
867
- header: n.value.field,
868
- widthMm: 30,
869
- semanticRole: "measure",
870
- align: "right",
871
- editable: !1,
872
- format: {
873
- kind: "number",
874
- ...n.value.digits === void 0 ? {} : { digits: n.value.digits }
875
- }
876
- }), Q(v)) {
877
- const b = new Map(u.value);
878
- b.delete(m.value), b.delete(n.value.field), u.value = b, m.value = n.value.field, c.accept();
879
- }
880
- }
881
- function ie() {
882
- if (!m.value) return;
883
- const v = I(e.list);
884
- if (v.computed = (v.computed ?? []).filter(
885
- (b) => b.field !== m.value
886
- ), Q(v)) {
887
- const b = new Map(u.value);
888
- b.delete(m.value), u.value = b, c.accept(), Y("");
889
- }
890
- }
891
- function se() {
892
- A.value = [], $.value = "";
893
- const v = e.datasets?.[e.list.dataset];
894
- if (!v?.length) {
895
- $.value = C.value.noData;
896
- return;
897
- }
898
- try {
899
- const b = De(v.slice(0, 1e3), {
900
- fields: ae(),
901
- maxRows: 1e3,
902
- maxCells: 2e6
903
- });
904
- A.value = b.rows.slice(0, 5).map((D, z) => ({
905
- row: z + 1,
906
- value: D[n.value.field]
907
- }));
908
- } catch (b) {
909
- $.value = b instanceof Error ? b.message : String(b);
910
- }
911
- }
912
- function r(v) {
913
- n.value.expression = v;
914
- }
915
- function i(v, b) {
916
- n.value.groupBy = b ? [...n.value.groupBy ?? [], v] : (n.value.groupBy ?? []).filter((D) => D !== v);
917
- }
918
- function O() {
919
- g.value.push({
920
- field: j.value[0]?.field ?? "",
921
- headerTemplate: "{value}",
922
- subtotalLabel: C.value.subtotalLabel,
923
- aggregates: [],
924
- keepWithNext: !0
925
- }), R.value = g.value.length - 1;
926
- }
927
- function E(v) {
928
- const b = R.value, D = b + v;
929
- D < 0 || D >= g.value.length || ([g.value[b], g.value[D]] = [
930
- g.value[D],
931
- g.value[b]
932
- ], R.value = D);
933
- }
934
- function ke() {
935
- g.value.splice(R.value, 1), R.value = Math.max(
936
- 0,
937
- Math.min(R.value, g.value.length - 1)
938
- );
939
- }
940
- function $e() {
941
- T.value && (T.value.aggregates ??= []).push({
942
- field: j.value[0]?.field ?? "",
943
- op: "sum",
944
- numeric: "number"
945
- });
946
- }
947
- function we() {
948
- const v = I(e.list);
949
- v.groups = I(g.value), delete v.groupBy, Q(v) && o.accept();
950
- }
951
- function ve(v) {
952
- !f && x.pending.value && (B.value = new Map(B.value).set(H, { when: I(V.value), style: { ..._.value } })), H = `${h.value}|${p.value}|${v}`, y.value = v;
953
- const b = p.value === "cell" ? q.value?.visibleWhen : p.value === "rowVisibility" ? e.list.rowVisibleWhen : q.value?.rules?.[v]?.when;
954
- V.value = I(b ?? { field: h.value, op: ">", value: 0 });
955
- const D = q.value?.rules?.[v]?.style;
956
- _.value = {
957
- color: String(D?.color ?? "#b91c1c"),
958
- backgroundColor: String(D?.backgroundColor ?? "#fff1f2"),
959
- bold: D?.bold === !0
960
- }, x.accept();
961
- const z = B.value.get(H);
962
- if (z) {
963
- V.value = I(z.when), _.value = { ...z.style };
964
- const ee = new Map(B.value);
965
- ee.delete(H), B.value = ee;
966
- }
967
- }
968
- function Ve(v) {
969
- const b = e.datasetSchema?.fields.find(
970
- (ee) => ee.field === V.value.field
971
- ), D = e.datasets?.[e.list.dataset]?.find(
972
- (ee) => ee[V.value.field] != null
973
- )?.[V.value.field], z = b?.type === "number" || !b && typeof D == "number";
974
- b?.type === "decimal" ? V.value.numeric = "decimal" : z ? V.value.numeric = "number" : delete V.value.numeric, V.value.value = z && v.trim() && Number.isFinite(Number(v)) ? Number(v) : v;
975
- }
976
- function Ce(v = !1) {
977
- const b = I(e.list), D = b.columns.find((z) => z.field === h.value);
978
- if (!D) {
979
- $.value = C.value.noSelection;
980
- return;
981
- }
982
- if (p.value === "rowVisibility")
983
- v ? delete b.rowVisibleWhen : b.rowVisibleWhen = I(V.value);
984
- else if (p.value === "cell")
985
- v ? delete D.visibleWhen : D.visibleWhen = I(V.value);
986
- else if (D.rules ??= [], v && y.value >= 0)
987
- D.rules.splice(y.value, 1);
988
- else {
989
- if (v) return;
990
- y.value < 0 ? D.rules.push({
991
- when: I(V.value),
992
- style: { ..._.value }
993
- }) : D.rules[y.value] = {
994
- when: I(V.value),
995
- style: { ..._.value }
996
- };
997
- }
998
- if (Q(b)) {
999
- const z = new Map(B.value);
1000
- z.delete(H), B.value = z, x.accept();
1001
- }
1002
- }
1003
- return {
1004
- m: C,
1005
- pendingLocalChanges: L,
1006
- draftSnapshot: () => JSON.stringify({ formula: n.value, groups: g.value, when: V.value, style: _.value, computedDrafts: [...u.value], conditionDrafts: [...B.value] }),
1007
- tab: W,
1008
- fields: j,
1009
- formula: n,
1010
- groups: g,
1011
- groupIndex: R,
1012
- currentGroup: T,
1013
- column: h,
1014
- currentColumn: q,
1015
- conditionIndex: y,
1016
- effect: p,
1017
- when: V,
1018
- style: _,
1019
- error: $,
1020
- preview: A,
1021
- diagnostics: oe,
1022
- selectedComputed: m,
1023
- loadComputed: Y,
1024
- applyComputed: ue,
1025
- removeComputed: ie,
1026
- check: se,
1027
- setExpression: r,
1028
- toggleGroupField: i,
1029
- addGroup: O,
1030
- moveGroup: E,
1031
- removeGroup: ke,
1032
- addAggregate: $e,
1033
- applyGroups: we,
1034
- loadCondition: ve,
1035
- setThreshold: Ve,
1036
- applyCondition: Ce,
1037
- applyLayout: Q,
1038
- resetDraft: () => {
1039
- S = void 0, X();
1040
- }
1041
- };
1042
- }
1043
- const ma = ["aria-label"], va = { class: "mr-rule-editor__directory" }, ba = ["aria-label"], ga = ["aria-selected", "onClick"], fa = { key: 0 }, ya = { key: 1 }, ha = { class: "mr-rule-editor__catalog" }, ka = ["disabled"], $a = ["aria-label"], wa = { class: "mr-rule-editor__field-list" }, Va = ["disabled", "title", "onClick"], Ca = { key: 1 }, Ua = {
1044
- key: 0,
1045
- class: "mr-rule-editor__panel"
1046
- }, xa = ["aria-label", "value", "disabled"], Ma = { value: "" }, Sa = ["value"], Fa = ["aria-label", "disabled"], Da = { class: "mr-rule-editor__pair" }, Ea = ["aria-label", "disabled"], Ra = ["value"], pa = ["aria-label", "disabled"], La = { value: "number" }, Ka = { value: "decimal" }, Na = {
1047
- key: 0,
1048
- class: "mr-rule-editor__checks"
1049
- }, Ga = ["checked", "disabled", "onChange"], Ba = {
1050
- key: 2,
1051
- class: "mr-rule-editor__hint"
1052
- }, Ta = { class: "mr-rule-editor__advanced" }, Oa = ["aria-label", "disabled"], Wa = ["aria-label", "disabled"], _a = { value: "propagate" }, Aa = { value: "error" }, ja = ["aria-label", "disabled"], Ia = { value: "error" }, Ja = { value: "null" }, Ha = {
1053
- key: 3,
1054
- class: "mr-rule-editor__hint"
1055
- }, za = {
1056
- key: 4,
1057
- class: "mr-rule-editor__diagnostic"
1058
- }, qa = { class: "mr-rule-editor__actions" }, Za = ["disabled"], Qa = ["disabled"], Pa = ["disabled"], Xa = {
1059
- key: 5,
1060
- class: "mr-rule-editor__error"
1061
- }, Ya = {
1062
- key: 1,
1063
- class: "mr-rule-editor__panel"
1064
- }, et = { class: "mr-rule-editor__pair" }, lt = ["aria-label"], at = ["value"], tt = {
1065
- key: 0,
1066
- value: 0
1067
- }, nt = ["disabled"], it = ["aria-label", "disabled"], st = ["value"], dt = { class: "mr-rule-editor__pair" }, ot = ["aria-label", "disabled"], ut = ["aria-label", "disabled"], rt = { class: "mr-rule-editor__checks" }, ct = ["disabled"], mt = ["disabled"], vt = { class: "mr-rule-editor__pair" }, bt = ["aria-label", "onUpdate:modelValue", "disabled"], gt = ["value"], ft = ["aria-label", "onUpdate:modelValue", "disabled"], yt = ["value"], ht = ["aria-label", "onUpdate:modelValue", "disabled"], kt = { value: void 0 }, $t = ["value"], wt = { key: 0 }, Vt = ["aria-label", "onUpdate:modelValue", "disabled"], Ct = ["value"], Ut = { class: "mr-rule-editor__pair" }, xt = ["onUpdate:modelValue", "disabled", "aria-label"], Mt = { value: "number" }, St = { value: "decimal" }, Ft = ["disabled", "onClick"], Dt = ["disabled"], Et = { class: "mr-rule-editor__actions" }, Rt = ["disabled", "aria-label"], pt = ["disabled", "aria-label"], Lt = ["disabled"], Kt = ["disabled"], Nt = {
1068
- key: 2,
1069
- class: "mr-rule-editor__panel"
1070
- }, Gt = ["aria-label", "disabled"], Bt = ["value"], Tt = ["aria-label", "disabled"], Ot = { value: "style" }, Wt = { value: "cell" }, _t = { value: "rowVisibility" }, At = { key: 0 }, jt = ["aria-label", "value", "disabled"], It = { value: -1 }, Jt = ["value"], Ht = ["aria-label", "disabled"], zt = ["value"], qt = { class: "mr-rule-editor__pair" }, Zt = ["aria-label", "disabled"], Qt = ["value"], Pt = ["value", "disabled"], Xt = { class: "mr-rule-editor__pair" }, Yt = ["disabled"], en = ["disabled"], ln = { class: "mr-rule-editor__check" }, an = ["disabled"], tn = { class: "mr-rule-editor__actions" }, nn = ["disabled"], sn = ["disabled"], dn = { class: "mr-rule-editor__explanation" }, on = { key: 0 }, un = { class: "mr-rule-editor__results" }, rn = { key: 0 }, cn = { key: 1 }, mn = {
1071
- key: 1,
1072
- class: "mr-rule-editor__error",
1073
- role: "alert"
1074
- }, vn = /* @__PURE__ */ re({
1075
- __name: "RuleEditor",
1076
- props: {
1077
- list: {},
1078
- datasets: {},
1079
- datasetSchema: {},
1080
- datasetSchemas: {},
1081
- readonly: { type: Boolean },
1082
- messages: {}
1083
- },
1084
- emits: ["change", "dirty"],
1085
- setup(e, { expose: K, emit: C }) {
1086
- const W = e, $ = C, m = ca(W, (se) => $("change", se)), {
1087
- m: n,
1088
- tab: g,
1089
- fields: R,
1090
- formula: h,
1091
- groups: y,
1092
- groupIndex: p,
1093
- currentGroup: V,
1094
- column: _,
1095
- currentColumn: A,
1096
- conditionIndex: c,
1097
- effect: o,
1098
- when: x,
1099
- style: u,
1100
- error: B,
1101
- preview: H,
1102
- diagnostics: f,
1103
- selectedComputed: L
1104
- } = m, S = G({}), j = G(0);
1105
- function T() {
1106
- m.resetDraft(), S.value = {}, j.value++;
1107
- }
1108
- const q = J(() => m.pendingLocalChanges.value || Object.values(S.value).some(Boolean));
1109
- P([q, m.draftSnapshot, S], () => $("dirty", q.value), { immediate: !0, deep: !0, flush: "sync" }), K({ get pendingLocalChanges() {
1110
- return q.value;
1111
- } });
1112
- const oe = Re(W, m.formula, n), { query: X, matches: Y, fieldWindow: ae, expression: Q, sources: ue } = oe, ie = ce();
1113
- return (se, r) => (s(), d("section", {
1114
- class: "mr-rule-editor",
1115
- "aria-label": l(n).settings
1116
- }, [
1117
- a("aside", va, [
1118
- a("div", {
1119
- class: "mr-rule-editor__tabs",
1120
- role: "tablist",
1121
- "aria-label": l(n).settings
1122
- }, [
1123
- (s(), d(w, null, M([
1124
- "computations",
1125
- "groups",
1126
- "conditions",
1127
- "detail",
1128
- "matrix"
1129
- ], (i) => a("button", {
1130
- key: i,
1131
- type: "button",
1132
- role: "tab",
1133
- "aria-selected": l(g) === i,
1134
- class: be({ "is-active": l(g) === i }),
1135
- onClick: (O) => g.value = i
1136
- }, [
1137
- k(t(l(n)[i]), 1),
1138
- i === "computations" && e.list.computed?.length ? (s(), d("span", fa, t(e.list.computed.length), 1)) : F("", !0),
1139
- i === "groups" && l(y).length ? (s(), d("span", ya, t(l(y).length), 1)) : F("", !0)
1140
- ], 10, ga)), 64))
1141
- ], 8, ba),
1142
- a("div", ha, [
1143
- a("strong", null, t(l(n).catalog), 1),
1144
- q.value ? (s(), d("button", {
1145
- key: 0,
1146
- type: "button",
1147
- disabled: e.readonly,
1148
- onClick: T
1149
- }, t(l(n).restoreDraft), 9, ka)) : F("", !0),
1150
- a("label", null, [
1151
- k(t(l(n).searchFields), 1),
1152
- U(a("input", {
1153
- "onUpdate:modelValue": r[0] || (r[0] = (i) => ne(X) ? X.value = i : null),
1154
- type: "search",
1155
- "aria-label": l(n).searchFields
1156
- }, null, 8, $a), [
1157
- [Z, l(X)]
1158
- ])
1159
- ]),
1160
- a("div", wa, [
1161
- (s(!0), d(w, null, M(l(ae), (i) => (s(), d("button", {
1162
- key: i.field,
1163
- type: "button",
1164
- disabled: e.readonly || l(g) !== "computations",
1165
- title: l(n).useField,
1166
- onClick: (O) => l(m).setExpression({ field: i.field })
1167
- }, [
1168
- a("strong", null, t(i.label), 1),
1169
- a("code", null, t(i.field), 1),
1170
- a("small", null, t(i.meta), 1)
1171
- ], 8, Va))), 128))
1172
- ]),
1173
- l(Y).length > 50 ? (s(), d("small", Ca, t(l(n).shown) + " 50 / " + t(l(Y).length), 1)) : F("", !0)
1174
- ])
1175
- ]),
1176
- l(g) === "computations" ? (s(), d("div", Ua, [
1177
- a("label", null, [
1178
- k(t(l(n).existing), 1),
1179
- a("select", {
1180
- "aria-label": l(n).existing,
1181
- value: l(L),
1182
- disabled: e.readonly,
1183
- onChange: r[1] || (r[1] = (i) => l(m).loadComputed(i.target.value))
1184
- }, [
1185
- a("option", Ma, "+ " + t(l(n).newField), 1),
1186
- (s(!0), d(w, null, M(e.list.computed, (i) => (s(), d("option", {
1187
- key: i.field,
1188
- value: i.field
1189
- }, t(i.field), 9, Sa))), 128))
1190
- ], 40, xa)
1191
- ]),
1192
- a("label", null, [
1193
- k(t(l(n).target), 1),
1194
- U(a("input", {
1195
- "aria-label": l(n).target,
1196
- "onUpdate:modelValue": r[2] || (r[2] = (i) => l(h).field = i),
1197
- disabled: e.readonly,
1198
- autocomplete: "off"
1199
- }, null, 8, Fa), [
1200
- [Z, l(h).field]
1201
- ])
1202
- ]),
1203
- a("div", Da, [
1204
- a("label", null, [
1205
- k(t(l(n).scope), 1),
1206
- U(a("select", {
1207
- "aria-label": l(n).scope,
1208
- "onUpdate:modelValue": r[3] || (r[3] = (i) => l(h).scope = i),
1209
- disabled: e.readonly
1210
- }, [
1211
- (s(!0), d(w, null, M(l(ie).scopes, (i) => (s(), d("option", {
1212
- key: i,
1213
- value: i
1214
- }, t(l(n)[i]), 9, Ra))), 128))
1215
- ], 8, Ea), [
1216
- [N, l(h).scope]
1217
- ])
1218
- ]),
1219
- a("label", null, [
1220
- k(t(l(n).numeric), 1),
1221
- U(a("select", {
1222
- "aria-label": l(n).numeric,
1223
- "onUpdate:modelValue": r[4] || (r[4] = (i) => l(h).numeric = i),
1224
- disabled: e.readonly
1225
- }, [
1226
- a("option", La, t(l(n).number), 1),
1227
- a("option", Ka, t(l(n).decimal), 1)
1228
- ], 8, pa), [
1229
- [N, l(h).numeric]
1230
- ])
1231
- ])
1232
- ]),
1233
- l(h).scope === "group" ? (s(), d("fieldset", Na, [
1234
- a("legend", null, t(l(n).groupFields), 1),
1235
- (s(!0), d(w, null, M(l(R), (i) => (s(), d("label", {
1236
- key: i.field
1237
- }, [
1238
- a("input", {
1239
- type: "checkbox",
1240
- checked: l(h).groupBy?.includes(i.field),
1241
- disabled: e.readonly,
1242
- onChange: (O) => l(m).toggleGroupField(
1243
- i.field,
1244
- O.target.checked
1245
- )
1246
- }, null, 40, Ga),
1247
- k(t(i.label), 1)
1248
- ]))), 128))
1249
- ])) : F("", !0),
1250
- typeof l(h).expression != "string" ? (s(), xe(ra, {
1251
- key: 1,
1252
- "model-value": l(h).expression,
1253
- fields: l(R),
1254
- messages: l(n),
1255
- readonly: e.readonly,
1256
- "onUpdate:modelValue": l(m).setExpression
1257
- }, null, 8, ["model-value", "fields", "messages", "readonly", "onUpdate:modelValue"])) : (s(), d("p", Ba, t(l(h).expression), 1)),
1258
- a("details", null, [
1259
- a("summary", null, t(l(n).advanced), 1),
1260
- a("div", Ta, [
1261
- a("label", null, [
1262
- k(t(l(n).digits), 1),
1263
- U(a("input", {
1264
- "aria-label": l(n).digits,
1265
- "onUpdate:modelValue": r[5] || (r[5] = (i) => l(h).digits = i),
1266
- type: "number",
1267
- min: "0",
1268
- max: "100",
1269
- disabled: e.readonly
1270
- }, null, 8, Oa), [
1271
- [
1272
- Z,
1273
- l(h).digits,
1274
- void 0,
1275
- { number: !0 }
1276
- ]
1277
- ])
1278
- ]),
1279
- a("label", null, [
1280
- k(t(l(n).nulls), 1),
1281
- U(a("select", {
1282
- "aria-label": l(n).nulls,
1283
- "onUpdate:modelValue": r[6] || (r[6] = (i) => l(h).nulls = i),
1284
- disabled: e.readonly
1285
- }, [
1286
- a("option", _a, t(l(n).propagate), 1),
1287
- a("option", Aa, t(l(n).error), 1)
1288
- ], 8, Wa), [
1289
- [N, l(h).nulls]
1290
- ])
1291
- ]),
1292
- a("label", null, [
1293
- k(t(l(n).division), 1),
1294
- U(a("select", {
1295
- "aria-label": l(n).division,
1296
- "onUpdate:modelValue": r[7] || (r[7] = (i) => l(h).divisionByZero = i),
1297
- disabled: e.readonly
1298
- }, [
1299
- a("option", Ia, t(l(n).error), 1),
1300
- a("option", Ja, t(l(n).propagate), 1)
1301
- ], 8, ja), [
1302
- [N, l(h).divisionByZero]
1303
- ])
1304
- ])
1305
- ])
1306
- ]),
1307
- l(h).numeric === "decimal" ? (s(), d("p", Ha, t(l(n).decimalHint), 1)) : F("", !0),
1308
- l(f).valid && l(h).field ? (s(), d("div", za, [
1309
- k(t(l(n).dependencies), 1),
1310
- a("strong", null, t(l(f).order.join(" → ")), 1)
1311
- ])) : F("", !0),
1312
- a("div", qa, [
1313
- a("button", {
1314
- type: "button",
1315
- disabled: e.readonly,
1316
- onClick: r[8] || (r[8] = //@ts-ignore
1317
- (...i) => l(m).check && l(m).check(...i))
1318
- }, t(l(n).check), 9, Za),
1319
- a("button", {
1320
- type: "button",
1321
- class: "mr-rule-editor__primary",
1322
- disabled: e.readonly || !l(f).valid,
1323
- onClick: r[9] || (r[9] = //@ts-ignore
1324
- (...i) => l(m).applyComputed && l(m).applyComputed(...i))
1325
- }, t(l(n).apply), 9, Qa),
1326
- l(L) ? (s(), d("button", {
1327
- key: 0,
1328
- type: "button",
1329
- disabled: e.readonly,
1330
- onClick: r[10] || (r[10] = //@ts-ignore
1331
- (...i) => l(m).removeComputed && l(m).removeComputed(...i))
1332
- }, t(l(n).remove), 9, Pa)) : F("", !0)
1333
- ]),
1334
- !l(f).valid && l(h).field ? (s(), d("p", Xa, t(l(f).errors.join(";")), 1)) : F("", !0)
1335
- ])) : l(g) === "groups" ? (s(), d("div", Ya, [
1336
- a("div", et, [
1337
- U(a("select", {
1338
- "onUpdate:modelValue": r[11] || (r[11] = (i) => ne(p) ? p.value = i : null),
1339
- "aria-label": l(n).groups
1340
- }, [
1341
- (s(!0), d(w, null, M(l(y), (i, O) => (s(), d("option", {
1342
- key: O,
1343
- value: O
1344
- }, t(O + 1) + " · " + t(i.field), 9, at))), 128)),
1345
- l(y).length ? F("", !0) : (s(), d("option", tt, t(l(n).noGroups), 1))
1346
- ], 8, lt), [
1347
- [
1348
- N,
1349
- l(p),
1350
- void 0,
1351
- { number: !0 }
1352
- ]
1353
- ]),
1354
- a("button", {
1355
- type: "button",
1356
- disabled: e.readonly || l(y).length >= 16,
1357
- onClick: r[12] || (r[12] = //@ts-ignore
1358
- (...i) => l(m).addGroup && l(m).addGroup(...i))
1359
- }, " + " + t(l(n).addGroup), 9, nt)
1360
- ]),
1361
- l(V) ? (s(), d(w, { key: 0 }, [
1362
- a("label", null, [
1363
- k(t(l(n).field), 1),
1364
- U(a("select", {
1365
- "aria-label": l(n).field,
1366
- "onUpdate:modelValue": r[13] || (r[13] = (i) => l(V).field = i),
1367
- disabled: e.readonly
1368
- }, [
1369
- (s(!0), d(w, null, M(l(R), (i) => (s(), d("option", {
1370
- key: i.field,
1371
- value: i.field
1372
- }, t(i.label), 9, st))), 128))
1373
- ], 8, it), [
1374
- [N, l(V).field]
1375
- ])
1376
- ]),
1377
- a("div", dt, [
1378
- a("label", null, [
1379
- k(t(l(n).header), 1),
1380
- U(a("input", {
1381
- "aria-label": l(n).header,
1382
- "onUpdate:modelValue": r[14] || (r[14] = (i) => l(V).headerTemplate = i),
1383
- disabled: e.readonly,
1384
- placeholder: "{value}"
1385
- }, null, 8, ot), [
1386
- [Z, l(V).headerTemplate]
1387
- ])
1388
- ]),
1389
- a("label", null, [
1390
- k(t(l(n).footer), 1),
1391
- U(a("input", {
1392
- "aria-label": l(n).footer,
1393
- "onUpdate:modelValue": r[15] || (r[15] = (i) => l(V).subtotalLabel = i),
1394
- disabled: e.readonly
1395
- }, null, 8, ut), [
1396
- [Z, l(V).subtotalLabel]
1397
- ])
1398
- ])
1399
- ]),
1400
- a("div", rt, [
1401
- a("label", null, [
1402
- U(a("input", {
1403
- "onUpdate:modelValue": r[16] || (r[16] = (i) => l(V).keepWithNext = i),
1404
- type: "checkbox",
1405
- disabled: e.readonly
1406
- }, null, 8, ct), [
1407
- [le, l(V).keepWithNext]
1408
- ]),
1409
- k(t(l(n).orphan), 1)
1410
- ]),
1411
- a("label", null, [
1412
- U(a("input", {
1413
- "onUpdate:modelValue": r[17] || (r[17] = (i) => l(V).repeatHeader = i),
1414
- type: "checkbox",
1415
- disabled: e.readonly
1416
- }, null, 8, mt), [
1417
- [le, l(V).repeatHeader]
1418
- ]),
1419
- k(t(l(n).repeat), 1)
1420
- ])
1421
- ]),
1422
- (s(!0), d(w, null, M(l(V).aggregates, (i, O) => (s(), d("div", {
1423
- key: O,
1424
- class: "mr-rule-editor__aggregate"
1425
- }, [
1426
- a("div", vt, [
1427
- a("label", null, [
1428
- k(t(l(n).output), 1),
1429
- U(a("select", {
1430
- "aria-label": l(n).output,
1431
- "onUpdate:modelValue": (E) => i.field = E,
1432
- disabled: e.readonly
1433
- }, [
1434
- (s(!0), d(w, null, M(l(R), (E) => (s(), d("option", {
1435
- key: E.field,
1436
- value: E.field
1437
- }, t(E.label), 9, gt))), 128))
1438
- ], 8, bt), [
1439
- [N, i.field]
1440
- ])
1441
- ]),
1442
- a("label", null, [
1443
- k(t(l(n).aggregate), 1),
1444
- U(a("select", {
1445
- "aria-label": l(n).aggregate,
1446
- "onUpdate:modelValue": (E) => i.op = E,
1447
- disabled: e.readonly
1448
- }, [
1449
- (s(!0), d(w, null, M(l(ie).aggregates, (E) => (s(), d("option", {
1450
- key: E,
1451
- value: E
1452
- }, t(l(n)[E]), 9, yt))), 128))
1453
- ], 8, ft), [
1454
- [N, i.op]
1455
- ])
1456
- ])
1457
- ]),
1458
- a("label", null, [
1459
- k(t(l(n).measure), 1),
1460
- U(a("select", {
1461
- "aria-label": l(n).measure,
1462
- "onUpdate:modelValue": (E) => i.valueField = E,
1463
- disabled: e.readonly
1464
- }, [
1465
- a("option", kt, t(i.field), 1),
1466
- (s(!0), d(w, null, M(l(R), (E) => (s(), d("option", {
1467
- key: E.field,
1468
- value: E.field
1469
- }, t(E.label), 9, $t))), 128))
1470
- ], 8, ht), [
1471
- [N, i.valueField]
1472
- ])
1473
- ]),
1474
- i.op === "weightedAvg" ? (s(), d("label", wt, [
1475
- k(t(l(n).weight), 1),
1476
- U(a("select", {
1477
- "aria-label": l(n).weight,
1478
- "onUpdate:modelValue": (E) => i.weightField = E,
1479
- disabled: e.readonly
1480
- }, [
1481
- (s(!0), d(w, null, M(l(R), (E) => (s(), d("option", {
1482
- key: E.field,
1483
- value: E.field
1484
- }, t(E.label), 9, Ct))), 128))
1485
- ], 8, Vt), [
1486
- [N, i.weightField]
1487
- ])
1488
- ])) : F("", !0),
1489
- a("div", Ut, [
1490
- U(a("select", {
1491
- "onUpdate:modelValue": (E) => i.numeric = E,
1492
- disabled: e.readonly,
1493
- "aria-label": l(n).numeric
1494
- }, [
1495
- a("option", Mt, t(l(n).number), 1),
1496
- a("option", St, t(l(n).decimal), 1)
1497
- ], 8, xt), [
1498
- [N, i.numeric]
1499
- ]),
1500
- a("button", {
1501
- type: "button",
1502
- disabled: e.readonly,
1503
- onClick: (E) => l(V).aggregates?.splice(O, 1)
1504
- }, t(l(n).remove), 9, Ft)
1505
- ])
1506
- ]))), 128)),
1507
- a("button", {
1508
- type: "button",
1509
- disabled: e.readonly,
1510
- onClick: r[18] || (r[18] = //@ts-ignore
1511
- (...i) => l(m).addAggregate && l(m).addAggregate(...i))
1512
- }, " + " + t(l(n).addAggregate), 9, Dt),
1513
- a("div", Et, [
1514
- a("button", {
1515
- type: "button",
1516
- disabled: e.readonly || l(p) === 0,
1517
- "aria-label": l(n).moveUp,
1518
- onClick: r[19] || (r[19] = (i) => l(m).moveGroup(-1))
1519
- }, " ↑ " + t(l(n).outer), 9, Rt),
1520
- a("button", {
1521
- type: "button",
1522
- disabled: e.readonly || l(p) >= l(y).length - 1,
1523
- "aria-label": l(n).moveDown,
1524
- onClick: r[20] || (r[20] = (i) => l(m).moveGroup(1))
1525
- }, " ↓ " + t(l(n).inner), 9, pt),
1526
- a("button", {
1527
- type: "button",
1528
- disabled: e.readonly,
1529
- onClick: r[21] || (r[21] = //@ts-ignore
1530
- (...i) => l(m).removeGroup && l(m).removeGroup(...i))
1531
- }, t(l(n).remove), 9, Lt)
1532
- ])
1533
- ], 64)) : F("", !0),
1534
- a("button", {
1535
- type: "button",
1536
- class: "mr-rule-editor__primary",
1537
- disabled: e.readonly,
1538
- onClick: r[22] || (r[22] = //@ts-ignore
1539
- (...i) => l(m).applyGroups && l(m).applyGroups(...i))
1540
- }, t(l(n).apply), 9, Kt)
1541
- ])) : l(g) === "conditions" ? (s(), d("div", Nt, [
1542
- a("label", null, [
1543
- k(t(l(n).column), 1),
1544
- U(a("select", {
1545
- "aria-label": l(n).column,
1546
- "onUpdate:modelValue": r[23] || (r[23] = (i) => ne(_) ? _.value = i : null),
1547
- disabled: e.readonly,
1548
- onChange: r[24] || (r[24] = (i) => l(m).loadCondition(-1))
1549
- }, [
1550
- (s(!0), d(w, null, M(e.list.columns, (i) => (s(), d("option", {
1551
- key: i.field,
1552
- value: i.field
1553
- }, t(i.header || i.field), 9, Bt))), 128))
1554
- ], 40, Gt), [
1555
- [N, l(_)]
1556
- ])
1557
- ]),
1558
- a("label", null, [
1559
- k(t(l(n).effect), 1),
1560
- U(a("select", {
1561
- "aria-label": l(n).effect,
1562
- "onUpdate:modelValue": r[25] || (r[25] = (i) => ne(o) ? o.value = i : null),
1563
- disabled: e.readonly,
1564
- onChange: r[26] || (r[26] = (i) => l(m).loadCondition(-1))
1565
- }, [
1566
- a("option", Ot, t(l(n).style), 1),
1567
- a("option", Wt, t(l(n).cell), 1),
1568
- a("option", _t, t(l(n).rowVisibility), 1)
1569
- ], 40, Tt), [
1570
- [N, l(o)]
1571
- ])
1572
- ]),
1573
- l(o) === "style" ? (s(), d("label", At, [
1574
- k(t(l(n).existing), 1),
1575
- a("select", {
1576
- "aria-label": l(n).existing,
1577
- value: l(c),
1578
- disabled: e.readonly,
1579
- onChange: r[27] || (r[27] = (i) => l(m).loadCondition(
1580
- Number(i.target.value)
1581
- ))
1582
- }, [
1583
- a("option", It, "+ " + t(l(n).newCondition), 1),
1584
- (s(!0), d(w, null, M(l(A)?.rules, (i, O) => (s(), d("option", {
1585
- key: O,
1586
- value: O
1587
- }, t(O + 1) + " · " + t(i.when.field) + " " + t(i.when.op) + " " + t(i.when.value), 9, Jt))), 128))
1588
- ], 40, jt)
1589
- ])) : F("", !0),
1590
- a("label", null, [
1591
- k(t(l(n).condition), 1),
1592
- U(a("select", {
1593
- "aria-label": l(n).condition,
1594
- "onUpdate:modelValue": r[28] || (r[28] = (i) => l(x).field = i),
1595
- disabled: e.readonly
1596
- }, [
1597
- (s(!0), d(w, null, M(l(R), (i) => (s(), d("option", {
1598
- key: i.field,
1599
- value: i.field
1600
- }, t(i.label), 9, zt))), 128))
1601
- ], 8, Ht), [
1602
- [N, l(x).field]
1603
- ])
1604
- ]),
1605
- a("div", qt, [
1606
- a("label", null, [
1607
- k(t(l(n).comparison), 1),
1608
- U(a("select", {
1609
- "aria-label": l(n).comparison,
1610
- "onUpdate:modelValue": r[29] || (r[29] = (i) => l(x).op = i),
1611
- disabled: e.readonly
1612
- }, [
1613
- (s(), d(w, null, M([">", ">=", "<", "<=", "==", "!="], (i) => a("option", {
1614
- key: i,
1615
- value: i
1616
- }, t(i), 9, Qt)), 64))
1617
- ], 8, Zt), [
1618
- [N, l(x).op]
1619
- ])
1620
- ]),
1621
- a("label", null, [
1622
- k(t(l(n).threshold), 1),
1623
- a("input", {
1624
- value: l(x).value,
1625
- disabled: e.readonly,
1626
- onInput: r[30] || (r[30] = (i) => l(m).setThreshold(i.target.value))
1627
- }, null, 40, Pt)
1628
- ])
1629
- ]),
1630
- l(o) === "style" ? (s(), d(w, { key: 1 }, [
1631
- a("div", Xt, [
1632
- a("label", null, [
1633
- k(t(l(n).color), 1),
1634
- U(a("input", {
1635
- "onUpdate:modelValue": r[31] || (r[31] = (i) => l(u).color = i),
1636
- type: "color",
1637
- disabled: e.readonly
1638
- }, null, 8, Yt), [
1639
- [Z, l(u).color]
1640
- ])
1641
- ]),
1642
- a("label", null, [
1643
- k(t(l(n).background), 1),
1644
- U(a("input", {
1645
- "onUpdate:modelValue": r[32] || (r[32] = (i) => l(u).backgroundColor = i),
1646
- type: "color",
1647
- disabled: e.readonly
1648
- }, null, 8, en), [
1649
- [Z, l(u).backgroundColor]
1650
- ])
1651
- ])
1652
- ]),
1653
- a("label", ln, [
1654
- U(a("input", {
1655
- "onUpdate:modelValue": r[33] || (r[33] = (i) => l(u).bold = i),
1656
- type: "checkbox",
1657
- disabled: e.readonly
1658
- }, null, 8, an), [
1659
- [le, l(u).bold]
1660
- ]),
1661
- k(t(l(n).bold), 1)
1662
- ])
1663
- ], 64)) : F("", !0),
1664
- a("div", tn, [
1665
- a("button", {
1666
- type: "button",
1667
- class: "mr-rule-editor__primary",
1668
- disabled: e.readonly,
1669
- onClick: r[34] || (r[34] = (i) => l(m).applyCondition())
1670
- }, t(l(n).apply), 9, nn),
1671
- l(c) >= 0 || l(o) !== "style" ? (s(), d("button", {
1672
- key: 0,
1673
- type: "button",
1674
- disabled: e.readonly,
1675
- onClick: r[35] || (r[35] = (i) => l(m).applyCondition(!0))
1676
- }, t(l(n).removeCondition), 9, sn)) : F("", !0)
1677
- ])
1678
- ])) : F("", !0),
1679
- (s(), d(w, null, M(["detail", "matrix"], (i) => U(ge(Ll, {
1680
- key: `${i}-${j.value}`,
1681
- list: e.list,
1682
- mode: i,
1683
- datasets: e.datasets,
1684
- "dataset-schema": e.datasetSchema,
1685
- "dataset-schemas": e.datasetSchemas,
1686
- readonly: e.readonly,
1687
- messages: l(n),
1688
- accept: l(m).applyLayout,
1689
- onDirty: (O) => S.value = { ...S.value, [i]: O }
1690
- }, null, 8, ["list", "mode", "datasets", "dataset-schema", "dataset-schemas", "readonly", "messages", "accept", "onDirty"]), [
1691
- [Me, l(g) === i]
1692
- ])), 64)),
1693
- a("aside", dn, [
1694
- a("header", null, [
1695
- a("strong", null, t(l(n).explanation), 1),
1696
- q.value ? (s(), d("span", on, t(l(n).pending), 1)) : F("", !0)
1697
- ]),
1698
- a("p", null, t(l(n).sourceHint), 1),
1699
- l(g) === "computations" ? (s(), d(w, { key: 0 }, [
1700
- a("h4", null, t(l(n).expression), 1),
1701
- a("code", null, t(l(Q)), 1),
1702
- a("div", un, [
1703
- a("h4", null, t(l(n).sourceValues) + " → " + t(l(n).result), 1),
1704
- (s(!0), d(w, null, M(l(ue), (i) => (s(), d("div", {
1705
- key: i.row,
1706
- class: "mr-rule-editor__trace"
1707
- }, [
1708
- a("small", null, "#" + t(i.row), 1),
1709
- a("code", null, t(i.values), 1),
1710
- a("strong", null, t(l(H).find((O) => O.row === i.row)?.value ?? (l(H).length ? "—" : l(n).notChecked)), 1)
1711
- ]))), 128)),
1712
- l(H).some((i) => i.value == null) ? (s(), d("p", rn, t(l(n).nullReason), 1)) : F("", !0),
1713
- l(H).length ? (s(), d("p", cn, t(l(n).sample), 1)) : F("", !0)
1714
- ])
1715
- ], 64)) : F("", !0),
1716
- l(B) ? (s(), d("p", mn, t(l(B)), 1)) : F("", !0)
1717
- ])
1718
- ], 8, ma));
1719
- }
1720
- }), $n = /* @__PURE__ */ me(vn, [["__scopeId", "data-v-81150490"]]);
1721
- export {
1722
- $n as default
1723
- };