@feedmepos/mf-report 5.8.2 → 5.9.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 (37) hide show
  1. package/dist/{App-C6VF9T5V.js → App-CSOLBHvz.js} +6 -7
  2. package/dist/DateRangeSelect.vue_vue_type_script_setup_true_lang-DFhiXlTW.js +180 -0
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-B0_QlxYu.js → Default.vue_vue_type_script_setup_true_lang-Bk5Aw-iX.js} +2 -2
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-zgh_zMvL.js +1447 -0
  5. package/dist/{InsightView-BQlzh0ue.js → InsightView-Bwh7zRnV.js} +7 -8
  6. package/dist/Integration-C6jAZ1_i.js +5222 -0
  7. package/dist/Integrations-BGmJBj90.js +338 -0
  8. package/dist/{Layout-RhBG3zKc.js → Layout-Db6yStGK.js} +1 -1
  9. package/dist/MenuTab.vue_vue_type_script_setup_true_lang-BEHjV9yH.js +342 -0
  10. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-BdzurgE4.js → NavigationTab.vue_vue_type_script_setup_true_lang-gDVPczBf.js} +1078 -1080
  11. package/dist/NoData.vue_vue_type_script_setup_true_lang-D-J81GXC.js +38 -0
  12. package/dist/{OverviewView-Boq9rgbj.js → OverviewView-WOEuALSq.js} +5 -5
  13. package/dist/{Report-C7GvAhoG.js → Report-_YQ9GpRY.js} +4 -4
  14. package/dist/ReportEditor-C9W5Dkcl.js +968 -0
  15. package/dist/{ReportView-DMLyspIY.js → ReportView-B2dPbjug.js} +7 -7
  16. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-CGlkGXWL.js +110 -0
  17. package/dist/{Setting-CLBZdtvx.js → Setting-BONU5EUv.js} +26 -23
  18. package/dist/TileEditor-B_5Z6Y4K.js +3080 -0
  19. package/dist/{TransitionFade-D3megUTB.js → TransitionFade-nQahFBUN.js} +207 -203
  20. package/dist/app.js +59 -19
  21. package/dist/helper-CFNxnCtm.js +75 -0
  22. package/dist/style.css +1 -1
  23. package/dist/{v4-Bi2F4URu.js → v4-CboKZWvc.js} +1955 -1844
  24. package/dist/{global-loader-CEOgl5uZ.js → vue-i18n-DX0diAld.js} +2057 -1976
  25. package/package.json +1 -1
  26. package/dist/DateRangeSelect.vue_vue_type_script_setup_true_lang-CpakO4U-.js +0 -162
  27. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-BO_HTvjY.js +0 -1417
  28. package/dist/Integration-CB31rvSG.js +0 -4751
  29. package/dist/Integrations-DGlzyZMR.js +0 -334
  30. package/dist/MenuTab.vue_vue_type_script_setup_true_lang-DsY5W3k7.js +0 -101
  31. package/dist/NoData.vue_vue_type_script_setup_true_lang-DZJxcekm.js +0 -31
  32. package/dist/ReportEditor-CwzONBLC.js +0 -621
  33. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-C23-eIYF.js +0 -104
  34. package/dist/TileEditor-CtVM3IbI.js +0 -3016
  35. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  36. package/dist/index-CH1WFv_s.js +0 -147
  37. package/dist/report-schema-C3sI223M.js +0 -31
