@feedmepos/mf-report 5.7.5 → 5.7.6-beta.100

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