@feedmepos/mf-report 5.21.65 → 5.22.0-beta.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 (32) hide show
  1. package/dist/{App-DjOXbuSR.js → App-CPsLJc1H.js} +40 -40
  2. package/dist/{BaseDialog.vue_vue_type_script_setup_true_lang-BI3REw2h.js → BaseDialog.vue_vue_type_script_setup_true_lang-DCcoPWWG.js} +6816 -6536
  3. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-DbXhUMAR.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-BRPx8vmv.js} +2 -2
  4. package/dist/{Default.vue_vue_type_script_setup_true_lang-Cwd7YD1i.js → Default.vue_vue_type_script_setup_true_lang-BNYAE0n1.js} +2 -2
  5. package/dist/FilterSelector.vue_vue_type_script_setup_true_lang-Cxo_dkbM.js +4275 -0
  6. package/dist/InsightView-BDOfDEqL.js +662 -0
  7. package/dist/{Integration-CVRLRPdq.js → Integration-CDrT_RSA.js} +3 -3
  8. package/dist/{Integrations-DOftS93E.js → Integrations-BIGSyUVS.js} +3 -3
  9. package/dist/{Layout-DntjaCaj.js → Layout-BidoThFl.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-BB4h_9Df.js → MenuTab.vue_vue_type_script_setup_true_lang-ChNSUv6e.js} +5 -5
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-DvytJlAR.js → NavigationTab.vue_vue_type_script_setup_true_lang-CTGCxTN2.js} +3599 -3599
  12. package/dist/{NoData.vue_vue_type_script_setup_true_lang-Bm43uVUi.js → NoData.vue_vue_type_script_setup_true_lang-BMfKUFHt.js} +1 -1
  13. package/dist/{OverviewView-CuQCAiyO.js → OverviewView-DzCdiaap.js} +5 -5
  14. package/dist/{Report-CGj_ONkL.js → Report-CoaQhheo.js} +4 -4
  15. package/dist/{ReportEditor-C7u26DTW.js → ReportEditor-CdAsRgbY.js} +6 -6
  16. package/dist/{ReportView-uZvTp_a7.js → ReportView-xBr-K0is.js} +8 -8
  17. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-FW4jnJX6.js → SelectComponent.vue_vue_type_script_setup_true_lang-DwhyK9V4.js} +1 -1
  18. package/dist/{Setting-DJh6P_el.js → Setting-Dvl7rBJD.js} +5 -5
  19. package/dist/TileEditor-DFBExGup.js +3547 -0
  20. package/dist/{TransitionFade-BMCSWEAj.js → TransitionFade-DEHp-ETN.js} +401 -393
  21. package/dist/{app-CrKcmNtX.js → app-DUppOHFW.js} +238 -98
  22. package/dist/app.js +1 -1
  23. package/dist/assets/formatChartData.worker-50q7LVBw.js +171 -0
  24. package/dist/assets/processTableData.worker-DrSBAOPU.js +171 -0
  25. package/dist/{InsightView-uUQohGVn.js → chart-DDDh8zNk.js} +1824 -2481
  26. package/dist/style.css +1 -1
  27. package/dist/{vue-i18n-DgYeUN5g.js → vue-i18n-CCeYOkNm.js} +2 -2
  28. package/package.json +1 -1
  29. package/dist/FilterSelector.vue_vue_type_script_setup_true_lang-DGktnZo1.js +0 -2915
  30. package/dist/TileEditor-CfXGe6pu.js +0 -2922
  31. package/dist/assets/formatChartData.worker-BJvDVXA9.js +0 -170
  32. package/dist/assets/processTableData.worker-B3PWntX0.js +0 -170