@@ -0,0 +1,1447 @@
1
+ import { computed as d, defineComponent as K, useModel as Z, ref as s, resolveComponent as A, createElementBlock as H, openBlock as E, Fragment as te, renderSlot as ue, createVNode as P, normalizeStyle as ae, unref as n, createElementVNode as B, toDisplayString as Te, withCtx as N, createBlock as O, createCommentVNode as ce, normalizeClass as Pe, h as ht, watch as ye, nextTick as mt, renderList as yt, mergeModels as wt, createTextVNode as Yt, onMounted as Ut, onUnmounted as Gt, resolveDynamicComponent as jt, withDirectives as Jt, vShow as Kt } from "vue";
2
+ import { W as y, v as Ve, P as Ie, d as bt, q as Zt, R as _e, g as Qt } from "./v4-CboKZWvc.js";
3
+ import { u as $e, b as Ke, a as Ze } from "./vue-i18n-DX0diAld.js";
4
+ import { a as pt } from "./helper-CFNxnCtm.js";
5
+ import { storeToRefs as ke, defineStore as ea } from "pinia";
6
+ import { a as ta } from "./SelectComponent.vue_vue_type_script_setup_true_lang-CGlkGXWL.js";
7
+ import { r as ge } from "./i18n-Cif1I9J2.js";
8
+ import { _ as ft } from "./NoData.vue_vue_type_script_setup_true_lang-D-J81GXC.js";
9
+ import { components as aa, useSnackbar as Ct, useBreakpoints as la } from "@feedmepos/ui-library";
10
+ var Xe = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(Xe || {}), J = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(J || {}), Ye = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(Ye || {}), Ue = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(Ue || {}), Ge = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(Ge || {}), je = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(je || {}), Je = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(Je || {});
11
+ y.Circular, y.Table, y.BarChart, y.LineChart, y.StackBarChart, y.StackLineChart, y.Scorecard, y.Spacer;
12
+ const oa = [
13
+ {
14
+ type: y.Circular,
15
+ showLabel: !1,
16
+ // TODO: temporarily removed show label as it has no function
17
+ showDrillDimension: !0,
18
+ showRollup: !1,
19
+ showSearchBar: !1
20
+ },
21
+ {
22
+ type: y.Table,
23
+ showLabel: !1,
24
+ showDrillDimension: !0,
25
+ showRollup: !0,
26
+ showSearchBar: !0
27
+ },
28
+ {
29
+ type: y.BarChart,
30
+ showLabel: !1,
31
+ // TODO: temporarily removed show label as it has no function
32
+ showDrillDimension: !0,
33
+ showRollup: !1,
34
+ showSearchBar: !1
35
+ },
36
+ {
37
+ type: y.LineChart,
38
+ showLabel: !1,
39
+ // TODO: temporarily removed show label as it has no function
40
+ showDrillDimension: !0,
41
+ showRollup: !0,
42
+ showSearchBar: !1
43
+ },
44
+ {
45
+ type: y.StackBarChart,
46
+ showLabel: !1,
47
+ // TODO: temporarily removed show label as it has no function
48
+ showDrillDimension: !0,
49
+ showRollup: !0,
50
+ showSearchBar: !1
51
+ },
52
+ {
53
+ type: y.StackLineChart,
54
+ showLabel: !1,
55
+ // TODO: temporarily removed show label as it has no function
56
+ showDrillDimension: !0,
57
+ showRollup: !0,
58
+ showSearchBar: !1
59
+ },
60
+ {
61
+ type: y.Scorecard,
62
+ showLabel: !1,
63
+ showDrillDimension: !1,
64
+ showRollup: !1,
65
+ showSearchBar: !1
66
+ },
67
+ {
68
+ type: y.Spacer,
69
+ showLabel: !1,
70
+ showDrillDimension: !1,
71
+ showRollup: !1,
72
+ showSearchBar: !1
73
+ }
74
+ ];
75
+ function Oe(e) {
76
+ const a = [e.schemaName, e.name];
77
+ return "option" in e && e.option && a.push(e.option), "aggregation" in e && e.aggregation && a.push(e.aggregation), a.push(e.label.replace(/[^a-zA-Z0-9]/g, "")), a.join("_").toLowerCase();
78
+ }
79
+ function na(e, a) {
80
+ switch (e) {
81
+ case y.BarChart:
82
+ case y.LineChart:
83
+ case y.StackBarChart:
84
+ case y.StackLineChart:
85
+ return Array.isArray(a == null ? void 0 : a.datasets) && Array.isArray(a == null ? void 0 : a.xAxis) && a.datasets.length > 0 && a.xAxis.length > 0;
86
+ case y.Table:
87
+ return Array.isArray(a == null ? void 0 : a.rows) && Array.isArray(a == null ? void 0 : a.columns) && a.rows.length > 0 && a.columns.length > 0;
88
+ case y.Circular:
89
+ return Array.isArray(a == null ? void 0 : a.datasets) && a.datasets.length > 0;
90
+ case y.Scorecard:
91
+ return !0;
92
+ case y.Spacer:
93
+ return !0;
94
+ }
95
+ }
96
+ const vt = [
97
+ "54, 162, 235",
98
+ //8CE6D7
99
+ "0, 123, 167",
100
+ //007BA7
101
+ "255, 93, 83",
102
+ //FF5D53
103
+ "115, 200, 230",
104
+ //73C8E6
105
+ "252, 162, 62",
106
+ //FCA23E
107
+ "240, 155, 190",
108
+ //F09BBE
109
+ "255, 210, 50",
110
+ //FFD232
111
+ "80, 190, 155",
112
+ //50BE9B
113
+ "131, 88, 212",
114
+ //8358D4
115
+ "155, 80, 70"
116
+ //9B5046
117
+ ];
118
+ function Fe({
119
+ index: e,
120
+ isCompare: a,
121
+ opacity: f
122
+ }) {
123
+ let t = typeof f == "number" ? f : 1;
124
+ return a && (t = t * 0.6), `rgba(${vt[e % vt.length]}, ${t})`;
125
+ }
126
+ function St(e, a, f) {
127
+ if (e === "" || a === "")
128
+ return null;
129
+ let t = (g) => g == null ? void 0 : g.replace(/,/g, "");
130
+ f === "ID" && (t = (g) => g == null ? void 0 : g.replace(/\./g, "").replace(/,/g, "."));
131
+ const T = Number(t(e)), x = Number(t(a));
132
+ if (isNaN(T) || isNaN(x))
133
+ return null;
134
+ let b = 0;
135
+ x === 0 ? T === 0 ? b = 0 : b = 1 : b = (T - x) / x;
136
+ const _ = sa(b);
137
+ return {
138
+ value: isNaN(b) ? "" : `${(b * 100).toFixed(0)}%`,
139
+ icon: _
140
+ };
141
+ }
142
+ function sa(e) {
143
+ return e > 0 ? {
144
+ name: "moving",
145
+ color: "#1F7735",
146
+ tailwind: "fm-color-system-success-100"
147
+ } : e < 0 ? {
148
+ name: "trending_down",
149
+ color: "#99231D",
150
+ tailwind: "fm-color-system-error-100"
151
+ } : {
152
+ name: "equal",
153
+ color: "#C7C7CC",
154
+ tailwind: "fm-color-neutral-gray-100"
155
+ };
156
+ }
157
+ function Re(e) {
158
+ const a = d(() => ({
159
+ display: e.showLabel,
160
+ align: e.labelAlign,
161
+ anchor: e.labelAnchor,
162
+ rotation: e.labelRotation,
163
+ offset: e.labelOffset,
164
+ font: {
165
+ size: e.labelFontSize
166
+ }
167
+ })), f = d(() => ({
168
+ display: e.showX,
169
+ position: e.xPosition,
170
+ grid: {
171
+ display: e.showXGrid
172
+ },
173
+ ticks: {
174
+ display: e.showXTick,
175
+ font: {
176
+ size: e.xTickFontSize
177
+ }
178
+ },
179
+ title: {
180
+ display: e.showXTitle,
181
+ text: e.xTitle,
182
+ font: {
183
+ size: e.xTitleFontSize
184
+ }
185
+ }
186
+ })), t = d(() => ({
187
+ display: e.showY,
188
+ position: e.yPosition,
189
+ grid: {
190
+ display: e.showYGrid
191
+ },
192
+ ticks: {
193
+ display: e.showYTick,
194
+ font: {
195
+ size: e.yTickFontSize
196
+ }
197
+ },
198
+ title: {
199
+ display: e.showYTitle,
200
+ text: e.yTitle,
201
+ font: {
202
+ size: e.yTitleFontSize
203
+ }
204
+ }
205
+ })), T = d(() => ({
206
+ display: e.showLegend,
207
+ position: e.legendPosition,
208
+ usePointStyle: e.usePointStyle
209
+ })), x = d(() => e.isTransposed), b = d(() => e.chartWidth), _ = d(() => e.chartHeight);
210
+ return { datalabels: a, xCfg: f, yCfg: t, isTransposed: x, legend: T, chartWidth: b, chartHeight: _ };
211
+ }
212
+ const ra = /* @__PURE__ */ K({
213
+ __name: "WidgetBarchart",
214
+ props: {
215
+ modelValue: { required: !0 },
216
+ modelModifiers: {}
217
+ },
218
+ emits: ["update:modelValue"],
219
+ setup(e) {
220
+ const a = Z(e, "modelValue"), f = d(() => {
221
+ var i;
222
+ return ((i = a.value.data) == null ? void 0 : i.xAxis) ?? [];
223
+ }), t = d(() => {
224
+ var i;
225
+ return ((i = a.value.data) == null ? void 0 : i.datasets) ?? [];
226
+ }), T = s(null), { datalabels: x, xCfg: b, yCfg: _, isTransposed: g, legend: k, chartWidth: L, chartHeight: h } = Re(
227
+ a.value
228
+ ), c = d(() => t.value.length > 0 ? [
229
+ ...t.value.map((i, S) => ({
230
+ label: i.name,
231
+ data: i.values,
232
+ dash: !!i.isCompare,
233
+ backgroundColor: Fe({ index: S, isCompare: i.isCompare })
234
+ }))
235
+ ] : []);
236
+ return (i, S) => {
237
+ const R = A("FmBarChart");
238
+ return E(), H(te, null, [
239
+ ue(i.$slots, "menu"),
240
+ P(R, {
241
+ ref_key: "chartRef",
242
+ ref: T,
243
+ class: "bar-chart",
244
+ datasets: c.value,
245
+ "x-axis": { categories: f.value },
246
+ "x-cfg": n(b),
247
+ "y-cfg": n(_),
248
+ transpose: n(g),
249
+ legend: {
250
+ display: n(k).display ?? !1,
251
+ position: n(k).position,
252
+ labels: {
253
+ usePointStyle: n(k).usePointStyle ?? !0
254
+ }
255
+ },
256
+ datalabels: n(x),
257
+ "maintain-aspect-ratio": !1,
258
+ style: ae({
259
+ "--chart-width": n(L) !== void 0 ? n(L) + "px" : "100%",
260
+ "--chart-height": n(h) !== void 0 ? n(h) + "px" : "calc(100% - 36px)"
261
+ })
262
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
263
+ ], 64);
264
+ };
265
+ }
266
+ }), ia = /* @__PURE__ */ K({
267
+ __name: "WidgetCircular",
268
+ props: {
269
+ modelValue: { required: !0 },
270
+ modelModifiers: {}
271
+ },
272
+ emits: ["update:modelValue"],
273
+ setup(e) {
274
+ const a = Z(e, "modelValue"), { datalabels: f, legend: t, chartWidth: T, chartHeight: x } = Re(a.value), b = d(() => {
275
+ let _ = [];
276
+ return a.value.data.datasets && a.value.data.metrics && a.value.data.datasets.length > 0 && a.value.data.metrics.length > 0 && (_ = [
277
+ {
278
+ label: a.value.data.metrics[0],
279
+ data: a.value.data.datasets.map((g) => g.value),
280
+ backgroundColor: a.value.data.datasets.map((g, k) => Fe({ index: k }))
281
+ }
282
+ ]), _;
283
+ });
284
+ return (_, g) => {
285
+ const k = A("FmPieChart");
286
+ return E(), H(te, null, [
287
+ ue(_.$slots, "menu"),
288
+ P(k, {
289
+ class: "circular",
290
+ percentage: "70%",
291
+ datasets: b.value,
292
+ metrics: a.value.data.datasets.map((L) => L.name),
293
+ variant: "doughnut",
294
+ legend: {
295
+ display: n(t).display ?? !0,
296
+ position: n(t).position ?? "top",
297
+ maxHeight: n(t).display === !0 ? void 0 : 54,
298
+ labels: {
299
+ usePointStyle: n(t).usePointStyle ?? !0
300
+ }
301
+ },
302
+ datalabels: n(f),
303
+ "maintain-aspect-ratio": !1,
304
+ style: ae({
305
+ "--chart-width": n(T) !== void 0 ? n(T) + "px" : "100%",
306
+ "--chart-height": n(x) !== void 0 ? n(x) + "px" : "calc(100% - 36px)"
307
+ })
308
+ }, null, 8, ["datasets", "metrics", "legend", "datalabels", "style"])
309
+ ], 64);
310
+ };
311
+ }
312
+ }), ca = { class: "flex flex-col gap-1" }, ua = { class: "fm-typo-en-title-sm-600" }, da = { class: "flex gap-2" }, ha = { key: 0 }, ma = { key: 1 }, pa = /* @__PURE__ */ K({
313
+ __name: "WidgetScorecard",
314
+ props: {
315
+ modelValue: { required: !0 },
316
+ modelModifiers: {}
317
+ },
318
+ emits: ["update:modelValue"],
319
+ setup(e) {
320
+ const a = Z(e, "modelValue"), { t: f } = $e(), { compareDateRange: t, defaultDateSetting: T } = ke(Ke()), { country: x } = Ze(), b = d(() => {
321
+ var h;
322
+ return ((h = a.value.data) == null ? void 0 : h.value) || "";
323
+ }), _ = d(() => {
324
+ const { data: h } = a.value;
325
+ return h != null && h.comparison ? St(b.value, h.comparison, x) : null;
326
+ });
327
+ function g(h) {
328
+ switch (h) {
329
+ case Xe.bar:
330
+ return "bar";
331
+ case Xe.line:
332
+ return "line";
333
+ default:
334
+ return "line";
335
+ }
336
+ }
337
+ const k = d(() => {
338
+ var h;
339
+ return (h = a.value.data) == null ? void 0 : h.sparkline;
340
+ }), L = d(() => k.value.datasets.map((h) => ({
341
+ label: h.name,
342
+ data: h.values,
343
+ fill: !0,
344
+ color: "#36a2eb"
345
+ })));
346
+ return (h, c) => {
347
+ var X;
348
+ const i = A("FmIcon"), S = A("FmChip"), R = A("FmTooltip"), M = A("FmLineChart");
349
+ return E(), H("div", ca, [
350
+ ue(h.$slots, "menu"),
351
+ B("p", ua, Te(b.value), 1),
352
+ B("div", da, [
353
+ P(R, {
354
+ content: `vs. ${(X = n(T).defaultCompareType) == null ? void 0 : X.split("_").join(" ")}`,
355
+ placement: "right",
356
+ "hide-arrow": "",
357
+ variant: "plain"
358
+ }, {
359
+ default: N(() => [
360
+ _.value ? (E(), O(S, {
361
+ key: 0,
362
+ icon: _.value.icon.name,
363
+ class: Pe(`bg-${_.value.icon.tailwind}`),
364
+ compact: ""
365
+ }, {
366
+ default: N(() => [
367
+ P(i, {
368
+ name: _.value.icon.name,
369
+ color: _.value.icon.color
370
+ }, null, 8, ["name", "color"]),
371
+ B("p", {
372
+ class: "fm-typo-en-body-md-600",
373
+ style: ae({ color: _.value.icon.color })
374
+ }, Te(_.value.value), 5)
375
+ ]),
376
+ _: 1
377
+ }, 8, ["icon", "class"])) : ce("", !0),
378
+ n(t).endDate !== null && n(t).startDate !== null && _.value === null ? (E(), O(S, {
379
+ key: 1,
380
+ compact: ""
381
+ }, {
382
+ default: N(() => [
383
+ P(i, {
384
+ name: "arrow_upward",
385
+ color: "#C7C7CC"
386
+ }),
387
+ c[0] || (c[0] = B("p", { class: "fm-typo-en-body-md-600 text-fm-color-typo-disabled" }, "N/A", -1))
388
+ ]),
389
+ _: 1
390
+ })) : ce("", !0)
391
+ ]),
392
+ _: 1
393
+ }, 8, ["content"])
394
+ ]),
395
+ k.value ? (E(), H("div", ha, [
396
+ g(k.value.type) === "line" ? (E(), O(M, {
397
+ key: 0,
398
+ class: "sparkline",
399
+ datasets: L.value,
400
+ legend: {
401
+ display: !1
402
+ },
403
+ datalabels: { display: !1 },
404
+ "x-axis": { categories: k.value.dimensions },
405
+ "y-cfg": { display: !1 },
406
+ "x-cfg": { display: !1 },
407
+ "maintain-aspect-ratio": !1
408
+ }, null, 8, ["datasets", "x-axis"])) : ce("", !0)
409
+ ])) : (E(), H("div", ma, c[1] || (c[1] = [
410
+ B("div", { class: "sparkline" }, [
411
+ B("div", { class: "flex flex-col gap-8" }, [
412
+ B("div"),
413
+ B("div")
414
+ ]),
415
+ B("div", { class: "grow" })
416
+ ], -1)
417
+ ])))
418
+ ]);
419
+ };
420
+ }
421
+ }), fa = {};
422
+ function va(e, a) {
423
+ const f = A("FmMenuDivider");
424
+ return E(), O(f);
425
+ }
426
+ const ga = /* @__PURE__ */ ta(fa, [["render", va]]), ya = "mf-reporttable-dimension", gt = ea(ya, () => {
427
+ const e = s(0), a = s([]), f = s(!1), t = (m, u) => {
428
+ e.value = m, x(m, u);
429
+ }, T = (m, u, w, F) => {
430
+ a[m] = u, a.value = [...a.value], b(m, u, w, F);
431
+ }, x = (m, u) => {
432
+ const w = (u == null ? void 0 : u.querySelectorAll("thead tr")) ?? [], F = (u == null ? void 0 : u.querySelectorAll("tbody tr")) ?? [];
433
+ [...w, ...F].forEach((z) => {
434
+ const o = z;
435
+ o && (o.style.height = `${m}px`);
436
+ });
437
+ }, b = (m, u, w, F = !1) => {
438
+ const p = (w == null ? void 0 : w.querySelectorAll("th")) ?? [];
439
+ if (m === void 0) return;
440
+ const z = p[m], o = F ? a[m] : u;
441
+ if (!z || o === void 0) return;
442
+ const r = () => {
443
+ z.style.width = `${o}px`;
444
+ };
445
+ F ? requestAnimationFrame(r) : r();
446
+ }, _ = () => {
447
+ const m = document.querySelectorAll("th"), u = document.querySelectorAll("td"), w = document.querySelector("table");
448
+ w == null || w.classList.add("table-fixed"), m.forEach((F) => F.classList.add("toggleEditResize")), u.forEach((F) => F.classList.add("toggleEditResize")), f.value = !0;
449
+ }, g = () => {
450
+ const m = document.querySelectorAll("th"), u = document.querySelectorAll("td"), w = document.querySelectorAll(".col-resize-handle"), F = document.querySelectorAll(".row-resize-handle");
451
+ m.forEach((p) => p.classList.remove("toggleEditResize")), u.forEach((p) => p.classList.remove("toggleEditResize")), w.forEach((p) => p.remove()), F.forEach((p) => p.remove()), f.value = !1;
452
+ }, k = () => {
453
+ e.value = 0, a.value = [];
454
+ }, L = (m, u) => {
455
+ if (u) {
456
+ const w = document.querySelectorAll(`thead th:nth-child(${m + 1})`), F = document.querySelectorAll(`tbody td:nth-child(${m + 1})`);
457
+ [...w, ...F].forEach((p) => {
458
+ p.classList.add("highlight-hover-col");
459
+ });
460
+ } else
461
+ document.querySelectorAll(
462
+ `thead th:nth-child(${m + 1}), tbody td:nth-child(${m + 1})`
463
+ ).forEach((w) => w.classList.add("highlight-col"));
464
+ }, h = (m) => {
465
+ const u = document.querySelectorAll("thead tr"), w = document.querySelectorAll("tbody tr"), F = [...u, ...w];
466
+ for (const p of F)
467
+ m ? p.classList.add("highlight-hover-row") : p.classList.add("highlight-row");
468
+ }, c = (m) => {
469
+ const u = m ? ".highlight-hover-row" : ".highlight-row", w = document.querySelectorAll(u);
470
+ for (const F of w)
471
+ F.classList.remove(u.slice(1));
472
+ }, i = (m) => {
473
+ m ? document.querySelectorAll(".highlight-hover-col").forEach((u) => {
474
+ u.classList.remove("highlight-hover-col");
475
+ }) : document.querySelectorAll(".highlight-col").forEach((u) => u.classList.remove("highlight-col"));
476
+ }, S = (m, u) => {
477
+ const w = /* @__PURE__ */ new Map(), F = m.clientX, p = m.target.closest("table"), z = p == null ? void 0 : p.querySelectorAll("th")[u], o = z == null ? void 0 : z.getBoundingClientRect().width, r = w.get(u) ? a[u.toString()] || 60 : (w.set(u, !0), o || a[u.toString()] || 60), v = z == null ? void 0 : z.querySelector("p");
478
+ if (!v) return;
479
+ const C = v.textContent || "", D = window.getComputedStyle(v), V = `${D.fontWeight} ${D.fontSize} ${D.fontFamily}`, I = document.createElement("canvas").getContext("2d");
480
+ if (!I) return;
481
+ I.font = V;
482
+ const Y = I.measureText(C), U = window.getComputedStyle(z), Le = parseFloat(U.paddingLeft || "0"), Ee = parseFloat(U.paddingRight || "0"), ze = Y.width + Le + Ee;
483
+ L(u, !1);
484
+ const be = (de) => {
485
+ const le = de.clientX - F, oe = Math.max(ze, r + le);
486
+ if (p) {
487
+ T(u, oe, p, !0);
488
+ let Q = 0;
489
+ p.querySelectorAll("th").forEach((ne, se) => {
490
+ Q += se === u ? oe : a[se] || ne.getBoundingClientRect().width;
491
+ }), p.classList.remove("w-full"), p.style.width = `${Q}px`;
492
+ const ee = p == null ? void 0 : p.parentElement;
493
+ if (ee) {
494
+ const ne = ee.scrollWidth, se = ee.scrollLeft;
495
+ ee.offsetWidth + se >= ne - 100 && (ee.scrollLeft = ne);
496
+ }
497
+ }
498
+ }, Ce = () => {
499
+ const de = (p == null ? void 0 : p.querySelectorAll("th")) ?? [], le = [...a.value];
500
+ de.forEach((oe, Q) => {
501
+ const he = oe.getBoundingClientRect().width;
502
+ a[Q] = he, le[Q] = he;
503
+ }), a.value = le, i(!1), document.removeEventListener("mousemove", be), document.removeEventListener("mouseup", Ce);
504
+ };
505
+ document.addEventListener("mousemove", be), document.addEventListener("mouseup", Ce);
506
+ }, R = (m) => {
507
+ const u = m.clientY, w = m.target.closest("table"), F = e.value || 48;
508
+ h(!1);
509
+ const p = (o) => {
510
+ const r = Math.max(30, F + (o.clientY - u));
511
+ w && t(r, w);
512
+ }, z = () => {
513
+ c(!1), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", z);
514
+ };
515
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", z);
516
+ };
517
+ return {
518
+ rowHeight: e,
519
+ colWidths: a,
520
+ isEditing: f,
521
+ updateRowHeight: t,
522
+ updateColWidth: T,
523
+ setRowHeights: x,
524
+ setColWidths: b,
525
+ enableEditMode: _,
526
+ disableEditMode: g,
527
+ resetStore: k,
528
+ highlightCol: L,
529
+ highlightRows: h,
530
+ removeRowHighlight: c,
531
+ removeColHighlight: i,
532
+ resizeCol: S,
533
+ resizeRow: R,
534
+ enableCellResizing: () => {
535
+ const m = document.querySelector("thead"), u = document.querySelectorAll("thead tr"), w = document.querySelectorAll("tbody tr"), F = [...u, ...w];
536
+ m && m.classList.remove("sticky");
537
+ const p = (z, o) => {
538
+ const r = document.createElement("div");
539
+ return r.className = `${z}-resize-handle`, z === "col" ? (r.addEventListener("mouseenter", () => L(o, !0)), r.addEventListener("mouseleave", () => i(!0)), r.addEventListener("mousedown", (v) => {
540
+ v.stopPropagation(), S(v, o);
541
+ })) : (r.addEventListener("mouseenter", () => h(!0)), r.addEventListener("mouseleave", () => c(!0)), r.addEventListener("mousedown", (v) => {
542
+ v.stopPropagation(), R(v);
543
+ })), r;
544
+ };
545
+ F.forEach((z) => {
546
+ const o = z.closest("thead") !== null;
547
+ z.querySelectorAll(o ? "th" : "td").forEach((v, C) => {
548
+ const D = p("col", C), V = p("row", C);
549
+ v.appendChild(D), v.appendChild(V);
550
+ });
551
+ }), _();
552
+ },
553
+ cancelResizingChanges: () => {
554
+ g();
555
+ }
556
+ };
557
+ }), wa = { class: "my-4" }, ba = {
558
+ class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
559
+ style: { backgroundColor: "#f9f9f9" }
560
+ }, Ca = { class: "font-bold" }, Sa = { class: "text-fm-color-neutral-gray-300" }, xa = /* @__PURE__ */ K({
561
+ __name: "WidgetTable",
562
+ props: {
563
+ modelValue: { required: !0 },
564
+ modelModifiers: {}
565
+ },
566
+ emits: ["update:modelValue"],
567
+ setup(e) {
568
+ const { t: a, te: f } = $e(), t = Z(e, "modelValue"), { country: T } = Ze(), { isEditing: x, colWidths: b, rowHeight: _ } = ke(gt()), { setColWidths: g, setRowHeights: k, enableCellResizing: L } = gt(), h = s(null), c = d(() => {
569
+ var o;
570
+ return ((o = t.value.data) == null ? void 0 : o.columns) || [{ label: "", key: "" }];
571
+ }), i = d(() => {
572
+ var o;
573
+ return ((o = t.value.data) == null ? void 0 : o.rows) || [];
574
+ }), S = d(() => t.value.filterText), R = d(() => {
575
+ var o, r;
576
+ if (!(S.value && S.value.trim().length > 0 || !((o = i.value[0]) != null && o.isRollup) && !((r = i.value[i.value.length - 1]) != null && r.isRollup))) {
577
+ if (t.value.rollupPosition === J.top || t.value.rollupPosition === void 0)
578
+ return J.top;
579
+ if (t.value.rollupPosition === J.bottom)
580
+ return J.bottom;
581
+ }
582
+ }), M = d(() => {
583
+ const C = R.value !== void 0 ? 1 : 0, D = (h.value ? h.value.$el.offsetHeight : 0) - 48;
584
+ return Math.floor((D - 34.5 - 32) / 48) - C;
585
+ }), X = d(() => {
586
+ var r, v;
587
+ let o = [];
588
+ switch (R.value) {
589
+ case J.top:
590
+ o = [...((r = i.value[0]) == null ? void 0 : r.cells) || []].map((C, D) => {
591
+ var V;
592
+ return {
593
+ main: C,
594
+ comparison: (V = i.value[0]) == null ? void 0 : V.comparisonCells[D],
595
+ rowType: c.value[D].type
596
+ };
597
+ });
598
+ break;
599
+ case J.bottom:
600
+ o = [...((v = i.value[i.value.length - 1]) == null ? void 0 : v.cells) || []].map((C, D) => {
601
+ var V;
602
+ return {
603
+ main: C,
604
+ comparison: (V = i.value[0]) == null ? void 0 : V.comparisonCells[D],
605
+ rowType: c.value[D].type
606
+ };
607
+ });
608
+ break;
609
+ }
610
+ return o.length > 0 && o[0].main === "" && (o[0].main = "Grand total"), o;
611
+ });
612
+ function m(o) {
613
+ const r = {};
614
+ for (let v = 0; v < c.value.length; v++)
615
+ if (c.value[v].key !== "") {
616
+ const C = o.comparisonCells[v];
617
+ r[c.value[v].key] = {
618
+ main: o.cells[v],
619
+ comparison: C
620
+ }, r.isRollup = o.isRollup;
621
+ }
622
+ return r;
623
+ }
624
+ function u(o) {
625
+ return [...new Array(o < 0 ? 0 : o)].map(() => {
626
+ var v;
627
+ const r = {};
628
+ if ((v = t.value.data) != null && v.columns)
629
+ for (let C = 0; C < t.value.data.columns.length; C++)
630
+ r[t.value.data.columns[C].key] = void 0;
631
+ return r;
632
+ });
633
+ }
634
+ function w(o) {
635
+ let r = (o == null ? void 0 : o.main) || "";
636
+ return r.includes("#") && !r.startsWith("#") && (r = r.split("#")[0]), !o || o.main === "" || o.comparison === "" ? {
637
+ main: r
638
+ } : {
639
+ main: r,
640
+ comparison: o == null ? void 0 : o.comparison,
641
+ difference: St(o.main, o.comparison, T)
642
+ };
643
+ }
644
+ const F = d(() => {
645
+ var D, V, G;
646
+ let o = ((D = t.value.data) == null ? void 0 : D.rows) || [];
647
+ switch (R.value) {
648
+ case J.bottom:
649
+ o = (V = o[o.length - 1]) != null && V.isRollup ? o.slice(0, -1) : o;
650
+ break;
651
+ case J.top:
652
+ o = (G = o[0]) != null && G.isRollup ? o.slice(1, o.length) : o;
653
+ break;
654
+ }
655
+ const r = o.filter((I) => !(S.value !== "" && (I.isRollup === !0 || !I.cells.some(
656
+ (Y) => {
657
+ var U;
658
+ return ((Y == null ? void 0 : Y.toLowerCase()) || "").includes((U = S.value) == null ? void 0 : U.toLowerCase());
659
+ }
660
+ )))).map((I) => m(I)), v = r.length % M.value;
661
+ let C = 0;
662
+ return v > 0 ? C = Math.abs(v - M.value) : r.length === 0 && (C = M.value), r.push(...u(C)), r;
663
+ }), p = d(
664
+ () => {
665
+ var o;
666
+ return (((o = t.value.colWidths) == null ? void 0 : o.length) ?? 0) > 0 || b.value.length > 0;
667
+ }
668
+ ), z = d(() => {
669
+ var r;
670
+ let o = [];
671
+ return (r = t.value.data) != null && r.columns && (o = [...t.value.data.columns.map((C) => {
672
+ const D = ge(a, f, C.label, "other");
673
+ return {
674
+ accessorKey: C.key,
675
+ header: () => ht(
676
+ "p",
677
+ {
678
+ class: `w-full ${C.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap`
679
+ },
680
+ D
681
+ ),
682
+ cell: (V) => {
683
+ var Y, U;
684
+ const G = w(V.getValue()), I = (U = (Y = V == null ? void 0 : V.row) == null ? void 0 : Y.original) == null ? void 0 : U.isRollup;
685
+ return ht(
686
+ "div",
687
+ {
688
+ class: [
689
+ I ? "fm-typo-en-body-md-600 text-fm-color-typo-secondary" : "fm-typo-en-body-md-400",
690
+ C.type === "NUMERIC" ? "text-right" : "",
691
+ p.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
692
+ ].join(" ")
693
+ },
694
+ [G.main]
695
+ );
696
+ },
697
+ enableSorting: !1
698
+ };
699
+ })]), o;
700
+ });
701
+ return ye(
702
+ () => b.value.length > 0,
703
+ async (o) => {
704
+ o && x.value && (await mt(), L());
705
+ }
706
+ ), ye(
707
+ [() => z.value],
708
+ async () => {
709
+ var D;
710
+ await mt();
711
+ const o = (D = h.value) == null ? void 0 : D.$el;
712
+ if (!o) return;
713
+ const r = o.querySelector("table");
714
+ if (!r) return;
715
+ r.classList.add(p.value ? "table-fixed" : "table-auto");
716
+ let v, C;
717
+ x.value ? (L(), v = b.value, C = _.value) : (C = t.value.rowHeight, v = t.value.colWidths), typeof C == "number" && k(C, o), v == null || v.forEach((V, G) => {
718
+ g(G, V, o);
719
+ });
720
+ },
721
+ { immediate: !0 }
722
+ ), (o, r) => {
723
+ const v = A("FmTable");
724
+ return E(), H(te, null, [
725
+ B("div", wa, [
726
+ ue(o.$slots, "menu")
727
+ ]),
728
+ P(v, {
729
+ ref_key: "table",
730
+ ref: h,
731
+ "column-defs": z.value,
732
+ "row-data": F.value,
733
+ "search-value": S.value,
734
+ "page-size": M.value,
735
+ "shrink-at": !1,
736
+ "force-mobile-footer": !0,
737
+ class: "scrollbar-hide-table"
738
+ }, {
739
+ "pin-top": N(() => [
740
+ B("tbody", null, [
741
+ B("tr", ba, [
742
+ (E(!0), H(te, null, yt(X.value, (C, D) => (E(), H("td", {
743
+ key: `${n(Ve)()}_${D}`,
744
+ class: "h-[48px] text-fm-color-typo-primary px-16"
745
+ }, [
746
+ B("span", {
747
+ class: Pe([
748
+ "items-center text-fm-color-typo-secondary gap-2",
749
+ C.rowType === "NUMERIC" ? "text-right" : "",
750
+ p.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
751
+ ])
752
+ }, [
753
+ B("p", Ca, Te(C.main), 1),
754
+ B("p", Sa, Te(C.comparison ? `(${C.comparison})` : ""), 1)
755
+ ], 2)
756
+ ]))), 128))
757
+ ])
758
+ ])
759
+ ]),
760
+ _: 1
761
+ }, 8, ["column-defs", "row-data", "search-value", "page-size"])
762
+ ], 64);
763
+ };
764
+ }
765
+ }), _a = /* @__PURE__ */ K({
766
+ __name: "WidgetStackBarChart",
767
+ props: {
768
+ modelValue: { required: !0 },
769
+ modelModifiers: {}
770
+ },
771
+ emits: ["update:modelValue"],
772
+ setup(e) {
773
+ const a = Z(e, "modelValue"), f = d(() => {
774
+ var S;
775
+ return ((S = a.value.data) == null ? void 0 : S.xAxis) || [];
776
+ }), t = d(() => {
777
+ var i;
778
+ return ((i = a.value.data) == null ? void 0 : i.datasets) ?? [];
779
+ }), T = s(null), { datalabels: x, xCfg: b, yCfg: _, isTransposed: g, legend: k, chartWidth: L, chartHeight: h } = Re(
780
+ a.value
781
+ ), c = d(() => t.value.length > 0 ? [
782
+ ...t.value.map((i, S) => {
783
+ let R = i.values;
784
+ return {
785
+ label: i.name,
786
+ data: R,
787
+ dash: !!i.isCompare,
788
+ backgroundColor: Fe({ index: S, isCompare: i.isCompare })
789
+ };
790
+ })
791
+ ] : []);
792
+ return (i, S) => {
793
+ const R = A("FmBarChart");
794
+ return E(), H(te, null, [
795
+ ue(i.$slots, "menu"),
796
+ P(R, {
797
+ ref_key: "chartRef",
798
+ ref: T,
799
+ class: "bar-chart",
800
+ datasets: c.value,
801
+ "x-axis": { categories: f.value },
802
+ "x-cfg": n(b),
803
+ "y-cfg": n(_),
804
+ transpose: n(g),
805
+ stacked: !0,
806
+ legend: {
807
+ display: n(k).display ?? !1,
808
+ position: n(k).position,
809
+ maxHeight: 54,
810
+ labels: {
811
+ usePointStyle: n(k).usePointStyle ?? !0
812
+ }
813
+ },
814
+ datalabels: n(x),
815
+ "maintain-aspect-ratio": !1,
816
+ style: ae({
817
+ "--chart-width": n(L) !== void 0 ? n(L) + "px" : "100%",
818
+ "--chart-height": n(h) !== void 0 ? n(h) + "px" : "calc(100% - 36px)"
819
+ })
820
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
821
+ ], 64);
822
+ };
823
+ }
824
+ }), Ta = /* @__PURE__ */ K({
825
+ __name: "WidgetStackLineChart",
826
+ props: {
827
+ modelValue: { required: !0 },
828
+ modelModifiers: {}
829
+ },
830
+ emits: ["update:modelValue"],
831
+ setup(e) {
832
+ const a = Z(e, "modelValue"), f = d(() => {
833
+ var c;
834
+ return ((c = a.value.data) == null ? void 0 : c.xAxis) ?? [];
835
+ }), t = d(() => {
836
+ var c;
837
+ return ((c = a.value.data) == null ? void 0 : c.datasets) ?? [];
838
+ }), { datalabels: T, xCfg: x, yCfg: b, isTransposed: _, legend: g, chartWidth: k, chartHeight: L } = Re(
839
+ a.value
840
+ ), h = d(() => t.value.length > 0 ? [
841
+ ...t.value.map((c, i) => {
842
+ let S = c.values;
843
+ return {
844
+ label: c.name,
845
+ data: S,
846
+ dash: c.isCompare,
847
+ fill: !1,
848
+ color: Fe({ index: i, isCompare: c.isCompare })
849
+ };
850
+ })
851
+ ] : []);
852
+ return (c, i) => {
853
+ const S = A("FmLineChart");
854
+ return E(), H(te, null, [
855
+ ue(c.$slots, "menu"),
856
+ P(S, {
857
+ class: "line-chart",
858
+ datasets: h.value,
859
+ "x-axis": { categories: f.value },
860
+ "x-cfg": n(x),
861
+ "y-cfg": n(b),
862
+ transpose: n(_),
863
+ legend: {
864
+ display: n(g).display ?? !1,
865
+ position: n(g).position,
866
+ maxHeight: 54,
867
+ labels: {
868
+ usePointStyle: n(g).usePointStyle ?? !0
869
+ }
870
+ },
871
+ stacked: !0,
872
+ datalabels: n(T),
873
+ "maintain-aspect-ratio": !1,
874
+ style: ae({
875
+ "--chart-width": n(k) !== void 0 ? n(k) + "px" : "97%",
876
+ "--chart-height": n(L) !== void 0 ? n(L) + "px" : "calc(100% - 36px)"
877
+ })
878
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
879
+ ], 64);
880
+ };
881
+ }
882
+ }), we = [
883
+ "col-span-1",
884
+ "col-span-2",
885
+ "col-span-3",
886
+ "col-span-4",
887
+ "col-span-5",
888
+ "col-span-6",
889
+ "col-span-7",
890
+ "col-span-8",
891
+ "col-span-9",
892
+ "col-span-10",
893
+ "col-span-11",
894
+ "col-span-12"
895
+ ];
896
+ function ka(e) {
897
+ return e < 12 ? we[e - 1] : we[11];
898
+ }
899
+ function Fa(e) {
900
+ return e < 12 ? we[Math.min(11, e * 2 - 1)] : we[11];
901
+ }
902
+ function Ra(e) {
903
+ return e < 12 ? we[Math.min(11, e * 3 - 1)] : we[11];
904
+ }
905
+ const La = /* @__PURE__ */ K({
906
+ __name: "WidgetLinechart",
907
+ props: {
908
+ modelValue: { required: !0 },
909
+ modelModifiers: {}
910
+ },
911
+ emits: ["update:modelValue"],
912
+ setup(e) {
913
+ const a = Z(e, "modelValue"), f = d(() => {
914
+ var c;
915
+ return ((c = a.value.data) == null ? void 0 : c.xAxis) ?? [];
916
+ }), t = d(() => {
917
+ var c;
918
+ return ((c = a.value.data) == null ? void 0 : c.datasets) ?? [];
919
+ }), { datalabels: T, xCfg: x, yCfg: b, isTransposed: _, legend: g, chartWidth: k, chartHeight: L } = Re(
920
+ a.value
921
+ ), h = d(() => t.value.length > 0 ? [
922
+ ...t.value.map((c, i) => ({
923
+ label: c.name,
924
+ data: c.values,
925
+ dash: !!c.isCompare,
926
+ fill: !1,
927
+ color: Fe({ index: i, isCompare: c.isCompare })
928
+ }))
929
+ ] : []);
930
+ return (c, i) => {
931
+ const S = A("FmLineChart");
932
+ return E(), H(te, null, [
933
+ ue(c.$slots, "menu"),
934
+ P(S, {
935
+ class: "line-chart",
936
+ datasets: h.value,
937
+ "x-axis": { categories: f.value },
938
+ "x-cfg": n(x),
939
+ "y-cfg": n(b),
940
+ transpose: n(_),
941
+ legend: {
942
+ display: n(g).display ?? !1,
943
+ position: n(g).position,
944
+ position: "bottom",
945
+ maxHeight: 54,
946
+ labels: {
947
+ usePointStyle: n(g).usePointStyle ?? !0
948
+ }
949
+ },
950
+ datalabels: n(T),
951
+ "maintain-aspect-ratio": !1,
952
+ style: ae({
953
+ "--chart-width": n(k) !== void 0 ? n(k) + "px" : "97%",
954
+ "--chart-height": n(L) !== void 0 ? n(L) + "px" : "calc(100% - 36px)"
955
+ })
956
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
957
+ ], 64);
958
+ };
959
+ }
960
+ }), Ea = { class: "flex flex-col gap-16" }, za = { class: "flex flex-row" }, Da = /* @__PURE__ */ K({
961
+ __name: "PdfOrientationDialog",
962
+ props: /* @__PURE__ */ wt({
963
+ reportType: {},
964
+ index: {}
965
+ }, {
966
+ modelValue: { type: Boolean, required: !0 },
967
+ modelModifiers: {}
968
+ }),
969
+ emits: ["update:modelValue"],
970
+ setup(e) {
971
+ const { t: a } = $e(), { FmForm: f } = aa, t = e, T = s(), x = Z(e, "modelValue"), b = s(!1), _ = Ct(), { selectedLocationIds: g, dateRange: k, timeRange: L } = ke(Ke()), h = s(Ie.PORTRAIT);
972
+ function c() {
973
+ var S;
974
+ (S = T.value) == null || S.validateInputs();
975
+ }
976
+ async function i() {
977
+ b.value = !0;
978
+ try {
979
+ t.index != null && await bt({
980
+ reportType: t.reportType,
981
+ index: t.index,
982
+ orientationTypes: [h.value],
983
+ timeRange: L.value,
984
+ dateRange: k.value,
985
+ locationIds: g.value
986
+ });
987
+ } catch (S) {
988
+ _.open({ message: S.message, type: "error" });
989
+ } finally {
990
+ b.value = !1;
991
+ }
992
+ }
993
+ return (S, R) => {
994
+ const M = A("FmRadio"), X = A("FmRadioGroup"), m = A("FmButton"), u = A("FmDialog");
995
+ return E(), O(u, {
996
+ modelValue: x.value,
997
+ "onUpdate:modelValue": R[2] || (R[2] = (w) => x.value = w),
998
+ overlay: !0,
999
+ "z-index": 10
1000
+ }, {
1001
+ "dialog-header": N(() => R[3] || (R[3] = [
1002
+ Yt("Select Orientation")
1003
+ ])),
1004
+ default: N(() => [
1005
+ P(n(f), {
1006
+ ref_key: "form",
1007
+ ref: T,
1008
+ onValidationSuccess: i
1009
+ }, {
1010
+ default: N(() => [
1011
+ B("div", Ea, [
1012
+ P(X, {
1013
+ modelValue: h.value,
1014
+ "onUpdate:modelValue": R[0] || (R[0] = (w) => h.value = w)
1015
+ }, {
1016
+ default: N(() => [
1017
+ P(M, {
1018
+ value: n(Ie).PORTRAIT,
1019
+ label: n(a)("report.common.portrait")
1020
+ }, null, 8, ["value", "label"]),
1021
+ P(M, {
1022
+ value: n(Ie).LANDSCAPE,
1023
+ label: n(a)("report.common.landscape")
1024
+ }, null, 8, ["value", "label"])
1025
+ ]),
1026
+ _: 1
1027
+ }, 8, ["modelValue"])
1028
+ ]),
1029
+ B("div", za, [
1030
+ R[4] || (R[4] = B("div", { class: "grow" }, null, -1)),
1031
+ P(m, {
1032
+ label: n(a)("report.common.cancel"),
1033
+ variant: "tertiary",
1034
+ onClick: R[1] || (R[1] = (w) => x.value = !1)
1035
+ }, null, 8, ["label"]),
1036
+ B("div", null, [
1037
+ P(m, {
1038
+ label: n(a)("report.common.download"),
1039
+ loading: b.value,
1040
+ onClick: c
1041
+ }, null, 8, ["label", "loading"])
1042
+ ])
1043
+ ])
1044
+ ]),
1045
+ _: 1
1046
+ }, 512)
1047
+ ]),
1048
+ _: 1
1049
+ }, 8, ["modelValue"]);
1050
+ };
1051
+ }
1052
+ }), Aa = {
1053
+ key: 1,
1054
+ class: "grow"
1055
+ }, Va = {
1056
+ key: 2,
1057
+ class: "flex"
1058
+ }, Oa = /* @__PURE__ */ K({
1059
+ __name: "DynamicWidget",
1060
+ props: /* @__PURE__ */ wt({
1061
+ index: {
1062
+ type: Number,
1063
+ default: 0
1064
+ },
1065
+ hideExport: {
1066
+ type: Boolean,
1067
+ default: !1
1068
+ },
1069
+ customScreenWidth: {
1070
+ type: Number,
1071
+ required: !1,
1072
+ default: void 0
1073
+ }
1074
+ }, {
1075
+ modelValue: { required: !0, default: () => {
1076
+ } },
1077
+ modelModifiers: {}
1078
+ }),
1079
+ emits: ["update:modelValue"],
1080
+ setup(e) {
1081
+ const a = s(!0), f = Z(e, "modelValue"), t = f.value.widget.config, { t: T, te: x } = $e(), b = e, _ = s(null), g = s(t.rollup), k = s(Ve()), L = s(t.drillDimension), h = d(() => {
1082
+ if (re.value.length > 0) {
1083
+ const l = re.value.findIndex(
1084
+ ($) => $.value === L.value
1085
+ );
1086
+ return l >= 0 ? l : 0;
1087
+ } else
1088
+ return -1;
1089
+ }), c = d(() => h.value !== 0), i = d(
1090
+ () => h.value != re.value.length - 1
1091
+ ), S = s(t.showTitle ?? !0), R = s(t.titleFontSize ?? 14), M = s(t.titleBold ?? !1), X = s(t.titleItalic ?? !1), m = s(t.titleUnderline ?? !1), u = s(t.chartWidth ?? void 0), w = s(t.chartHeight ?? void 0), F = s(t.showLabel ?? !1), p = s(t.labelAlign ?? Ue.center), z = s(t.labelAnchor ?? Ye.center), o = s(t.labelRotation ?? 0), r = s(t.labelOffset ?? 0), v = s(t.labelFontSize ?? 12), C = d(() => t.showSearchBar), D = s(t.showX ?? !0), V = s(t.xPosition ?? Ge.bottom), G = s(t.showXGrid ?? !1), I = s(t.showXTick ?? !0), Y = s(t.xTickFontSize ?? 12), U = s(t.showXTitle ?? !1), Le = s(t.xTitle ?? ""), Ee = s(t.xTitleFontSize ?? 12), ze = s(t.showY ?? !0), be = s(t.yPosition ?? je.left), Ce = s(t.showYGrid ?? !1), de = s(t.showYTick ?? !0), le = s(t.yTickFontSize ?? 12), oe = s(t.showYTitle ?? !1), Q = s(t.yTitle ?? ""), he = s(t.yTitleFontSize ?? 12), ee = s(t.showLegend ?? void 0), ne = s(t.legendPosition ?? Je.top), se = s(t.usePointStyle ?? !0), Be = s(t.rowHeight ?? 0), Qe = s(t.colWidths ?? []), We = s(!1), He = s(""), { breakpoints: me, getBreakpointsBoundary: Se } = la(), et = s(), q = d(
1092
+ () => b.customScreenWidth === void 0 ? window.innerWidth : b.customScreenWidth
1093
+ ), xt = d(
1094
+ () => (q == null ? void 0 : q.value) > Se("xs")[1] && (q == null ? void 0 : q.value) <= Se("sm")[1]
1095
+ ), _t = d(
1096
+ () => (q == null ? void 0 : q.value) > Se("sm")[1] && (q == null ? void 0 : q.value) <= Se("md")[1]
1097
+ ), Tt = d(() => (q == null ? void 0 : q.value) > Se("md")[1]), kt = d(() => {
1098
+ const l = f.value.size.width;
1099
+ return Tt.value || _t.value ? ka(l) : xt.value ? Fa(l) : Ra(l);
1100
+ }), De = d(
1101
+ () => oa.find((l) => l.type === f.value.widget.type)
1102
+ ), pe = pt(() => {
1103
+ var l;
1104
+ et.value = At((l = _.value) == null ? void 0 : l.$el.offsetWidth), k.value = Ve();
1105
+ }), Ft = d(() => {
1106
+ if (na(W.value.type, fe.value))
1107
+ switch (f.value.widget.type) {
1108
+ case y.BarChart:
1109
+ return ra;
1110
+ case y.StackBarChart:
1111
+ return _a;
1112
+ case y.LineChart:
1113
+ return La;
1114
+ case y.StackLineChart:
1115
+ return Ta;
1116
+ case y.Circular:
1117
+ return ia;
1118
+ case y.Scorecard:
1119
+ return pa;
1120
+ case y.Spacer:
1121
+ return ga;
1122
+ case y.Table:
1123
+ return xa;
1124
+ default:
1125
+ return ft;
1126
+ }
1127
+ else
1128
+ return ft;
1129
+ }), fe = s(null), {
1130
+ selectedLocationIds: qe,
1131
+ dateRange: tt,
1132
+ compareDateRange: Rt,
1133
+ timeRange: at,
1134
+ globalFilters: Lt,
1135
+ isGlobalFiltersLoading: Me
1136
+ } = ke(Ke()), { businessId: Et } = ke(Ze()), W = d(() => {
1137
+ const l = JSON.parse(JSON.stringify(f.value.widget));
1138
+ return {
1139
+ ...l,
1140
+ config: {
1141
+ ...l.config,
1142
+ rollup: g.value,
1143
+ drillDimension: L.value,
1144
+ showGrandTotal: !1
1145
+ }
1146
+ };
1147
+ });
1148
+ function zt() {
1149
+ return {
1150
+ data: fe.value,
1151
+ showTitle: S.value,
1152
+ titleFontSize: R.value,
1153
+ titleBold: M.value,
1154
+ titleItalic: X.value,
1155
+ titleUnderline: m.value,
1156
+ chartHeight: w.value,
1157
+ chartWidth: u.value,
1158
+ showLabel: F.value,
1159
+ labelAnchor: z.value,
1160
+ labelAlign: p.value,
1161
+ labelRotation: o.value,
1162
+ labelOffset: r.value,
1163
+ labelFontSize: v.value,
1164
+ showX: D.value,
1165
+ xPosition: V.value,
1166
+ showXGrid: G.value,
1167
+ showXTick: I.value,
1168
+ xTickFontSize: Y.value,
1169
+ showXTitle: U.value,
1170
+ xTitle: Le.value,
1171
+ xTitleFontSize: Ee.value,
1172
+ showY: ze.value,
1173
+ yPosition: be.value,
1174
+ showYGrid: Ce.value,
1175
+ showYTick: de.value,
1176
+ yTitle: Q.value,
1177
+ showYTitle: oe.value,
1178
+ yTitleFontSize: he.value,
1179
+ yTickFontSize: le.value,
1180
+ isTransposed: W.value.config.isTransposed,
1181
+ showLegend: ee.value,
1182
+ legendPosition: ne.value,
1183
+ usePointStyle: se.value
1184
+ };
1185
+ }
1186
+ function Dt() {
1187
+ return {
1188
+ data: fe.value,
1189
+ filterText: He.value,
1190
+ rollupPosition: W.value.config.rollupPosition,
1191
+ rowHeight: Be.value,
1192
+ colWidths: Qe.value
1193
+ };
1194
+ }
1195
+ const lt = d(() => {
1196
+ switch (W.value.type) {
1197
+ case y.Table:
1198
+ return Dt();
1199
+ case y.BarChart:
1200
+ case y.LineChart:
1201
+ case y.StackBarChart:
1202
+ case y.StackLineChart:
1203
+ case y.Circular:
1204
+ return zt();
1205
+ default:
1206
+ return { data: fe.value };
1207
+ }
1208
+ }), ot = d(() => {
1209
+ const { config: l } = f.value.widget;
1210
+ if (l.rollup != null) {
1211
+ const $ = [...l.dimensions].filter((ie) => !ie.hide);
1212
+ return $.sort(
1213
+ (ie, xe) => (l.rowIds || []).indexOf(Oe(ie)) - (l.rowIds || []).indexOf(Oe(xe))
1214
+ ), [
1215
+ { label: ge(T, x, "None", "other"), value: null },
1216
+ { label: ge(T, x, "Grand Total", "other"), value: 0 },
1217
+ ...[...$].slice(0, $.length - 1).map((ie, xe) => ({
1218
+ label: ge(T, x, ie.label, "other"),
1219
+ value: xe + 1
1220
+ }))
1221
+ ];
1222
+ }
1223
+ return [];
1224
+ }), re = d(() => {
1225
+ const { config: l } = W.value;
1226
+ return l.isDrillable ? l.dimensions.map(($) => ({
1227
+ label: ge(T, x, $.label, "other"),
1228
+ value: Oe($)
1229
+ })) : [];
1230
+ });
1231
+ ye(
1232
+ () => f.value.widget.config,
1233
+ (l) => {
1234
+ g.value = l.rollup, S.value = l.showTitle ?? !0, R.value = l.titleFontSize ?? 14, M.value = l.titleBold ?? !1, X.value = l.titleItalic ?? !1, m.value = l.titleUnderline ?? !1, w.value = l.chartHeight ?? void 0, u.value = l.chartWidth ?? void 0, F.value = l.showLabel ?? !1, p.value = l.labelAlign ?? Ue.center, z.value = l.labelAnchor ?? Ye.center, o.value = l.labelRotation ?? 0, r.value = l.labelOffset ?? 0, v.value = l.labelFontSize ?? 12, D.value = l.showX ?? !0, V.value = l.xPosition ?? Ge.bottom, G.value = l.showXGrid ?? !1, I.value = l.showXTick ?? !0, Y.value = l.xTickFontSize ?? 12, U.value = l.showXTitle ?? !1, Le.value = l.xTitle ?? "", Ee.value = l.xTitleFontSize ?? 12, ze.value = l.showY ?? !0, be.value = l.yPosition ?? je.left, Ce.value = l.showYGrid ?? !1, de.value = l.showYTick ?? !0, le.value = l.yTickFontSize ?? 12, oe.value = l.showYTitle ?? !1, Q.value = l.yTitle ?? "", he.value = l.yTitleFontSize ?? 12, ee.value = l.showLegend ?? void 0, ne.value = l.legendPosition ?? Je.top, se.value = l.usePointStyle ?? !0, Be.value = l.rowHeight ?? 0, Qe.value = l.colWidths ?? [];
1235
+ },
1236
+ { deep: !0 }
1237
+ ), ye([() => g.value], () => {
1238
+ g.value !== null && (f.value.widget.config.rollup = g.value);
1239
+ }), ye(
1240
+ [
1241
+ () => W.value,
1242
+ () => tt.value,
1243
+ () => at.value,
1244
+ () => Rt.value,
1245
+ () => qe.value,
1246
+ () => Et.value,
1247
+ () => Lt.value,
1248
+ () => Me.value
1249
+ ],
1250
+ () => {
1251
+ st();
1252
+ },
1253
+ {
1254
+ deep: !0
1255
+ }
1256
+ ), ye(
1257
+ [() => f.value.size],
1258
+ () => {
1259
+ pe();
1260
+ },
1261
+ { deep: !0 }
1262
+ ), Ut(() => {
1263
+ pe(), me.value.sm || me.value.md || me.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", pe)) : addEventListener("resize", pe), st();
1264
+ }), Gt(() => {
1265
+ me.value.sm || me.value.md || me.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", pe)) : removeEventListener("resize", pe);
1266
+ });
1267
+ const nt = Ct();
1268
+ let Ae;
1269
+ async function st() {
1270
+ if (!(qe.value.length === 0 || Me.value)) {
1271
+ if (W.value.config.schemaNames.length <= 0 && !(W.value.config.dimensions.length <= 0 || W.value.config.metrics.length <= 0)) {
1272
+ nt.open({
1273
+ message: "schema must not be empty and dimension or metrics must have at least 1 column",
1274
+ type: "info"
1275
+ }), a.value = !1;
1276
+ return;
1277
+ }
1278
+ try {
1279
+ a.value = !0, Ae && Ae.abort(), Ae = new AbortController();
1280
+ const l = Ae.signal;
1281
+ fe.value = await pt(Zt, 500)(W.value, l, f.value.id), k.value = Ve(), a.value = !1;
1282
+ } catch (l) {
1283
+ l.code !== "ERR_CANCELED" && (fe.value = null, nt.open({ message: `Invalid chart ${W.value.type}`, type: "error" }), console.log(l), a.value = !1);
1284
+ }
1285
+ }
1286
+ }
1287
+ function At(l) {
1288
+ switch (f.value.widget.type) {
1289
+ case "SPACER":
1290
+ return;
1291
+ case "SCORECARD":
1292
+ return;
1293
+ case "TABLE":
1294
+ return `${f.value.size.height * 100 + (C.value ? 72 : 0) + 96.5}px`;
1295
+ }
1296
+ return `${Math.max(l / f.value.size.width, 90) * f.value.size.height}px`;
1297
+ }
1298
+ function Vt() {
1299
+ const l = h.value - 1;
1300
+ l >= 0 && (L.value = re.value[l].value);
1301
+ }
1302
+ function Pt() {
1303
+ const l = h.value + 1;
1304
+ l >= 0 && l < re.value.length && (L.value = re.value[l].value);
1305
+ }
1306
+ const rt = s(_e.EXCEL), it = s(), $t = Object.values(_e).map((l) => ({
1307
+ label: Qt(l),
1308
+ value: l,
1309
+ onClick: async () => {
1310
+ l === _e.EXCEL || l === _e.PDFFULLSIZE ? await bt({
1311
+ reportType: l,
1312
+ index: b.index,
1313
+ timeRange: at.value,
1314
+ dateRange: tt.value,
1315
+ locationIds: qe.value
1316
+ }) : l === _e.PDF && (rt.value = l, it.value = b.index, We.value = !0);
1317
+ }
1318
+ })), Bt = W.value.type === y.Spacer ? "flat" : "outlined", Wt = W.value.type === y.Spacer ? "p-0" : "p-16";
1319
+ return (l, $) => {
1320
+ const ie = A("FmTooltip"), xe = A("FmSearch"), Ht = A("FmCheckbox"), Ne = A("FmButton"), qt = A("FmSelect"), Mt = A("FmMenuItem"), Nt = A("FmMenu"), It = A("FmForm"), Ot = A("FmCircularProgress"), Xt = A("FmCard");
1321
+ return E(), O(Xt, {
1322
+ ref_key: "tileCard",
1323
+ ref: _,
1324
+ class: Pe(`${kt.value} ${n(Wt)}`),
1325
+ variant: n(Bt)
1326
+ }, {
1327
+ default: N(() => [
1328
+ P(Da, {
1329
+ modelValue: We.value,
1330
+ "onUpdate:modelValue": $[0] || ($[0] = (ve) => We.value = ve),
1331
+ "report-type": rt.value,
1332
+ index: it.value
1333
+ }, null, 8, ["modelValue", "report-type", "index"]),
1334
+ !a.value && !n(Me) ? (E(), H("div", {
1335
+ key: 0,
1336
+ style: ae({ height: et.value })
1337
+ }, [
1338
+ (E(), O(jt(Ft.value), {
1339
+ key: k.value,
1340
+ modelValue: lt.value,
1341
+ "onUpdate:modelValue": $[4] || ($[4] = (ve) => lt.value = ve)
1342
+ }, {
1343
+ menu: N(() => [
1344
+ P(It, { class: "flex items-center gap-2" }, {
1345
+ default: N(() => {
1346
+ var ve, ct, ut, dt;
1347
+ return [
1348
+ P(ie, {
1349
+ variant: "plain",
1350
+ placement: "right",
1351
+ content: W.value.description,
1352
+ "hide-arrow": !0,
1353
+ disabled: !W.value.description
1354
+ }, {
1355
+ default: N(() => [
1356
+ S.value !== !1 ? (E(), H("p", {
1357
+ key: 0,
1358
+ style: ae({
1359
+ fontSize: R.value + "px",
1360
+ fontWeight: M.value ? "bold" : "normal",
1361
+ fontStyle: X.value ? "italic" : "normal",
1362
+ textDecoration: m.value ? "underline" : "none"
1363
+ }),
1364
+ class: Pe(["text-fm-color-typo-secondary line-clamp-1", [
1365
+ R.value <= 18 ? "fm-typo-en-body-md-400" : "",
1366
+ W.value.description ? "border-b-2 border-dashed border-gray-300" : ""
1367
+ ]])
1368
+ }, Te(n(ge)(n(T), n(x), W.value.title, "other")), 7)) : ce("", !0)
1369
+ ]),
1370
+ _: 1
1371
+ }, 8, ["content", "disabled"]),
1372
+ (ve = De.value) != null && ve.showSearchBar ? (E(), O(xe, {
1373
+ key: 0,
1374
+ modelValue: He.value,
1375
+ "onUpdate:modelValue": $[1] || ($[1] = (j) => He.value = j),
1376
+ class: "grow"
1377
+ }, null, 8, ["modelValue"])) : (E(), H("div", Aa)),
1378
+ Jt(P(Ht, {
1379
+ modelValue: F.value,
1380
+ "onUpdate:modelValue": $[2] || ($[2] = (j) => F.value = j),
1381
+ label: "Label",
1382
+ value: !1
1383
+ }, null, 8, ["modelValue"]), [
1384
+ [Kt, (ct = De.value) == null ? void 0 : ct.showLabel]
1385
+ ]),
1386
+ (ut = De.value) != null && ut.showDrillDimension && re.value.length > 0 ? (E(), H("div", Va, [
1387
+ P(Ne, {
1388
+ icon: "arrow_upward",
1389
+ variant: "tertiary",
1390
+ disabled: !c.value,
1391
+ onClick: Vt
1392
+ }, null, 8, ["disabled"]),
1393
+ P(Ne, {
1394
+ icon: "arrow_downward",
1395
+ variant: "tertiary",
1396
+ disabled: !i.value,
1397
+ onClick: Pt
1398
+ }, null, 8, ["disabled"])
1399
+ ])) : ce("", !0),
1400
+ (dt = De.value) != null && dt.showRollup && ot.value.length > 0 ? (E(), O(qt, {
1401
+ key: 3,
1402
+ modelValue: g.value,
1403
+ "onUpdate:modelValue": $[3] || ($[3] = (j) => g.value = j),
1404
+ class: "w-[150px]",
1405
+ items: ot.value
1406
+ }, null, 8, ["modelValue", "items"])) : ce("", !0),
1407
+ b.hideExport ? ce("", !0) : (E(), O(Nt, {
1408
+ key: 4,
1409
+ shift: !0
1410
+ }, {
1411
+ "menu-button": N(() => [
1412
+ P(Ne, {
1413
+ icon: "more_vert",
1414
+ variant: "tertiary"
1415
+ })
1416
+ ]),
1417
+ default: N(() => [
1418
+ (E(!0), H(te, null, yt(n($t), (j) => (E(), O(Mt, {
1419
+ key: j.value,
1420
+ label: j.label,
1421
+ onClick: j.onClick
1422
+ }, null, 8, ["label", "onClick"]))), 128))
1423
+ ]),
1424
+ _: 1
1425
+ }))
1426
+ ];
1427
+ }),
1428
+ _: 1
1429
+ })
1430
+ ]),
1431
+ _: 1
1432
+ }, 8, ["modelValue"]))
1433
+ ], 4)) : (E(), O(Ot, { key: 1 }))
1434
+ ]),
1435
+ _: 1
1436
+ }, 8, ["class", "variant"]);
1437
+ };
1438
+ }
1439
+ });
1440
+ export {
1441
+ Ue as L,
1442
+ J as R,
1443
+ Oa as _,
1444
+ Ye as a,
1445
+ Oe as g,
1446
+ gt as u
1447
+ };