@agile-team/mach-report 2.17.0 → 2.18.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 (168) hide show
  1. package/README.md +18 -9
  2. package/dist/{ExcelBindingWizard-Bq6FYME6.cjs → ExcelBindingWizard-Czn3C2yE.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-Co1svTsw.js → ExcelBindingWizard-DMGZj6I6.js} +3 -3
  4. package/dist/ParamEditor-KzDQvbHY.js +732 -0
  5. package/dist/ParamEditor-oDfD8LgE.cjs +1 -0
  6. package/dist/{ReportBatchPanel-uQh06usx.js → ReportBatchPanel-BJK7PvZ4.js} +39 -39
  7. package/dist/ReportBatchPanel-DnmNRssu.cjs +1 -0
  8. package/dist/ReportParamPanel-mQkeN70Q.js +1020 -0
  9. package/dist/ReportParamPanel-sOANVRz-.cjs +1 -0
  10. package/dist/ReportPreview-BxWWTUL5.js +5583 -0
  11. package/dist/ReportPreview-Yf99omi3.cjs +6 -0
  12. package/dist/{ReportTemplateLibrary-TIL_Oj2l.js → ReportTemplateLibrary-BFjB08Wu.js} +1 -1
  13. package/dist/{ReportTemplateLibrary-CnP7_1pH.cjs → ReportTemplateLibrary-BO42QnWd.cjs} +1 -1
  14. package/dist/RuleEditor-CqxT1a-W.js +2337 -0
  15. package/dist/RuleEditor-D7YWigD9.cjs +1 -0
  16. package/dist/{TemplateOutlinePanel-BlLxRrfu.cjs → TemplateOutlinePanel-B0XX350V.cjs} +1 -1
  17. package/dist/{TemplateOutlinePanel-BouxsuqQ.js → TemplateOutlinePanel-zG0DrsIB.js} +2 -2
  18. package/dist/{TemplateReusePanel-yxsHSO40.cjs → TemplateReusePanel-BD0HSKp_.cjs} +1 -1
  19. package/dist/{TemplateReusePanel-BEACLPaN.js → TemplateReusePanel-Czwe5GbC.js} +2 -2
  20. package/dist/{TemplateReviewPanel-D9Cx0m2N.cjs → TemplateReviewPanel-CA5sdffM.cjs} +1 -1
  21. package/dist/{TemplateReviewPanel-B1OGRY2i.js → TemplateReviewPanel-NhmQI65C.js} +2 -2
  22. package/dist/analytics.cjs +1 -1
  23. package/dist/analytics.d.cts +100 -41
  24. package/dist/analytics.d.ts +100 -41
  25. package/dist/analytics.js +76 -141
  26. package/dist/artifact-integrity.json +108 -102
  27. package/dist/assets-2eC3mOcV.js +232 -0
  28. package/dist/assets-B0Hxn4l6.cjs +1 -0
  29. package/dist/{auto-DDHflI9v.cjs → auto-B0EZFIK1.cjs} +1 -1
  30. package/dist/{auto-BIOmtVhk.js → auto-BlchZ1b8.js} +19 -19
  31. package/dist/{batch-WzDIXJAt.js → batch-DGCt44XM.js} +1 -1
  32. package/dist/{batch-z6Aw5GEY.cjs → batch-DYcokH4v.cjs} +1 -1
  33. package/dist/charts-Dlv8j2AG.js +141 -0
  34. package/dist/charts-aCtoswXq.cjs +1 -0
  35. package/dist/codes.cjs +9 -9
  36. package/dist/codes.d.cts +54 -0
  37. package/dist/codes.d.ts +54 -0
  38. package/dist/codes.js +12097 -13668
  39. package/dist/column-visual-BpgQVWwT.js +238 -0
  40. package/dist/column-visual-CtYxnBCP.cjs +1 -0
  41. package/dist/component-tree-6TV7W6Yj.cjs +1 -0
  42. package/dist/component-tree-CvW4lzpv.js +67 -0
  43. package/dist/computed-4TnxzgIh.cjs +1 -0
  44. package/dist/computed-C8NRZQss.js +739 -0
  45. package/dist/data-bar-Ce38juRZ.cjs +1 -0
  46. package/dist/data-bar-PtjXhMgN.js +9 -0
  47. package/dist/designer--TKECSEc.cjs +2 -0
  48. package/dist/designer-d6hJS41w.js +5683 -0
  49. package/dist/designer.cjs +1 -1
  50. package/dist/designer.d.cts +710 -42
  51. package/dist/designer.d.ts +710 -42
  52. package/dist/designer.js +23 -20
  53. package/dist/{encoding-BFMFIc4r.cjs → encoding-B--eZpp1.cjs} +1 -1
  54. package/dist/{encoding-DP_Eaf0A.js → encoding-mctOLocI.js} +2 -2
  55. package/dist/{font-loader-7FWVlykp.cjs → font-loader-DBBJ5KE9.cjs} +1 -1
  56. package/dist/{font-loader-CQZowp0I.js → font-loader-DW8tIaNp.js} +1 -1
  57. package/dist/index-CPh6tqge.js +1575 -0
  58. package/dist/index-CUNw7dL9.cjs +1 -0
  59. package/dist/index.cjs +7 -7
  60. package/dist/index.d.cts +361 -15
  61. package/dist/index.d.ts +361 -15
  62. package/dist/index.js +876 -835
  63. package/dist/json-snapshot-By4ZVVUt.js +1967 -0
  64. package/dist/json-snapshot-jiXff4lc.cjs +2 -0
  65. package/dist/matrix-0hywp0-F.cjs +1 -0
  66. package/dist/matrix-Dy-tyY7E.js +381 -0
  67. package/dist/param-validation-C-8sRJLq.cjs +1 -0
  68. package/dist/param-validation-CnDEd2l-.js +333 -0
  69. package/dist/{pdf-l3ea86di.js → pdf-CKROKygt.js} +1851 -1849
  70. package/dist/{pdf-B8JouyYv.cjs → pdf-DqyxJ96U.cjs} +46 -46
  71. package/dist/pdf.cjs +1 -1
  72. package/dist/pdf.d.cts +54 -0
  73. package/dist/pdf.d.ts +54 -0
  74. package/dist/pdf.js +2 -2
  75. package/dist/{plugin-BBp74CQZ.js → plugin-ByjF2kiV.js} +5 -5
  76. package/dist/{plugin-CtFX9PFG.cjs → plugin-DM1M2wlI.cjs} +1 -1
  77. package/dist/prefill-B8H9qwE4.js +371 -0
  78. package/dist/prefill-D7EswyTI.cjs +1 -0
  79. package/dist/{prepared-CARicKYh.js → prepared-BE-4jfX5.js} +2 -2
  80. package/dist/{prepared-Ch1x_Gog.cjs → prepared-CGVphji3.cjs} +1 -1
  81. package/dist/{protocol-B5A2uom4.cjs → protocol-ByRVzzQG.cjs} +1 -1
  82. package/dist/{protocol-BaiWjq5w.js → protocol-Cr81vFSQ.js} +3 -3
  83. package/dist/{record-bindings-D4TuMzHs.js → record-bindings-DEJtmo3p.js} +67 -107
  84. package/dist/record-bindings-ehjnCDHt.cjs +1 -0
  85. package/dist/{region-binding-workflow-BNasF5kz.js → region-binding-workflow-CBg0l_tj.js} +1 -1
  86. package/dist/{region-binding-workflow-O2Cni3mF.cjs → region-binding-workflow-D05tOYn3.cjs} +1 -1
  87. package/dist/report-encoding-worker.cjs +1 -1
  88. package/dist/report-encoding-worker.js +1 -1
  89. package/dist/{report-params-B1RzkhJj.js → report-params-D9tBuM9B.js} +1 -1
  90. package/dist/{report-params-WDGrA4oP.cjs → report-params-VTg8MoCp.cjs} +1 -1
  91. package/dist/runtime-CDA6d263.cjs +1 -0
  92. package/dist/runtime-CEMvybO7.js +170 -0
  93. package/dist/sbom.cdx.json +1 -1
  94. package/dist/server/node.d.cts +75 -7
  95. package/dist/server/node.d.ts +75 -7
  96. package/dist/server-node.cjs +4 -4
  97. package/dist/server-node.js +2692 -1990
  98. package/dist/server.cjs +1 -1
  99. package/dist/server.d.cts +243 -28
  100. package/dist/server.d.ts +243 -28
  101. package/dist/server.js +28 -28
  102. package/dist/sha256-BDQ1Qk7A.js +158 -0
  103. package/dist/sha256-DgZAKXqI.cjs +1 -0
  104. package/dist/style.css +1 -1
  105. package/dist/template-bindings-Cg5oBLFT.cjs +1 -0
  106. package/dist/template-bindings-TKnXM7ll.js +62 -0
  107. package/dist/{template-catalog-wT1fNeAP.js → template-catalog-CmbWOJqy.js} +16 -16
  108. package/dist/{template-catalog-Dua8h9ZA.cjs → template-catalog-Utu4GP09.cjs} +1 -1
  109. package/dist/{template-fragments-BajTajb4.cjs → template-fragments-C_zSHJAa.cjs} +1 -1
  110. package/dist/{template-fragments-DmX5XK4N.js → template-fragments-DWgo9tlZ.js} +2 -2
  111. package/dist/{template-outline-BwRV_eRo.cjs → template-outline-DWkzZXVC.cjs} +1 -1
  112. package/dist/{template-outline-cnWfT_LK.js → template-outline-DiADphlq.js} +1 -1
  113. package/dist/{template-registry-u11fPd8D.js → template-registry-BIhIHOab.js} +319 -314
  114. package/dist/template-registry-DzWswQI5.cjs +1 -0
  115. package/dist/vue/async.d.cts +528 -33
  116. package/dist/vue/async.d.ts +528 -33
  117. package/dist/vue/index.d.cts +616 -64
  118. package/dist/vue/index.d.ts +616 -64
  119. package/dist/vue-async.cjs +1 -1
  120. package/dist/vue-async.js +3 -3
  121. package/dist/vue.cjs +1 -1
  122. package/dist/vue.js +94 -89
  123. package/dist/{workbook-session-DN5LSA5C.cjs → workbook-session-B94EwVa_.cjs} +1 -1
  124. package/dist/{workbook-session-B8pNW24X.js → workbook-session-BoScoOg-.js} +2 -2
  125. package/dist/worker.cjs +1 -1
  126. package/dist/worker.d.cts +75 -7
  127. package/dist/worker.d.ts +75 -7
  128. package/dist/worker.js +4 -4
  129. package/dist/xlsx.cjs +4 -4
  130. package/dist/xlsx.d.cts +120 -13
  131. package/dist/xlsx.d.ts +120 -13
  132. package/dist/xlsx.js +313 -279
  133. package/package.json +1 -1
  134. package/dist/ParamEditor-B5UZRgxv.cjs +0 -1
  135. package/dist/ParamEditor-DNNARyeB.js +0 -594
  136. package/dist/ReportBatchPanel-Ctvs2t_9.cjs +0 -1
  137. package/dist/ReportPreview-BdQawRh0.js +0 -4879
  138. package/dist/ReportPreview-CJC_-j2I.cjs +0 -6
  139. package/dist/RuleEditor-DkRjOLlr.js +0 -2141
  140. package/dist/RuleEditor-h5anGsDB.cjs +0 -1
  141. package/dist/assets-BIMVwjQe.js +0 -231
  142. package/dist/assets-Dfs2ElxI.cjs +0 -1
  143. package/dist/component-tree-Ca6YYfHq.js +0 -61
  144. package/dist/component-tree-DkGLEfZC.cjs +0 -1
  145. package/dist/computed-BW5a8QFk.js +0 -612
  146. package/dist/computed-C2GD3XcE.cjs +0 -1
  147. package/dist/config-Dg_o8e7m.cjs +0 -1
  148. package/dist/config-XQ4qrQ7Q.js +0 -844
  149. package/dist/designer-D9XAxqSc.js +0 -5178
  150. package/dist/designer-uCDo5XSK.cjs +0 -2
  151. package/dist/drill-ByN8COs_.cjs +0 -1
  152. package/dist/drill-CKW3Xtfa.js +0 -145
  153. package/dist/json-snapshot-D7PE1NsU.cjs +0 -2
  154. package/dist/json-snapshot-DYmEe3sO.js +0 -1779
  155. package/dist/matrix-JLAXlux-.js +0 -302
  156. package/dist/matrix-gTHpDTGm.cjs +0 -1
  157. package/dist/param-validation-C3HlcLLO.cjs +0 -1
  158. package/dist/param-validation-Do7Eg8Zv.js +0 -181
  159. package/dist/record-bindings-B86Sur_y.cjs +0 -1
  160. package/dist/runtime-DakRXui3.js +0 -170
  161. package/dist/runtime-dL5ygIfa.cjs +0 -1
  162. package/dist/sha256-BshdOkCC.cjs +0 -1
  163. package/dist/sha256-DTG-Gq8i.js +0 -157
  164. package/dist/template-bindings-C2SpvsMU.js +0 -58
  165. package/dist/template-bindings-CEtWyiLX.cjs +0 -1
  166. package/dist/template-registry-CpysHAxy.cjs +0 -1
  167. package/dist/tree-CLpxYbKa.cjs +0 -1
  168. package/dist/tree-DNJorJUf.js +0 -172