@@ -1,2915 +0,0 @@
1
- import { computed as F, defineComponent as _e, mergeModels as We, useModel as De, ref as T, onMounted as Ie, nextTick as Ce, watch as me, resolveComponent as U, createElementBlock as se, openBlock as P, Fragment as xe, renderSlot as Ne, createVNode as G, normalizeStyle as Ve, unref as d, createElementVNode as j, toDisplayString as ke, withCtx as ce, createBlock as fe, createCommentVNode as Te, normalizeClass as Ze, h as ut, renderList as dt, toRaw as Sl, markRaw as kl, createTextVNode as wt, onUnmounted as Xt, resolveDynamicComponent as Tl, withDirectives as _l, vShow as Fl, withModifiers as gt } from "vue";
2
- import { W as N, e as at, f as Ll, S as qe, v as tt, g as Rl, h as yt, i as Gt, q as jt, R as Ke, j as $l, D as $e, c as ye, C as Se, a as zl, b as El, _ as Vl } from "./BaseDialog.vue_vue_type_script_setup_true_lang-BI3REw2h.js";
3
- import { u as nt, b as lt, a as Rt, h as Dl } from "./vue-i18n-DgYeUN5g.js";
4
- import { d as xt, _ as Al, a as Ml, b as Wl, c as Il } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-DbXhUMAR.js";
5
- import { storeToRefs as ze, defineStore as Kt } from "pinia";
6
- import { useBreakpoints as Jt, useSnackbar as $t, components as Nl } from "@feedmepos/ui-library";
7
- import { _ as Pl } from "./SelectComponent.vue_vue_type_script_setup_true_lang-FW4jnJX6.js";
8
- import { r as Ye } from "./i18n-CI_sQ5d_.js";
9
- import { _ as Ct } from "./NoData.vue_vue_type_script_setup_true_lang-Bm43uVUi.js";
10
- import { d as Je } from "./app-CrKcmNtX.js";
11
- var St = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(St || {}), Oe = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(Oe || {}), kt = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(kt || {}), Tt = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(Tt || {}), _t = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(_t || {}), Ft = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(Ft || {}), Lt = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(Lt || {});
12
- N.Circular, N.Table, N.BarChart, N.LineChart, N.StackBarChart, N.StackLineChart, N.Scorecard, N.Spacer;
13
- const Bl = [
14
- {
15
- type: N.Circular,
16
- showLabel: !1,
17
- // TODO: temporarily removed show label as it has no function
18
- showDrillDimension: !0,
19
- showRollup: !1,
20
- showSearchBar: !1
21
- },
22
- {
23
- type: N.Table,
24
- showLabel: !1,
25
- showDrillDimension: !0,
26
- showRollup: !0,
27
- showSearchBar: !0
28
- },
29
- {
30
- type: N.BarChart,
31
- showLabel: !1,
32
- // TODO: temporarily removed show label as it has no function
33
- showDrillDimension: !0,
34
- showRollup: !1,
35
- showSearchBar: !1
36
- },
37
- {
38
- type: N.LineChart,
39
- showLabel: !1,
40
- // TODO: temporarily removed show label as it has no function
41
- showDrillDimension: !0,
42
- showRollup: !0,
43
- showSearchBar: !1
44
- },
45
- {
46
- type: N.StackBarChart,
47
- showLabel: !1,
48
- // TODO: temporarily removed show label as it has no function
49
- showDrillDimension: !0,
50
- showRollup: !0,
51
- showSearchBar: !1
52
- },
53
- {
54
- type: N.StackLineChart,
55
- showLabel: !1,
56
- // TODO: temporarily removed show label as it has no function
57
- showDrillDimension: !0,
58
- showRollup: !0,
59
- showSearchBar: !1
60
- },
61
- {
62
- type: N.Scorecard,
63
- showLabel: !1,
64
- showDrillDimension: !1,
65
- showRollup: !1,
66
- showSearchBar: !1
67
- },
68
- {
69
- type: N.Spacer,
70
- showLabel: !1,
71
- showDrillDimension: !1,
72
- showRollup: !1,
73
- showSearchBar: !1
74
- }
75
- ];
76
- function bt(e) {
77
- const o = [e.schemaName, e.name];
78
- return "option" in e && e.option && o.push(e.option), "aggregation" in e && e.aggregation && o.push(e.aggregation), o.push(e.label.replace(/[^\p{L}\p{N}_]+/gu, "")), o.join("_").toLowerCase();
79
- }
80
- function Hl(e, o) {
81
- switch (e) {
82
- case N.BarChart:
83
- case N.LineChart:
84
- case N.StackBarChart:
85
- case N.StackLineChart:
86
- return Array.isArray(o == null ? void 0 : o.datasets) && Array.isArray(o == null ? void 0 : o.xAxis) && o.datasets.length > 0 && o.xAxis.length > 0;
87
- case N.Table:
88
- return Array.isArray(o == null ? void 0 : o.rows) && Array.isArray(o == null ? void 0 : o.columns) && o.rows.length > 0 && o.columns.length > 0;
89
- case N.Circular:
90
- return Array.isArray(o == null ? void 0 : o.datasets) && o.datasets.length > 0;
91
- case N.Scorecard:
92
- return !0;
93
- case N.Spacer:
94
- return !0;
95
- }
96
- }
97
- const Ot = [
98
- "54, 162, 235",
99
- //8CE6D7
100
- "0, 123, 167",
101
- //007BA7
102
- "255, 93, 83",
103
- //FF5D53
104
- "115, 200, 230",
105
- //73C8E6
106
- "252, 162, 62",
107
- //FCA23E
108
- "240, 155, 190",
109
- //F09BBE
110
- "255, 210, 50",
111
- //FFD232
112
- "80, 190, 155",
113
- //50BE9B
114
- "131, 88, 212",
115
- //8358D4
116
- "155, 80, 70"
117
- //9B5046
118
- ];
119
- function Ee({
120
- index: e,
121
- isCompare: o,
122
- opacity: i
123
- }) {
124
- let s = typeof i == "number" ? i : 1;
125
- return o && (s = s * 0.6), `rgba(${Ot[e % Ot.length]}, ${s})`;
126
- }
127
- function Zt(e, o, i) {
128
- if (e === "" || o === "")
129
- return null;
130
- let s = (k) => k == null ? void 0 : k.replace(/,/g, "");
131
- i === "ID" && (s = (k) => k == null ? void 0 : k.replace(/\./g, "").replace(/,/g, "."));
132
- const m = Number(s(e)), u = Number(s(o));
133
- if (isNaN(m) || isNaN(u))
134
- return null;
135
- let C = 0;
136
- u === 0 ? m === 0 ? C = 0 : C = 1 : C = (m - u) / u;
137
- const _ = Ol(C);
138
- return {
139
- value: isNaN(C) ? "" : `${(C * 100).toFixed(0)}%`,
140
- icon: _
141
- };
142
- }
143
- function Ol(e) {
144
- return e > 0 ? {
145
- name: "moving",
146
- color: "#1F7735",
147
- tailwind: "fm-color-system-success-100"
148
- } : e < 0 ? {
149
- name: "trending_down",
150
- color: "#99231D",
151
- tailwind: "fm-color-system-error-100"
152
- } : {
153
- name: "equal",
154
- color: "#C7C7CC",
155
- tailwind: "fm-color-neutral-gray-100"
156
- };
157
- }
158
- function pt(e) {
159
- let o = !1;
160
- const i = (u) => {
161
- if (typeof document > "u" || typeof window > "u")
162
- return;
163
- const C = String((u == null ? void 0 : u.id) ?? "");
164
- if (!C)
165
- return;
166
- const _ = document.querySelector(
167
- `#comparison-tooltip-${C}`
168
- );
169
- _ && (_.__onViewportChange && (window.removeEventListener("scroll", _.__onViewportChange, !0), window.removeEventListener("resize", _.__onViewportChange)), _.remove());
170
- }, s = (u) => {
171
- var _;
172
- return (Array.isArray((_ = u == null ? void 0 : u.data) == null ? void 0 : _.datasets) ? u.data.datasets : []).some((k) => Reflect.get(k, "dash") === !0 || Reflect.get(k, "isCompare") === !0);
173
- }, m = (u) => {
174
- var l, w;
175
- if (e === "bar" && !s(u))
176
- return;
177
- const C = ((l = u.tooltip) == null ? void 0 : l.getActiveElements()) ?? [];
178
- if (C.length === 0)
179
- return;
180
- const _ = u.scales.x, k = u.scales.y;
181
- if (!_ || !k)
182
- return;
183
- const V = u.ctx, p = C[0], x = p.element, v = ((w = u.options) == null ? void 0 : w.indexAxis) === "y", g = v ? k : _, b = v ? x.y : x.x, L = g.getPixelForValue(p.index), c = e === "bar" ? L : b ?? L, { left: t, right: r, top: h, bottom: a } = u.chartArea;
184
- V.save(), V.beginPath(), V.lineWidth = 1, V.strokeStyle = "rgba(0, 0, 0, 0.3)", V.setLineDash([5, 5]), v ? (V.moveTo(t, c), V.lineTo(r, c)) : (V.moveTo(c, h), V.lineTo(c, a)), V.stroke(), V.restore();
185
- };
186
- return {
187
- id: "crosshair",
188
- afterDatasetsDraw: (u) => {
189
- m(u);
190
- },
191
- beforeTooltipDraw: (u) => {
192
- var _;
193
- const C = u.ctx;
194
- (((_ = u.tooltip) == null ? void 0 : _.opacity) ?? 0) > 0 && (C.save(), C.shadowColor = "rgba(17, 24, 39, 0.14)", C.shadowBlur = 12, C.shadowOffsetX = 0, C.shadowOffsetY = 4, o = !0);
195
- },
196
- afterTooltipDraw: (u) => {
197
- o && (u.ctx.restore(), o = !1);
198
- },
199
- beforeDestroy: (u) => {
200
- i(u);
201
- },
202
- afterDestroy: (u) => {
203
- i(u);
204
- }
205
- };
206
- }
207
- function ot(e = !1, o = !1) {
208
- const i = (c) => typeof c != "string" ? [] : c.split("#").map((t) => t.trim()).filter((t) => t.length > 0), s = (c) => Reflect.get(c, "dash") === !0 || Reflect.get(c, "isCompare") === !0, m = (c) => {
209
- const t = Reflect.get(c.dataset, "label"), r = typeof t == "string" ? t : "", h = c.parsed, a = e ? h.x : h.y, l = e ? h.y : h.x;
210
- return `${r}: ${(a ?? l ?? 0).toLocaleString()}`;
211
- }, u = (c, t) => {
212
- if (typeof c == "string") return c;
213
- if (Array.isArray(c)) {
214
- const r = c[t];
215
- return typeof r == "string" ? r : void 0;
216
- }
217
- }, C = (c) => {
218
- if (typeof c != "string") return "#9ca3af";
219
- const t = c.trim();
220
- return /^[-#(),.%\sa-zA-Z0-9]+$/.test(t) ? t : "#9ca3af";
221
- }, _ = (c) => {
222
- const t = c.replace(/\s+/g, "").toLowerCase();
223
- return !!(t === "transparent" || /^rgba\([^)]*,0(?:\.0+)?\)$/.test(t) || /^hsla\([^)]*,0(?:\.0+)?\)$/.test(t) || t === "#0000" || t === "#00000000");
224
- }, k = (...c) => {
225
- for (const t of c) {
226
- if (!t) continue;
227
- const r = C(t);
228
- if (!_(r))
229
- return r;
230
- }
231
- return "#9ca3af";
232
- }, V = (c) => {
233
- var h, a;
234
- const t = c.dataset;
235
- return Reflect.get(t, "type") === "bar" ? !0 : ((a = (h = c.chart) == null ? void 0 : h.config) == null ? void 0 : a.type) === "bar";
236
- }, p = (c) => {
237
- const t = c.dataset, r = typeof c.dataIndex == "number" ? c.dataIndex : 0, h = u(Reflect.get(t, "borderColor"), r), a = u(Reflect.get(t, "backgroundColor"), r), l = Reflect.get(
238
- c.element,
239
- "options"
240
- ), w = u(
241
- Reflect.get(l ?? {}, "borderColor"),
242
- r
243
- ), $ = u(
244
- Reflect.get(l ?? {}, "backgroundColor"),
245
- r
246
- );
247
- return V(c) ? k(a, $, h, w) : k(h, w, a, $);
248
- }, x = (c) => c.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\"/g, "&quot;").replace(/'/g, "&#39;"), y = (c) => {
249
- var Z;
250
- const t = (Z = c[0]) == null ? void 0 : Z.label, r = i(t), h = r[0] ?? (t == null ? "" : String(t)), a = r[1], l = [], w = [];
251
- c.forEach((W) => {
252
- const K = W.dataset ?? {}, re = {
253
- text: m(W),
254
- color: p(W),
255
- isBar: V(W)
256
- };
257
- if (a && s(K)) {
258
- w.push(re);
259
- return;
260
- }
261
- l.push(re);
262
- });
263
- const $ = (W, K = !1) => `<div style="font-size:13px;font-weight:600;color:#111827;text-align:left;margin:${K ? "10px" : "0"} 0 6px;">${x(W)}</div>`, A = (W) => `<div style="display:flex;align-items:center;font-size:14px;font-weight:500;color:#374151;text-align:left;line-height:1.45;margin:0 0 4px;"><span style="${W.isBar ? `display:inline-block;width:14px;height:14px;border-radius:3px;background:${W.color};border:1px solid rgba(17, 24, 39, 0.35);box-sizing:border-box;margin-right:10px;flex:0 0 auto;` : `display:inline-block;width:14px;height:14px;border-radius:9999px;background:${W.color};border:2px solid #ffffff;box-shadow:0 0 0 1px rgba(17, 24, 39, 0.35);box-sizing:border-box;margin-right:10px;flex:0 0 auto;`}"></span><span>${x(W.text)}</span></div>`;
264
- let I = "";
265
- return h.length > 0 && (I += $(h)), I += l.map((W) => A(W)).join(""), a && w.length > 0 && (I += $(a, I.length > 0), I += w.map((W) => A(W)).join("")), I;
266
- }, v = (c) => {
267
- const t = window.getComputedStyle(c);
268
- return [t.overflow, t.overflowX, t.overflowY].some((h) => h !== "visible");
269
- }, g = (c) => {
270
- let t = c.parentElement ?? c, r = t;
271
- for (; r && r.parentElement && r.parentElement !== document.body && r.parentElement !== document.documentElement; )
272
- v(r) && (t = r.parentElement), r = r.parentElement;
273
- return window.getComputedStyle(t).position === "static" && (t.style.position = "relative"), t;
274
- }, b = (c, t, r, h, a) => {
275
- const l = t.getBoundingClientRect(), w = r.getBoundingClientRect(), $ = r.scrollLeft, A = r.scrollTop, I = 8, Z = l.left - w.left + $ + h + 12, W = l.top - w.top + A + a - c.offsetHeight / 2, K = $ + I;
276
- let re = A + I;
277
- const ue = document.querySelector(
278
- '[data-menu-tab="true"]'
279
- );
280
- if (ue) {
281
- const O = ue.getBoundingClientRect().bottom - w.top + A + I;
282
- re = Math.max(re, O);
283
- }
284
- const S = Math.max(
285
- K,
286
- $ + r.clientWidth - c.offsetWidth - I
287
- ), E = Math.max(
288
- re,
289
- A + r.clientHeight - c.offsetHeight - I
290
- ), X = Math.min(Math.max(K, Z), S), q = Math.min(Math.max(re, W), E);
291
- c.style.left = `${X}px`, c.style.top = `${q}px`;
292
- }, L = {
293
- mode: "index",
294
- intersect: !1,
295
- axis: e ? "y" : "x",
296
- backgroundColor: "#ffffff",
297
- titleColor: "#111827",
298
- bodyColor: "#374151",
299
- borderColor: "#d1d5db",
300
- borderWidth: 1.2,
301
- cornerRadius: 8,
302
- padding: {
303
- top: 10,
304
- right: 12,
305
- bottom: 10,
306
- left: 12
307
- },
308
- boxPadding: 5,
309
- bodySpacing: 8,
310
- caretPadding: 8,
311
- caretSize: 6,
312
- titleAlign: "left",
313
- bodyAlign: "left",
314
- multiKeyBackground: "#ffffff",
315
- usePointStyle: !1,
316
- titleFont: {
317
- size: 14,
318
- weight: 600
319
- },
320
- bodyFont: {
321
- size: 14,
322
- weight: 500
323
- },
324
- titleMarginBottom: 10
325
- };
326
- return o ? {
327
- ...L,
328
- enabled: !1,
329
- external: ({ chart: c, tooltip: t }) => {
330
- if (typeof document > "u" || typeof window > "u")
331
- return;
332
- const r = c == null ? void 0 : c.canvas;
333
- if (!(r instanceof HTMLCanvasElement))
334
- return;
335
- const h = g(r), a = `comparison-tooltip-${String(c.id)}`;
336
- let l = document.querySelector(`#${a}`);
337
- if (l || (l = document.createElement("div"), l.id = a, l.style.background = "#ffffff", l.style.border = "1.2px solid #d1d5db", l.style.borderRadius = "8px", l.style.boxShadow = "0 4px 12px rgba(17, 24, 39, 0.14)", l.style.color = "#374151", l.style.left = "0", l.style.opacity = "0", l.style.maxHeight = "calc(100% - 16px)", l.style.maxWidth = "min(420px, calc(100% - 16px))", l.style.overflowY = "auto", l.style.padding = "10px 12px", l.style.pointerEvents = "none", l.style.position = "absolute", l.style.textAlign = "left", l.style.top = "0", l.style.transform = "none", l.style.whiteSpace = "normal", l.style.wordBreak = "break-word", l.style.zIndex = "9999"), l.parentElement !== h && h.appendChild(l), l.__onViewportChange || (l.__onViewportChange = () => {
338
- if (l.style.opacity !== "1")
339
- return;
340
- const I = Number(l.dataset.caretX), Z = Number(l.dataset.caretY);
341
- if (!Number.isFinite(I) || !Number.isFinite(Z)) {
342
- l.style.opacity = "0";
343
- return;
344
- }
345
- const W = g(r);
346
- l.parentElement !== W && W.appendChild(l), b(l, r, W, I, Z);
347
- }, window.addEventListener("scroll", l.__onViewportChange, {
348
- capture: !0,
349
- passive: !0
350
- }), window.addEventListener("resize", l.__onViewportChange, {
351
- passive: !0
352
- })), ((t == null ? void 0 : t.opacity) ?? 0) === 0) {
353
- l.style.opacity = "0";
354
- return;
355
- }
356
- const w = (t == null ? void 0 : t.dataPoints) ?? [];
357
- if (w.length === 0) {
358
- l.style.opacity = "0";
359
- return;
360
- }
361
- l.innerHTML = y(w);
362
- const $ = typeof (t == null ? void 0 : t.caretX) == "number" ? t.caretX : 0, A = typeof (t == null ? void 0 : t.caretY) == "number" ? t.caretY : 0;
363
- l.dataset.caretX = String($), l.dataset.caretY = String(A), b(l, r, h, $, A), l.style.opacity = "1";
364
- }
365
- } : {
366
- ...L,
367
- callbacks: {
368
- title: (c) => {
369
- var r;
370
- const t = (r = c[0]) == null ? void 0 : r.label;
371
- return t == null ? "" : String(t);
372
- },
373
- label: (c) => m(c)
374
- }
375
- };
376
- }
377
- function st(e) {
378
- function o(p, x, y) {
379
- if (p.measureText(x).width <= y) return x;
380
- const v = "…";
381
- let g = 0, b = x.length;
382
- for (; g < b; ) {
383
- const L = Math.floor((g + b) / 2), c = x.slice(0, L) + v;
384
- p.measureText(c).width <= y ? g = L + 1 : b = L;
385
- }
386
- return x.slice(0, g - 1) + v;
387
- }
388
- function i(p) {
389
- const x = p == null ? "" : String(p), [y] = x.split("#");
390
- return (y ?? x).trim();
391
- }
392
- const s = F(() => ({
393
- display: e.showLabel,
394
- align: e.labelAlign,
395
- anchor: e.labelAnchor,
396
- rotation: e.labelRotation,
397
- offset: e.labelOffset,
398
- font: {
399
- size: e.labelFontSize
400
- },
401
- color: (p) => {
402
- const x = p.chart.data.datasets[p.datasetIndex];
403
- return x.borderColor ? Array.isArray(x.borderColor) ? x.borderColor[p.dataIndex] : x.borderColor : x.backgroundColor ? Array.isArray(x.backgroundColor) ? x.backgroundColor[p.dataIndex] : x.backgroundColor : "#000";
404
- },
405
- formatter: (p) => p === 0 ? "" : p.toLocaleString("en-US")
406
- })), m = F(() => ({
407
- display: e.showX,
408
- position: e.xPosition,
409
- grid: {
410
- display: e.showXGrid
411
- },
412
- ticks: {
413
- display: e.showXTick,
414
- callback: function(p) {
415
- if ((e == null ? void 0 : e.isTransposed) === !0) return i(p);
416
- let y = String(p);
417
- const v = this;
418
- v && typeof v.getLabelForValue == "function" && (y = v.getLabelForValue(p)), y = i(y);
419
- const g = v == null ? void 0 : v.chart, b = v == null ? void 0 : v.ctx, L = g.height * 0.25;
420
- if (b && L > 0) {
421
- b.save();
422
- const t = b.measureText(y).width > L ? o(b, y, L) : y;
423
- return b.restore(), t;
424
- }
425
- return y;
426
- },
427
- font: {
428
- size: e.xTickFontSize
429
- }
430
- },
431
- title: {
432
- display: e.showXTitle,
433
- text: e.xTitle,
434
- font: {
435
- size: e.xTitleFontSize
436
- }
437
- },
438
- afterBuildTicks: (p) => {
439
- const x = Array.isArray(p == null ? void 0 : p.ticks) ? p.ticks : [];
440
- if (x.length === 0) return;
441
- const y = i(p.getLabelForValue(x[0].value)), v = !isNaN(Number(y));
442
- p.options.ticks.minRotation = v || x.length < 10 ? 0 : 90;
443
- },
444
- afterFit: (p) => {
445
- if (!(e != null && e.isTransposed)) {
446
- const x = p.chart.height * 0.4;
447
- p.height > x && (p.height = x);
448
- }
449
- }
450
- })), u = F(() => ({
451
- display: e.showY,
452
- position: e.yPosition,
453
- grid: {
454
- display: e.showYGrid
455
- },
456
- ticks: {
457
- display: e.showYTick,
458
- font: {
459
- size: e.yTickFontSize
460
- },
461
- callback: function(p) {
462
- if (!((e == null ? void 0 : e.isTransposed) === !0)) return i(p);
463
- let y = String(p);
464
- const v = this;
465
- v && typeof v.getLabelForValue == "function" && (y = v.getLabelForValue(p)), y = i(y);
466
- const g = v == null ? void 0 : v.chart, b = v == null ? void 0 : v.ctx, L = g.width * 0.4;
467
- if (b && L > 0) {
468
- b.save();
469
- const t = b.measureText(y).width > L ? o(b, y, L) : y;
470
- return b.restore(), t;
471
- }
472
- return y;
473
- }
474
- },
475
- title: {
476
- display: e.showYTitle,
477
- text: e.yTitle,
478
- font: {
479
- size: e.yTitleFontSize
480
- }
481
- }
482
- })), C = F(() => ({
483
- display: e.showLegend,
484
- position: e.legendPosition,
485
- usePointStyle: e.usePointStyle,
486
- maxHeight: e.legendMaxHeight,
487
- maxWidth: e.legendMaxWidth,
488
- labels: {
489
- usePointStyle: e.usePointStyle ?? !0,
490
- generateLabels: (p) => {
491
- var y;
492
- const x = ((y = p == null ? void 0 : p.data) == null ? void 0 : y.datasets) || [];
493
- if (x.length === 0) return [];
494
- if (x.length === 1 && Array.isArray(x[0].backgroundColor) && x[0].backgroundColor.length > 1 && Array.isArray(x[0].data)) {
495
- const v = x[0];
496
- return p.data.labels.map((b, L) => {
497
- const c = v.backgroundColor[L];
498
- return {
499
- text: b,
500
- fontColor: "#6b6b6b",
501
- fillStyle: c,
502
- strokeStyle: c,
503
- datasetIndex: 0,
504
- index: L,
505
- hidden: p.getDataVisibility ? !p.getDataVisibility(L) : !1
506
- };
507
- });
508
- }
509
- return p.data.datasets.map((v, g) => {
510
- const b = v.borderColor || v.backgroundColor;
511
- return {
512
- text: v.label,
513
- fontColor: "#6b6b6b",
514
- fillStyle: b,
515
- strokeStyle: b,
516
- datasetIndex: g,
517
- hidden: !p.isDatasetVisible(g)
518
- };
519
- });
520
- }
521
- }
522
- })), _ = F(() => e.isTransposed), k = F(() => e.chartWidth), V = F(() => e.chartHeight);
523
- return { datalabels: s, xCfg: m, yCfg: u, isTransposed: _, legend: C, chartWidth: k, chartHeight: V };
524
- }
525
- const ql = /* @__PURE__ */ _e({
526
- __name: "WidgetBarchart",
527
- props: /* @__PURE__ */ We({
528
- tileIndex: {}
529
- }, {
530
- modelValue: { required: !0 },
531
- modelModifiers: {}
532
- }),
533
- emits: ["update:modelValue"],
534
- setup(e) {
535
- const o = e, i = De(e, "modelValue"), s = T(null), m = F(() => {
536
- var t;
537
- return ((t = i.value.data) == null ? void 0 : t.xAxis) ?? [];
538
- }), u = F(() => {
539
- var t;
540
- return ((t = i.value.data) == null ? void 0 : t.datasets) ?? [];
541
- }), { datalabels: C, xCfg: _, yCfg: k, isTransposed: V, legend: p, chartWidth: x, chartHeight: y } = st(
542
- i.value
543
- ), v = F(() => ot(i.value.isTransposed === !0, !0)), g = pt("bar"), b = F(() => u.value.length > 0 ? [
544
- ...u.value.map((t, r) => ({
545
- label: t.name,
546
- data: t.values,
547
- dash: !!t.isCompare,
548
- backgroundColor: Ee({ index: r, isCompare: t.isCompare })
549
- }))
550
- ] : []), L = at();
551
- function c() {
552
- return L.extractChartSize(s.value, o.tileIndex) || { width: 0, height: 0 };
553
- }
554
- return Ie(() => {
555
- Ce(() => {
556
- c();
557
- });
558
- }), me([b], () => {
559
- Ce(() => c());
560
- }), (t, r) => {
561
- const h = U("FmBarChart");
562
- return P(), se(xe, null, [
563
- Ne(t.$slots, "menu"),
564
- G(h, {
565
- ref_key: "chartRef",
566
- ref: s,
567
- class: "bar-chart",
568
- datasets: b.value,
569
- "x-axis": { categories: m.value },
570
- "x-cfg": d(_),
571
- "y-cfg": d(k),
572
- transpose: d(V),
573
- legend: {
574
- display: d(p).display ?? !1,
575
- position: d(p).position,
576
- maxHeight: d(p).maxHeight,
577
- maxWidth: d(p).maxWidth,
578
- labels: d(p).labels
579
- },
580
- tooltip: v.value,
581
- datalabels: d(C),
582
- plugins: [d(g)],
583
- "maintain-aspect-ratio": !1,
584
- style: Ve({
585
- "--chart-width": d(x) !== void 0 ? d(x) + "px" : "100%",
586
- "--chart-height": d(y) !== void 0 ? d(y) + "px" : "calc(100% - 36px)"
587
- })
588
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "tooltip", "datalabels", "plugins", "style"])
589
- ], 64);
590
- };
591
- }
592
- }), Yl = /* @__PURE__ */ _e({
593
- __name: "WidgetCircular",
594
- props: /* @__PURE__ */ We({
595
- tileIndex: {}
596
- }, {
597
- modelValue: { required: !0 },
598
- modelModifiers: {}
599
- }),
600
- emits: ["update:modelValue"],
601
- setup(e) {
602
- const o = e, i = De(e, "modelValue"), { breakpoints: s } = Jt(), m = T(null), { datalabels: u, legend: C, chartWidth: _, chartHeight: k } = st(i.value), V = F(() => {
603
- let b = [];
604
- return i.value.data.datasets && i.value.data.metrics && i.value.data.datasets.length > 0 && i.value.data.metrics.length > 0 && (b = [
605
- {
606
- label: i.value.data.metrics[0],
607
- data: i.value.data.datasets.map((L) => L.value),
608
- backgroundColor: i.value.data.datasets.map((L, c) => Ee({ index: c }))
609
- }
610
- ]), b;
611
- }), p = at();
612
- function x() {
613
- return p.extractChartSize(m.value, o.tileIndex) || { width: 0, height: 0 };
614
- }
615
- Ie(() => {
616
- Ce(() => {
617
- x();
618
- });
619
- }), me([V], () => {
620
- Ce(() => x());
621
- });
622
- const y = F(() => s.value.lg ? 12 : 8), v = F(
623
- () => ({
624
- display: C.value.display ?? !0,
625
- position: C.value.position ?? "top",
626
- maxHeight: C.value.maxHeight,
627
- maxWidth: C.value.maxWidth,
628
- labels: {
629
- ...C.value.labels,
630
- font: {
631
- size: y.value
632
- }
633
- }
634
- })
635
- ), g = {
636
- backgroundColor: "#ffffff",
637
- titleColor: "#111827",
638
- bodyColor: "#374151",
639
- borderColor: "#d1d5db",
640
- borderWidth: 1.2,
641
- cornerRadius: 8,
642
- padding: {
643
- top: 10,
644
- right: 12,
645
- bottom: 10,
646
- left: 12
647
- },
648
- boxPadding: 5,
649
- bodySpacing: 8,
650
- caretPadding: 8,
651
- caretSize: 6,
652
- titleAlign: "left",
653
- bodyAlign: "left",
654
- multiKeyBackground: "#ffffff",
655
- usePointStyle: !0,
656
- titleFont: {
657
- size: 13,
658
- weight: 600
659
- },
660
- bodyFont: {
661
- size: 12,
662
- weight: 500
663
- },
664
- titleMarginBottom: 10,
665
- callbacks: {
666
- label: (b) => {
667
- const L = b.label || "", c = typeof b.parsed == "number" ? b.parsed : 0, r = (Array.isArray(b.dataset.data) ? b.dataset.data : []).reduce((a, l) => a + Number(l || 0), 0), h = r > 0 ? (c / r * 100).toFixed(1) : "0.0";
668
- return `${L}: ${c.toLocaleString()} (${h}%)`;
669
- }
670
- }
671
- };
672
- return (b, L) => {
673
- const c = U("FmPieChart");
674
- return P(), se(xe, null, [
675
- Ne(b.$slots, "menu"),
676
- G(c, {
677
- ref_key: "chartRef",
678
- ref: m,
679
- class: "circular",
680
- percentage: "70%",
681
- datasets: V.value,
682
- metrics: i.value.data.datasets.map((t) => t.name),
683
- tooltip: g,
684
- variant: "doughnut",
685
- legend: v.value,
686
- datalabels: d(u),
687
- "maintain-aspect-ratio": !1,
688
- style: Ve({
689
- "--chart-width": d(_) !== void 0 ? d(_) + "px" : "100%",
690
- "--chart-height": d(k) !== void 0 ? d(k) + "px" : "calc(100% - 36px)"
691
- })
692
- }, null, 8, ["datasets", "metrics", "legend", "datalabels", "style"])
693
- ], 64);
694
- };
695
- }
696
- });
697
- function ct(e) {
698
- if (e == null || e === "")
699
- return "";
700
- const o = String(e), i = Number(o);
701
- if (isNaN(i)) return o;
702
- const [s, m] = o.split("."), u = new Intl.NumberFormat("en-US").format(Number(s));
703
- return m !== void 0 ? `${u}.${m}` : u;
704
- }
705
- const Ul = { class: "flex flex-col gap-1" }, Xl = { class: "fm-typo-en-title-md-600" }, Gl = { class: "flex gap-2" }, jl = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Kl = { key: 0 }, Jl = { key: 1 }, Zl = /* @__PURE__ */ _e({
706
- __name: "WidgetScorecard",
707
- props: {
708
- modelValue: { required: !0 },
709
- modelModifiers: {}
710
- },
711
- emits: ["update:modelValue"],
712
- setup(e) {
713
- const o = De(e, "modelValue"), { t: i } = nt(), { compareDateRange: s, defaultDateSetting: m } = ze(lt()), { country: u } = Rt(), C = F(() => {
714
- var g;
715
- return ((g = o.value.data) == null ? void 0 : g.value) || "";
716
- }), _ = F(() => ct(C.value)), k = F(() => {
717
- const { data: g } = o.value;
718
- return g != null && g.comparison ? Zt(C.value, g.comparison, u) : null;
719
- });
720
- function V(g) {
721
- switch (g) {
722
- case St.bar:
723
- return "bar";
724
- case St.line:
725
- return "line";
726
- default:
727
- return "line";
728
- }
729
- }
730
- const p = F(() => {
731
- var g;
732
- return (g = o.value.data) == null ? void 0 : g.sparkline;
733
- }), x = F(() => ({
734
- display: !1,
735
- beginAtZero: !1,
736
- grace: "20%"
737
- })), y = F(() => p.value.datasets.map((g) => ({
738
- label: g.name,
739
- data: g.values,
740
- fill: !0,
741
- color: "#36a2eb"
742
- }))), v = F(() => ot(!1, !0));
743
- return (g, b) => {
744
- const L = U("FmIcon"), c = U("FmChip"), t = U("FmTooltip"), r = U("FmLineChart");
745
- return P(), se("div", Ul, [
746
- Ne(g.$slots, "menu"),
747
- j("p", Xl, ke(_.value), 1),
748
- j("div", Gl, [
749
- G(t, {
750
- disabled: k.value === null,
751
- placement: "right",
752
- "hide-arrow": "",
753
- variant: "rich"
754
- }, {
755
- content: ce(() => {
756
- var h;
757
- return [
758
- j("span", jl, ke(`vs. ${(h = d(m).defaultCompareType) == null ? void 0 : h.split("_").join(" ")}`), 1)
759
- ];
760
- }),
761
- default: ce(() => [
762
- k.value ? (P(), fe(c, {
763
- key: 0,
764
- icon: k.value.icon.name,
765
- class: Ze(`bg-${k.value.icon.tailwind}`),
766
- compact: ""
767
- }, {
768
- default: ce(() => [
769
- G(L, {
770
- name: k.value.icon.name,
771
- color: k.value.icon.color
772
- }, null, 8, ["name", "color"]),
773
- j("p", {
774
- class: "fm-typo-en-body-md-600",
775
- style: Ve({ color: k.value.icon.color })
776
- }, ke(k.value.value), 5)
777
- ]),
778
- _: 1
779
- }, 8, ["icon", "class"])) : Te("", !0),
780
- d(s).endDate != null && d(s).startDate != null && k.value === null ? (P(), fe(c, {
781
- key: 1,
782
- class: "invisible pointer-events-none",
783
- "aria-hidden": "true",
784
- compact: ""
785
- }, {
786
- default: ce(() => [
787
- G(L, {
788
- name: "arrow_upward",
789
- color: "#C7C7CC"
790
- }),
791
- b[0] || (b[0] = j("p", { class: "fm-typo-en-body-md-600" }, " ", -1))
792
- ]),
793
- _: 1
794
- })) : Te("", !0)
795
- ]),
796
- _: 1
797
- }, 8, ["disabled"])
798
- ]),
799
- p.value ? (P(), se("div", Kl, [
800
- V(p.value.type) === "line" ? (P(), fe(r, {
801
- key: 0,
802
- class: "sparkline",
803
- datasets: y.value,
804
- legend: {
805
- display: !1
806
- },
807
- datalabels: { display: !1 },
808
- "x-axis": { categories: p.value.dimensions },
809
- "y-cfg": x.value,
810
- "x-cfg": { display: !1 },
811
- tooltip: v.value,
812
- "maintain-aspect-ratio": !1
813
- }, null, 8, ["datasets", "x-axis", "y-cfg", "tooltip"])) : Te("", !0)
814
- ])) : (P(), se("div", Jl, b[1] || (b[1] = [
815
- j("div", { class: "sparkline" }, [
816
- j("div", { class: "flex flex-col gap-8" }, [
817
- j("div"),
818
- j("div")
819
- ]),
820
- j("div", { class: "grow" })
821
- ], -1)
822
- ])))
823
- ]);
824
- };
825
- }
826
- }), Ql = {};
827
- function ea(e, o) {
828
- const i = U("FmMenuDivider");
829
- return P(), fe(i);
830
- }
831
- const ta = /* @__PURE__ */ Pl(Ql, [["render", ea]]), la = "mf-reporttable-dimension", qt = Kt(la, () => {
832
- const e = T(0), o = T([]), i = T(!1), s = (t, r) => {
833
- e.value = t, u(t, r);
834
- }, m = (t, r, h, a) => {
835
- o[t] = r, o.value = [...o.value], C(t, r, h, a);
836
- }, u = (t, r) => {
837
- const h = (r == null ? void 0 : r.querySelectorAll("thead tr")) ?? [], a = (r == null ? void 0 : r.querySelectorAll("tbody tr")) ?? [];
838
- [...h, ...a].forEach((w) => {
839
- const $ = w;
840
- $ && ($.style.height = `${t}px`);
841
- });
842
- }, C = (t, r, h, a = !1) => {
843
- const l = (h == null ? void 0 : h.querySelectorAll("th")) ?? [];
844
- if (t === void 0) return;
845
- const w = l[t], $ = a ? o[t] : r;
846
- if (!w || $ === void 0) return;
847
- const A = () => {
848
- w.style.width = `${$}px`;
849
- };
850
- a ? requestAnimationFrame(A) : A();
851
- }, _ = () => {
852
- const t = document.querySelectorAll("th"), r = document.querySelectorAll("td"), h = document.querySelector("table");
853
- h == null || h.classList.add("table-fixed"), t.forEach((a) => a.classList.add("toggleEditResize")), r.forEach((a) => a.classList.add("toggleEditResize")), i.value = !0;
854
- }, k = () => {
855
- const t = document.querySelectorAll("th"), r = document.querySelectorAll("td"), h = document.querySelectorAll(".col-resize-handle"), a = document.querySelectorAll(".row-resize-handle");
856
- t.forEach((l) => l.classList.remove("toggleEditResize")), r.forEach((l) => l.classList.remove("toggleEditResize")), h.forEach((l) => l.remove()), a.forEach((l) => l.remove()), i.value = !1;
857
- }, V = () => {
858
- e.value = 0, o.value = [];
859
- }, p = (t, r) => {
860
- if (r) {
861
- const h = document.querySelectorAll(`thead th:nth-child(${t + 1})`), a = document.querySelectorAll(`tbody td:nth-child(${t + 1})`);
862
- [...h, ...a].forEach((l) => {
863
- l.classList.add("highlight-hover-col");
864
- });
865
- } else
866
- document.querySelectorAll(
867
- `thead th:nth-child(${t + 1}), tbody td:nth-child(${t + 1})`
868
- ).forEach((h) => h.classList.add("highlight-col"));
869
- }, x = (t) => {
870
- const r = document.querySelectorAll("thead tr"), h = document.querySelectorAll("tbody tr"), a = [...r, ...h];
871
- for (const l of a)
872
- t ? l.classList.add("highlight-hover-row") : l.classList.add("highlight-row");
873
- }, y = (t) => {
874
- const r = t ? ".highlight-hover-row" : ".highlight-row", h = document.querySelectorAll(r);
875
- for (const a of h)
876
- a.classList.remove(r.slice(1));
877
- }, v = (t) => {
878
- t ? document.querySelectorAll(".highlight-hover-col").forEach((r) => {
879
- r.classList.remove("highlight-hover-col");
880
- }) : document.querySelectorAll(".highlight-col").forEach((r) => r.classList.remove("highlight-col"));
881
- }, g = (t, r) => {
882
- const h = t.clientX, a = t.target.closest("table");
883
- if (!a) return;
884
- const l = a.querySelectorAll("th")[r];
885
- if (!l) return;
886
- const w = l.getBoundingClientRect().width || 60, $ = l.querySelector("button"), A = ($ == null ? void 0 : $.querySelector("span")) || l.querySelector("p") || l;
887
- let I = 60;
888
- if (A) {
889
- const S = A.textContent || "", E = window.getComputedStyle(A), X = `${E.fontWeight} ${E.fontSize} ${E.fontFamily}`, B = document.createElement("canvas").getContext("2d");
890
- if (B) {
891
- B.font = X;
892
- const O = B.measureText(S), he = window.getComputedStyle(l), Fe = parseFloat(he.paddingLeft || "0"), Ae = parseFloat(he.paddingRight || "0");
893
- I = O.width + Fe + Ae;
894
- }
895
- }
896
- p(r, !1);
897
- let Z = null, W = null;
898
- const K = () => {
899
- if (W === null) return;
900
- const S = l;
901
- S.style.width = `${W}px`;
902
- let E = 0;
903
- a.querySelectorAll("th").forEach((q, B) => {
904
- E += B === r ? W : q.getBoundingClientRect().width;
905
- }), a.classList.remove("w-full"), a.style.width = `${E}px`, Z = null;
906
- }, re = (S) => {
907
- const E = S.clientX - h;
908
- W = Math.max(I, w + E), Z === null && (Z = requestAnimationFrame(K));
909
- }, ue = () => {
910
- Z !== null && cancelAnimationFrame(Z), W !== null && (l.style.width = `${W}px`);
911
- const S = a.querySelectorAll("th"), E = [];
912
- S.forEach((X) => {
913
- E.push(X.getBoundingClientRect().width);
914
- }), o.value = E, v(!1), document.removeEventListener("mousemove", re), document.removeEventListener("mouseup", ue);
915
- };
916
- document.addEventListener("mousemove", re), document.addEventListener("mouseup", ue);
917
- }, b = (t) => {
918
- const r = t.clientY, h = t.target.closest("table"), a = e.value || 48;
919
- x(!1);
920
- const l = ($) => {
921
- const A = Math.max(30, a + ($.clientY - r));
922
- h && s(A, h);
923
- }, w = () => {
924
- y(!1), document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", w);
925
- };
926
- document.addEventListener("mousemove", l), document.addEventListener("mouseup", w);
927
- };
928
- return {
929
- rowHeight: e,
930
- colWidths: o,
931
- isEditing: i,
932
- updateRowHeight: s,
933
- updateColWidth: m,
934
- setRowHeights: u,
935
- setColWidths: C,
936
- enableEditMode: _,
937
- disableEditMode: k,
938
- resetStore: V,
939
- highlightCol: p,
940
- highlightRows: x,
941
- removeRowHighlight: y,
942
- removeColHighlight: v,
943
- resizeCol: g,
944
- resizeRow: b,
945
- enableCellResizing: () => {
946
- const t = document.querySelector("thead"), r = document.querySelectorAll("thead tr"), h = document.querySelectorAll("tbody tr"), a = [...r, ...h];
947
- t && t.classList.remove("sticky");
948
- const l = (w, $) => {
949
- const A = document.createElement("div");
950
- return A.className = `${w}-resize-handle`, w === "col" ? (A.addEventListener("mouseenter", () => p($, !0)), A.addEventListener("mouseleave", () => v(!0)), A.addEventListener("mousedown", (I) => {
951
- I.stopPropagation(), g(I, $);
952
- })) : (A.addEventListener("mouseenter", () => x(!0)), A.addEventListener("mouseleave", () => y(!0)), A.addEventListener("mousedown", (I) => {
953
- I.stopPropagation(), b(I);
954
- })), A;
955
- };
956
- a.forEach((w) => {
957
- const $ = w.closest("thead") !== null;
958
- w.querySelectorAll($ ? "th" : "td").forEach((I, Z) => {
959
- const W = l("col", Z), K = l("row", Z);
960
- I.appendChild(W), I.appendChild(K);
961
- });
962
- }), _();
963
- },
964
- cancelResizingChanges: () => {
965
- k();
966
- }
967
- };
968
- }), aa = "/assets/processTableData.worker-B3PWntX0.js", na = { class: "my-4" }, oa = {
969
- class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
970
- style: { backgroundColor: "#f9f9f9" }
971
- }, sa = { class: "font-bold" }, ra = { class: "text-fm-color-neutral-gray-300" }, ia = /* @__PURE__ */ _e({
972
- __name: "WidgetTable",
973
- props: /* @__PURE__ */ We({
974
- tileIndex: {}
975
- }, {
976
- modelValue: { required: !0 },
977
- modelModifiers: {}
978
- }),
979
- emits: ["update:modelValue"],
980
- setup(e) {
981
- const { t: o, te: i } = nt(), s = De(e, "modelValue"), { country: m } = Rt(), { clearTileSorts: u, setTileSorts: C } = Ll(), _ = $t(), k = e, V = T([]), { isEditing: p, colWidths: x, rowHeight: y } = ze(qt()), { setColWidths: v, setRowHeights: g, enableCellResizing: b } = qt(), L = T(null), c = F(() => {
982
- var S;
983
- return ((S = s.value.data) == null ? void 0 : S.columns) || [{ label: "", key: "" }];
984
- }), t = F(() => {
985
- var S;
986
- return ((S = s.value.data) == null ? void 0 : S.rows) || [];
987
- }), r = F(() => s.value.filterText), h = F(() => {
988
- var S, E;
989
- if (!(r.value && r.value.trim().length > 0 || !((S = t.value[0]) != null && S.isRollup) && !((E = t.value[t.value.length - 1]) != null && E.isRollup))) {
990
- if (s.value.rollupPosition === Oe.top || s.value.rollupPosition === void 0)
991
- return Oe.top;
992
- if (s.value.rollupPosition === Oe.bottom)
993
- return Oe.bottom;
994
- }
995
- }), a = F(() => {
996
- const q = h.value !== void 0 ? 1 : 0, B = (L.value ? L.value.$el.offsetHeight : 0) - 48;
997
- return Math.floor((B - 34.5 - 32) / 48) - q;
998
- }), l = F(() => {
999
- var E, X;
1000
- let S = [];
1001
- switch (h.value) {
1002
- case Oe.top:
1003
- S = [...((E = t.value[0]) == null ? void 0 : E.cells) || []].map((q, B) => {
1004
- var O;
1005
- return {
1006
- main: q,
1007
- comparison: (O = t.value[0]) == null ? void 0 : O.comparisonCells[B],
1008
- rowType: c.value[B].type
1009
- };
1010
- });
1011
- break;
1012
- case Oe.bottom:
1013
- S = [...((X = t.value[t.value.length - 1]) == null ? void 0 : X.cells) || []].map((q, B) => {
1014
- var O;
1015
- return {
1016
- main: q,
1017
- comparison: (O = t.value[0]) == null ? void 0 : O.comparisonCells[B],
1018
- rowType: c.value[B].type
1019
- };
1020
- });
1021
- break;
1022
- }
1023
- return S.length > 0 && S[0].main === "" && (S[0].main = Ye(o, i, "Grand Total", "other")), S;
1024
- });
1025
- function w(S) {
1026
- let E = (S == null ? void 0 : S.main) || "";
1027
- return !S || S.main === "" || !S.comparison ? {
1028
- main: E
1029
- } : (E.includes("#") && !E.startsWith("#") && (E = E.split("#")[0]), {
1030
- main: E,
1031
- comparison: S == null ? void 0 : S.comparison,
1032
- difference: Zt(S.main, S.comparison, m)
1033
- });
1034
- }
1035
- Ie(() => {
1036
- u();
1037
- });
1038
- const $ = T([]);
1039
- let A = 0, I;
1040
- function Z() {
1041
- var B;
1042
- if (!((B = s.value) != null && B.data)) {
1043
- $.value = [];
1044
- return;
1045
- }
1046
- const S = ++A, E = (s.value.data.rows || []).map((O) => ({
1047
- isRollup: O.isRollup,
1048
- cells: Array.isArray(O.cells) ? [...O.cells] : [],
1049
- comparisonCells: Array.isArray(O.comparisonCells) ? [...O.comparisonCells] : []
1050
- })), X = (s.value.data.columns || []).map((O) => ({
1051
- key: O.key,
1052
- type: O.type,
1053
- label: O.label
1054
- })), q = {
1055
- rows: E,
1056
- columns: X,
1057
- filter: r.value ?? "",
1058
- globalSorts: Sl(V.value).map((O) => ({
1059
- key: O.key,
1060
- type: O.type
1061
- })),
1062
- grandTotalPosition: h.value,
1063
- pageSize: a.value
1064
- };
1065
- Rl(aa, q).then((O) => {
1066
- S === A && (O != null && O.error ? (_.open({ message: "Failed to process table data. Please retry.", type: "error" }), console.log(O.error), $.value = []) : $.value = kl(O.data || []));
1067
- });
1068
- }
1069
- me(
1070
- () => V.value,
1071
- (S) => {
1072
- k.tileIndex === void 0 || k.tileIndex === null || C(k.tileIndex, S);
1073
- },
1074
- { immediate: !0, deep: !0 }
1075
- );
1076
- const W = F(() => {
1077
- var X, q;
1078
- const S = ((X = s.value.data) == null ? void 0 : X.rows) || [], E = ((q = s.value.data) == null ? void 0 : q.columns) || [];
1079
- return JSON.stringify({
1080
- rowsLength: S.length,
1081
- columns: E.map((B) => ({ key: B.key, type: B.type, label: B.label })),
1082
- filter: r.value ?? "",
1083
- globalSorts: V.value.map((B) => ({ key: B.key, type: B.type })),
1084
- grandTotalPosition: h.value,
1085
- pageSize: a.value
1086
- });
1087
- });
1088
- me(
1089
- () => W.value,
1090
- () => {
1091
- clearTimeout(I), I = setTimeout(Z, 200);
1092
- },
1093
- { immediate: !0 }
1094
- );
1095
- function K(S) {
1096
- const E = V.value.find((X) => X.key === S);
1097
- if (!E) {
1098
- V.value.push({ key: S, type: qe.Asc });
1099
- return;
1100
- }
1101
- E.type === qe.Asc ? E.type = qe.Desc : E.type === qe.Desc && (V.value = V.value.filter((X) => X.key !== S));
1102
- }
1103
- const re = F(
1104
- () => {
1105
- var S;
1106
- return (((S = s.value.colWidths) == null ? void 0 : S.length) ?? 0) > 0 || x.value.length > 0;
1107
- }
1108
- ), ue = F(() => {
1109
- var S;
1110
- return (S = s.value.data) != null && S.columns ? s.value.data.columns.map((E) => {
1111
- const X = Ye(o, i, E.label, "other"), q = V.value.find((he) => he.key === E.key), B = !!q, O = B ? q.type === qe.Asc ? "arrow_upward" : "arrow_downward" : "unfold_more";
1112
- return {
1113
- accessorKey: E.key,
1114
- header: () => {
1115
- const he = U("FmIcon");
1116
- return ut(
1117
- "button",
1118
- {
1119
- type: "button",
1120
- class: `w-full flex items-center gap-1 group/select-header select-none ${E.type === "NUMERIC" ? "justify-end" : "justify-start"} ${B ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-400"}`,
1121
- onClick: () => K(E.key)
1122
- },
1123
- [
1124
- ut(
1125
- "span",
1126
- { class: `${E.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap` },
1127
- X
1128
- ),
1129
- ut(he, {
1130
- name: O,
1131
- color: B ? "primary" : "neutral-gray-400",
1132
- size: "sm",
1133
- class: "transition-transform",
1134
- style: O === "arrow_upward" ? "transform: translateY(-1px);" : ""
1135
- })
1136
- ]
1137
- );
1138
- },
1139
- cell: (he) => {
1140
- var Pe, Me;
1141
- const Fe = w(he.getValue()), Ae = (Me = (Pe = he == null ? void 0 : he.row) == null ? void 0 : Pe.original) == null ? void 0 : Me.isRollup;
1142
- return ut(
1143
- "div",
1144
- {
1145
- class: [
1146
- Ae ? "fm-typo-en-body-md-600 text-fm-color-typo-primary" : "fm-typo-en-body-md-400",
1147
- E.type === "NUMERIC" ? "text-right" : "",
1148
- re.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
1149
- ].join(" ")
1150
- },
1151
- [E.type === "NUMERIC" ? ct(Fe.main) : Fe.main]
1152
- );
1153
- },
1154
- enableSorting: !1
1155
- };
1156
- }) : [];
1157
- });
1158
- return me(
1159
- () => x.value.length > 0,
1160
- async (S) => {
1161
- S && p.value && (await Ce(), b());
1162
- }
1163
- ), me(
1164
- [() => ue.value],
1165
- async () => {
1166
- var B;
1167
- await Ce();
1168
- const S = (B = L.value) == null ? void 0 : B.$el;
1169
- if (!S) return;
1170
- const E = S.querySelector("table");
1171
- if (!E) return;
1172
- E.classList.add(re.value ? "table-fixed" : "table-auto");
1173
- let X, q;
1174
- p.value ? (b(), X = x.value, q = y.value) : (q = s.value.rowHeight, X = s.value.colWidths), typeof q == "number" && g(q, S), X == null || X.forEach((O, he) => {
1175
- v(he, O, S);
1176
- });
1177
- },
1178
- { immediate: !0 }
1179
- ), (S, E) => {
1180
- const X = U("FmTable");
1181
- return P(), se(xe, null, [
1182
- j("div", na, [
1183
- Ne(S.$slots, "menu")
1184
- ]),
1185
- G(X, {
1186
- ref_key: "table",
1187
- ref: L,
1188
- "column-defs": ue.value,
1189
- "row-data": $.value,
1190
- "search-value": r.value,
1191
- "page-size": a.value,
1192
- "shrink-at": !1,
1193
- "force-mobile-footer": !0,
1194
- class: "scrollbar-hide-table",
1195
- "pin-header-row": !0,
1196
- "auto-reset-page-index": !0
1197
- }, {
1198
- "pin-top": ce(() => [
1199
- j("tbody", null, [
1200
- j("tr", oa, [
1201
- (P(!0), se(xe, null, dt(l.value, (q, B) => (P(), se("td", {
1202
- key: `${d(tt)()}_${B}`,
1203
- class: "h-[48px] text-fm-color-typo-primary px-16"
1204
- }, [
1205
- j("span", {
1206
- class: Ze([
1207
- "items-center text-fm-color-typo-secondary gap-2",
1208
- q.rowType === "NUMERIC" ? "text-right" : "",
1209
- re.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
1210
- ])
1211
- }, [
1212
- j("p", sa, ke(q.rowType === "NUMERIC" ? d(ct)(q.main) : q.main), 1),
1213
- j("p", ra, ke(q.comparison ? q.rowType === "NUMERIC" ? `(${d(ct)(q.comparison)})` : `(${q.comparison})` : ""), 1)
1214
- ], 2)
1215
- ]))), 128))
1216
- ])
1217
- ])
1218
- ]),
1219
- _: 1
1220
- }, 8, ["column-defs", "row-data", "search-value", "page-size"])
1221
- ], 64);
1222
- };
1223
- }
1224
- }), ua = /* @__PURE__ */ _e({
1225
- __name: "WidgetStackBarChart",
1226
- props: /* @__PURE__ */ We({
1227
- tileIndex: {}
1228
- }, {
1229
- modelValue: { required: !0 },
1230
- modelModifiers: {}
1231
- }),
1232
- emits: ["update:modelValue"],
1233
- setup(e) {
1234
- const o = e, i = De(e, "modelValue"), s = T(null), m = F(() => {
1235
- var r;
1236
- return ((r = i.value.data) == null ? void 0 : r.xAxis) || [];
1237
- }), u = F(() => {
1238
- var t;
1239
- return ((t = i.value.data) == null ? void 0 : t.datasets) ?? [];
1240
- }), { datalabels: C, xCfg: _, yCfg: k, isTransposed: V, legend: p, chartWidth: x, chartHeight: y } = st(
1241
- i.value
1242
- ), v = F(() => ot(i.value.isTransposed === !0, !0)), g = pt("bar"), b = F(() => u.value.length > 0 ? [
1243
- ...u.value.map((t, r) => {
1244
- let h = t.values;
1245
- return {
1246
- label: t.name,
1247
- data: h,
1248
- dash: !!t.isCompare,
1249
- backgroundColor: Ee({ index: r, isCompare: t.isCompare })
1250
- };
1251
- })
1252
- ] : []), L = at();
1253
- function c() {
1254
- return L.extractChartSize(s.value, o.tileIndex) || { width: 0, height: 0 };
1255
- }
1256
- return Ie(() => {
1257
- Ce(() => {
1258
- c();
1259
- });
1260
- }), me([b], () => {
1261
- Ce(() => c());
1262
- }), (t, r) => {
1263
- const h = U("FmBarChart");
1264
- return P(), se(xe, null, [
1265
- Ne(t.$slots, "menu"),
1266
- G(h, {
1267
- ref_key: "chartRef",
1268
- ref: s,
1269
- class: "bar-chart",
1270
- datasets: b.value,
1271
- "x-axis": { categories: m.value },
1272
- "x-cfg": d(_),
1273
- "y-cfg": d(k),
1274
- transpose: d(V),
1275
- stacked: !0,
1276
- legend: {
1277
- display: d(p).display ?? !1,
1278
- position: d(p).position,
1279
- maxHeight: d(p).maxHeight,
1280
- maxWidth: d(p).maxWidth,
1281
- labels: d(p).labels
1282
- },
1283
- tooltip: v.value,
1284
- plugins: [d(g)],
1285
- datalabels: d(C),
1286
- "maintain-aspect-ratio": !1,
1287
- style: Ve({
1288
- "--chart-width": d(x) !== void 0 ? d(x) + "px" : "100%",
1289
- "--chart-height": d(y) !== void 0 ? d(y) + "px" : "calc(100% - 36px)"
1290
- })
1291
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "tooltip", "plugins", "datalabels", "style"])
1292
- ], 64);
1293
- };
1294
- }
1295
- }), ca = /* @__PURE__ */ _e({
1296
- __name: "WidgetStackLineChart",
1297
- props: /* @__PURE__ */ We({
1298
- tileIndex: {}
1299
- }, {
1300
- modelValue: { required: !0 },
1301
- modelModifiers: {}
1302
- }),
1303
- emits: ["update:modelValue"],
1304
- setup(e) {
1305
- var h;
1306
- const o = e, i = De(e, "modelValue"), s = ((h = i.value.data) == null ? void 0 : h.xAxis) ?? [], m = F(
1307
- () => s.length === 1 && _.value.length > 0 && _.value.every((a) => a.values.length === 1)
1308
- ), u = F(() => m.value ? ["", s[0], ""] : s), C = T(null), _ = F(() => {
1309
- var a;
1310
- return ((a = i.value.data) == null ? void 0 : a.datasets) ?? [];
1311
- }), { datalabels: k, xCfg: V, yCfg: p, isTransposed: x, legend: y, chartWidth: v, chartHeight: g } = st(
1312
- i.value
1313
- ), b = F(() => ot(i.value.isTransposed === !0, !0)), L = pt("line"), c = F(() => _.value.length > 0 ? [
1314
- ..._.value.map((a, l) => {
1315
- let w = a.values;
1316
- return m.value && (w = [NaN, w[0], NaN]), {
1317
- label: a.name,
1318
- data: w,
1319
- dash: a.isCompare,
1320
- fill: !1,
1321
- color: Ee({ index: l, isCompare: a.isCompare }),
1322
- pointRadius: m.value ? 4 : void 0,
1323
- pointHoverRadius: m.value ? 6 : void 0,
1324
- pointBackgroundColor: m.value ? Ee({ index: l, isCompare: a.isCompare }) : void 0,
1325
- pointBorderColor: m.value ? Ee({ index: l, isCompare: a.isCompare }) : void 0,
1326
- pointBorderWidth: m.value ? 2 : void 0
1327
- };
1328
- })
1329
- ] : []), t = at();
1330
- function r() {
1331
- return t.extractChartSize(C.value, o.tileIndex) || { width: 0, height: 0 };
1332
- }
1333
- return Ie(() => {
1334
- Ce(() => {
1335
- r();
1336
- });
1337
- }), me([c], () => {
1338
- Ce(() => r());
1339
- }), (a, l) => {
1340
- const w = U("FmLineChart");
1341
- return P(), se(xe, null, [
1342
- Ne(a.$slots, "menu"),
1343
- G(w, {
1344
- ref_key: "chartRef",
1345
- ref: C,
1346
- class: "line-chart",
1347
- datasets: c.value,
1348
- "x-axis": { categories: u.value },
1349
- "x-cfg": d(V),
1350
- "y-cfg": d(p),
1351
- transpose: d(x),
1352
- legend: {
1353
- display: d(y).display ?? !1,
1354
- position: d(y).position,
1355
- maxHeight: d(y).maxHeight,
1356
- maxWidth: d(y).maxWidth,
1357
- labels: d(y).labels
1358
- },
1359
- tooltip: b.value,
1360
- plugins: [d(L)],
1361
- stacked: !0,
1362
- datalabels: d(k),
1363
- "maintain-aspect-ratio": !1,
1364
- style: Ve({
1365
- "--chart-width": d(v) !== void 0 ? d(v) + "px" : "100%",
1366
- "--chart-height": d(g) !== void 0 ? d(g) + "px" : "calc(100% - 36px)"
1367
- })
1368
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "tooltip", "plugins", "datalabels", "style"])
1369
- ], 64);
1370
- };
1371
- }
1372
- }), Qe = [
1373
- "col-span-1",
1374
- "col-span-2",
1375
- "col-span-3",
1376
- "col-span-4",
1377
- "col-span-5",
1378
- "col-span-6",
1379
- "col-span-7",
1380
- "col-span-8",
1381
- "col-span-9",
1382
- "col-span-10",
1383
- "col-span-11",
1384
- "col-span-12"
1385
- ];
1386
- function da(e) {
1387
- return e < 12 ? Qe[e - 1] : Qe[11];
1388
- }
1389
- function pa(e) {
1390
- return e < 12 ? Qe[Math.min(11, e * 2 - 1)] : Qe[11];
1391
- }
1392
- function ma(e) {
1393
- return e < 12 ? Qe[Math.min(11, e * 3 - 1)] : Qe[11];
1394
- }
1395
- const fa = /* @__PURE__ */ _e({
1396
- __name: "WidgetLinechart",
1397
- props: /* @__PURE__ */ We({
1398
- tileIndex: {}
1399
- }, {
1400
- modelValue: { required: !0 },
1401
- modelModifiers: {}
1402
- }),
1403
- emits: ["update:modelValue"],
1404
- setup(e) {
1405
- var h;
1406
- const o = e, i = De(e, "modelValue"), s = ((h = i.value.data) == null ? void 0 : h.xAxis) ?? [], m = F(
1407
- () => s.length === 1 && _.value.length > 0 && _.value.every((a) => a.values.length === 1)
1408
- ), u = F(() => m.value ? ["", s[0], ""] : s), C = T(null), _ = F(() => {
1409
- var a;
1410
- return ((a = i.value.data) == null ? void 0 : a.datasets) ?? [];
1411
- }), { datalabels: k, xCfg: V, yCfg: p, isTransposed: x, legend: y, chartWidth: v, chartHeight: g } = st(
1412
- i.value
1413
- ), b = F(() => ot(i.value.isTransposed === !0, !0)), L = pt("line"), c = F(() => _.value.length > 0 ? [
1414
- ..._.value.map((a, l) => {
1415
- let w = a.values;
1416
- return m.value && (w = [NaN, w[0], NaN]), {
1417
- label: a.name,
1418
- data: w,
1419
- dash: !!a.isCompare,
1420
- fill: !1,
1421
- color: Ee({ index: l, isCompare: a.isCompare }),
1422
- pointRadius: m.value ? 4 : void 0,
1423
- pointHoverRadius: m.value ? 6 : void 0,
1424
- pointBackgroundColor: m.value ? Ee({ index: l, isCompare: a.isCompare }) : void 0,
1425
- pointBorderColor: m.value ? Ee({ index: l, isCompare: a.isCompare }) : void 0,
1426
- pointBorderWidth: m.value ? 2 : void 0
1427
- };
1428
- })
1429
- ] : []), t = at();
1430
- function r() {
1431
- return t.extractChartSize(C.value, o.tileIndex) || { width: 0, height: 0 };
1432
- }
1433
- return Ie(() => {
1434
- Ce(() => {
1435
- r();
1436
- });
1437
- }), me([c], () => {
1438
- Ce(() => r());
1439
- }), (a, l) => {
1440
- const w = U("FmLineChart");
1441
- return P(), se(xe, null, [
1442
- Ne(a.$slots, "menu"),
1443
- G(w, {
1444
- ref_key: "chartRef",
1445
- ref: C,
1446
- class: "line-chart",
1447
- datasets: c.value,
1448
- "x-axis": { categories: u.value },
1449
- "x-cfg": d(V),
1450
- "y-cfg": d(p),
1451
- transpose: d(x),
1452
- legend: {
1453
- display: d(y).display ?? !1,
1454
- position: d(y).position,
1455
- maxHeight: d(y).maxHeight,
1456
- maxWidth: d(y).maxWidth,
1457
- labels: d(y).labels
1458
- },
1459
- tooltip: b.value,
1460
- datalabels: d(k),
1461
- plugins: [d(L)],
1462
- "maintain-aspect-ratio": !1,
1463
- style: Ve({
1464
- "--chart-width": d(v) !== void 0 ? d(v) + "px" : "100%",
1465
- "--chart-height": d(g) !== void 0 ? d(g) + "px" : "calc(100% - 36px)"
1466
- })
1467
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "tooltip", "datalabels", "plugins", "style"])
1468
- ], 64);
1469
- };
1470
- }
1471
- }), ha = { class: "flex flex-col gap-16" }, va = { class: "flex flex-row" }, ga = /* @__PURE__ */ _e({
1472
- __name: "PdfOrientationDialog",
1473
- props: /* @__PURE__ */ We({
1474
- reportType: {},
1475
- index: {}
1476
- }, {
1477
- modelValue: { type: Boolean, required: !0 },
1478
- modelModifiers: {}
1479
- }),
1480
- emits: ["update:modelValue"],
1481
- setup(e) {
1482
- const { t: o } = nt(), { FmForm: i } = Nl, s = e, m = T(), u = De(e, "modelValue"), C = T(!0), _ = T(!1), k = $t(), { selectedLocationIds: V, dateRange: p, timeRange: x } = ze(lt()), y = T(yt.PORTRAIT);
1483
- function v() {
1484
- var b;
1485
- (b = m.value) == null || b.validateInputs();
1486
- }
1487
- async function g() {
1488
- _.value = !0;
1489
- try {
1490
- s.index != null && await Gt({
1491
- reportType: s.reportType,
1492
- index: s.index,
1493
- orientationTypes: [y.value],
1494
- isCombinedLocationLayout: C.value,
1495
- timeRange: x.value,
1496
- dateRange: p.value,
1497
- locationIds: V.value
1498
- });
1499
- } catch (b) {
1500
- k.open({ message: b.message, type: "error" });
1501
- } finally {
1502
- _.value = !1;
1503
- }
1504
- }
1505
- return (b, L) => {
1506
- const c = U("FmRadio"), t = U("FmRadioGroup"), r = U("FmButton"), h = U("FmDialog");
1507
- return P(), fe(h, {
1508
- modelValue: u.value,
1509
- "onUpdate:modelValue": L[2] || (L[2] = (a) => u.value = a),
1510
- overlay: !0,
1511
- "z-index": 10
1512
- }, {
1513
- "dialog-header": ce(() => L[3] || (L[3] = [
1514
- wt("Select Orientation")
1515
- ])),
1516
- default: ce(() => [
1517
- G(d(i), {
1518
- ref_key: "form",
1519
- ref: m,
1520
- onValidationSuccess: g
1521
- }, {
1522
- default: ce(() => [
1523
- j("div", ha, [
1524
- G(t, {
1525
- modelValue: y.value,
1526
- "onUpdate:modelValue": L[0] || (L[0] = (a) => y.value = a)
1527
- }, {
1528
- default: ce(() => [
1529
- G(c, {
1530
- value: d(yt).PORTRAIT,
1531
- label: d(o)("report.common.portrait")
1532
- }, null, 8, ["value", "label"]),
1533
- G(c, {
1534
- value: d(yt).LANDSCAPE,
1535
- label: d(o)("report.common.landscape")
1536
- }, null, 8, ["value", "label"])
1537
- ]),
1538
- _: 1
1539
- }, 8, ["modelValue"])
1540
- ]),
1541
- j("div", va, [
1542
- L[4] || (L[4] = j("div", { class: "grow" }, null, -1)),
1543
- G(r, {
1544
- label: d(o)("report.common.cancel"),
1545
- variant: "tertiary",
1546
- onClick: L[1] || (L[1] = (a) => u.value = !1)
1547
- }, null, 8, ["label"]),
1548
- j("div", null, [
1549
- G(r, {
1550
- label: d(o)("report.common.download"),
1551
- loading: _.value,
1552
- onClick: v
1553
- }, null, 8, ["label", "loading"])
1554
- ])
1555
- ])
1556
- ]),
1557
- _: 1
1558
- }, 512)
1559
- ]),
1560
- _: 1
1561
- }, 8, ["modelValue"]);
1562
- };
1563
- }
1564
- });
1565
- function ya(e) {
1566
- const { containerRef: o, stickyOffset: i = T(0), enabled: s = T(!0) } = e;
1567
- let m = null, u = null, C = null, _ = null, k = null, V = null;
1568
- function p() {
1569
- return o.value ? o.value.querySelector("table") : null;
1570
- }
1571
- function x() {
1572
- var l;
1573
- let a = (l = o.value) == null ? void 0 : l.parentElement;
1574
- for (; a; ) {
1575
- const w = window.getComputedStyle(a);
1576
- if (w.overflowY === "auto" || w.overflowY === "scroll")
1577
- return a;
1578
- a = a.parentElement;
1579
- }
1580
- return null;
1581
- }
1582
- function y() {
1583
- var w;
1584
- const a = [];
1585
- o.value && o.value.querySelectorAll("div,section,main,article,aside").forEach(($) => {
1586
- if ($.scrollWidth > $.clientWidth) {
1587
- const A = window.getComputedStyle($);
1588
- (A.overflowX === "auto" || A.overflowX === "scroll") && a.push($);
1589
- }
1590
- });
1591
- let l = (w = o.value) == null ? void 0 : w.parentElement;
1592
- for (; l; ) {
1593
- if (l.scrollWidth > l.clientWidth) {
1594
- const $ = window.getComputedStyle(l);
1595
- ($.overflowX === "auto" || $.overflowX === "scroll") && a.push(l);
1596
- }
1597
- l = l.parentElement;
1598
- }
1599
- return a;
1600
- }
1601
- function v() {
1602
- if (r(), !s.value || !o.value || (u = p(), !u) || (C = u.querySelector("thead"), !C)) return;
1603
- m = document.createElement("div"), m.className = "sticky-header-clone", m.style.cssText = `
1604
- position: fixed;
1605
- top: ${i.value}px;
1606
- left: 0;
1607
- right: 0;
1608
- z-index: 9;
1609
- overflow: hidden;
1610
- pointer-events: none;
1611
- visibility: hidden;
1612
- `;
1613
- const a = document.createElement("table");
1614
- a.className = u.className, a.style.cssText = `
1615
- table-layout: fixed;
1616
- width: ${u.offsetWidth}px;
1617
- margin: 0;
1618
- border-collapse: collapse;
1619
- pointer-events: auto;
1620
- `;
1621
- const l = C.cloneNode(!0);
1622
- l.style.cssText = "pointer-events: auto;", g(C, l), a.appendChild(l), m.appendChild(a), document.body.appendChild(m), L(), c(), t(), b();
1623
- }
1624
- function g(a, l) {
1625
- const w = a.querySelectorAll("th, td"), $ = l.querySelectorAll("th, td");
1626
- w.forEach((A, I) => {
1627
- const Z = $[I];
1628
- if (!Z) return;
1629
- const W = A, K = window.getComputedStyle(W);
1630
- Object.assign(Z.style, {
1631
- width: `${W.offsetWidth}px`,
1632
- minWidth: `${W.offsetWidth}px`,
1633
- maxWidth: `${W.offsetWidth}px`,
1634
- height: `${W.offsetHeight}px`,
1635
- padding: K.padding,
1636
- backgroundColor: K.backgroundColor,
1637
- borderBottom: K.borderBottom,
1638
- fontSize: K.fontSize,
1639
- fontWeight: K.fontWeight,
1640
- textAlign: K.textAlign,
1641
- verticalAlign: K.verticalAlign,
1642
- boxSizing: "border-box",
1643
- cursor: K.cursor || "pointer",
1644
- pointerEvents: "auto"
1645
- }), Z.onclick = (re) => {
1646
- re.preventDefault(), re.stopPropagation();
1647
- const ue = W.querySelector(
1648
- "button, a, [role='button']"
1649
- );
1650
- ue ? ue.click() : W.click();
1651
- };
1652
- });
1653
- }
1654
- function b() {
1655
- if (!m || !u || !C || !o.value) return;
1656
- const a = o.value.getBoundingClientRect(), l = u.getBoundingClientRect(), w = C.getBoundingClientRect(), $ = x(), A = $ == null ? void 0 : $.getBoundingClientRect(), I = i.value > 0 ? i.value : (A == null ? void 0 : A.top) ?? 0;
1657
- if (!(l.top < I && l.bottom > I + w.height)) {
1658
- m.style.visibility = "hidden";
1659
- return;
1660
- }
1661
- m.style.visibility = "visible", m.style.top = `${I}px`;
1662
- const W = A ?? a, K = Math.max(a.left, W.left), ue = Math.min(a.right, W.right) - K;
1663
- m.style.left = `${K}px`, m.style.width = `${ue}px`;
1664
- const S = m.querySelector("table");
1665
- S && (S.style.width = `${u.offsetWidth}px`, S.style.marginLeft = `${w.left - K}px`);
1666
- }
1667
- function L() {
1668
- var w;
1669
- k = () => requestAnimationFrame(b), window.addEventListener("scroll", k, { passive: !0 });
1670
- const a = x();
1671
- a && a.addEventListener("scroll", k, { passive: !0 }), y().forEach(($) => {
1672
- k && $.addEventListener("scroll", k, { passive: !0 });
1673
- });
1674
- let l = (w = o.value) == null ? void 0 : w.parentElement;
1675
- for (; l; )
1676
- l !== a && (l.scrollHeight > l.clientHeight || l.scrollWidth > l.clientWidth) && l.addEventListener("scroll", k, { passive: !0 }), l = l.parentElement;
1677
- }
1678
- function c() {
1679
- _ = new ResizeObserver(() => {
1680
- if (C && m) {
1681
- const a = m.querySelector("thead");
1682
- a && g(C, a);
1683
- const l = m.querySelector("table");
1684
- l && u && (l.style.width = `${u.offsetWidth}px`);
1685
- }
1686
- b();
1687
- }), o.value && _.observe(o.value), u && _.observe(u);
1688
- }
1689
- function t() {
1690
- if (!C) return;
1691
- const a = xt(() => v(), 100), l = () => {
1692
- if (C && m) {
1693
- const w = m.querySelector("thead");
1694
- w && g(C, w), b();
1695
- }
1696
- };
1697
- V = new MutationObserver((w) => {
1698
- w.some((A) => A.type === "childList" ? A.addedNodes.length > 0 || A.removedNodes.length > 0 : !1) ? a() : l();
1699
- }), V.observe(C, {
1700
- childList: !0,
1701
- subtree: !0,
1702
- attributes: !0,
1703
- characterData: !0
1704
- });
1705
- }
1706
- function r() {
1707
- var a;
1708
- if (m && (m.remove(), m = null), k) {
1709
- window.removeEventListener("scroll", k);
1710
- const l = x();
1711
- l && l.removeEventListener("scroll", k), y().forEach(($) => {
1712
- k && $.removeEventListener("scroll", k);
1713
- });
1714
- let w = (a = o.value) == null ? void 0 : a.parentElement;
1715
- for (; w; )
1716
- w.removeEventListener("scroll", k), w = w.parentElement;
1717
- k = null;
1718
- }
1719
- _ && (_.disconnect(), _ = null), V && (V.disconnect(), V = null), u = null, C = null;
1720
- }
1721
- function h() {
1722
- v();
1723
- }
1724
- return me(s, (a) => {
1725
- a ? v() : r();
1726
- }), me(i, () => {
1727
- m && (m.style.top = `${i.value}px`, b());
1728
- }), me(o, () => {
1729
- o.value && s.value && setTimeout(v, 100);
1730
- }), Ie(() => {
1731
- s.value && setTimeout(v, 100);
1732
- }), Xt(() => {
1733
- r();
1734
- }), { refresh: h, cleanup: r };
1735
- }
1736
- const ba = {
1737
- key: 1,
1738
- class: "grow"
1739
- }, wa = {
1740
- key: 2,
1741
- class: "flex"
1742
- }, Ga = /* @__PURE__ */ _e({
1743
- __name: "DynamicWidget",
1744
- props: /* @__PURE__ */ We({
1745
- index: {
1746
- type: Number,
1747
- default: 0
1748
- },
1749
- hideExport: {
1750
- type: Boolean,
1751
- default: !1
1752
- },
1753
- customScreenWidth: {
1754
- type: Number,
1755
- required: !1,
1756
- default: void 0
1757
- },
1758
- stickyHeaderOffset: {
1759
- type: Number,
1760
- default: 0
1761
- },
1762
- isStyleEditing: {
1763
- type: Boolean,
1764
- default: !1
1765
- }
1766
- }, {
1767
- modelValue: { required: !0, default: () => {
1768
- } },
1769
- modelModifiers: {}
1770
- }),
1771
- emits: ["update:modelValue"],
1772
- setup(e) {
1773
- const o = T(!0), i = De(e, "modelValue"), s = i.value.widget.config, { t: m, te: u, locale: C } = nt(), _ = e, k = T(null), V = F(() => _.stickyHeaderOffset), p = F(() => i.value.widget.type === N.Table), x = F(() => {
1774
- var f;
1775
- return (f = k.value) == null ? void 0 : f.$el;
1776
- }), { refresh: y } = ya({
1777
- containerRef: x,
1778
- stickyOffset: V,
1779
- enabled: p
1780
- }), v = T(s.rollup), g = T(tt()), b = T(s.drillDimension), L = F(() => {
1781
- if (He.value.length > 0) {
1782
- const f = He.value.findIndex(
1783
- (ne) => ne.value === b.value
1784
- );
1785
- return f >= 0 ? f : 0;
1786
- } else
1787
- return -1;
1788
- }), c = F(() => L.value !== 0), t = F(
1789
- () => L.value != He.value.length - 1
1790
- ), r = T(s.showTitle ?? !0), h = T(s.titleFontSize ?? 14), a = T(s.titleBold ?? !1), l = T(s.titleItalic ?? !1), w = T(s.titleUnderline ?? !1), $ = T(s.chartWidth ?? void 0), A = T(s.chartHeight ?? void 0), I = T(s.showLabel ?? !1), Z = T(s.labelAlign ?? Tt.center), W = T(s.labelAnchor ?? kt.center), K = T(s.labelRotation ?? 0), re = T(s.labelOffset ?? 0), ue = T(s.labelFontSize ?? 12), S = F(() => s.showSearchBar), E = T(s.showX ?? !0), X = T(s.xPosition ?? _t.bottom), q = T(s.showXGrid ?? !1), B = T(s.showXTick ?? !0), O = T(s.xTickFontSize ?? 12), he = T(s.showXTitle ?? !1), Fe = T(s.xTitle ?? ""), Ae = T(s.xTitleFontSize ?? 12), Pe = T(s.showY ?? !0), Me = T(s.yPosition ?? Ft.left), n = T(s.showYGrid ?? !1), z = T(s.showYTick ?? !0), M = T(s.yTickFontSize ?? 12), D = T(s.showYTitle ?? !1), J = T(s.yTitle ?? ""), de = T(s.yTitleFontSize ?? 12), be = T(s.showLegend ?? void 0), ge = T(s.legendPosition ?? Lt.top), oe = T(s.usePointStyle ?? !0), H = T(s.legendMaxHeight), Y = T(s.legendMaxWidth), R = T(s.rowHeight ?? 0), Q = T(s.colWidths ?? []), ee = T(!1), pe = T(""), { breakpoints: ae, getBreakpointsBoundary: te } = Jt(), we = T(), le = F(
1791
- () => _.customScreenWidth === void 0 ? window.innerWidth : _.customScreenWidth
1792
- ), Be = F(
1793
- () => (le == null ? void 0 : le.value) > te("xs")[1] && (le == null ? void 0 : le.value) <= te("sm")[1]
1794
- ), mt = F(
1795
- () => (le == null ? void 0 : le.value) > te("sm")[1] && (le == null ? void 0 : le.value) <= te("md")[1]
1796
- ), ie = F(() => (le == null ? void 0 : le.value) > te("md")[1]), el = F(() => {
1797
- const f = i.value.size.width;
1798
- return ie.value || mt.value ? da(f) : Be.value ? pa(f) : ma(f);
1799
- }), rt = F(
1800
- () => Bl.find((f) => f.type === i.value.widget.type)
1801
- ), Xe = xt(() => {
1802
- var f;
1803
- we.value = cl((f = k.value) == null ? void 0 : f.$el.offsetWidth), g.value = tt();
1804
- }), tl = F(() => {
1805
- if (Hl(ve.value.type, Ge.value))
1806
- switch (i.value.widget.type) {
1807
- case N.BarChart:
1808
- return ql;
1809
- case N.StackBarChart:
1810
- return ua;
1811
- case N.LineChart:
1812
- return fa;
1813
- case N.StackLineChart:
1814
- return ca;
1815
- case N.Circular:
1816
- return Yl;
1817
- case N.Scorecard:
1818
- return Zl;
1819
- case N.Spacer:
1820
- return ta;
1821
- case N.Table:
1822
- return ia;
1823
- default:
1824
- return Ct;
1825
- }
1826
- else
1827
- return Ct;
1828
- }), Ge = T(null), {
1829
- selectedLocationIds: ft,
1830
- dateRange: zt,
1831
- compareDateRange: ll,
1832
- timeRange: Et,
1833
- globalFilters: al,
1834
- isGlobalFiltersLoading: Vt
1835
- } = ze(lt()), { businessId: nl } = ze(Rt()), { businessLoadedId: ol, businessDataVersion: ht } = ze(lt());
1836
- F(() => ol.value === nl.value && ft.value.length > 0 && !Vt.value);
1837
- const sl = T(!0), ve = F(() => {
1838
- const f = JSON.parse(JSON.stringify(i.value.widget));
1839
- return {
1840
- ...f,
1841
- config: {
1842
- ...f.config,
1843
- rollup: v.value,
1844
- drillDimension: b.value,
1845
- showGrandTotal: !1
1846
- }
1847
- };
1848
- });
1849
- function rl() {
1850
- return {
1851
- data: Ge.value,
1852
- showTitle: r.value,
1853
- titleFontSize: h.value,
1854
- titleBold: a.value,
1855
- titleItalic: l.value,
1856
- titleUnderline: w.value,
1857
- chartHeight: A.value,
1858
- chartWidth: $.value,
1859
- showLabel: I.value,
1860
- labelAnchor: W.value,
1861
- labelAlign: Z.value,
1862
- labelRotation: K.value,
1863
- labelOffset: re.value,
1864
- labelFontSize: ue.value,
1865
- showX: E.value,
1866
- xPosition: X.value,
1867
- showXGrid: q.value,
1868
- showXTick: B.value,
1869
- xTickFontSize: O.value,
1870
- showXTitle: he.value,
1871
- xTitle: Fe.value,
1872
- xTitleFontSize: Ae.value,
1873
- showY: Pe.value,
1874
- yPosition: Me.value,
1875
- showYGrid: n.value,
1876
- showYTick: z.value,
1877
- yTitle: J.value,
1878
- showYTitle: D.value,
1879
- yTitleFontSize: de.value,
1880
- yTickFontSize: M.value,
1881
- isTransposed: ve.value.config.isTransposed,
1882
- showLegend: be.value,
1883
- legendPosition: ge.value,
1884
- usePointStyle: oe.value,
1885
- legendMaxHeight: H.value,
1886
- legendMaxWidth: Y.value
1887
- };
1888
- }
1889
- function il() {
1890
- return {
1891
- data: Ge.value,
1892
- filterText: pe.value,
1893
- rollupPosition: ve.value.config.rollupPosition,
1894
- rowHeight: R.value,
1895
- colWidths: Q.value
1896
- };
1897
- }
1898
- const Dt = F(() => {
1899
- switch (ve.value.type) {
1900
- case N.Table:
1901
- return il();
1902
- case N.BarChart:
1903
- case N.LineChart:
1904
- case N.StackBarChart:
1905
- case N.StackLineChart:
1906
- case N.Circular:
1907
- return rl();
1908
- default:
1909
- return { data: Ge.value };
1910
- }
1911
- }), At = F(() => {
1912
- const { config: f } = i.value.widget;
1913
- if (f.rollup != null) {
1914
- const ne = [...f.dimensions].filter((Le) => !Le.hide);
1915
- return ne.sort(
1916
- (Le, et) => (f.rowIds || []).indexOf(bt(Le)) - (f.rowIds || []).indexOf(bt(et))
1917
- ), [
1918
- { label: Ye(m, u, "None", "other"), value: "none" },
1919
- { label: Ye(m, u, "Grand Total", "other"), value: 0 },
1920
- ...[...ne].slice(0, ne.length - 1).map((Le, et) => ({
1921
- label: Ye(m, u, Le.label, "other"),
1922
- value: et + 1
1923
- }))
1924
- ];
1925
- }
1926
- return [];
1927
- }), He = F(() => {
1928
- const { config: f } = ve.value;
1929
- return f.isDrillable ? f.dimensions.map((ne) => ({
1930
- label: Ye(m, u, ne.label, "other"),
1931
- value: bt(ne)
1932
- })) : [];
1933
- }), ul = F(() => {
1934
- const f = i.value.id;
1935
- return (al.value || []).filter(
1936
- (ne) => Array.isArray(ne.tileIds) && ne.tileIds.includes(f)
1937
- );
1938
- });
1939
- me(
1940
- () => i.value.widget.config,
1941
- (f) => {
1942
- v.value = f.rollup, r.value = f.showTitle ?? !0, h.value = f.titleFontSize ?? 14, a.value = f.titleBold ?? !1, l.value = f.titleItalic ?? !1, w.value = f.titleUnderline ?? !1, A.value = f.chartHeight ?? void 0, $.value = f.chartWidth ?? void 0, I.value = f.showLabel ?? !1, Z.value = f.labelAlign ?? Tt.center, W.value = f.labelAnchor ?? kt.center, K.value = f.labelRotation ?? 0, re.value = f.labelOffset ?? 0, ue.value = f.labelFontSize ?? 12, E.value = f.showX ?? !0, X.value = f.xPosition ?? _t.bottom, q.value = f.showXGrid ?? !1, B.value = f.showXTick ?? !0, O.value = f.xTickFontSize ?? 12, he.value = f.showXTitle ?? !1, Fe.value = f.xTitle ?? "", Ae.value = f.xTitleFontSize ?? 12, Pe.value = f.showY ?? !0, Me.value = f.yPosition ?? Ft.left, n.value = f.showYGrid ?? !1, z.value = f.showYTick ?? !0, M.value = f.yTickFontSize ?? 12, D.value = f.showYTitle ?? !1, J.value = f.yTitle ?? "", de.value = f.yTitleFontSize ?? 12, be.value = f.showLegend ?? void 0, ge.value = f.legendPosition ?? Lt.top, oe.value = f.usePointStyle ?? !0, H.value = f.legendMaxHeight, Y.value = f.legendMaxWidth, R.value = f.rowHeight ?? 0, Q.value = f.colWidths ?? [], g.value = tt();
1943
- },
1944
- { deep: !0 }
1945
- ), me([() => v.value], () => {
1946
- v.value !== null && (i.value.widget.config.rollup = v.value);
1947
- }), me(
1948
- [
1949
- () => ve.value,
1950
- () => zt.value,
1951
- () => Et.value,
1952
- () => ll.value,
1953
- () => ft.value,
1954
- () => ul.value,
1955
- () => ht.value
1956
- ],
1957
- () => {
1958
- Wt();
1959
- },
1960
- { deep: !0 }
1961
- ), me(
1962
- [() => i.value.size],
1963
- () => {
1964
- Xe();
1965
- },
1966
- { deep: !0 }
1967
- ), Ie(() => {
1968
- Xe(), ae.value.sm || ae.value.md || ae.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", Xe)) : addEventListener("resize", Xe), Wt();
1969
- }), Xt(() => {
1970
- ae.value.sm || ae.value.md || ae.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", Xe)) : removeEventListener("resize", Xe);
1971
- });
1972
- const Mt = $t();
1973
- let it;
1974
- async function Wt() {
1975
- if (!_.isStyleEditing) {
1976
- if (ve.value.config.schemaNames.length <= 0 && !(ve.value.config.dimensions.length <= 0 || ve.value.config.metrics.length <= 0)) {
1977
- Mt.open({
1978
- message: "schema must not be empty and dimension or metrics must have at least 1 column",
1979
- type: "info"
1980
- }), o.value = !1;
1981
- return;
1982
- }
1983
- try {
1984
- o.value = !0, it && it.abort(), it = new AbortController();
1985
- const f = it.signal, ne = ht.value, Le = await xt(jt, 500)(ve.value, f, i.value.id);
1986
- ht.value === ne && (Ge.value = Le, g.value = tt(), setTimeout(() => y(), 100)), o.value = !1;
1987
- } catch (f) {
1988
- f.code !== "ERR_CANCELED" && (Ge.value = null, Mt.open({ message: `Invalid chart ${ve.value.type}`, type: "error" }), console.log(f), o.value = !1);
1989
- }
1990
- }
1991
- }
1992
- function cl(f) {
1993
- switch (i.value.widget.type) {
1994
- case "SPACER":
1995
- return;
1996
- case "SCORECARD":
1997
- return;
1998
- case "TABLE":
1999
- return `${i.value.size.height * 100 + (S.value ? 72 : 0) + 96.5}px`;
2000
- }
2001
- return `${Math.max(f / i.value.size.width, 90) * i.value.size.height}px`;
2002
- }
2003
- function dl() {
2004
- const f = L.value - 1;
2005
- f >= 0 && (b.value = He.value[f].value);
2006
- }
2007
- function pl() {
2008
- const f = L.value + 1;
2009
- f >= 0 && f < He.value.length && (b.value = He.value[f].value);
2010
- }
2011
- const It = T(Ke.EXCEL), Nt = T(), ml = Object.values(Ke).map((f) => ({
2012
- label: $l(f),
2013
- value: f,
2014
- onClick: async () => {
2015
- f === Ke.EXCEL || f === Ke.PDFFULLSIZE || f === Ke.PDFRECEIPT ? await Gt({
2016
- reportType: f,
2017
- index: _.index,
2018
- isCombinedLocationLayout: sl.value,
2019
- timeRange: Et.value,
2020
- dateRange: zt.value,
2021
- locationIds: ft.value
2022
- }) : f === Ke.PDF && (It.value = f, Nt.value = _.index, ee.value = !0);
2023
- }
2024
- })), fl = ve.value.type === N.Spacer ? "flat" : "outlined", hl = ve.value.type === N.Spacer ? "p-0" : "p-16";
2025
- return (f, ne) => {
2026
- const Le = U("FmTooltip"), et = U("FmSearch"), vl = U("FmCheckbox"), vt = U("FmButton"), gl = U("FmSelect"), yl = U("FmMenuItem"), bl = U("FmMenu"), wl = U("FmForm"), xl = U("FmCircularProgress"), Cl = U("FmCard");
2027
- return P(), fe(Cl, {
2028
- ref_key: "tileCard",
2029
- ref: k,
2030
- class: Ze(`${el.value} ${d(hl)}`),
2031
- variant: d(fl)
2032
- }, {
2033
- default: ce(() => [
2034
- G(ga, {
2035
- modelValue: ee.value,
2036
- "onUpdate:modelValue": ne[0] || (ne[0] = (je) => ee.value = je),
2037
- "report-type": It.value,
2038
- index: Nt.value
2039
- }, null, 8, ["modelValue", "report-type", "index"]),
2040
- !o.value && !d(Vt) ? (P(), se("div", {
2041
- key: 0,
2042
- style: Ve({ height: we.value })
2043
- }, [
2044
- (P(), fe(Tl(tl.value), {
2045
- key: g.value,
2046
- modelValue: Dt.value,
2047
- "onUpdate:modelValue": ne[4] || (ne[4] = (je) => Dt.value = je),
2048
- "tile-index": _.index
2049
- }, {
2050
- menu: ce(() => [
2051
- G(wl, { class: "flex items-center gap-2" }, {
2052
- default: ce(() => {
2053
- var je, Pt, Bt, Ht;
2054
- return [
2055
- G(Le, {
2056
- variant: "plain",
2057
- placement: "right",
2058
- content: ve.value.description,
2059
- "hide-arrow": !0,
2060
- disabled: !ve.value.description,
2061
- "z-index": 99
2062
- }, {
2063
- default: ce(() => [
2064
- r.value !== !1 ? (P(), se("p", {
2065
- key: 0,
2066
- style: Ve({
2067
- fontSize: h.value + "px",
2068
- fontWeight: a.value ? "bold" : "normal",
2069
- fontStyle: l.value ? "italic" : "normal",
2070
- textDecoration: w.value ? "underline" : "none"
2071
- }),
2072
- class: Ze(["text-fm-color-typo-secondary line-clamp-1", [
2073
- h.value <= 18 ? "fm-typo-en-body-md-400" : "",
2074
- ve.value.description ? "border-b-2 border-dashed border-gray-300" : ""
2075
- ]])
2076
- }, ke(d(Ye)(d(m), d(u), ve.value.title, "other")), 7)) : Te("", !0)
2077
- ]),
2078
- _: 1
2079
- }, 8, ["content", "disabled"]),
2080
- (je = rt.value) != null && je.showSearchBar ? (P(), fe(et, {
2081
- key: 0,
2082
- modelValue: pe.value,
2083
- "onUpdate:modelValue": ne[1] || (ne[1] = (Re) => pe.value = Re),
2084
- class: "grow"
2085
- }, null, 8, ["modelValue"])) : (P(), se("div", ba)),
2086
- _l(G(vl, {
2087
- modelValue: I.value,
2088
- "onUpdate:modelValue": ne[2] || (ne[2] = (Re) => I.value = Re),
2089
- label: "Label",
2090
- value: !1
2091
- }, null, 8, ["modelValue"]), [
2092
- [Fl, (Pt = rt.value) == null ? void 0 : Pt.showLabel]
2093
- ]),
2094
- (Bt = rt.value) != null && Bt.showDrillDimension && He.value.length > 0 ? (P(), se("div", wa, [
2095
- G(vt, {
2096
- icon: "arrow_upward",
2097
- variant: "tertiary",
2098
- disabled: !c.value,
2099
- onClick: dl
2100
- }, null, 8, ["disabled"]),
2101
- G(vt, {
2102
- icon: "arrow_downward",
2103
- variant: "tertiary",
2104
- disabled: !t.value,
2105
- onClick: pl
2106
- }, null, 8, ["disabled"])
2107
- ])) : Te("", !0),
2108
- (Ht = rt.value) != null && Ht.showRollup && At.value.length > 0 ? (P(), fe(gl, {
2109
- key: `rollup-${d(C)}`,
2110
- modelValue: v.value,
2111
- "onUpdate:modelValue": ne[3] || (ne[3] = (Re) => v.value = Re),
2112
- class: "w-[150px]",
2113
- items: At.value
2114
- }, null, 8, ["modelValue", "items"])) : Te("", !0),
2115
- _.hideExport ? Te("", !0) : (P(), fe(bl, {
2116
- key: 4,
2117
- shift: !0
2118
- }, {
2119
- "menu-button": ce(() => [
2120
- G(vt, {
2121
- icon: "more_vert",
2122
- variant: "tertiary"
2123
- })
2124
- ]),
2125
- default: ce(() => [
2126
- (P(!0), se(xe, null, dt(d(ml), (Re) => (P(), fe(yl, {
2127
- key: Re.value,
2128
- label: Re.label,
2129
- onClick: Re.onClick
2130
- }, null, 8, ["label", "onClick"]))), 128))
2131
- ]),
2132
- _: 1
2133
- }))
2134
- ];
2135
- }),
2136
- _: 1
2137
- })
2138
- ]),
2139
- _: 1
2140
- }, 8, ["modelValue", "tile-index"]))
2141
- ], 4)) : (P(), fe(xl, { key: 1 }))
2142
- ]),
2143
- _: 1
2144
- }, 8, ["class", "variant"]);
2145
- };
2146
- }
2147
- });
2148
- var Ue = /* @__PURE__ */ ((e) => (e.Select = "Select", e.TextField = "TextField", e.Timestamp = "Timestamp", e))(Ue || {});
2149
- function xa(e) {
2150
- let o = !1, i = 1;
2151
- switch (e) {
2152
- case Se.Equal:
2153
- case Se.NotEqual:
2154
- case Se.Like:
2155
- case Se.NotLike:
2156
- o = !1, i = 1;
2157
- break;
2158
- case Se.GreaterThan:
2159
- case Se.GreaterThanOrEqual:
2160
- case Se.LessThan:
2161
- case Se.LessThanOrEqual:
2162
- o = !0, i = 1;
2163
- break;
2164
- case Se.Between:
2165
- o = !0, i = 2;
2166
- break;
2167
- }
2168
- return {
2169
- fixed: o,
2170
- count: i
2171
- };
2172
- }
2173
- function ja({
2174
- operator: e,
2175
- dimensionOption: o,
2176
- dataType: i,
2177
- t: s
2178
- }) {
2179
- const { fixed: m, count: u } = xa(e);
2180
- switch (i) {
2181
- case $e.String:
2182
- return {
2183
- type: "TextField",
2184
- fixed: m,
2185
- count: u,
2186
- dataType: void 0,
2187
- default: ""
2188
- };
2189
- case $e.Numeric:
2190
- return {
2191
- type: "TextField",
2192
- fixed: m,
2193
- count: u,
2194
- dataType: "number",
2195
- default: 0
2196
- };
2197
- case $e.Bool:
2198
- return {
2199
- type: "Select",
2200
- fixed: m,
2201
- count: u,
2202
- options: [
2203
- { label: s("report.common.yes"), value: !0 },
2204
- { label: s("report.common.no"), value: !1 }
2205
- ],
2206
- default: !0
2207
- };
2208
- case $e.Timestamp:
2209
- return Qt({
2210
- dimensionOption: o,
2211
- fixed: m,
2212
- count: u,
2213
- t: s
2214
- });
2215
- }
2216
- return {
2217
- type: "TextField",
2218
- fixed: m,
2219
- count: u,
2220
- dataType: void 0,
2221
- default: ""
2222
- };
2223
- }
2224
- function Ka(e) {
2225
- switch (e) {
2226
- case ye.HourOfDay:
2227
- return 0;
2228
- case ye.DayOfMonth:
2229
- return 1;
2230
- default:
2231
- return;
2232
- }
2233
- }
2234
- function Ja(e) {
2235
- switch (e) {
2236
- case ye.HourOfDay:
2237
- return 23;
2238
- case ye.DayOfMonth:
2239
- return 31;
2240
- default:
2241
- return;
2242
- }
2243
- }
2244
- function Qt({
2245
- dimensionOption: e,
2246
- fixed: o,
2247
- count: i,
2248
- t: s
2249
- }) {
2250
- switch (e) {
2251
- case ye.HourOfDay:
2252
- return {
2253
- type: Ue.Select,
2254
- fixed: o,
2255
- count: i,
2256
- options: Array.from({ length: 24 }, (m, u) => ({
2257
- label: u.toString().padStart(2, "0"),
2258
- value: u.toString()
2259
- })),
2260
- default: "0"
2261
- };
2262
- case ye.DayOfWeek:
2263
- return {
2264
- type: Ue.Select,
2265
- fixed: o,
2266
- count: i,
2267
- options: [
2268
- { label: s("report.days.sunday"), value: "1" },
2269
- { label: s("report.days.monday"), value: "2" },
2270
- { label: s("report.days.tuesday"), value: "3" },
2271
- { label: s("report.days.wednesday"), value: "4" },
2272
- { label: s("report.days.thursday"), value: "5" },
2273
- { label: s("report.days.friday"), value: "6" },
2274
- { label: s("report.days.saturday"), value: "7" }
2275
- ],
2276
- default: "1"
2277
- };
2278
- case ye.DayOfMonth:
2279
- return {
2280
- type: Ue.Select,
2281
- fixed: o,
2282
- count: i,
2283
- options: Array.from({ length: 31 }, (m, u) => ({
2284
- label: (u + 1).toString(),
2285
- value: (u + 1).toString()
2286
- })),
2287
- default: "1"
2288
- };
2289
- case ye.MonthOfYear:
2290
- return {
2291
- type: Ue.Select,
2292
- fixed: o,
2293
- count: i,
2294
- options: [
2295
- { label: s("report.months.january"), value: "1" },
2296
- { label: s("report.months.february"), value: "2" },
2297
- { label: s("report.months.march"), value: "3" },
2298
- { label: s("report.months.april"), value: "4" },
2299
- { label: s("report.months.may"), value: "5" },
2300
- { label: s("report.months.june"), value: "6" },
2301
- { label: s("report.months.july"), value: "7" },
2302
- { label: s("report.months.august"), value: "8" },
2303
- { label: s("report.months.september"), value: "9" },
2304
- { label: s("report.months.october"), value: "10" },
2305
- { label: s("report.months.november"), value: "11" },
2306
- { label: s("report.months.december"), value: "12" }
2307
- ],
2308
- default: "1"
2309
- };
2310
- default:
2311
- return {
2312
- type: Ue.Timestamp,
2313
- fixed: o,
2314
- count: i,
2315
- default: (/* @__PURE__ */ new Date()).toISOString()
2316
- };
2317
- }
2318
- }
2319
- function Yt({
2320
- dimensionOption: e,
2321
- t: o
2322
- }) {
2323
- const i = Qt({
2324
- dimensionOption: e,
2325
- fixed: !1,
2326
- count: 1,
2327
- t: o
2328
- });
2329
- return i.type !== Ue.Select ? [] : [{ label: o("report.input.unknown"), value: "" }, ...i.options];
2330
- }
2331
- const Ca = "mf-reportglobalFilter";
2332
- function Ut(e, o) {
2333
- var i;
2334
- return [
2335
- o,
2336
- e.schemaName,
2337
- e.name,
2338
- e.operator ?? "",
2339
- e.option ?? "",
2340
- e.dataFormula ?? "",
2341
- ((i = e.tileIds) == null ? void 0 : i.join(",")) ?? ""
2342
- ].join("|");
2343
- }
2344
- const Sa = Kt(Ca, () => {
2345
- const e = T({}), o = T(!1), i = T(null), s = () => ({
2346
- search: "",
2347
- selectedValues: [],
2348
- keepSelection: !1,
2349
- showAdvanced: !1,
2350
- visibleCount: 50
2351
- });
2352
- function m(y, v) {
2353
- const g = Ut(y, v);
2354
- return e.value[g] || (e.value[g] = s()), e.value[g];
2355
- }
2356
- const u = F(() => e.value), C = (y) => i.value === y;
2357
- function _(y, v, g, b) {
2358
- m(y, v)[g] = b;
2359
- }
2360
- function k(y, v, g = 50) {
2361
- m(y, v).visibleCount += g;
2362
- }
2363
- function V(y) {
2364
- o.value = y;
2365
- }
2366
- function p(y) {
2367
- i.value = y;
2368
- }
2369
- function x() {
2370
- i.value = null;
2371
- }
2372
- return {
2373
- allStates: u,
2374
- includeUnavailable: o,
2375
- openMenuKey: i,
2376
- getGlobalFilter: m,
2377
- isMenuOpen: C,
2378
- setGlobalFilter: _,
2379
- showMore: k,
2380
- setIncludeUnavailable: V,
2381
- openMenu: p,
2382
- closeMenu: x,
2383
- getKey: Ut
2384
- };
2385
- }), ka = { class: "flex flex-row flex-wrap gap-2" }, Ta = { class: "inline-flex max-w-[460px]" }, _a = {
2386
- key: 0,
2387
- class: "flex justify-center my-2"
2388
- }, Fa = { class: "px-2 pb-8" }, La = { class: "flex-1 overflow-y-auto overflow-x-hidden" }, Ra = { class: "px-2 pb-8" }, $a = { class: "flex items-start w-full" }, za = ["onClick"], Ea = { class: "fm-typo-en-body-md-400" }, Va = { key: 0 }, Da = { class: "px-12 py-3" }, Aa = { class: "flex items-center justify-between" }, Ma = { class: "text-xs max-w-[200px]" }, Wa = { class: "px-4 py-3 flex flex-row justify-end gap-2 bg-white" }, Za = /* @__PURE__ */ _e({
2389
- __name: "FilterSelector",
2390
- setup(e) {
2391
- const { t: o, locale: i } = nt(), { currentReport: s, editingTile: m } = ze(zl());
2392
- let { globalFilters: u, isGlobalFiltersLoading: C, timeRange: _, dateRange: k, selectedLocationIds: V, timezone: p } = ze(lt()), { schemas: x } = ze(El()), { showMore: y, getGlobalFilter: v, setGlobalFilter: g, setIncludeUnavailable: b, getKey: L, isMenuOpen: c } = Sa();
2393
- const t = F(() => o("report.input.unknown"));
2394
- let r = null;
2395
- const h = T(!1), a = F(() => {
2396
- var n;
2397
- return ((n = s.value) == null ? void 0 : n.id) ?? "";
2398
- }), l = T([]);
2399
- function w(n) {
2400
- const M = v(n.filter, a.value).selectedValues;
2401
- n.selectedValues = n.keepSelection ? M : n.options.map((D) => D.value), n.filter.values = [...n.selectedValues], g(n.filter, a.value, "selectedValues", n.selectedValues);
2402
- }
2403
- me(
2404
- () => ({
2405
- reportId: a.value,
2406
- globalFilters: u.value
2407
- }),
2408
- () => {
2409
- l.value = (u.value || []).map((n, z) => {
2410
- const M = v(n, a.value), D = M.selectedValues.length ? [...M.selectedValues] : [...n.values ?? []];
2411
- return {
2412
- id: `${L(n, a.value)}|${z}`,
2413
- filter: n,
2414
- search: M.search,
2415
- options: [],
2416
- type: $(n),
2417
- selectedValues: D,
2418
- visibleCount: M.visibleCount,
2419
- keepSelection: M.keepSelection,
2420
- showAdvanced: M.showAdvanced
2421
- };
2422
- }), ue();
2423
- },
2424
- { immediate: !0 }
2425
- ), me(
2426
- [_, k, V],
2427
- async () => {
2428
- await ue();
2429
- },
2430
- { deep: !0, immediate: !0 }
2431
- ), me(
2432
- [() => m.value],
2433
- async () => {
2434
- l.value.forEach((n) => {
2435
- n.options = [];
2436
- }), await ue();
2437
- },
2438
- { deep: !0 }
2439
- ), me(
2440
- () => i.value,
2441
- async () => {
2442
- await ue(!0);
2443
- }
2444
- );
2445
- function $(n) {
2446
- var M;
2447
- const z = (M = x.value.find((D) => D.name === n.schemaName)) == null ? void 0 : M.fields.find((D) => D.name === n.name);
2448
- return z == null ? void 0 : z.type;
2449
- }
2450
- function A(n) {
2451
- var ge;
2452
- if (!s.value && !m.value) return [];
2453
- const z = m.value ? [m.value] : [...((ge = s.value) == null ? void 0 : ge.tiles) ?? []], { name: M = "", schemaName: D = "" } = n, J = z.filter((oe) => {
2454
- var ee, pe;
2455
- const H = (ee = oe == null ? void 0 : oe.widget) == null ? void 0 : ee.config;
2456
- if (!H || (pe = n.tileIds) != null && pe.length && !n.tileIds.includes(oe.id)) return !1;
2457
- const Y = (H.dimensions ?? []).some(
2458
- (ae) => ae.schemaName === D && ae.name === M
2459
- ), R = (H.joinDatasources ?? []).some(
2460
- (ae) => (ae.dimensions ?? []).some((te) => te.schemaName === D && te.name === M)
2461
- ), Q = (H.schemaNames ?? []).includes(D);
2462
- return Y || R || Q;
2463
- });
2464
- if (!J.length) return [];
2465
- const de = (oe, H) => {
2466
- const Y = /* @__PURE__ */ new Map(), R = (Q) => {
2467
- const ee = `${Q.schemaName}:${Q.name}:${Q.operator}:${Q.option ?? ""}:${Q.dataFormula ?? ""}`, pe = Y.get(ee);
2468
- pe ? [Se.Like, Se.NotLike].includes(Q.operator) ? pe.values = Array.from(/* @__PURE__ */ new Set([...pe.values ?? [], ...Q.values ?? []])) : Y.set(ee, { ...Q }) : Y.set(ee, { ...Q });
2469
- };
2470
- return oe.forEach(R), H.forEach(R), Array.from(Y.values());
2471
- }, be = (oe) => {
2472
- var Y;
2473
- const H = (Y = oe.dimensions) == null ? void 0 : Y.find(
2474
- (R) => R.schemaName === D && R.name === M
2475
- );
2476
- return {
2477
- name: M,
2478
- schemaName: D,
2479
- label: (H == null ? void 0 : H.label) ?? M,
2480
- hide: !1,
2481
- option: n.option ?? null,
2482
- dataFormula: H == null ? void 0 : H.dataFormula
2483
- };
2484
- };
2485
- return J.map((oe) => {
2486
- var ae, te;
2487
- const H = (ae = oe == null ? void 0 : oe.widget) == null ? void 0 : ae.config;
2488
- if (!H) return null;
2489
- const Y = be(H), R = (H.dimensions ?? []).some((we) => we.schemaName === D) || (H.schemaNames ?? []).includes(D), Q = de(
2490
- H.filters ?? [],
2491
- (n.filters ?? []).filter((we) => {
2492
- var le;
2493
- return (le = H.schemaNames) == null ? void 0 : le.includes(we.schemaName);
2494
- })
2495
- ), ee = (te = H.joinDatasources) == null ? void 0 : te.find(
2496
- (we) => (we.schemaNames ?? []).includes(D) || (we.dimensions ?? []).some((le) => le.schemaName === D)
2497
- ), pe = de(
2498
- (ee == null ? void 0 : ee.filters) ?? [],
2499
- (n.filters ?? []).filter((we) => {
2500
- var le;
2501
- return (le = ee == null ? void 0 : ee.schemaNames) == null ? void 0 : le.includes(we.schemaName);
2502
- })
2503
- );
2504
- return {
2505
- type: N.Table,
2506
- title: "Global Filter",
2507
- config: {
2508
- schemaNames: H.schemaNames,
2509
- schemas: H.schemas,
2510
- dimensions: R ? [Y] : [],
2511
- filters: Q,
2512
- sorts: R ? [{ name: M, schemaName: D, type: qe.Asc, aggregation: null, dimensionOption: null }] : [],
2513
- joinDatasources: !R && ee ? [
2514
- {
2515
- ...ee,
2516
- dimensions: [Y],
2517
- sorts: [
2518
- {
2519
- name: M,
2520
- schemaName: D,
2521
- type: qe.Asc,
2522
- aggregation: null,
2523
- dimensionOption: null
2524
- }
2525
- ],
2526
- filters: pe
2527
- }
2528
- ] : [],
2529
- rowIds: [],
2530
- metrics: [],
2531
- limit: null,
2532
- rollup: void 0,
2533
- drillDimension: void 0,
2534
- showGrandTotal: !1,
2535
- breakdownDimension: void 0,
2536
- sparklineDimension: void 0,
2537
- isTransposed: !1,
2538
- isDrillable: !1,
2539
- isBlend: !1
2540
- }
2541
- };
2542
- }).filter(Boolean);
2543
- }
2544
- function I(n) {
2545
- return n.options.every((z) => {
2546
- var M;
2547
- return (M = n.selectedValues) == null ? void 0 : M.includes(z.value);
2548
- });
2549
- }
2550
- function Z(n) {
2551
- I(n) ? n.selectedValues = ["(EMPTY)"] : n.selectedValues = n.options.map((z) => z.value);
2552
- }
2553
- const W = F(
2554
- () => l.value.map((n) => {
2555
- const z = n.options, M = n.search.toLowerCase() ?? "";
2556
- return z.filter(
2557
- (J) => J.label.toLowerCase().includes(M.toLowerCase())
2558
- ).slice(0, n.visibleCount);
2559
- })
2560
- );
2561
- function K(n) {
2562
- n.visibleCount += 50, y(n.filter, a.value, 50);
2563
- }
2564
- async function re(n, z) {
2565
- var M;
2566
- if (!(!n.type && (n.type = $(n.filter), !n.type)))
2567
- switch (n.type) {
2568
- case $e.String:
2569
- try {
2570
- const D = A(n.filter);
2571
- if (!D.length) {
2572
- n.options = [];
2573
- return;
2574
- }
2575
- const J = [];
2576
- for (const H of D) {
2577
- const Y = await jt(H, z);
2578
- (Y == null ? void 0 : Y.type) === N.Table && J.push(...Y.rows.map((R) => {
2579
- var Q;
2580
- return ((Q = R.cells) == null ? void 0 : Q[0]) ?? " ";
2581
- }));
2582
- }
2583
- const de = Array.from(new Set(J)), be = (M = v(n.filter, a.value).selectedValues) != null && M.length ? v(n.filter, a.value).selectedValues : n.selectedValues || [], ge = n.keepSelection ? Array.from(/* @__PURE__ */ new Set([...de, ...be])) : de, oe = new Set(J);
2584
- n.options = ge.map((H) => ({
2585
- label: String(H).trim() === "" ? t.value : String(H),
2586
- value: H,
2587
- available: n.keepSelection ? oe.has(H) : new Set(de).has(H)
2588
- })), w(n);
2589
- } catch (D) {
2590
- if ((D == null ? void 0 : D.code) === "ERR_CANCELED" || (D == null ? void 0 : D.name) === "CanceledError")
2591
- return;
2592
- throw D;
2593
- }
2594
- break;
2595
- case $e.Bool: {
2596
- n.options = [
2597
- { label: o("report.common.yes"), value: !0 },
2598
- { label: o("report.common.no"), value: !1 }
2599
- ], w(n);
2600
- break;
2601
- }
2602
- case $e.Timestamp:
2603
- if (n.filter.option !== ye.DateTime && n.filter.option !== ye.TimeOfDay) {
2604
- const D = n.filter.option;
2605
- n.options = Yt({ dimensionOption: D, t: o }), n.filter.values = n.options.length ? n.options.map((J) => J.value) : ["NULL"];
2606
- }
2607
- w(n);
2608
- break;
2609
- case $e.Numeric:
2610
- break;
2611
- }
2612
- }
2613
- async function ue(n = !1) {
2614
- if (!a.value || !l.value.length) return;
2615
- r == null || r.abort();
2616
- const z = new AbortController();
2617
- r = z;
2618
- try {
2619
- n || (C.value = !0), h.value = !0, await Promise.all(
2620
- l.value.map((M) => re(M, z.signal))
2621
- );
2622
- } finally {
2623
- r === z && (n || (C.value = !1), h.value = !1);
2624
- }
2625
- }
2626
- function S(n, z) {
2627
- var D;
2628
- if ((D = n.selectedValues) == null ? void 0 : D.includes(z)) {
2629
- let J = (n.selectedValues || []).filter((de) => de !== z && de !== "(EMPTY)");
2630
- n.selectedValues = J.length > 0 ? J : ["(EMPTY)"];
2631
- } else
2632
- n.selectedValues = [...(n.selectedValues || []).filter((J) => J !== "(EMPTY)"), z];
2633
- g(n.filter, a.value, "selectedValues", n.selectedValues);
2634
- }
2635
- function E(n, z) {
2636
- if (z === null)
2637
- n.values = [];
2638
- else {
2639
- const D = Je(z.startDate).tz(p.value).startOf("day").utc().toISOString(), J = Je(z.endDate).tz(p.value).endOf("day").utc().toISOString();
2640
- n.values = [D, J];
2641
- }
2642
- const M = l.value.find((D) => D.filter === n);
2643
- M && (M.keepSelection = z !== null, g(M.filter, a.value, "keepSelection", M.keepSelection));
2644
- }
2645
- function X(n) {
2646
- const z = (n.selectedValues || []).filter((M) => M !== "(EMPTY)");
2647
- return `${o("report.section.filter.selectAll")} (${z.length}/${n.options.length})`;
2648
- }
2649
- function q(n) {
2650
- const z = n.options.length, M = o("report.section.filter.search"), D = o("report.common.results", { count: z });
2651
- return `${M} (${D})`;
2652
- }
2653
- function B(n) {
2654
- var de, be, ge, oe, H;
2655
- const z = Dl(n.filter);
2656
- if (n.type === $e.Timestamp) {
2657
- const Y = ((de = n.filter.values) == null ? void 0 : de.length) === 2;
2658
- if (n.filter.option === ye.DateTime)
2659
- return { preview: Y ? `${z} is between ${Wl({
2660
- startDate: ((be = n.filter.values) == null ? void 0 : be[0]) || null,
2661
- endDate: ((ge = n.filter.values) == null ? void 0 : ge[1]) || null,
2662
- locale: i.value,
2663
- timezone: p.value
2664
- })}` : z, suffix: "" };
2665
- if (n.filter.option === ye.TimeOfDay) {
2666
- const R = (oe = n.filter.values) != null && oe[0] ? Je(n.filter.values[0]).tz(p.value) : null, Q = (H = n.filter.values) != null && H[1] ? Je(n.filter.values[1]).tz(p.value) : null, ee = (ae) => ae && ae.isValid() ? { hour: ae.hour(), minute: ae.minute() } : null;
2667
- return { preview: Y ? `${z} is between ${Il({
2668
- startTime: ee(R),
2669
- endTime: ee(Q),
2670
- locale: i.value
2671
- })}` : z, suffix: "" };
2672
- }
2673
- if (n.filter.option !== ye.DateTime && n.filter.option !== ye.TimeOfDay) {
2674
- const R = Yt({
2675
- dimensionOption: n.filter.option,
2676
- t: o
2677
- }), Q = new Map(R.map((te) => [String(te.value), te.label])), pe = (n.selectedValues || []).filter((te) => te !== "(EMPTY)").map((te) => Q.get(String(te)) ?? String(te)), ae = pe.map((te) => te.length > 20 ? `${te.slice(0, 20)}…` : te).join(", ");
2678
- return pe.length ? {
2679
- preview: `${z}: ${ae}`,
2680
- suffix: `(${pe.length} selected)`
2681
- } : { preview: z, suffix: "" };
2682
- }
2683
- }
2684
- const D = (n.selectedValues || []).filter((Y) => Y !== "(EMPTY)").map((Y) => Y === !0 ? o("report.common.yes") || "Yes" : Y === !1 ? o("report.common.no") || "No" : String(Y).trim() === "" ? t.value : String(Y)), J = D.map((Y) => Y.length > 20 ? `${Y.slice(0, 20)}…` : Y).join(", ");
2685
- return D.length ? {
2686
- preview: `${z}: ${J}`,
2687
- suffix: `(${D.length} selected)`
2688
- } : { preview: J, suffix: `${z}` };
2689
- }
2690
- function O(n) {
2691
- n.filter.values = [...n.selectedValues || []], g(n.filter, a.value, "selectedValues", n.selectedValues), document.body.click();
2692
- }
2693
- function he(n) {
2694
- n.selectedValues = [...n.filter.values || []], g(n.filter, a.value, "selectedValues", n.selectedValues), document.body.click();
2695
- }
2696
- function Fe(n) {
2697
- n.showAdvanced = !n.showAdvanced, g(n.filter, a.value, "showAdvanced", n.showAdvanced);
2698
- }
2699
- function Ae(n) {
2700
- n.keepSelection = !n.keepSelection, b(n.keepSelection), g(n.filter, a.value, "keepSelection", n.keepSelection), n.options = [], ue(!0);
2701
- }
2702
- function Pe(n, z) {
2703
- return n ? n.length > z ? `${n.slice(0, z)}…` : n : t.value;
2704
- }
2705
- function Me(n, z) {
2706
- var D, J, de, be;
2707
- if (z === null)
2708
- n.values = [];
2709
- else {
2710
- const ge = Je().tz(p.value).set("hour", Number((D = z.start) == null ? void 0 : D.hour)).set("minute", Number((J = z.start) == null ? void 0 : J.minute)).toISOString(), oe = Je().tz(p.value).set("hour", Number((de = z.end) == null ? void 0 : de.hour)).set("minute", Number((be = z.end) == null ? void 0 : be.minute)).toISOString();
2711
- n.values = [ge, oe];
2712
- }
2713
- const M = l.value.find((ge) => ge.filter === n);
2714
- M && (M.keepSelection = z !== null, g(M.filter, a.value, "keepSelection", M.keepSelection));
2715
- }
2716
- return (n, z) => {
2717
- const M = U("FmCircularProgress"), D = U("FmTextField"), J = U("FmMenuItem"), de = U("FmTooltip"), be = U("FmIcon"), ge = U("FmMenuDivider"), oe = U("FmSwitch"), H = U("FmButton"), Y = U("FmMenu");
2718
- return P(), se("div", ka, [
2719
- (P(!0), se(xe, null, dt(l.value, (R, Q) => {
2720
- var ee, pe, ae, te, we, le;
2721
- return P(), se("div", {
2722
- key: R.id
2723
- }, [
2724
- R.filter.option === d(ye).DateTime ? (P(), fe(Al, {
2725
- key: 0,
2726
- "model-value": { startDate: (ee = R.filter.values) == null ? void 0 : ee[0], endDate: (pe = R.filter.values) == null ? void 0 : pe[1] },
2727
- class: "w-full",
2728
- label: B(R).preview,
2729
- removable: ((ae = R.filter.values) == null ? void 0 : ae.length) === 2,
2730
- onUpdate: (Be) => E(R.filter, Be),
2731
- onChipClosed: () => E(R.filter, null)
2732
- }, null, 8, ["model-value", "label", "removable", "onUpdate", "onChipClosed"])) : R.filter.option === d(ye).TimeOfDay ? (P(), fe(Vl, {
2733
- key: 1,
2734
- "model-value": { start: (te = R.filter.values) == null ? void 0 : te[0], end: (we = R.filter.values) == null ? void 0 : we[1] },
2735
- class: "w-full",
2736
- label: B(R).preview,
2737
- removable: ((le = R.filter.values) == null ? void 0 : le.length) === 2,
2738
- onUpdate: (Be) => Me(R.filter, Be),
2739
- onChipClosed: () => Me(R.filter, null)
2740
- }, null, 8, ["model-value", "label", "removable", "onUpdate", "onChipClosed"])) : (P(), fe(Y, {
2741
- key: 2,
2742
- "close-on-click": !1,
2743
- shift: !0,
2744
- open: d(c)(R.id)
2745
- }, {
2746
- "menu-button": ce(() => [
2747
- j("div", Ta, [
2748
- G(Ml, {
2749
- "left-icon": "filter_alt",
2750
- "trailing-icon": "expand_more",
2751
- label: B(R).preview,
2752
- class: "w-full"
2753
- }, {
2754
- default: ce(() => [
2755
- wt(ke(B(R).suffix), 1)
2756
- ]),
2757
- _: 2
2758
- }, 1032, ["label"])
2759
- ])
2760
- ]),
2761
- "menu-wrapper": ce(({ maxHeight: Be, width: mt }) => [
2762
- j("div", {
2763
- class: "flex flex-col bg-fm-color-neutral-white p-2 rounded-lg shadow-light-300",
2764
- style: Ve({ maxHeight: `${Be}px`, width: mt })
2765
- }, [
2766
- h.value ? (P(), se("div", _a, [
2767
- G(M)
2768
- ])) : R.options.length > 0 && !d(C) ? (P(), se(xe, { key: 1 }, [
2769
- j("div", Fa, [
2770
- G(D, {
2771
- modelValue: R.search,
2772
- "onUpdate:modelValue": [
2773
- (ie) => R.search = ie,
2774
- (ie) => d(g)(R.filter, a.value, "search", ie)
2775
- ],
2776
- type: "text",
2777
- "prepend-icon": "search",
2778
- placeholder: q(R),
2779
- class: "border px-2 pb-8 text-sm mb-1 rounded"
2780
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
2781
- ]),
2782
- j("div", La, [
2783
- j("div", Ra, [
2784
- G(J, {
2785
- label: X(R),
2786
- "has-checkbox": !0,
2787
- "model-value": I(R),
2788
- indeterminate: !0,
2789
- onClick: (ie) => Z(R)
2790
- }, null, 8, ["label", "model-value", "onClick"]),
2791
- (P(!0), se(xe, null, dt(W.value[Q], (ie) => (P(), se(xe, {
2792
- key: ie.value
2793
- }, [
2794
- ie.label && ie.label.length > 110 ? (P(), fe(de, {
2795
- key: 0,
2796
- placement: "right",
2797
- "hide-arrow": !0,
2798
- "z-index": 2e3
2799
- }, {
2800
- content: ce(() => [
2801
- wt(ke(ie.label), 1)
2802
- ]),
2803
- default: ce(() => [
2804
- j("div", $a, [
2805
- G(J, {
2806
- label: Pe(ie.label, 110),
2807
- "has-checkbox": !0,
2808
- "model-value": R.selectedValues.includes(ie.value),
2809
- class: Ze([
2810
- "flex-1 text-left",
2811
- { "bg-gray-200": ie.available === !1 }
2812
- ]),
2813
- onClick: () => S(R, ie.value)
2814
- }, null, 8, ["label", "model-value", "class", "onClick"])
2815
- ])
2816
- ]),
2817
- _: 2
2818
- }, 1024)) : (P(), fe(J, {
2819
- key: 1,
2820
- label: ie.label,
2821
- "has-checkbox": !0,
2822
- "model-value": R.selectedValues.includes(ie.value),
2823
- class: Ze(["flex-1 text-left", { "bg-gray-100": ie.available === !1 }]),
2824
- onClick: () => S(R, ie.value)
2825
- }, null, 8, ["label", "model-value", "class", "onClick"]))
2826
- ], 64))), 128)),
2827
- W.value[Q].length < R.options.length && !R.search ? (P(), fe(J, {
2828
- key: 0,
2829
- class: "fm-typo-en-body-md-400 -ml-2",
2830
- label: d(o)("report.section.filter.loadMore"),
2831
- onClick: gt((ie) => K(R), ["stop"]),
2832
- icon: "autorenew"
2833
- }, null, 8, ["label", "onClick"])) : Te("", !0)
2834
- ])
2835
- ]),
2836
- j("div", {
2837
- class: "px-12 py-2 flex items-center gap-2 cursor-pointer hover:bg-fm-color-neutral-50 transition-colors",
2838
- onClick: (ie) => Fe(R)
2839
- }, [
2840
- G(be, {
2841
- name: R.showAdvanced ? "keyboard_arrow_up" : "keyboard_arrow_down",
2842
- size: "md",
2843
- class: ""
2844
- }, null, 8, ["name"]),
2845
- j("span", Ea, ke(d(o)("report.section.filter.advanced")), 1)
2846
- ], 8, za),
2847
- G(ge),
2848
- R.showAdvanced ? (P(), se("div", Va, [
2849
- j("div", Da, [
2850
- j("div", Aa, [
2851
- G(oe, {
2852
- "model-value": R.keepSelection,
2853
- label: d(o)("report.section.filter.keepSelection"),
2854
- labelPlacement: "right",
2855
- "onUpdate:modelValue": () => Ae(R)
2856
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]),
2857
- G(de, {
2858
- placement: "top",
2859
- "z-index": 2e3
2860
- }, {
2861
- content: ce(() => [
2862
- j("div", Ma, ke(d(o)("report.section.filter.keepSelectionTooltip")), 1)
2863
- ]),
2864
- default: ce(() => [
2865
- G(be, {
2866
- name: "info",
2867
- size: "md",
2868
- class: "text-fm-color-primary"
2869
- })
2870
- ]),
2871
- _: 1
2872
- })
2873
- ])
2874
- ])
2875
- ])) : Te("", !0),
2876
- j("div", Wa, [
2877
- G(H, {
2878
- variant: "tertiary",
2879
- label: d(o)("report.common.cancel"),
2880
- onClick: gt((ie) => he(R), ["stop"])
2881
- }, null, 8, ["label", "onClick"]),
2882
- G(H, {
2883
- color: "primary",
2884
- onClick: gt((ie) => O(R), ["stop"]),
2885
- label: d(o)("report.common.apply")
2886
- }, null, 8, ["onClick", "label"])
2887
- ])
2888
- ], 64)) : d(C) ? Te("", !0) : (P(), fe(Ct, { key: 2 }))
2889
- ], 4)
2890
- ]),
2891
- _: 2
2892
- }, 1032, ["open"]))
2893
- ]);
2894
- }), 128)),
2895
- Ne(n.$slots, "default")
2896
- ]);
2897
- };
2898
- }
2899
- });
2900
- export {
2901
- Ue as I,
2902
- Tt as L,
2903
- Oe as R,
2904
- _t as X,
2905
- Ft as Y,
2906
- Ga as _,
2907
- Za as a,
2908
- kt as b,
2909
- Lt as c,
2910
- Ka as d,
2911
- Ja as e,
2912
- ja as f,
2913
- bt as g,
2914
- qt as u
2915
- };