@@ -1,2141 +0,0 @@
1
- import { ref as I, computed as P, watch as se, defineComponent as re, openBlock as d, createElementBlock as o, createElementVNode as a, withDirectives as $, isRef as oe, vModelCheckbox as ie, unref as l, createTextVNode as f, toDisplayString as t, Fragment as w, renderList as D, vModelSelect as K, vModelText as j, createCommentVNode as L, resolveComponent as Se, normalizeClass as ve, createVNode as ge, createBlock as Me, vShow as De } from "vue";
2
- import { i as ce, v as xe, e as Re } from "./computed-BW5a8QFk.js";
3
- import { u as ye, D as Ee } from "./designer-D9XAxqSc.js";
4
- import { u as ue } from "./useLocalDraft-BnhcxXk_.js";
5
- import { c as Le } from "./matrix-JLAXlux-.js";
6
- import { v as fe } from "./template-registry-u11fPd8D.js";
7
- import { c as Ke } from "./tree-DNJorJUf.js";
8
- import { _ as me } from "./_plugin-vue_export-helper-8SL1F89S.js";
9
- function he(e, A = /* @__PURE__ */ new Set()) {
10
- return typeof e == "string" || ("field" in e && e.field && A.add(e.field), "weightField" in e && e.weightField && A.add(e.weightField), "args" in e && e.args.forEach((x) => he(x, A))), A;
11
- }
12
- function ke(e, A) {
13
- return typeof e == "string" ? e : "value" in e ? e.value === null ? A.null : String(e.value) : "aggregate" in e ? `${A[e.aggregate]}(${e.field ?? A.allRows})` : "field" in e ? e.field : `${A[e.op]}(${e.args.map((x) => ke(x, A)).join(", ")})`;
14
- }
15
- function Ne(e, A, x) {
16
- const W = I("");
17
- function k(C) {
18
- const V = e.list.columns.find((T) => T.field === C)?.format;
19
- return V && "digits" in V && V.digits !== void 0 ? `${V.digits} ${x.value.digits}` : void 0;
20
- }
21
- const b = P(() => {
22
- const C = /* @__PURE__ */ new Map();
23
- for (const V of e.datasetSchema?.fields ?? []) C.set(V.field, {
24
- field: V.field,
25
- label: V.label ?? V.field,
26
- meta: [V.type, V.unit, k(V.field)].filter(Boolean).join(" · ")
27
- });
28
- for (const V of e.list.columns) C.has(V.field) || C.set(V.field, { field: V.field, label: V.header || V.field, meta: V.semanticRole ?? "" });
29
- return [...C.values()];
30
- }), s = P(() => {
31
- const C = W.value.trim().toLocaleLowerCase();
32
- return b.value.filter((V) => `${V.field} ${V.label} ${V.meta}`.toLocaleLowerCase().includes(C));
33
- }), y = P(() => ke(A.value.expression, x.value)), U = P(() => {
34
- const C = [...he(A.value.expression)];
35
- return (e.datasets?.[e.list.dataset] ?? []).slice(0, 5).map((V, T) => ({
36
- row: T + 1,
37
- values: C.map((R) => `${R} = ${V[R] == null ? x.value.null : String(V[R])}`).join(" · ")
38
- }));
39
- });
40
- return { query: W, matches: s, fieldWindow: P(() => s.value.slice(0, 50)), expression: y, sources: U };
41
- }
42
- const te = (e) => JSON.parse(JSON.stringify(e));
43
- function Te(e, A) {
44
- const x = I(!1), W = I(""), k = I({
45
- dataset: "",
46
- parentKey: "",
47
- foreignKey: "",
48
- columns: []
49
- }), b = I({
50
- rowFields: [],
51
- columnFields: [],
52
- measures: []
53
- }), s = I({ input: "flat", idField: "id", parentField: "parentId", labelField: "", parentValues: "source" }), y = ue(() => ({ enabled: x.value, detail: k.value, matrix: b.value, tree: s.value }));
54
- let U;
55
- const C = I(), V = P(() => [
56
- .../* @__PURE__ */ new Set([
57
- ...Object.keys(e.datasets ?? {}),
58
- ...Object.keys(e.datasetSchemas ?? {})
59
- ])
60
- ]), T = P(
61
- () => G(e.list.dataset, e.datasetSchema)
62
- ), R = P(() => G(k.value.dataset));
63
- function G(c, F) {
64
- const E = /* @__PURE__ */ new Map();
65
- for (const u of (F ?? e.datasetSchemas?.[c])?.fields ?? [])
66
- E.set(u.field, u.label ?? u.field);
67
- const M = e.datasets?.[c]?.[0];
68
- for (const u of Object.keys(M ?? {}))
69
- E.has(u) || E.set(u, u);
70
- if (c === e.list.dataset)
71
- for (const u of e.list.columns)
72
- E.has(u.field) || E.set(u.field, u.header || u.field);
73
- return [...E].map(([u, i]) => ({ field: u, label: i }));
74
- }
75
- function H() {
76
- if (U === JSON.stringify(e.list)) {
77
- U = void 0;
78
- return;
79
- }
80
- x.value = !!e.list[e.mode];
81
- const c = V.value.find((F) => F !== e.list.dataset) ?? "";
82
- k.value = te(
83
- e.list.detail ?? {
84
- dataset: c,
85
- parentKey: e.list.rowKey ?? e.datasetSchema?.rowKey ?? T.value[0]?.field ?? "",
86
- foreignKey: "",
87
- columns: [],
88
- header: !0,
89
- unmatched: "error"
90
- }
91
- ), b.value = te(
92
- e.list.matrix ?? {
93
- rowFields: [],
94
- columnFields: [],
95
- measures: [],
96
- totals: !0
97
- }
98
- ), b.value.measures = b.value.measures.map((F) => ({ ...F, numeric: F.numeric ?? "number" })), s.value = te(e.list.tree ?? { input: "flat", idField: e.list.rowKey ?? "id", parentField: "parentId", childrenField: "children", labelField: e.list.columns[0]?.field ?? "", parentValues: "source", orphan: "error", indentMm: 3, maxRows: 1e5, maxDepth: 64 }), W.value = "", C.value = void 0, y.accept();
99
- }
100
- se(() => [e.mode, e.list.dataset, e.list[e.mode]], H, { immediate: !0 });
101
- function S(c) {
102
- k.value.dataset = c, k.value.columns = [], k.value.foreignKey = R.value[0]?.field ?? "", k.value.rowKey = e.datasetSchemas?.[c]?.rowKey;
103
- }
104
- function r(c, F) {
105
- if (F && !k.value.columns.some((E) => E.field === c)) {
106
- const E = e.datasetSchemas?.[k.value.dataset]?.fields.find((M) => M.field === c);
107
- k.value.columns.push({
108
- field: c,
109
- header: R.value.find((M) => M.field === c)?.label ?? c,
110
- widthMm: 30,
111
- align: "auto",
112
- semanticRole: E?.semanticRole,
113
- editable: !1
114
- });
115
- } else F || (k.value.columns = k.value.columns.filter(
116
- (E) => E.field !== c
117
- ));
118
- }
119
- function n(c, F, E) {
120
- if (e.readonly) return;
121
- const M = b.value[c];
122
- m(c, E ? [.../* @__PURE__ */ new Set([...M, F])] : M.filter((u) => u !== F));
123
- }
124
- function m(c, F) {
125
- const E = b.value[c];
126
- b.value[c] = F;
127
- const M = b.value.hierarchy?.[c === "rowFields" ? "row" : "column"];
128
- M && (M.sort && (M.sort = F.map((u) => M.sort?.[E.indexOf(u)] ?? "source")), M.labels && (M.labels = F.map((u) => M.labels?.[E.indexOf(u)] ?? u)), M.subtotals && (M.subtotals = M.subtotals.map((u) => F.indexOf(E[u - 1]) + 1).filter((u) => u > 0 && u < F.length)));
129
- }
130
- function v(c, F, E) {
131
- const M = [...b.value[c]], u = F + E;
132
- e.readonly || F < 0 || F >= M.length || u < 0 || u >= M.length || ([M[F], M[u]] = [M[u], M[F]], m(c, M));
133
- }
134
- function B() {
135
- b.value.measures = [
136
- ...b.value.measures,
137
- { field: T.value[0]?.field ?? "", op: "sum", numeric: "number" }
138
- ];
139
- }
140
- function Z(c) {
141
- b.value.measures = b.value.measures.filter(
142
- (F, E) => E !== c
143
- );
144
- }
145
- function ee(c) {
146
- e.readonly || (c ? b.value.hierarchy ??= {} : delete b.value.hierarchy);
147
- }
148
- function Q(c, F, E) {
149
- if (e.readonly || !b.value.hierarchy) return;
150
- const M = b.value.hierarchy[c] ??= {}, i = (c === "row" ? b.value.rowFields : b.value.columnFields).map((J, O) => M.sort?.[O] ?? "source");
151
- i[F] = E, M.sort = i;
152
- }
153
- function Y(c, F, E) {
154
- if (e.readonly || !b.value.hierarchy) return;
155
- const M = b.value.hierarchy[c] ??= {};
156
- M.subtotals = [...new Set(E ? [...M.subtotals ?? [], F] : (M.subtotals ?? []).filter((u) => u !== F))];
157
- }
158
- function le() {
159
- s.value.aggregates = [...s.value.aggregates ?? [], { field: T.value.find((c) => c.field !== s.value.labelField && c.field !== s.value.idField)?.field ?? "", op: "sum", numeric: "number" }];
160
- }
161
- function X(c) {
162
- s.value.aggregates = s.value.aggregates?.filter((F, E) => E !== c);
163
- }
164
- function de() {
165
- W.value = "", C.value = void 0;
166
- try {
167
- const c = e.datasets?.[e.list.dataset] ?? [];
168
- if (!c.length) throw new Error(e.messages.noData);
169
- if (c.length > 1e3) throw new Error(e.messages.treeBudget);
170
- const F = Ke(c, { ...s.value, aggregates: s.value.parentValues === "leaf-aggregate" ? s.value.aggregates : void 0, maxRows: 1e3 }), E = e.list.columns.slice(0, 5);
171
- C.value = { columns: E.map((M) => M.header), rows: F.entries.slice(0, 8).map((M) => E.map((u) => u.field === s.value.labelField ? `${" ".repeat(Math.min(6, M.depth))}${M.row[u.field] ?? ""}` : M.row[u.field])) };
172
- } catch (c) {
173
- W.value = c instanceof Error ? c.message : String(c);
174
- }
175
- }
176
- function p(c) {
177
- if (!x.value) {
178
- delete c.tree;
179
- return;
180
- }
181
- c.tree = te(s.value), c.tree.parentValues !== "leaf-aggregate" && delete c.tree.aggregates, c.rowKey = c.tree.idField, delete c.detail, delete c.matrix, delete c.groupBy, delete c.groups, delete c.rowVisibleWhen;
182
- }
183
- function _() {
184
- W.value = "", C.value = void 0;
185
- try {
186
- const c = e.datasets?.[e.list.dataset] ?? [];
187
- if (!c.length) throw new Error(e.messages.noData);
188
- const F = Le(c.slice(0, 1e3), {
189
- ...b.value,
190
- maxInputRows: 1e3
191
- });
192
- C.value = {
193
- columns: F.columns.slice(0, 5).map((E) => E.header),
194
- rows: F.rows.slice(0, 5).map(
195
- (E) => F.columns.slice(0, 5).map((M) => E[M.field])
196
- )
197
- };
198
- } catch (c) {
199
- W.value = c instanceof Error ? c.message : String(c);
200
- }
201
- }
202
- function ae() {
203
- if (e.readonly) return;
204
- const c = te(e.list);
205
- e.mode === "tree" ? p(c) : e.mode === "detail" ? x.value ? (c.detail = te(k.value), delete c.matrix, delete c.tree) : delete c.detail : x.value ? (c.matrix = te(b.value), delete c.detail, delete c.tree, delete c.groups, delete c.groupBy, delete c.grandTotal) : delete c.matrix;
206
- const F = fe({ pages: [{ widthMm: Math.max(1, c.leftMm + c.widthMm), heightMm: 297, components: [c] }] });
207
- if (!F.ok) {
208
- W.value = F.errors.slice(0, 3).map((E) => E.message).join(";");
209
- return;
210
- }
211
- e.accept && !e.accept(c) || (U = JSON.stringify(c), e.accept || A(c), y.accept());
212
- }
213
- return ye({ key: () => `${e.recoveryKey ?? "rules:0:0"}:${e.mode}`, baseline: () => JSON.stringify(e.list[e.mode]), pending: () => y.pending.value, snapshot: () => JSON.stringify({ enabled: x.value, detail: k.value, matrix: b.value, tree: s.value, baseline: y.baseline.value }), restore(c) {
214
- const F = JSON.parse(c);
215
- x.value = F.enabled, k.value = F.detail, b.value = F.matrix, s.value = F.tree, y.baseline.value = F.baseline;
216
- } }), {
217
- enabled: x,
218
- pendingLocalChanges: y.pending,
219
- detail: k,
220
- matrix: b,
221
- tree: s,
222
- datasets: V,
223
- sourceFields: T,
224
- childFields: R,
225
- error: W,
226
- preview: C,
227
- chooseDataset: S,
228
- toggleChildColumn: r,
229
- toggleDimension: n,
230
- moveDimension: v,
231
- addMeasure: B,
232
- removeMeasure: Z,
233
- checkMatrix: _,
234
- toggleHierarchy: ee,
235
- setDimensionSort: Q,
236
- toggleMatrixSubtotal: Y,
237
- addTreeAggregate: le,
238
- removeTreeAggregate: X,
239
- checkTree: de,
240
- apply: ae
241
- };
242
- }
243
- const Oe = { class: "mr-data-layout" }, Be = { class: "mr-data-layout__check" }, Ae = ["disabled"], Ie = { class: "mr-data-layout__hint" }, Ge = ["aria-label", "value", "disabled"], We = {
244
- value: "",
245
- disabled: ""
246
- }, Je = ["value"], He = { class: "mr-data-layout__pair" }, je = ["aria-label", "disabled"], ze = ["value"], Pe = ["aria-label", "disabled"], qe = {
247
- value: "",
248
- disabled: ""
249
- }, Ze = ["value"], Qe = ["aria-label", "disabled"], Xe = { value: void 0 }, Ye = ["value"], pe = { class: "mr-data-layout__choices" }, _e = ["checked", "disabled", "onChange"], el = ["aria-label", "disabled"], ll = { class: "mr-data-layout__pair" }, al = ["aria-label", "disabled"], tl = { value: "error" }, sl = { value: "ignore" }, nl = { class: "mr-data-layout__check" }, il = ["disabled"], dl = { class: "mr-data-layout__hint" }, ol = { class: "mr-data-layout__pair" }, ul = ["aria-label", "disabled"], rl = { value: "flat" }, cl = { value: "nested" }, ml = ["aria-label", "disabled"], bl = ["value"], vl = { class: "mr-data-layout__pair" }, gl = { key: 0 }, yl = ["aria-label", "disabled"], fl = ["value"], hl = { key: 1 }, kl = ["aria-label", "disabled"], $l = ["aria-label", "disabled"], wl = ["value"], Vl = { class: "mr-data-layout__pair" }, Cl = ["aria-label", "disabled"], Ul = { key: 0 }, Fl = ["aria-label", "disabled"], Sl = { value: "error" }, Ml = { value: "root" }, Dl = ["aria-label", "disabled"], xl = { value: "source" }, Rl = { value: "leaf-aggregate" }, El = { class: "mr-data-layout__pair" }, Ll = ["onUpdate:modelValue", "aria-label", "disabled"], Kl = ["value"], Nl = ["onUpdate:modelValue", "aria-label", "disabled"], Tl = ["value"], Ol = { key: 0 }, Bl = ["onUpdate:modelValue", "aria-label", "disabled"], Al = ["value"], Il = { class: "mr-data-layout__pair" }, Gl = ["onUpdate:modelValue", "aria-label", "disabled"], Wl = { value: "number" }, Jl = { value: "decimal" }, Hl = ["onUpdate:modelValue", "aria-label", "disabled"], jl = ["disabled", "onClick"], zl = ["disabled"], Pl = { class: "mr-data-layout__pair" }, ql = ["aria-label", "disabled"], Zl = ["aria-label", "disabled"], Ql = { class: "mr-data-layout__hint" }, Xl = { class: "mr-data-layout__hint" }, Yl = ["checked", "disabled", "onChange"], pl = { class: "mr-data-layout__pair" }, _l = ["aria-label", "onUpdate:modelValue", "disabled"], ea = ["value"], la = ["aria-label", "onUpdate:modelValue", "disabled"], aa = ["value"], ta = ["aria-label", "onUpdate:modelValue", "disabled", "placeholder"], sa = { key: 0 }, na = ["aria-label", "onUpdate:modelValue", "disabled"], ia = ["value"], da = { class: "mr-data-layout__pair" }, oa = ["aria-label", "onUpdate:modelValue", "disabled"], ua = { value: "number" }, ra = { value: "decimal" }, ca = ["aria-label", "onUpdate:modelValue", "disabled"], ma = ["disabled", "onClick"], ba = ["disabled"], va = { class: "mr-data-layout__check" }, ga = ["disabled"], ya = { class: "mr-data-layout__check" }, fa = ["checked", "disabled"], ha = { class: "mr-data-layout__hint" }, ka = ["aria-label", "disabled"], $a = ["aria-label", "value", "disabled", "onChange"], wa = { value: "source" }, Va = { value: "asc" }, Ca = { value: "desc" }, Ua = ["aria-label", "disabled", "onClick"], Fa = ["aria-label", "disabled", "onClick"], Sa = {
250
- key: 0,
251
- class: "mr-data-layout__check"
252
- }, Ma = ["checked", "disabled", "onChange"], Da = { class: "mr-data-layout__pair" }, xa = ["disabled"], Ra = ["disabled"], Ea = { class: "mr-data-layout__actions" }, La = ["disabled"], Ka = ["disabled"], Na = ["disabled"], Ta = {
253
- key: 3,
254
- class: "mr-data-layout__preview"
255
- }, Oa = {
256
- key: 4,
257
- class: "mr-data-layout__error",
258
- role: "alert"
259
- }, Ba = /* @__PURE__ */ re({
260
- __name: "RuleDataLayout",
261
- props: {
262
- recoveryKey: {},
263
- list: {},
264
- accept: { type: Function },
265
- mode: {},
266
- datasets: {},
267
- datasetSchema: {},
268
- datasetSchemas: {},
269
- readonly: { type: Boolean },
270
- messages: {}
271
- },
272
- emits: ["change", "dirty"],
273
- setup(e, { emit: A }) {
274
- const x = e, W = A, k = Te(x, (S) => W("change", S)), {
275
- enabled: b,
276
- detail: s,
277
- matrix: y,
278
- tree: U,
279
- datasets: C,
280
- sourceFields: V,
281
- childFields: T,
282
- error: R,
283
- preview: G
284
- } = k;
285
- se([k.pendingLocalChanges, b, s, y, U], () => W("dirty", k.pendingLocalChanges.value), { immediate: !0, deep: !0, flush: "sync" });
286
- const H = ce();
287
- return (S, r) => (d(), o("div", Oe, [
288
- a("label", Be, [
289
- $(a("input", {
290
- "onUpdate:modelValue": r[0] || (r[0] = (n) => oe(b) ? b.value = n : null),
291
- type: "checkbox",
292
- disabled: e.readonly
293
- }, null, 8, Ae), [
294
- [ie, l(b)]
295
- ]),
296
- f(t(e.messages.enabled) + t(e.messages[e.mode]), 1)
297
- ]),
298
- l(b) && e.mode === "detail" ? (d(), o(w, { key: 0 }, [
299
- a("p", Ie, t(e.messages.detailHint), 1),
300
- a("label", null, [
301
- f(t(e.messages.childDataset), 1),
302
- a("select", {
303
- "aria-label": e.messages.childDataset,
304
- value: l(s).dataset,
305
- disabled: e.readonly,
306
- onChange: r[1] || (r[1] = (n) => l(k).chooseDataset(n.target.value))
307
- }, [
308
- a("option", We, t(e.messages.select), 1),
309
- (d(!0), o(w, null, D(l(C), (n) => (d(), o("option", {
310
- key: n,
311
- value: n
312
- }, t(n), 9, Je))), 128))
313
- ], 40, Ge)
314
- ]),
315
- a("div", He, [
316
- a("label", null, [
317
- f(t(e.messages.parentKey), 1),
318
- $(a("select", {
319
- "aria-label": e.messages.parentKey,
320
- "onUpdate:modelValue": r[2] || (r[2] = (n) => l(s).parentKey = n),
321
- disabled: e.readonly
322
- }, [
323
- (d(!0), o(w, null, D(l(V), (n) => (d(), o("option", {
324
- key: n.field,
325
- value: n.field
326
- }, t(n.label), 9, ze))), 128))
327
- ], 8, je), [
328
- [K, l(s).parentKey]
329
- ])
330
- ]),
331
- a("label", null, [
332
- f(t(e.messages.foreignKey), 1),
333
- $(a("select", {
334
- "aria-label": e.messages.foreignKey,
335
- "onUpdate:modelValue": r[3] || (r[3] = (n) => l(s).foreignKey = n),
336
- disabled: e.readonly
337
- }, [
338
- a("option", qe, t(e.messages.select), 1),
339
- (d(!0), o(w, null, D(l(T), (n) => (d(), o("option", {
340
- key: n.field,
341
- value: n.field
342
- }, t(n.label), 9, Ze))), 128))
343
- ], 8, Pe), [
344
- [K, l(s).foreignKey]
345
- ])
346
- ])
347
- ]),
348
- a("label", null, [
349
- f(t(e.messages.rowKey), 1),
350
- $(a("select", {
351
- "aria-label": e.messages.rowKey,
352
- "onUpdate:modelValue": r[4] || (r[4] = (n) => l(s).rowKey = n),
353
- disabled: e.readonly
354
- }, [
355
- a("option", Xe, t(e.messages.noRowKey), 1),
356
- (d(!0), o(w, null, D(l(T), (n) => (d(), o("option", {
357
- key: n.field,
358
- value: n.field
359
- }, t(n.label), 9, Ye))), 128))
360
- ], 8, Qe), [
361
- [K, l(s).rowKey]
362
- ])
363
- ]),
364
- a("fieldset", pe, [
365
- a("legend", null, t(e.messages.childColumns), 1),
366
- (d(!0), o(w, null, D(l(T), (n) => (d(), o("label", {
367
- key: n.field
368
- }, [
369
- a("input", {
370
- type: "checkbox",
371
- checked: l(s).columns.some((m) => m.field === n.field),
372
- disabled: e.readonly,
373
- onChange: (m) => l(k).toggleChildColumn(
374
- n.field,
375
- m.target.checked
376
- )
377
- }, null, 40, _e),
378
- f(t(n.label), 1)
379
- ]))), 128))
380
- ]),
381
- a("label", null, [
382
- f(t(e.messages.title), 1),
383
- $(a("input", {
384
- "aria-label": e.messages.title,
385
- "onUpdate:modelValue": r[5] || (r[5] = (n) => l(s).label = n),
386
- disabled: e.readonly
387
- }, null, 8, el), [
388
- [j, l(s).label]
389
- ])
390
- ]),
391
- a("div", ll, [
392
- a("label", null, [
393
- f(t(e.messages.unmatched), 1),
394
- $(a("select", {
395
- "aria-label": e.messages.unmatched,
396
- "onUpdate:modelValue": r[6] || (r[6] = (n) => l(s).unmatched = n),
397
- disabled: e.readonly
398
- }, [
399
- a("option", tl, t(e.messages.error), 1),
400
- a("option", sl, t(e.messages.ignore), 1)
401
- ], 8, al), [
402
- [K, l(s).unmatched]
403
- ])
404
- ]),
405
- a("label", nl, [
406
- $(a("input", {
407
- "onUpdate:modelValue": r[7] || (r[7] = (n) => l(s).header = n),
408
- type: "checkbox",
409
- disabled: e.readonly
410
- }, null, 8, il), [
411
- [ie, l(s).header]
412
- ]),
413
- f(t(e.messages.childHeader), 1)
414
- ])
415
- ])
416
- ], 64)) : l(b) && e.mode === "tree" ? (d(), o(w, { key: 1 }, [
417
- a("p", dl, t(e.messages.treeHint), 1),
418
- a("div", ol, [
419
- a("label", null, [
420
- f(t(e.messages.treeInput), 1),
421
- $(a("select", {
422
- "onUpdate:modelValue": r[8] || (r[8] = (n) => l(U).input = n),
423
- "aria-label": e.messages.treeInput,
424
- disabled: e.readonly
425
- }, [
426
- a("option", rl, t(e.messages.treeFlat), 1),
427
- a("option", cl, t(e.messages.treeNested), 1)
428
- ], 8, ul), [
429
- [K, l(U).input]
430
- ])
431
- ]),
432
- a("label", null, [
433
- f(t(e.messages.treeId), 1),
434
- $(a("select", {
435
- "onUpdate:modelValue": r[9] || (r[9] = (n) => l(U).idField = n),
436
- "aria-label": e.messages.treeId,
437
- disabled: e.readonly
438
- }, [
439
- (d(!0), o(w, null, D(l(V), (n) => (d(), o("option", {
440
- key: n.field,
441
- value: n.field
442
- }, t(n.label), 9, bl))), 128))
443
- ], 8, ml), [
444
- [K, l(U).idField]
445
- ])
446
- ])
447
- ]),
448
- a("div", vl, [
449
- l(U).input === "flat" ? (d(), o("label", gl, [
450
- f(t(e.messages.treeParent), 1),
451
- $(a("select", {
452
- "onUpdate:modelValue": r[10] || (r[10] = (n) => l(U).parentField = n),
453
- "aria-label": e.messages.treeParent,
454
- disabled: e.readonly
455
- }, [
456
- (d(!0), o(w, null, D(l(V), (n) => (d(), o("option", {
457
- key: n.field,
458
- value: n.field
459
- }, t(n.label), 9, fl))), 128))
460
- ], 8, yl), [
461
- [K, l(U).parentField]
462
- ])
463
- ])) : (d(), o("label", hl, [
464
- f(t(e.messages.treeChildren), 1),
465
- $(a("input", {
466
- "onUpdate:modelValue": r[11] || (r[11] = (n) => l(U).childrenField = n),
467
- "aria-label": e.messages.treeChildren,
468
- disabled: e.readonly,
469
- placeholder: "children"
470
- }, null, 8, kl), [
471
- [j, l(U).childrenField]
472
- ])
473
- ])),
474
- a("label", null, [
475
- f(t(e.messages.treeLabel), 1),
476
- $(a("select", {
477
- "onUpdate:modelValue": r[12] || (r[12] = (n) => l(U).labelField = n),
478
- "aria-label": e.messages.treeLabel,
479
- disabled: e.readonly
480
- }, [
481
- (d(!0), o(w, null, D(e.list.columns.filter((n) => !n.hidden), (n) => (d(), o("option", {
482
- key: n.field,
483
- value: n.field
484
- }, t(n.header), 9, wl))), 128))
485
- ], 8, $l), [
486
- [K, l(U).labelField]
487
- ])
488
- ])
489
- ]),
490
- a("div", Vl, [
491
- a("label", null, [
492
- f(t(e.messages.treeIndent), 1),
493
- $(a("input", {
494
- "onUpdate:modelValue": r[13] || (r[13] = (n) => l(U).indentMm = n),
495
- "aria-label": e.messages.treeIndent,
496
- type: "number",
497
- min: "0",
498
- max: "20",
499
- step: "0.5",
500
- disabled: e.readonly
501
- }, null, 8, Cl), [
502
- [
503
- j,
504
- l(U).indentMm,
505
- void 0,
506
- { number: !0 }
507
- ]
508
- ])
509
- ]),
510
- l(U).input === "flat" ? (d(), o("label", Ul, [
511
- f(t(e.messages.treeOrphan), 1),
512
- $(a("select", {
513
- "onUpdate:modelValue": r[14] || (r[14] = (n) => l(U).orphan = n),
514
- "aria-label": e.messages.treeOrphan,
515
- disabled: e.readonly
516
- }, [
517
- a("option", Sl, t(e.messages.error), 1),
518
- a("option", Ml, t(e.messages.treeAsRoot), 1)
519
- ], 8, Fl), [
520
- [K, l(U).orphan]
521
- ])
522
- ])) : L("", !0)
523
- ]),
524
- a("label", null, [
525
- f(t(e.messages.treeValues), 1),
526
- $(a("select", {
527
- "onUpdate:modelValue": r[15] || (r[15] = (n) => l(U).parentValues = n),
528
- "aria-label": e.messages.treeValues,
529
- disabled: e.readonly
530
- }, [
531
- a("option", xl, t(e.messages.treeSource), 1),
532
- a("option", Rl, t(e.messages.treeLeaves), 1)
533
- ], 8, Dl), [
534
- [K, l(U).parentValues]
535
- ])
536
- ]),
537
- l(U).parentValues === "leaf-aggregate" ? (d(), o(w, { key: 0 }, [
538
- (d(!0), o(w, null, D(l(U).aggregates, (n, m) => (d(), o("div", {
539
- key: m,
540
- class: "mr-data-layout__measure"
541
- }, [
542
- a("div", El, [
543
- a("label", null, [
544
- f(t(e.messages.measure), 1),
545
- $(a("select", {
546
- "onUpdate:modelValue": (v) => n.field = v,
547
- "aria-label": e.messages.measure,
548
- disabled: e.readonly
549
- }, [
550
- (d(!0), o(w, null, D(l(V), (v) => (d(), o("option", {
551
- key: v.field,
552
- value: v.field
553
- }, t(v.label), 9, Kl))), 128))
554
- ], 8, Ll), [
555
- [K, n.field]
556
- ])
557
- ]),
558
- a("label", null, [
559
- f(t(e.messages.aggregate), 1),
560
- $(a("select", {
561
- "onUpdate:modelValue": (v) => n.op = v,
562
- "aria-label": e.messages.aggregate,
563
- disabled: e.readonly
564
- }, [
565
- (d(!0), o(w, null, D(l(H).aggregates, (v) => (d(), o("option", {
566
- key: v,
567
- value: v
568
- }, t(e.messages[v]), 9, Tl))), 128))
569
- ], 8, Nl), [
570
- [K, n.op]
571
- ])
572
- ])
573
- ]),
574
- n.op === "weightedAvg" ? (d(), o("label", Ol, [
575
- f(t(e.messages.weight), 1),
576
- $(a("select", {
577
- "onUpdate:modelValue": (v) => n.weightField = v,
578
- "aria-label": e.messages.weight,
579
- disabled: e.readonly
580
- }, [
581
- (d(!0), o(w, null, D(l(V), (v) => (d(), o("option", {
582
- key: v.field,
583
- value: v.field
584
- }, t(v.label), 9, Al))), 128))
585
- ], 8, Bl), [
586
- [K, n.weightField]
587
- ])
588
- ])) : L("", !0),
589
- a("div", Il, [
590
- a("label", null, [
591
- f(t(e.messages.numeric), 1),
592
- $(a("select", {
593
- "onUpdate:modelValue": (v) => n.numeric = v,
594
- "aria-label": e.messages.numeric,
595
- disabled: e.readonly
596
- }, [
597
- a("option", Wl, t(e.messages.number), 1),
598
- a("option", Jl, t(e.messages.decimal), 1)
599
- ], 8, Gl), [
600
- [K, n.numeric]
601
- ])
602
- ]),
603
- a("label", null, [
604
- f(t(e.messages.digits), 1),
605
- $(a("input", {
606
- "onUpdate:modelValue": (v) => n.digits = v,
607
- "aria-label": e.messages.digits,
608
- type: "number",
609
- min: "0",
610
- max: "100",
611
- disabled: e.readonly
612
- }, null, 8, Hl), [
613
- [
614
- j,
615
- n.digits,
616
- void 0,
617
- { number: !0 }
618
- ]
619
- ])
620
- ])
621
- ]),
622
- a("button", {
623
- type: "button",
624
- disabled: e.readonly,
625
- onClick: (v) => l(k).removeTreeAggregate(m)
626
- }, t(e.messages.remove), 9, jl)
627
- ]))), 128)),
628
- a("button", {
629
- type: "button",
630
- disabled: e.readonly || (l(U).aggregates?.length ?? 0) >= 32,
631
- onClick: r[16] || (r[16] = //@ts-ignore
632
- (...n) => l(k).addTreeAggregate && l(k).addTreeAggregate(...n))
633
- }, "+ " + t(e.messages.addAggregate), 9, zl)
634
- ], 64)) : L("", !0),
635
- a("details", null, [
636
- a("summary", null, t(e.messages.advanced), 1),
637
- a("div", Pl, [
638
- a("label", null, [
639
- f(t(e.messages.treeRows), 1),
640
- $(a("input", {
641
- "onUpdate:modelValue": r[17] || (r[17] = (n) => l(U).maxRows = n),
642
- "aria-label": e.messages.treeRows,
643
- type: "number",
644
- min: "1",
645
- max: "1000000",
646
- disabled: e.readonly
647
- }, null, 8, ql), [
648
- [
649
- j,
650
- l(U).maxRows,
651
- void 0,
652
- { number: !0 }
653
- ]
654
- ])
655
- ]),
656
- a("label", null, [
657
- f(t(e.messages.treeDepth), 1),
658
- $(a("input", {
659
- "onUpdate:modelValue": r[18] || (r[18] = (n) => l(U).maxDepth = n),
660
- "aria-label": e.messages.treeDepth,
661
- type: "number",
662
- min: "1",
663
- max: "256",
664
- disabled: e.readonly
665
- }, null, 8, Zl), [
666
- [
667
- j,
668
- l(U).maxDepth,
669
- void 0,
670
- { number: !0 }
671
- ]
672
- ])
673
- ])
674
- ])
675
- ]),
676
- a("p", Ql, t(e.messages.treeReadonly), 1)
677
- ], 64)) : l(b) ? (d(), o(w, { key: 2 }, [
678
- a("p", Xl, t(e.messages.matrixHint), 1),
679
- (d(), o(w, null, D(["rowFields", "columnFields"], (n) => a("fieldset", {
680
- key: n,
681
- class: "mr-data-layout__choices"
682
- }, [
683
- a("legend", null, t(e.messages[n]), 1),
684
- (d(!0), o(w, null, D(l(V), (m) => (d(), o("label", {
685
- key: m.field
686
- }, [
687
- a("input", {
688
- type: "checkbox",
689
- checked: l(y)[n].includes(m.field),
690
- disabled: e.readonly,
691
- onChange: (v) => l(k).toggleDimension(
692
- n,
693
- m.field,
694
- v.target.checked
695
- )
696
- }, null, 40, Yl),
697
- f(t(m.label), 1)
698
- ]))), 128))
699
- ])), 64)),
700
- (d(!0), o(w, null, D(l(y).measures, (n, m) => (d(), o("div", {
701
- key: m,
702
- class: "mr-data-layout__measure"
703
- }, [
704
- a("div", pl, [
705
- a("label", null, [
706
- f(t(e.messages.measure), 1),
707
- $(a("select", {
708
- "aria-label": e.messages.measure,
709
- "onUpdate:modelValue": (v) => n.field = v,
710
- disabled: e.readonly
711
- }, [
712
- (d(!0), o(w, null, D(l(V), (v) => (d(), o("option", {
713
- key: v.field,
714
- value: v.field
715
- }, t(v.label), 9, ea))), 128))
716
- ], 8, _l), [
717
- [K, n.field]
718
- ])
719
- ]),
720
- a("label", null, [
721
- f(t(e.messages.aggregate), 1),
722
- $(a("select", {
723
- "aria-label": e.messages.aggregate,
724
- "onUpdate:modelValue": (v) => n.op = v,
725
- disabled: e.readonly
726
- }, [
727
- (d(!0), o(w, null, D(l(H).aggregates, (v) => (d(), o("option", {
728
- key: v,
729
- value: v
730
- }, t(e.messages[v]), 9, aa))), 128))
731
- ], 8, la), [
732
- [K, n.op]
733
- ])
734
- ])
735
- ]),
736
- a("label", null, [
737
- f(t(e.messages.measureLabel), 1),
738
- $(a("input", {
739
- "aria-label": e.messages.measureLabel,
740
- "onUpdate:modelValue": (v) => n.label = v,
741
- disabled: e.readonly,
742
- placeholder: n.field
743
- }, null, 8, ta), [
744
- [j, n.label]
745
- ])
746
- ]),
747
- n.op === "weightedAvg" ? (d(), o("label", sa, [
748
- f(t(e.messages.weight), 1),
749
- $(a("select", {
750
- "aria-label": e.messages.weight,
751
- "onUpdate:modelValue": (v) => n.weightField = v,
752
- disabled: e.readonly
753
- }, [
754
- (d(!0), o(w, null, D(l(V), (v) => (d(), o("option", {
755
- key: v.field,
756
- value: v.field
757
- }, t(v.label), 9, ia))), 128))
758
- ], 8, na), [
759
- [K, n.weightField]
760
- ])
761
- ])) : L("", !0),
762
- a("div", da, [
763
- a("label", null, [
764
- f(t(e.messages.numeric), 1),
765
- $(a("select", {
766
- "aria-label": e.messages.numeric,
767
- "onUpdate:modelValue": (v) => n.numeric = v,
768
- disabled: e.readonly
769
- }, [
770
- a("option", ua, t(e.messages.number), 1),
771
- a("option", ra, t(e.messages.decimal), 1)
772
- ], 8, oa), [
773
- [K, n.numeric]
774
- ])
775
- ]),
776
- a("label", null, [
777
- f(t(e.messages.digits), 1),
778
- $(a("input", {
779
- "aria-label": e.messages.digits,
780
- "onUpdate:modelValue": (v) => n.digits = v,
781
- type: "number",
782
- min: "0",
783
- max: "100",
784
- disabled: e.readonly
785
- }, null, 8, ca), [
786
- [
787
- j,
788
- n.digits,
789
- void 0,
790
- { number: !0 }
791
- ]
792
- ])
793
- ])
794
- ]),
795
- a("button", {
796
- type: "button",
797
- disabled: e.readonly,
798
- onClick: (v) => l(k).removeMeasure(m)
799
- }, t(e.messages.remove), 9, ma)
800
- ]))), 128)),
801
- a("button", {
802
- type: "button",
803
- disabled: e.readonly || l(y).measures.length >= 32,
804
- onClick: r[19] || (r[19] = //@ts-ignore
805
- (...n) => l(k).addMeasure && l(k).addMeasure(...n))
806
- }, " + " + t(e.messages.addAggregate), 9, ba),
807
- a("label", va, [
808
- $(a("input", {
809
- "onUpdate:modelValue": r[20] || (r[20] = (n) => l(y).totals = n),
810
- type: "checkbox",
811
- disabled: e.readonly
812
- }, null, 8, ga), [
813
- [ie, l(y).totals]
814
- ]),
815
- f(t(e.messages.totals), 1)
816
- ]),
817
- a("details", null, [
818
- a("summary", null, t(e.messages.matrixHierarchy), 1),
819
- a("label", ya, [
820
- a("input", {
821
- type: "checkbox",
822
- checked: !!l(y).hierarchy,
823
- disabled: e.readonly,
824
- onChange: r[21] || (r[21] = (n) => l(k).toggleHierarchy(n.target.checked))
825
- }, null, 40, fa),
826
- f(t(e.messages.enabled), 1)
827
- ]),
828
- l(y).hierarchy ? (d(), o(w, { key: 0 }, [
829
- a("p", ha, t(e.messages.matrixHierarchyHint), 1),
830
- a("label", null, [
831
- f(t(e.messages.matrixEmptyLabel), 1),
832
- $(a("input", {
833
- "onUpdate:modelValue": r[22] || (r[22] = (n) => l(y).hierarchy.emptyLabel = n),
834
- "aria-label": e.messages.matrixEmptyLabel,
835
- disabled: e.readonly,
836
- placeholder: "(空)"
837
- }, null, 8, ka), [
838
- [j, l(y).hierarchy.emptyLabel]
839
- ])
840
- ]),
841
- (d(), o(w, null, D(["row", "column"], (n) => a("fieldset", {
842
- key: n,
843
- class: "mr-data-layout__choices"
844
- }, [
845
- a("legend", null, t(n === "row" ? e.messages.rowFields : e.messages.columnFields), 1),
846
- (d(!0), o(w, null, D(l(y)[n === "row" ? "rowFields" : "columnFields"], (m, v) => (d(), o("div", {
847
- key: m,
848
- class: "mr-data-layout__pair"
849
- }, [
850
- a("label", null, [
851
- f(t(m), 1),
852
- a("select", {
853
- "aria-label": `${m} · ${e.messages.matrixSort}`,
854
- value: l(y).hierarchy[n]?.sort?.[v] ?? "source",
855
- disabled: e.readonly,
856
- onChange: (B) => l(k).setDimensionSort(n, v, B.target.value)
857
- }, [
858
- a("option", wa, t(e.messages.matrixSourceOrder), 1),
859
- a("option", Va, t(e.messages.matrixAscending), 1),
860
- a("option", Ca, t(e.messages.matrixDescending), 1)
861
- ], 40, $a)
862
- ]),
863
- a("div", null, [
864
- a("button", {
865
- type: "button",
866
- "aria-label": `${m} · ${e.messages.moveUp}`,
867
- disabled: e.readonly || v === 0,
868
- onClick: (B) => l(k).moveDimension(n === "row" ? "rowFields" : "columnFields", v, -1)
869
- }, "↑", 8, Ua),
870
- a("button", {
871
- type: "button",
872
- "aria-label": `${m} · ${e.messages.moveDown}`,
873
- disabled: e.readonly || v === l(y)[n === "row" ? "rowFields" : "columnFields"].length - 1,
874
- onClick: (B) => l(k).moveDimension(n === "row" ? "rowFields" : "columnFields", v, 1)
875
- }, "↓", 8, Fa)
876
- ]),
877
- v < l(y)[n === "row" ? "rowFields" : "columnFields"].length - 1 ? (d(), o("label", Sa, [
878
- a("input", {
879
- type: "checkbox",
880
- checked: l(y).hierarchy[n]?.subtotals?.includes(v + 1) ?? !1,
881
- disabled: e.readonly,
882
- onChange: (B) => l(k).toggleMatrixSubtotal(n, v + 1, B.target.checked)
883
- }, null, 40, Ma),
884
- f(t(e.messages.matrixPrefixSubtotal), 1)
885
- ])) : L("", !0)
886
- ]))), 128))
887
- ])), 64))
888
- ], 64)) : L("", !0)
889
- ]),
890
- a("details", null, [
891
- a("summary", null, t(e.messages.widthSettings), 1),
892
- a("div", Da, [
893
- a("label", null, [
894
- f(t(e.messages.dimensionWidth), 1),
895
- $(a("input", {
896
- "onUpdate:modelValue": r[23] || (r[23] = (n) => l(y).rowWidthMm = n),
897
- type: "number",
898
- min: "1",
899
- disabled: e.readonly,
900
- placeholder: "40"
901
- }, null, 8, xa), [
902
- [
903
- j,
904
- l(y).rowWidthMm,
905
- void 0,
906
- { number: !0 }
907
- ]
908
- ])
909
- ]),
910
- a("label", null, [
911
- f(t(e.messages.measureWidth), 1),
912
- $(a("input", {
913
- "onUpdate:modelValue": r[24] || (r[24] = (n) => l(y).columnWidthMm = n),
914
- type: "number",
915
- min: "1",
916
- disabled: e.readonly,
917
- placeholder: "28"
918
- }, null, 8, Ra), [
919
- [
920
- j,
921
- l(y).columnWidthMm,
922
- void 0,
923
- { number: !0 }
924
- ]
925
- ])
926
- ])
927
- ])
928
- ])
929
- ], 64)) : L("", !0),
930
- a("div", Ea, [
931
- l(b) && e.mode === "matrix" ? (d(), o("button", {
932
- key: 0,
933
- type: "button",
934
- disabled: e.readonly,
935
- onClick: r[25] || (r[25] = //@ts-ignore
936
- (...n) => l(k).checkMatrix && l(k).checkMatrix(...n))
937
- }, t(e.messages.check), 9, La)) : L("", !0),
938
- l(b) && e.mode === "tree" ? (d(), o("button", {
939
- key: 1,
940
- type: "button",
941
- disabled: e.readonly,
942
- onClick: r[26] || (r[26] = //@ts-ignore
943
- (...n) => l(k).checkTree && l(k).checkTree(...n))
944
- }, t(e.messages.check), 9, Ka)) : L("", !0),
945
- a("button", {
946
- type: "button",
947
- class: "mr-data-layout__primary",
948
- disabled: e.readonly,
949
- onClick: r[27] || (r[27] = //@ts-ignore
950
- (...n) => l(k).apply && l(k).apply(...n))
951
- }, t(e.messages.apply), 9, Na)
952
- ]),
953
- l(G) ? (d(), o("div", Ta, [
954
- a("p", null, t(e.messages.sample), 1),
955
- a("table", null, [
956
- a("thead", null, [
957
- a("tr", null, [
958
- (d(!0), o(w, null, D(l(G).columns, (n, m) => (d(), o("th", { key: m }, t(n), 1))), 128))
959
- ])
960
- ]),
961
- a("tbody", null, [
962
- (d(!0), o(w, null, D(l(G).rows, (n, m) => (d(), o("tr", { key: m }, [
963
- (d(!0), o(w, null, D(n, (v, B) => (d(), o("td", { key: B }, t(v ?? "—"), 1))), 128))
964
- ]))), 128))
965
- ])
966
- ])
967
- ])) : L("", !0),
968
- l(R) ? (d(), o("p", Oa, t(l(R)), 1)) : L("", !0)
969
- ]));
970
- }
971
- }), Aa = /* @__PURE__ */ me(Ba, [["__scopeId", "data-v-c42e721c"]]), Ia = { class: "mr-expression__row" }, Ga = ["value", "disabled", "aria-label"], Wa = { value: "field" }, Ja = { value: "constant" }, Ha = {
972
- key: 0,
973
- value: "operation"
974
- }, ja = { value: "aggregate" }, za = ["value", "disabled", "aria-label"], Pa = ["value"], qa = ["value", "disabled", "aria-label"], Za = ["value"], Qa = ["value", "disabled", "aria-label"], Xa = ["value"], Ya = ["value", "disabled", "aria-label"], pa = { value: "text" }, _a = { value: "number" }, et = { value: "boolean" }, lt = { value: "null" }, at = ["value", "disabled", "aria-label"], tt = {
975
- key: 0,
976
- value: ""
977
- }, st = ["value"], nt = ["value", "disabled", "aria-label"], it = {
978
- value: "",
979
- disabled: ""
980
- }, dt = ["value"], ot = ["value", "disabled", "aria-label"], ut = { value: "true" }, rt = { value: "false" }, ct = ["type", "value", "disabled", "aria-label"], mt = ["disabled", "aria-label", "onClick"], bt = ["disabled"], vt = /* @__PURE__ */ re({
981
- __name: "ReportExpressionEditor",
982
- props: {
983
- modelValue: {},
984
- fields: {},
985
- messages: {},
986
- readonly: { type: Boolean },
987
- depth: {}
988
- },
989
- emits: ["update:modelValue"],
990
- setup(e, { emit: A }) {
991
- const x = e, W = A, k = ce(), b = P(
992
- () => "aggregate" in x.modelValue ? "aggregate" : "field" in x.modelValue ? "field" : "value" in x.modelValue ? "constant" : "operation"
993
- ), s = I("text");
994
- se(
995
- () => x.modelValue,
996
- (S) => {
997
- "value" in S && (s.value = S.value === null ? "null" : typeof S.value == "string" ? "text" : typeof S.value);
998
- },
999
- { immediate: !0 }
1000
- );
1001
- function y(S) {
1002
- x.readonly || W("update:modelValue", S);
1003
- }
1004
- function U(S) {
1005
- y(S === "aggregate" ? { aggregate: "sum", field: x.fields[0]?.field ?? "" } : S === "field" ? { field: x.fields[0]?.field ?? "" } : S === "constant" ? { value: "" } : {
1006
- op: "add",
1007
- args: [{ field: x.fields[0]?.field ?? "" }, { value: 0 }]
1008
- });
1009
- }
1010
- function C(S) {
1011
- const r = S, n = "args" in x.modelValue ? x.modelValue.args : [{ value: 0 }, { value: 0 }];
1012
- y({
1013
- op: r,
1014
- args: r === "divide" || r === "subtract" ? n.slice(0, 2) : n
1015
- });
1016
- }
1017
- function V(S, r) {
1018
- "args" in x.modelValue && y({
1019
- ...x.modelValue,
1020
- args: x.modelValue.args.map(
1021
- (n, m) => m === S ? r : n
1022
- )
1023
- });
1024
- }
1025
- function T(S) {
1026
- if (!("args" in x.modelValue)) return;
1027
- const r = S === void 0 ? [...x.modelValue.args, { value: 0 }] : x.modelValue.args.filter((n, m) => m !== S);
1028
- y({ ...x.modelValue, args: r });
1029
- }
1030
- function R(S) {
1031
- s.value = S, y({
1032
- value: S === "null" ? null : S === "boolean" ? !1 : S === "number" ? 0 : ""
1033
- });
1034
- }
1035
- function G(S) {
1036
- s.value === "number" ? S.trim() && Number.isFinite(Number(S)) && y({ value: Number(S) }) : y({ value: S });
1037
- }
1038
- function H(S, r) {
1039
- if (!("aggregate" in x.modelValue)) return;
1040
- const n = { ...x.modelValue, [S]: r };
1041
- S === "aggregate" && (n.aggregate = r), S === "field" && !r && delete n.field, y(n);
1042
- }
1043
- return (S, r) => {
1044
- const n = Se("ReportExpressionEditor", !0);
1045
- return d(), o("div", {
1046
- class: ve(["mr-expression", { "mr-expression--nested": (e.depth ?? 0) > 0 }])
1047
- }, [
1048
- a("div", Ia, [
1049
- a("select", {
1050
- value: b.value,
1051
- disabled: e.readonly,
1052
- "aria-label": e.messages.argument,
1053
- onChange: r[0] || (r[0] = (m) => U(m.target.value))
1054
- }, [
1055
- a("option", Wa, t(e.messages.field), 1),
1056
- a("option", Ja, t(e.messages.constant), 1),
1057
- (e.depth ?? 0) < 12 ? (d(), o("option", Ha, t(e.messages.operation), 1)) : L("", !0),
1058
- a("option", ja, t(e.messages.aggregate), 1)
1059
- ], 40, Ga),
1060
- "field" in e.modelValue && !("aggregate" in e.modelValue) ? (d(), o("select", {
1061
- key: 0,
1062
- value: e.modelValue.field,
1063
- disabled: e.readonly,
1064
- "aria-label": e.messages.field,
1065
- onChange: r[1] || (r[1] = (m) => y({ field: m.target.value }))
1066
- }, [
1067
- (d(!0), o(w, null, D(e.fields, (m) => (d(), o("option", {
1068
- key: m.field,
1069
- value: m.field
1070
- }, t(m.label), 9, Pa))), 128))
1071
- ], 40, za)) : "op" in e.modelValue ? (d(), o("select", {
1072
- key: 1,
1073
- value: e.modelValue.op,
1074
- disabled: e.readonly,
1075
- "aria-label": e.messages.operation,
1076
- onChange: r[2] || (r[2] = (m) => C(m.target.value))
1077
- }, [
1078
- (d(!0), o(w, null, D(l(k).operations, (m) => (d(), o("option", {
1079
- key: m,
1080
- value: m
1081
- }, t(e.messages[m]), 9, Za))), 128))
1082
- ], 40, qa)) : "aggregate" in e.modelValue ? (d(), o("select", {
1083
- key: 2,
1084
- value: e.modelValue.aggregate,
1085
- disabled: e.readonly,
1086
- "aria-label": e.messages.aggregate,
1087
- onChange: r[3] || (r[3] = (m) => H("aggregate", m.target.value))
1088
- }, [
1089
- (d(!0), o(w, null, D(l(k).aggregates, (m) => (d(), o("option", {
1090
- key: m,
1091
- value: m
1092
- }, t(e.messages[m]), 9, Xa))), 128))
1093
- ], 40, Qa)) : (d(), o("select", {
1094
- key: 3,
1095
- value: s.value,
1096
- disabled: e.readonly,
1097
- "aria-label": e.messages.resultType,
1098
- onChange: r[4] || (r[4] = (m) => R(m.target.value))
1099
- }, [
1100
- a("option", pa, t(e.messages.text), 1),
1101
- a("option", _a, t(e.messages.number), 1),
1102
- a("option", et, t(e.messages.boolean), 1),
1103
- a("option", lt, t(e.messages.null), 1)
1104
- ], 40, Ya))
1105
- ]),
1106
- "aggregate" in e.modelValue ? (d(), o(w, { key: 0 }, [
1107
- a("select", {
1108
- value: e.modelValue.field ?? "",
1109
- disabled: e.readonly,
1110
- "aria-label": e.messages.measure,
1111
- onChange: r[5] || (r[5] = (m) => H("field", m.target.value))
1112
- }, [
1113
- e.modelValue.aggregate === "count" ? (d(), o("option", tt, t(e.messages.allRows), 1)) : L("", !0),
1114
- (d(!0), o(w, null, D(e.fields, (m) => (d(), o("option", {
1115
- key: m.field,
1116
- value: m.field
1117
- }, t(m.label), 9, st))), 128))
1118
- ], 40, at),
1119
- e.modelValue.aggregate === "weightedAvg" ? (d(), o("select", {
1120
- key: 0,
1121
- value: e.modelValue.weightField ?? "",
1122
- disabled: e.readonly,
1123
- "aria-label": e.messages.weight,
1124
- onChange: r[6] || (r[6] = (m) => H(
1125
- "weightField",
1126
- m.target.value
1127
- ))
1128
- }, [
1129
- a("option", it, t(e.messages.weight), 1),
1130
- (d(!0), o(w, null, D(e.fields, (m) => (d(), o("option", {
1131
- key: m.field,
1132
- value: m.field
1133
- }, t(m.label), 9, dt))), 128))
1134
- ], 40, nt)) : L("", !0)
1135
- ], 64)) : "value" in e.modelValue ? (d(), o(w, { key: 1 }, [
1136
- s.value === "boolean" ? (d(), o("select", {
1137
- key: 0,
1138
- value: String(e.modelValue.value),
1139
- disabled: e.readonly,
1140
- "aria-label": e.messages.constant,
1141
- onChange: r[7] || (r[7] = (m) => y({
1142
- value: m.target.value === "true"
1143
- }))
1144
- }, [
1145
- a("option", ut, t(e.messages.true), 1),
1146
- a("option", rt, t(e.messages.false), 1)
1147
- ], 40, ot)) : s.value !== "null" ? (d(), o("input", {
1148
- key: 1,
1149
- type: s.value === "number" ? "number" : "text",
1150
- value: e.modelValue.value ?? "",
1151
- disabled: e.readonly,
1152
- "aria-label": e.messages.constant,
1153
- onInput: r[8] || (r[8] = (m) => G(m.target.value))
1154
- }, null, 40, ct)) : L("", !0)
1155
- ], 64)) : "args" in e.modelValue ? (d(), o(w, { key: 2 }, [
1156
- (d(!0), o(w, null, D(e.modelValue.args, (m, v) => (d(), o("div", {
1157
- key: v,
1158
- class: "mr-expression__argument"
1159
- }, [
1160
- ge(n, {
1161
- "model-value": m,
1162
- fields: e.fields,
1163
- messages: e.messages,
1164
- readonly: e.readonly,
1165
- depth: (e.depth ?? 0) + 1,
1166
- "onUpdate:modelValue": (B) => V(v, B)
1167
- }, null, 8, ["model-value", "fields", "messages", "readonly", "depth", "onUpdate:modelValue"]),
1168
- e.modelValue.args.length > 2 ? (d(), o("button", {
1169
- key: 0,
1170
- type: "button",
1171
- disabled: e.readonly,
1172
- "aria-label": `${e.messages.remove} ${e.messages.argument} ${v + 1}`,
1173
- onClick: (B) => T(v)
1174
- }, " × ", 8, mt)) : L("", !0)
1175
- ]))), 128)),
1176
- !["subtract", "divide"].includes(e.modelValue.op) && e.modelValue.args.length < 16 ? (d(), o("button", {
1177
- key: 0,
1178
- type: "button",
1179
- disabled: e.readonly,
1180
- onClick: r[9] || (r[9] = (m) => T())
1181
- }, " + " + t(e.messages.addArgument), 9, bt)) : L("", !0)
1182
- ], 64)) : L("", !0)
1183
- ], 2);
1184
- };
1185
- }
1186
- }), gt = /* @__PURE__ */ me(vt, [["__scopeId", "data-v-84e5c0e5"]]), z = (e) => JSON.parse(JSON.stringify(e));
1187
- function yt(e, A) {
1188
- const x = P(() => ({
1189
- ...Ee,
1190
- ...e.messages
1191
- })), W = I("computations"), k = I(""), b = I(""), s = I({
1192
- field: "",
1193
- expression: { field: "" },
1194
- scope: "row"
1195
- }), y = I([]), U = I(0), C = I(""), V = I(-1), T = I("style"), R = I({ field: "", op: ">", value: 0 }), G = I({
1196
- color: "#b91c1c",
1197
- backgroundColor: "#fff1f2",
1198
- bold: !1
1199
- }), H = I([]), S = ue(() => s.value), r = ue(() => y.value), n = ue(() => ({ when: R.value, style: G.value })), m = I(/* @__PURE__ */ new Map()), v = I(/* @__PURE__ */ new Map());
1200
- let B = "", Z = !1;
1201
- const ee = P(() => S.pending.value || r.pending.value || n.pending.value || m.value.size > 0 || v.value.size > 0);
1202
- let Q;
1203
- const Y = P(() => {
1204
- const h = /* @__PURE__ */ new Map();
1205
- for (const g of e.datasetSchema?.fields ?? [])
1206
- h.set(g.field, g.label ?? g.field);
1207
- for (const g of e.list.columns)
1208
- h.has(g.field) || h.set(g.field, g.header || g.field);
1209
- for (const g of Object.keys(
1210
- e.datasets?.[e.list.dataset]?.[0] ?? {}
1211
- ))
1212
- h.has(g) || h.set(g, g);
1213
- return [...h].map(([g, N]) => ({ field: g, label: N }));
1214
- }), le = P(() => y.value[U.value]), X = P(
1215
- () => e.list.columns.find((h) => h.field === C.value)
1216
- ), de = P(() => xe(ae()));
1217
- function p() {
1218
- if (Q === JSON.stringify(e.list)) {
1219
- Q = void 0;
1220
- return;
1221
- }
1222
- Z = !0, m.value = /* @__PURE__ */ new Map(), v.value = /* @__PURE__ */ new Map(), y.value = z(
1223
- e.list.groups ?? (e.list.groupBy ? [e.list.groupBy] : [])
1224
- );
1225
- for (const h of y.value) for (const g of h.aggregates ?? []) g.numeric ??= "number";
1226
- e.list.columns.some((h) => h.field === C.value) || (C.value = e.list.columns[0]?.field ?? ""), k.value = "", H.value = [], _(b.value), be(-1), r.accept(), Z = !1;
1227
- }
1228
- se(() => e.list, p, { immediate: !0 }), se(s, () => {
1229
- H.value = [];
1230
- }, { deep: !0 }), se(() => e.datasets, () => {
1231
- H.value = [];
1232
- }, { deep: !0 });
1233
- function _(h) {
1234
- !Z && S.pending.value && (m.value = new Map(m.value).set(b.value, z(s.value))), b.value = h, s.value = z(
1235
- e.list.computed?.find((N) => N.field === h) ?? {
1236
- field: "",
1237
- expression: { field: Y.value[0]?.field ?? "" },
1238
- scope: "row"
1239
- }
1240
- ), s.value.numeric ??= "number", H.value = [], k.value = "", S.accept();
1241
- const g = m.value.get(h);
1242
- if (g) {
1243
- s.value = z(g);
1244
- const N = new Map(m.value);
1245
- N.delete(h), m.value = N;
1246
- }
1247
- }
1248
- function ae() {
1249
- return [
1250
- ...(e.list.computed ?? []).filter((g) => g.field !== b.value),
1251
- z(s.value)
1252
- ];
1253
- }
1254
- function c(h) {
1255
- if (e.readonly) return !1;
1256
- const g = fe({
1257
- pages: [
1258
- {
1259
- widthMm: Math.max(1, h.leftMm + h.widthMm),
1260
- heightMm: 297,
1261
- components: [h]
1262
- }
1263
- ]
1264
- });
1265
- return g.ok ? (k.value = "", Q = JSON.stringify(h), A(h), !0) : (k.value = g.errors.map((N) => N.message).slice(0, 3).join(";"), !1);
1266
- }
1267
- function F() {
1268
- if (!s.value.field.trim()) {
1269
- k.value = x.value.missingTarget;
1270
- return;
1271
- }
1272
- const h = z(e.list);
1273
- if (h.computed = ae(), h.columns.some((g) => g.field === s.value.field) || h.columns.push({
1274
- field: s.value.field,
1275
- header: s.value.field,
1276
- widthMm: 30,
1277
- semanticRole: "measure",
1278
- align: "right",
1279
- editable: !1,
1280
- format: {
1281
- kind: "number",
1282
- ...s.value.digits === void 0 ? {} : { digits: s.value.digits }
1283
- }
1284
- }), c(h)) {
1285
- const g = new Map(m.value);
1286
- g.delete(b.value), g.delete(s.value.field), m.value = g, b.value = s.value.field, S.accept();
1287
- }
1288
- }
1289
- function E() {
1290
- if (!b.value) return;
1291
- const h = z(e.list);
1292
- if (h.computed = (h.computed ?? []).filter(
1293
- (g) => g.field !== b.value
1294
- ), c(h)) {
1295
- const g = new Map(m.value);
1296
- g.delete(b.value), m.value = g, S.accept(), _("");
1297
- }
1298
- }
1299
- function M() {
1300
- H.value = [], k.value = "";
1301
- const h = e.datasets?.[e.list.dataset];
1302
- if (!h?.length) {
1303
- k.value = x.value.noData;
1304
- return;
1305
- }
1306
- try {
1307
- const g = Re(h.slice(0, 1e3), {
1308
- fields: ae(),
1309
- maxRows: 1e3,
1310
- maxCells: 2e6
1311
- });
1312
- H.value = g.rows.slice(0, 5).map((N, q) => ({
1313
- row: q + 1,
1314
- value: N[s.value.field]
1315
- }));
1316
- } catch (g) {
1317
- k.value = g instanceof Error ? g.message : String(g);
1318
- }
1319
- }
1320
- function u(h) {
1321
- s.value.expression = h;
1322
- }
1323
- function i(h, g) {
1324
- s.value.groupBy = g ? [...s.value.groupBy ?? [], h] : (s.value.groupBy ?? []).filter((N) => N !== h);
1325
- }
1326
- function J() {
1327
- y.value.push({
1328
- field: Y.value[0]?.field ?? "",
1329
- headerTemplate: "{value}",
1330
- subtotalLabel: x.value.subtotalLabel,
1331
- aggregates: [],
1332
- keepWithNext: !0
1333
- }), U.value = y.value.length - 1;
1334
- }
1335
- function O(h) {
1336
- const g = U.value, N = g + h;
1337
- N < 0 || N >= y.value.length || ([y.value[g], y.value[N]] = [
1338
- y.value[N],
1339
- y.value[g]
1340
- ], U.value = N);
1341
- }
1342
- function $e() {
1343
- y.value.splice(U.value, 1), U.value = Math.max(
1344
- 0,
1345
- Math.min(U.value, y.value.length - 1)
1346
- );
1347
- }
1348
- function we() {
1349
- le.value && (le.value.aggregates ??= []).push({
1350
- field: Y.value[0]?.field ?? "",
1351
- op: "sum",
1352
- numeric: "number"
1353
- });
1354
- }
1355
- function Ve() {
1356
- const h = z(e.list);
1357
- h.groups = z(y.value), delete h.groupBy, c(h) && r.accept();
1358
- }
1359
- function be(h) {
1360
- !Z && n.pending.value && (v.value = new Map(v.value).set(B, { when: z(R.value), style: { ...G.value } })), B = `${C.value}|${T.value}|${h}`, V.value = h;
1361
- const g = T.value === "cell" ? X.value?.visibleWhen : T.value === "rowVisibility" ? e.list.rowVisibleWhen : X.value?.rules?.[h]?.when;
1362
- R.value = z(g ?? { field: C.value, op: ">", value: 0 });
1363
- const N = X.value?.rules?.[h]?.style;
1364
- G.value = {
1365
- color: String(N?.color ?? "#b91c1c"),
1366
- backgroundColor: String(N?.backgroundColor ?? "#fff1f2"),
1367
- bold: N?.bold === !0
1368
- }, n.accept();
1369
- const q = v.value.get(B);
1370
- if (q) {
1371
- R.value = z(q.when), G.value = { ...q.style };
1372
- const ne = new Map(v.value);
1373
- ne.delete(B), v.value = ne;
1374
- }
1375
- }
1376
- function Ce(h) {
1377
- const g = e.datasetSchema?.fields.find(
1378
- (ne) => ne.field === R.value.field
1379
- ), N = e.datasets?.[e.list.dataset]?.find(
1380
- (ne) => ne[R.value.field] != null
1381
- )?.[R.value.field], q = g?.type === "number" || !g && typeof N == "number";
1382
- g?.type === "decimal" ? R.value.numeric = "decimal" : q ? R.value.numeric = "number" : delete R.value.numeric, R.value.value = q && h.trim() && Number.isFinite(Number(h)) ? Number(h) : h;
1383
- }
1384
- function Ue(h = !1) {
1385
- const g = z(e.list), N = g.columns.find((q) => q.field === C.value);
1386
- if (!N) {
1387
- k.value = x.value.noSelection;
1388
- return;
1389
- }
1390
- if (T.value === "rowVisibility")
1391
- h ? delete g.rowVisibleWhen : g.rowVisibleWhen = z(R.value);
1392
- else if (T.value === "cell")
1393
- h ? delete N.visibleWhen : N.visibleWhen = z(R.value);
1394
- else if (N.rules ??= [], h && V.value >= 0)
1395
- N.rules.splice(V.value, 1);
1396
- else {
1397
- if (h) return;
1398
- V.value < 0 ? N.rules.push({
1399
- when: z(R.value),
1400
- style: { ...G.value }
1401
- }) : N.rules[V.value] = {
1402
- when: z(R.value),
1403
- style: { ...G.value }
1404
- };
1405
- }
1406
- if (c(g)) {
1407
- const q = new Map(v.value);
1408
- q.delete(B), v.value = q, n.accept();
1409
- }
1410
- }
1411
- ye({ key: () => e.recoveryKey ?? "rules:0:0", baseline: () => JSON.stringify(e.list), pending: () => ee.value, snapshot: () => JSON.stringify(Fe()), restore(h) {
1412
- const g = JSON.parse(h);
1413
- s.value = g.formula, y.value = g.groups, R.value = g.when, G.value = g.style, b.value = g.selectedComputed, C.value = g.column, V.value = g.conditionIndex, B = g.conditionKey, T.value = g.effect, W.value = g.tab, m.value = new Map(g.computedDrafts), v.value = new Map(g.conditionDrafts), S.baseline.value = g.formulaBaseline, r.baseline.value = g.groupBaseline, n.baseline.value = g.conditionBaseline;
1414
- } });
1415
- function Fe() {
1416
- return { formula: s.value, groups: y.value, when: R.value, style: G.value, selectedComputed: b.value, column: C.value, conditionIndex: V.value, conditionKey: B, effect: T.value, tab: W.value, computedDrafts: [...m.value], conditionDrafts: [...v.value], formulaBaseline: S.baseline.value, groupBaseline: r.baseline.value, conditionBaseline: n.baseline.value };
1417
- }
1418
- return {
1419
- m: x,
1420
- pendingLocalChanges: ee,
1421
- draftSnapshot: () => JSON.stringify({ formula: s.value, groups: y.value, when: R.value, style: G.value, computedDrafts: [...m.value], conditionDrafts: [...v.value] }),
1422
- tab: W,
1423
- fields: Y,
1424
- formula: s,
1425
- groups: y,
1426
- groupIndex: U,
1427
- currentGroup: le,
1428
- column: C,
1429
- currentColumn: X,
1430
- conditionIndex: V,
1431
- effect: T,
1432
- when: R,
1433
- style: G,
1434
- error: k,
1435
- preview: H,
1436
- diagnostics: de,
1437
- selectedComputed: b,
1438
- loadComputed: _,
1439
- applyComputed: F,
1440
- removeComputed: E,
1441
- check: M,
1442
- setExpression: u,
1443
- toggleGroupField: i,
1444
- addGroup: J,
1445
- moveGroup: O,
1446
- removeGroup: $e,
1447
- addAggregate: we,
1448
- applyGroups: Ve,
1449
- loadCondition: be,
1450
- setThreshold: Ce,
1451
- applyCondition: Ue,
1452
- applyLayout: c,
1453
- resetDraft: () => {
1454
- Q = void 0, p();
1455
- }
1456
- };
1457
- }
1458
- const ft = ["aria-label"], ht = { class: "mr-rule-editor__directory" }, kt = ["aria-label"], $t = ["aria-selected", "onClick"], wt = { key: 0 }, Vt = { key: 1 }, Ct = { class: "mr-rule-editor__catalog" }, Ut = ["disabled"], Ft = ["aria-label"], St = { class: "mr-rule-editor__field-list" }, Mt = ["disabled", "title", "onClick"], Dt = { key: 1 }, xt = {
1459
- key: 0,
1460
- class: "mr-rule-editor__panel"
1461
- }, Rt = ["aria-label", "value", "disabled"], Et = { value: "" }, Lt = ["value"], Kt = ["aria-label", "disabled"], Nt = { class: "mr-rule-editor__pair" }, Tt = ["aria-label", "disabled"], Ot = ["value"], Bt = ["aria-label", "disabled"], At = { value: "number" }, It = { value: "decimal" }, Gt = {
1462
- key: 0,
1463
- class: "mr-rule-editor__checks"
1464
- }, Wt = ["checked", "disabled", "onChange"], Jt = {
1465
- key: 2,
1466
- class: "mr-rule-editor__hint"
1467
- }, Ht = { class: "mr-rule-editor__advanced" }, jt = ["aria-label", "disabled"], zt = ["aria-label", "disabled"], Pt = { value: "propagate" }, qt = { value: "error" }, Zt = ["aria-label", "disabled"], Qt = { value: "error" }, Xt = { value: "null" }, Yt = {
1468
- key: 3,
1469
- class: "mr-rule-editor__hint"
1470
- }, pt = {
1471
- key: 4,
1472
- class: "mr-rule-editor__diagnostic"
1473
- }, _t = { class: "mr-rule-editor__actions" }, es = ["disabled"], ls = ["disabled"], as = ["disabled"], ts = {
1474
- key: 5,
1475
- class: "mr-rule-editor__error"
1476
- }, ss = {
1477
- key: 1,
1478
- class: "mr-rule-editor__panel"
1479
- }, ns = { class: "mr-rule-editor__pair" }, is = ["aria-label"], ds = ["value"], os = {
1480
- key: 0,
1481
- value: 0
1482
- }, us = ["disabled"], rs = ["aria-label", "disabled"], cs = ["value"], ms = { class: "mr-rule-editor__pair" }, bs = ["aria-label", "disabled"], vs = ["aria-label", "disabled"], gs = { class: "mr-rule-editor__checks" }, ys = ["disabled"], fs = ["disabled"], hs = { class: "mr-rule-editor__pair" }, ks = ["aria-label", "onUpdate:modelValue", "disabled"], $s = ["value"], ws = ["aria-label", "onUpdate:modelValue", "disabled"], Vs = ["value"], Cs = ["aria-label", "onUpdate:modelValue", "disabled"], Us = { value: void 0 }, Fs = ["value"], Ss = { key: 0 }, Ms = ["aria-label", "onUpdate:modelValue", "disabled"], Ds = ["value"], xs = { class: "mr-rule-editor__pair" }, Rs = ["onUpdate:modelValue", "disabled", "aria-label"], Es = { value: "number" }, Ls = { value: "decimal" }, Ks = ["disabled", "onClick"], Ns = ["disabled"], Ts = { class: "mr-rule-editor__actions" }, Os = ["disabled", "aria-label"], Bs = ["disabled", "aria-label"], As = ["disabled"], Is = ["disabled"], Gs = {
1483
- key: 2,
1484
- class: "mr-rule-editor__panel"
1485
- }, Ws = ["aria-label", "disabled"], Js = ["value"], Hs = ["aria-label", "disabled"], js = { value: "style" }, zs = { value: "cell" }, Ps = { value: "rowVisibility" }, qs = { key: 0 }, Zs = ["aria-label", "value", "disabled"], Qs = { value: -1 }, Xs = ["value"], Ys = ["aria-label", "disabled"], ps = ["value"], _s = { class: "mr-rule-editor__pair" }, en = ["aria-label", "disabled"], ln = ["value"], an = ["value", "disabled"], tn = { class: "mr-rule-editor__pair" }, sn = ["disabled"], nn = ["disabled"], dn = { class: "mr-rule-editor__check" }, on = ["disabled"], un = { class: "mr-rule-editor__actions" }, rn = ["disabled"], cn = ["disabled"], mn = { class: "mr-rule-editor__explanation" }, bn = { key: 0 }, vn = { class: "mr-rule-editor__results" }, gn = { key: 0 }, yn = { key: 1 }, fn = {
1486
- key: 1,
1487
- class: "mr-rule-editor__error",
1488
- role: "alert"
1489
- }, hn = /* @__PURE__ */ re({
1490
- __name: "RuleEditor",
1491
- props: {
1492
- recoveryKey: {},
1493
- list: {},
1494
- datasets: {},
1495
- datasetSchema: {},
1496
- datasetSchemas: {},
1497
- readonly: { type: Boolean },
1498
- messages: {}
1499
- },
1500
- emits: ["change", "dirty"],
1501
- setup(e, { expose: A, emit: x }) {
1502
- const W = e, k = x, b = yt(W, (M) => k("change", M)), {
1503
- m: s,
1504
- tab: y,
1505
- fields: U,
1506
- formula: C,
1507
- groups: V,
1508
- groupIndex: T,
1509
- currentGroup: R,
1510
- column: G,
1511
- currentColumn: H,
1512
- conditionIndex: S,
1513
- effect: r,
1514
- when: n,
1515
- style: m,
1516
- error: v,
1517
- preview: B,
1518
- diagnostics: Z,
1519
- selectedComputed: ee
1520
- } = b, Q = I({}), Y = I(0);
1521
- function le() {
1522
- b.resetDraft(), Q.value = {}, Y.value++;
1523
- }
1524
- const X = P(() => b.pendingLocalChanges.value || Object.values(Q.value).some(Boolean));
1525
- se([X, b.draftSnapshot, Q], () => k("dirty", X.value), { immediate: !0, deep: !0, flush: "sync" }), A({ get pendingLocalChanges() {
1526
- return X.value;
1527
- } });
1528
- const de = Ne(W, b.formula, s), { query: p, matches: _, fieldWindow: ae, expression: c, sources: F } = de, E = ce();
1529
- return (M, u) => (d(), o("section", {
1530
- class: "mr-rule-editor",
1531
- "aria-label": l(s).settings
1532
- }, [
1533
- a("aside", ht, [
1534
- a("div", {
1535
- class: "mr-rule-editor__tabs",
1536
- role: "tablist",
1537
- "aria-label": l(s).settings
1538
- }, [
1539
- (d(), o(w, null, D([
1540
- "computations",
1541
- "groups",
1542
- "conditions",
1543
- "detail",
1544
- "matrix",
1545
- "tree"
1546
- ], (i) => a("button", {
1547
- key: i,
1548
- type: "button",
1549
- role: "tab",
1550
- "aria-selected": l(y) === i,
1551
- class: ve({ "is-active": l(y) === i }),
1552
- onClick: (J) => y.value = i
1553
- }, [
1554
- f(t(l(s)[i]), 1),
1555
- i === "computations" && e.list.computed?.length ? (d(), o("span", wt, t(e.list.computed.length), 1)) : L("", !0),
1556
- i === "groups" && l(V).length ? (d(), o("span", Vt, t(l(V).length), 1)) : L("", !0)
1557
- ], 10, $t)), 64))
1558
- ], 8, kt),
1559
- a("div", Ct, [
1560
- a("strong", null, t(l(s).catalog), 1),
1561
- X.value ? (d(), o("button", {
1562
- key: 0,
1563
- type: "button",
1564
- disabled: e.readonly,
1565
- onClick: le
1566
- }, t(l(s).restoreDraft), 9, Ut)) : L("", !0),
1567
- a("label", null, [
1568
- f(t(l(s).searchFields), 1),
1569
- $(a("input", {
1570
- "onUpdate:modelValue": u[0] || (u[0] = (i) => oe(p) ? p.value = i : null),
1571
- type: "search",
1572
- "aria-label": l(s).searchFields
1573
- }, null, 8, Ft), [
1574
- [j, l(p)]
1575
- ])
1576
- ]),
1577
- a("div", St, [
1578
- (d(!0), o(w, null, D(l(ae), (i) => (d(), o("button", {
1579
- key: i.field,
1580
- type: "button",
1581
- disabled: e.readonly || l(y) !== "computations",
1582
- title: l(s).useField,
1583
- onClick: (J) => l(b).setExpression({ field: i.field })
1584
- }, [
1585
- a("strong", null, t(i.label), 1),
1586
- a("code", null, t(i.field), 1),
1587
- a("small", null, t(i.meta), 1)
1588
- ], 8, Mt))), 128))
1589
- ]),
1590
- l(_).length > 50 ? (d(), o("small", Dt, t(l(s).shown) + " 50 / " + t(l(_).length), 1)) : L("", !0)
1591
- ])
1592
- ]),
1593
- l(y) === "computations" ? (d(), o("div", xt, [
1594
- a("label", null, [
1595
- f(t(l(s).existing), 1),
1596
- a("select", {
1597
- "aria-label": l(s).existing,
1598
- value: l(ee),
1599
- disabled: e.readonly,
1600
- onChange: u[1] || (u[1] = (i) => l(b).loadComputed(i.target.value))
1601
- }, [
1602
- a("option", Et, "+ " + t(l(s).newField), 1),
1603
- (d(!0), o(w, null, D(e.list.computed, (i) => (d(), o("option", {
1604
- key: i.field,
1605
- value: i.field
1606
- }, t(i.field), 9, Lt))), 128))
1607
- ], 40, Rt)
1608
- ]),
1609
- a("label", null, [
1610
- f(t(l(s).target), 1),
1611
- $(a("input", {
1612
- "aria-label": l(s).target,
1613
- "onUpdate:modelValue": u[2] || (u[2] = (i) => l(C).field = i),
1614
- disabled: e.readonly,
1615
- autocomplete: "off"
1616
- }, null, 8, Kt), [
1617
- [j, l(C).field]
1618
- ])
1619
- ]),
1620
- a("div", Nt, [
1621
- a("label", null, [
1622
- f(t(l(s).scope), 1),
1623
- $(a("select", {
1624
- "aria-label": l(s).scope,
1625
- "onUpdate:modelValue": u[3] || (u[3] = (i) => l(C).scope = i),
1626
- disabled: e.readonly
1627
- }, [
1628
- (d(!0), o(w, null, D(l(E).scopes, (i) => (d(), o("option", {
1629
- key: i,
1630
- value: i
1631
- }, t(l(s)[i]), 9, Ot))), 128))
1632
- ], 8, Tt), [
1633
- [K, l(C).scope]
1634
- ])
1635
- ]),
1636
- a("label", null, [
1637
- f(t(l(s).numeric), 1),
1638
- $(a("select", {
1639
- "aria-label": l(s).numeric,
1640
- "onUpdate:modelValue": u[4] || (u[4] = (i) => l(C).numeric = i),
1641
- disabled: e.readonly
1642
- }, [
1643
- a("option", At, t(l(s).number), 1),
1644
- a("option", It, t(l(s).decimal), 1)
1645
- ], 8, Bt), [
1646
- [K, l(C).numeric]
1647
- ])
1648
- ])
1649
- ]),
1650
- l(C).scope === "group" ? (d(), o("fieldset", Gt, [
1651
- a("legend", null, t(l(s).groupFields), 1),
1652
- (d(!0), o(w, null, D(l(U), (i) => (d(), o("label", {
1653
- key: i.field
1654
- }, [
1655
- a("input", {
1656
- type: "checkbox",
1657
- checked: l(C).groupBy?.includes(i.field),
1658
- disabled: e.readonly,
1659
- onChange: (J) => l(b).toggleGroupField(
1660
- i.field,
1661
- J.target.checked
1662
- )
1663
- }, null, 40, Wt),
1664
- f(t(i.label), 1)
1665
- ]))), 128))
1666
- ])) : L("", !0),
1667
- typeof l(C).expression != "string" ? (d(), Me(gt, {
1668
- key: 1,
1669
- "model-value": l(C).expression,
1670
- fields: l(U),
1671
- messages: l(s),
1672
- readonly: e.readonly,
1673
- "onUpdate:modelValue": l(b).setExpression
1674
- }, null, 8, ["model-value", "fields", "messages", "readonly", "onUpdate:modelValue"])) : (d(), o("p", Jt, t(l(C).expression), 1)),
1675
- a("details", null, [
1676
- a("summary", null, t(l(s).advanced), 1),
1677
- a("div", Ht, [
1678
- a("label", null, [
1679
- f(t(l(s).digits), 1),
1680
- $(a("input", {
1681
- "aria-label": l(s).digits,
1682
- "onUpdate:modelValue": u[5] || (u[5] = (i) => l(C).digits = i),
1683
- type: "number",
1684
- min: "0",
1685
- max: "100",
1686
- disabled: e.readonly
1687
- }, null, 8, jt), [
1688
- [
1689
- j,
1690
- l(C).digits,
1691
- void 0,
1692
- { number: !0 }
1693
- ]
1694
- ])
1695
- ]),
1696
- a("label", null, [
1697
- f(t(l(s).nulls), 1),
1698
- $(a("select", {
1699
- "aria-label": l(s).nulls,
1700
- "onUpdate:modelValue": u[6] || (u[6] = (i) => l(C).nulls = i),
1701
- disabled: e.readonly
1702
- }, [
1703
- a("option", Pt, t(l(s).propagate), 1),
1704
- a("option", qt, t(l(s).error), 1)
1705
- ], 8, zt), [
1706
- [K, l(C).nulls]
1707
- ])
1708
- ]),
1709
- a("label", null, [
1710
- f(t(l(s).division), 1),
1711
- $(a("select", {
1712
- "aria-label": l(s).division,
1713
- "onUpdate:modelValue": u[7] || (u[7] = (i) => l(C).divisionByZero = i),
1714
- disabled: e.readonly
1715
- }, [
1716
- a("option", Qt, t(l(s).error), 1),
1717
- a("option", Xt, t(l(s).propagate), 1)
1718
- ], 8, Zt), [
1719
- [K, l(C).divisionByZero]
1720
- ])
1721
- ])
1722
- ])
1723
- ]),
1724
- l(C).numeric === "decimal" ? (d(), o("p", Yt, t(l(s).decimalHint), 1)) : L("", !0),
1725
- l(Z).valid && l(C).field ? (d(), o("div", pt, [
1726
- f(t(l(s).dependencies), 1),
1727
- a("strong", null, t(l(Z).order.join(" → ")), 1)
1728
- ])) : L("", !0),
1729
- a("div", _t, [
1730
- a("button", {
1731
- type: "button",
1732
- disabled: e.readonly,
1733
- onClick: u[8] || (u[8] = //@ts-ignore
1734
- (...i) => l(b).check && l(b).check(...i))
1735
- }, t(l(s).check), 9, es),
1736
- a("button", {
1737
- type: "button",
1738
- class: "mr-rule-editor__primary",
1739
- disabled: e.readonly || !l(Z).valid,
1740
- onClick: u[9] || (u[9] = //@ts-ignore
1741
- (...i) => l(b).applyComputed && l(b).applyComputed(...i))
1742
- }, t(l(s).apply), 9, ls),
1743
- l(ee) ? (d(), o("button", {
1744
- key: 0,
1745
- type: "button",
1746
- disabled: e.readonly,
1747
- onClick: u[10] || (u[10] = //@ts-ignore
1748
- (...i) => l(b).removeComputed && l(b).removeComputed(...i))
1749
- }, t(l(s).remove), 9, as)) : L("", !0)
1750
- ]),
1751
- !l(Z).valid && l(C).field ? (d(), o("p", ts, t(l(Z).errors.join(";")), 1)) : L("", !0)
1752
- ])) : l(y) === "groups" ? (d(), o("div", ss, [
1753
- a("div", ns, [
1754
- $(a("select", {
1755
- "onUpdate:modelValue": u[11] || (u[11] = (i) => oe(T) ? T.value = i : null),
1756
- "aria-label": l(s).groups
1757
- }, [
1758
- (d(!0), o(w, null, D(l(V), (i, J) => (d(), o("option", {
1759
- key: J,
1760
- value: J
1761
- }, t(J + 1) + " · " + t(i.field), 9, ds))), 128)),
1762
- l(V).length ? L("", !0) : (d(), o("option", os, t(l(s).noGroups), 1))
1763
- ], 8, is), [
1764
- [
1765
- K,
1766
- l(T),
1767
- void 0,
1768
- { number: !0 }
1769
- ]
1770
- ]),
1771
- a("button", {
1772
- type: "button",
1773
- disabled: e.readonly || l(V).length >= 16,
1774
- onClick: u[12] || (u[12] = //@ts-ignore
1775
- (...i) => l(b).addGroup && l(b).addGroup(...i))
1776
- }, " + " + t(l(s).addGroup), 9, us)
1777
- ]),
1778
- l(R) ? (d(), o(w, { key: 0 }, [
1779
- a("label", null, [
1780
- f(t(l(s).field), 1),
1781
- $(a("select", {
1782
- "aria-label": l(s).field,
1783
- "onUpdate:modelValue": u[13] || (u[13] = (i) => l(R).field = i),
1784
- disabled: e.readonly
1785
- }, [
1786
- (d(!0), o(w, null, D(l(U), (i) => (d(), o("option", {
1787
- key: i.field,
1788
- value: i.field
1789
- }, t(i.label), 9, cs))), 128))
1790
- ], 8, rs), [
1791
- [K, l(R).field]
1792
- ])
1793
- ]),
1794
- a("div", ms, [
1795
- a("label", null, [
1796
- f(t(l(s).header), 1),
1797
- $(a("input", {
1798
- "aria-label": l(s).header,
1799
- "onUpdate:modelValue": u[14] || (u[14] = (i) => l(R).headerTemplate = i),
1800
- disabled: e.readonly,
1801
- placeholder: "{value}"
1802
- }, null, 8, bs), [
1803
- [j, l(R).headerTemplate]
1804
- ])
1805
- ]),
1806
- a("label", null, [
1807
- f(t(l(s).footer), 1),
1808
- $(a("input", {
1809
- "aria-label": l(s).footer,
1810
- "onUpdate:modelValue": u[15] || (u[15] = (i) => l(R).subtotalLabel = i),
1811
- disabled: e.readonly
1812
- }, null, 8, vs), [
1813
- [j, l(R).subtotalLabel]
1814
- ])
1815
- ])
1816
- ]),
1817
- a("div", gs, [
1818
- a("label", null, [
1819
- $(a("input", {
1820
- "onUpdate:modelValue": u[16] || (u[16] = (i) => l(R).keepWithNext = i),
1821
- type: "checkbox",
1822
- disabled: e.readonly
1823
- }, null, 8, ys), [
1824
- [ie, l(R).keepWithNext]
1825
- ]),
1826
- f(t(l(s).orphan), 1)
1827
- ]),
1828
- a("label", null, [
1829
- $(a("input", {
1830
- "onUpdate:modelValue": u[17] || (u[17] = (i) => l(R).repeatHeader = i),
1831
- type: "checkbox",
1832
- disabled: e.readonly
1833
- }, null, 8, fs), [
1834
- [ie, l(R).repeatHeader]
1835
- ]),
1836
- f(t(l(s).repeat), 1)
1837
- ])
1838
- ]),
1839
- (d(!0), o(w, null, D(l(R).aggregates, (i, J) => (d(), o("div", {
1840
- key: J,
1841
- class: "mr-rule-editor__aggregate"
1842
- }, [
1843
- a("div", hs, [
1844
- a("label", null, [
1845
- f(t(l(s).output), 1),
1846
- $(a("select", {
1847
- "aria-label": l(s).output,
1848
- "onUpdate:modelValue": (O) => i.field = O,
1849
- disabled: e.readonly
1850
- }, [
1851
- (d(!0), o(w, null, D(l(U), (O) => (d(), o("option", {
1852
- key: O.field,
1853
- value: O.field
1854
- }, t(O.label), 9, $s))), 128))
1855
- ], 8, ks), [
1856
- [K, i.field]
1857
- ])
1858
- ]),
1859
- a("label", null, [
1860
- f(t(l(s).aggregate), 1),
1861
- $(a("select", {
1862
- "aria-label": l(s).aggregate,
1863
- "onUpdate:modelValue": (O) => i.op = O,
1864
- disabled: e.readonly
1865
- }, [
1866
- (d(!0), o(w, null, D(l(E).aggregates, (O) => (d(), o("option", {
1867
- key: O,
1868
- value: O
1869
- }, t(l(s)[O]), 9, Vs))), 128))
1870
- ], 8, ws), [
1871
- [K, i.op]
1872
- ])
1873
- ])
1874
- ]),
1875
- a("label", null, [
1876
- f(t(l(s).measure), 1),
1877
- $(a("select", {
1878
- "aria-label": l(s).measure,
1879
- "onUpdate:modelValue": (O) => i.valueField = O,
1880
- disabled: e.readonly
1881
- }, [
1882
- a("option", Us, t(i.field), 1),
1883
- (d(!0), o(w, null, D(l(U), (O) => (d(), o("option", {
1884
- key: O.field,
1885
- value: O.field
1886
- }, t(O.label), 9, Fs))), 128))
1887
- ], 8, Cs), [
1888
- [K, i.valueField]
1889
- ])
1890
- ]),
1891
- i.op === "weightedAvg" ? (d(), o("label", Ss, [
1892
- f(t(l(s).weight), 1),
1893
- $(a("select", {
1894
- "aria-label": l(s).weight,
1895
- "onUpdate:modelValue": (O) => i.weightField = O,
1896
- disabled: e.readonly
1897
- }, [
1898
- (d(!0), o(w, null, D(l(U), (O) => (d(), o("option", {
1899
- key: O.field,
1900
- value: O.field
1901
- }, t(O.label), 9, Ds))), 128))
1902
- ], 8, Ms), [
1903
- [K, i.weightField]
1904
- ])
1905
- ])) : L("", !0),
1906
- a("div", xs, [
1907
- $(a("select", {
1908
- "onUpdate:modelValue": (O) => i.numeric = O,
1909
- disabled: e.readonly,
1910
- "aria-label": l(s).numeric
1911
- }, [
1912
- a("option", Es, t(l(s).number), 1),
1913
- a("option", Ls, t(l(s).decimal), 1)
1914
- ], 8, Rs), [
1915
- [K, i.numeric]
1916
- ]),
1917
- a("button", {
1918
- type: "button",
1919
- disabled: e.readonly,
1920
- onClick: (O) => l(R).aggregates?.splice(J, 1)
1921
- }, t(l(s).remove), 9, Ks)
1922
- ])
1923
- ]))), 128)),
1924
- a("button", {
1925
- type: "button",
1926
- disabled: e.readonly,
1927
- onClick: u[18] || (u[18] = //@ts-ignore
1928
- (...i) => l(b).addAggregate && l(b).addAggregate(...i))
1929
- }, " + " + t(l(s).addAggregate), 9, Ns),
1930
- a("div", Ts, [
1931
- a("button", {
1932
- type: "button",
1933
- disabled: e.readonly || l(T) === 0,
1934
- "aria-label": l(s).moveUp,
1935
- onClick: u[19] || (u[19] = (i) => l(b).moveGroup(-1))
1936
- }, " ↑ " + t(l(s).outer), 9, Os),
1937
- a("button", {
1938
- type: "button",
1939
- disabled: e.readonly || l(T) >= l(V).length - 1,
1940
- "aria-label": l(s).moveDown,
1941
- onClick: u[20] || (u[20] = (i) => l(b).moveGroup(1))
1942
- }, " ↓ " + t(l(s).inner), 9, Bs),
1943
- a("button", {
1944
- type: "button",
1945
- disabled: e.readonly,
1946
- onClick: u[21] || (u[21] = //@ts-ignore
1947
- (...i) => l(b).removeGroup && l(b).removeGroup(...i))
1948
- }, t(l(s).remove), 9, As)
1949
- ])
1950
- ], 64)) : L("", !0),
1951
- a("button", {
1952
- type: "button",
1953
- class: "mr-rule-editor__primary",
1954
- disabled: e.readonly,
1955
- onClick: u[22] || (u[22] = //@ts-ignore
1956
- (...i) => l(b).applyGroups && l(b).applyGroups(...i))
1957
- }, t(l(s).apply), 9, Is)
1958
- ])) : l(y) === "conditions" ? (d(), o("div", Gs, [
1959
- a("label", null, [
1960
- f(t(l(s).column), 1),
1961
- $(a("select", {
1962
- "aria-label": l(s).column,
1963
- "onUpdate:modelValue": u[23] || (u[23] = (i) => oe(G) ? G.value = i : null),
1964
- disabled: e.readonly,
1965
- onChange: u[24] || (u[24] = (i) => l(b).loadCondition(-1))
1966
- }, [
1967
- (d(!0), o(w, null, D(e.list.columns, (i) => (d(), o("option", {
1968
- key: i.field,
1969
- value: i.field
1970
- }, t(i.header || i.field), 9, Js))), 128))
1971
- ], 40, Ws), [
1972
- [K, l(G)]
1973
- ])
1974
- ]),
1975
- a("label", null, [
1976
- f(t(l(s).effect), 1),
1977
- $(a("select", {
1978
- "aria-label": l(s).effect,
1979
- "onUpdate:modelValue": u[25] || (u[25] = (i) => oe(r) ? r.value = i : null),
1980
- disabled: e.readonly,
1981
- onChange: u[26] || (u[26] = (i) => l(b).loadCondition(-1))
1982
- }, [
1983
- a("option", js, t(l(s).style), 1),
1984
- a("option", zs, t(l(s).cell), 1),
1985
- a("option", Ps, t(l(s).rowVisibility), 1)
1986
- ], 40, Hs), [
1987
- [K, l(r)]
1988
- ])
1989
- ]),
1990
- l(r) === "style" ? (d(), o("label", qs, [
1991
- f(t(l(s).existing), 1),
1992
- a("select", {
1993
- "aria-label": l(s).existing,
1994
- value: l(S),
1995
- disabled: e.readonly,
1996
- onChange: u[27] || (u[27] = (i) => l(b).loadCondition(
1997
- Number(i.target.value)
1998
- ))
1999
- }, [
2000
- a("option", Qs, "+ " + t(l(s).newCondition), 1),
2001
- (d(!0), o(w, null, D(l(H)?.rules, (i, J) => (d(), o("option", {
2002
- key: J,
2003
- value: J
2004
- }, t(J + 1) + " · " + t(i.when.field) + " " + t(i.when.op) + " " + t(i.when.value), 9, Xs))), 128))
2005
- ], 40, Zs)
2006
- ])) : L("", !0),
2007
- a("label", null, [
2008
- f(t(l(s).condition), 1),
2009
- $(a("select", {
2010
- "aria-label": l(s).condition,
2011
- "onUpdate:modelValue": u[28] || (u[28] = (i) => l(n).field = i),
2012
- disabled: e.readonly
2013
- }, [
2014
- (d(!0), o(w, null, D(l(U), (i) => (d(), o("option", {
2015
- key: i.field,
2016
- value: i.field
2017
- }, t(i.label), 9, ps))), 128))
2018
- ], 8, Ys), [
2019
- [K, l(n).field]
2020
- ])
2021
- ]),
2022
- a("div", _s, [
2023
- a("label", null, [
2024
- f(t(l(s).comparison), 1),
2025
- $(a("select", {
2026
- "aria-label": l(s).comparison,
2027
- "onUpdate:modelValue": u[29] || (u[29] = (i) => l(n).op = i),
2028
- disabled: e.readonly
2029
- }, [
2030
- (d(), o(w, null, D([">", ">=", "<", "<=", "==", "!="], (i) => a("option", {
2031
- key: i,
2032
- value: i
2033
- }, t(i), 9, ln)), 64))
2034
- ], 8, en), [
2035
- [K, l(n).op]
2036
- ])
2037
- ]),
2038
- a("label", null, [
2039
- f(t(l(s).threshold), 1),
2040
- a("input", {
2041
- value: l(n).value,
2042
- disabled: e.readonly,
2043
- onInput: u[30] || (u[30] = (i) => l(b).setThreshold(i.target.value))
2044
- }, null, 40, an)
2045
- ])
2046
- ]),
2047
- l(r) === "style" ? (d(), o(w, { key: 1 }, [
2048
- a("div", tn, [
2049
- a("label", null, [
2050
- f(t(l(s).color), 1),
2051
- $(a("input", {
2052
- "onUpdate:modelValue": u[31] || (u[31] = (i) => l(m).color = i),
2053
- type: "color",
2054
- disabled: e.readonly
2055
- }, null, 8, sn), [
2056
- [j, l(m).color]
2057
- ])
2058
- ]),
2059
- a("label", null, [
2060
- f(t(l(s).background), 1),
2061
- $(a("input", {
2062
- "onUpdate:modelValue": u[32] || (u[32] = (i) => l(m).backgroundColor = i),
2063
- type: "color",
2064
- disabled: e.readonly
2065
- }, null, 8, nn), [
2066
- [j, l(m).backgroundColor]
2067
- ])
2068
- ])
2069
- ]),
2070
- a("label", dn, [
2071
- $(a("input", {
2072
- "onUpdate:modelValue": u[33] || (u[33] = (i) => l(m).bold = i),
2073
- type: "checkbox",
2074
- disabled: e.readonly
2075
- }, null, 8, on), [
2076
- [ie, l(m).bold]
2077
- ]),
2078
- f(t(l(s).bold), 1)
2079
- ])
2080
- ], 64)) : L("", !0),
2081
- a("div", un, [
2082
- a("button", {
2083
- type: "button",
2084
- class: "mr-rule-editor__primary",
2085
- disabled: e.readonly,
2086
- onClick: u[34] || (u[34] = (i) => l(b).applyCondition())
2087
- }, t(l(s).apply), 9, rn),
2088
- l(S) >= 0 || l(r) !== "style" ? (d(), o("button", {
2089
- key: 0,
2090
- type: "button",
2091
- disabled: e.readonly,
2092
- onClick: u[35] || (u[35] = (i) => l(b).applyCondition(!0))
2093
- }, t(l(s).removeCondition), 9, cn)) : L("", !0)
2094
- ])
2095
- ])) : L("", !0),
2096
- (d(), o(w, null, D(["detail", "matrix", "tree"], (i) => $(ge(Aa, {
2097
- key: `${i}-${Y.value}`,
2098
- list: e.list,
2099
- "recovery-key": e.recoveryKey,
2100
- mode: i,
2101
- datasets: e.datasets,
2102
- "dataset-schema": e.datasetSchema,
2103
- "dataset-schemas": e.datasetSchemas,
2104
- readonly: e.readonly,
2105
- messages: l(s),
2106
- accept: l(b).applyLayout,
2107
- onDirty: (J) => Q.value = { ...Q.value, [i]: J }
2108
- }, null, 8, ["list", "recovery-key", "mode", "datasets", "dataset-schema", "dataset-schemas", "readonly", "messages", "accept", "onDirty"]), [
2109
- [De, l(y) === i]
2110
- ])), 64)),
2111
- a("aside", mn, [
2112
- a("header", null, [
2113
- a("strong", null, t(l(s).explanation), 1),
2114
- X.value ? (d(), o("span", bn, t(l(s).pending), 1)) : L("", !0)
2115
- ]),
2116
- a("p", null, t(l(s).sourceHint), 1),
2117
- l(y) === "computations" ? (d(), o(w, { key: 0 }, [
2118
- a("h4", null, t(l(s).expression), 1),
2119
- a("code", null, t(l(c)), 1),
2120
- a("div", vn, [
2121
- a("h4", null, t(l(s).sourceValues) + " → " + t(l(s).result), 1),
2122
- (d(!0), o(w, null, D(l(F), (i) => (d(), o("div", {
2123
- key: i.row,
2124
- class: "mr-rule-editor__trace"
2125
- }, [
2126
- a("small", null, "#" + t(i.row), 1),
2127
- a("code", null, t(i.values), 1),
2128
- a("strong", null, t(l(B).find((J) => J.row === i.row)?.value ?? (l(B).length ? "—" : l(s).notChecked)), 1)
2129
- ]))), 128)),
2130
- l(B).some((i) => i.value == null) ? (d(), o("p", gn, t(l(s).nullReason), 1)) : L("", !0),
2131
- l(B).length ? (d(), o("p", yn, t(l(s).sample), 1)) : L("", !0)
2132
- ])
2133
- ], 64)) : L("", !0),
2134
- l(v) ? (d(), o("p", fn, t(l(v)), 1)) : L("", !0)
2135
- ])
2136
- ], 8, ft));
2137
- }
2138
- }), Dn = /* @__PURE__ */ me(hn, [["__scopeId", "data-v-f5eea239"]]);
2139
- export {
2140
- Dn as default
2141
- };