@feedmepos/mf-report 5.7.6 → 5.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/App-D-1FYTfD.js +150 -0
  2. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-Bi_BES93.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-g6ESEkM9.js} +2 -2
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-RIJC16Ui.js → Default.vue_vue_type_script_setup_true_lang-D1H_MdWO.js} +2 -2
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-BVc7b2H4.js +1417 -0
  5. package/dist/{InsightView-DIhPKYKe.js → InsightView-BlFnt7q8.js} +6 -6
  6. package/dist/{Integration-D61lmDoO.js → Integration-7h1cJFLg.js} +3 -3
  7. package/dist/{Integrations-BiJVCGrp.js → Integrations-Dm7n-0iv.js} +3 -3
  8. package/dist/{Layout-DH7q-7AG.js → Layout-CcuoNe0d.js} +1 -1
  9. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-nPHvtT2O.js → MenuTab.vue_vue_type_script_setup_true_lang-Bn3KCbjG.js} +3 -3
  10. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-CPTKq_OA.js → NavigationTab.vue_vue_type_script_setup_true_lang-DuOqx76g.js} +7074 -7041
  11. package/dist/{NoData.vue_vue_type_script_setup_true_lang-CdFXBqlX.js → NoData.vue_vue_type_script_setup_true_lang-CAbykN6l.js} +1 -1
  12. package/dist/{OverviewView-Cp0quKsj.js → OverviewView-Dka3jZx6.js} +5 -5
  13. package/dist/{Report-DSO3L0cw.js → Report-DopMKVRe.js} +4 -4
  14. package/dist/ReportEditor-HDMGjShp.js +621 -0
  15. package/dist/{ReportView-CRKPSw3H.js → ReportView-cqB-ep4p.js} +7 -7
  16. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-N2Lg1Vpt.js → SelectComponent.vue_vue_type_script_setup_true_lang-BEkJzB27.js} +1 -1
  17. package/dist/{Setting-Dd1O-wia.js → Setting-CxBF2fVm.js} +4 -4
  18. package/dist/{TileEditor-BLsGvreq.js → TileEditor-BNx2KgYJ.js} +8 -8
  19. package/dist/{TransitionFade-C7yNEw8X.js → TransitionFade-BR2i09Vy.js} +4 -4
  20. package/dist/app.js +29 -14
  21. package/dist/{global-loader-CbmVhJAK.js → global-loader-DKYDQRZx.js} +1175 -1204
  22. package/dist/{index-BWqDfeY6.js → index--mBthMxH.js} +1 -1
  23. package/dist/{report-schema-BnzKoFjx.js → report-schema-DDo0Dgd1.js} +1 -1
  24. package/dist/{v4-Cbq0RSpY.js → v4-CfR4tJai.js} +287 -281
  25. package/package.json +1 -1
  26. package/dist/App-BrW5SiDe.js +0 -152
  27. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-DokEr03U.js +0 -1390
  28. package/dist/ReportEditor-DPWD6PV0.js +0 -527
@@ -0,0 +1,1417 @@
1
+ import { computed as d, defineComponent as ee, useModel as te, ref as u, resolveComponent as V, createElementBlock as H, openBlock as E, Fragment as le, renderSlot as de, createVNode as $, normalizeStyle as oe, unref as n, createElementVNode as B, toDisplayString as xe, withCtx as N, createBlock as O, createCommentVNode as ue, normalizeClass as Ve, h as nt, watch as ge, nextTick as st, renderList as dt, mergeModels as mt, createTextVNode as Wt, onMounted as Ht, onUnmounted as qt, resolveDynamicComponent as Mt, withDirectives as Nt, vShow as It } from "vue";
2
+ import { W as y, v as ze, P as We, d as ht, R as Se, g as Ot, q as Ut } from "./v4-CfR4tJai.js";
3
+ import { u as Pe, b as Xe, a as Ye } from "./global-loader-DKYDQRZx.js";
4
+ import { d as rt } from "./index--mBthMxH.js";
5
+ import { storeToRefs as _e, defineStore as Xt } from "pinia";
6
+ import { _ as Yt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
+ import { r as ve } from "./i18n-Cif1I9J2.js";
8
+ import { _ as it } from "./NoData.vue_vue_type_script_setup_true_lang-CAbykN6l.js";
9
+ import { components as Gt, useSnackbar as pt, useBreakpoints as jt } from "@feedmepos/ui-library";
10
+ var qe = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(qe || {}), Q = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(Q || {}), Me = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(Me || {}), Ne = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(Ne || {}), Ie = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(Ie || {}), Oe = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(Oe || {}), Ue = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(Ue || {});
11
+ y.Circular, y.Table, y.BarChart, y.LineChart, y.StackBarChart, y.StackLineChart, y.Scorecard, y.Spacer;
12
+ const Jt = [
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 He(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 Kt(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 ct = [
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 ke({
119
+ index: e,
120
+ isCompare: t,
121
+ opacity: f
122
+ }) {
123
+ let a = typeof f == "number" ? f : 1;
124
+ return t && (a = a * 0.6), `rgba(${ct[e % ct.length]}, ${a})`;
125
+ }
126
+ function ft(e, t, f) {
127
+ if (e === "" || t === "")
128
+ return null;
129
+ let a = (g) => g == null ? void 0 : g.replace(/,/g, "");
130
+ f === "ID" && (a = (g) => g == null ? void 0 : g.replace(/\./g, "").replace(/,/g, "."));
131
+ const k = Number(a(e)), x = Number(a(t));
132
+ if (isNaN(k) || isNaN(x))
133
+ return null;
134
+ let b = 0;
135
+ x === 0 ? k === 0 ? b = 0 : b = 1 : b = (k - x) / x;
136
+ const _ = Zt(b);
137
+ return {
138
+ value: isNaN(b) ? "" : `${(b * 100).toFixed(0)}%`,
139
+ icon: _
140
+ };
141
+ }
142
+ function Zt(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 t = 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
+ })), a = d(() => ({
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 = d(() => ({
192
+ display: e.showLegend,
193
+ position: e.legendPosition,
194
+ usePointStyle: e.usePointStyle
195
+ })), x = d(() => e.isTransposed), b = d(() => e.chartWidth), _ = d(() => e.chartHeight);
196
+ return { datalabels: t, xCfg: f, yCfg: a, isTransposed: x, legend: k, chartWidth: b, chartHeight: _ };
197
+ }
198
+ const Qt = /* @__PURE__ */ ee({
199
+ __name: "WidgetBarchart",
200
+ props: {
201
+ modelValue: { required: !0 },
202
+ modelModifiers: {}
203
+ },
204
+ emits: ["update:modelValue"],
205
+ setup(e) {
206
+ const t = te(e, "modelValue"), f = d(() => {
207
+ var r;
208
+ return ((r = t.value.data) == null ? void 0 : r.xAxis) ?? [];
209
+ }), a = d(() => {
210
+ var r;
211
+ return ((r = t.value.data) == null ? void 0 : r.datasets) ?? [];
212
+ }), k = u(null), { datalabels: x, xCfg: b, yCfg: _, isTransposed: g, legend: R, chartWidth: T, chartHeight: m } = Re(
213
+ t.value
214
+ ), i = d(() => a.value.length > 0 ? [
215
+ ...a.value.map((r, S) => ({
216
+ label: r.name,
217
+ data: r.values,
218
+ dash: !!r.isCompare,
219
+ backgroundColor: ke({ index: S, isCompare: r.isCompare })
220
+ }))
221
+ ] : []);
222
+ return (r, S) => {
223
+ const L = V("FmBarChart");
224
+ return E(), H(le, null, [
225
+ de(r.$slots, "menu"),
226
+ $(L, {
227
+ ref_key: "chartRef",
228
+ ref: k,
229
+ class: "bar-chart",
230
+ datasets: i.value,
231
+ "x-axis": { categories: f.value },
232
+ "x-cfg": n(b),
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(x),
243
+ "maintain-aspect-ratio": !1,
244
+ style: oe({
245
+ "--chart-width": n(T) !== void 0 ? n(T) + "px" : "100%",
246
+ "--chart-height": n(m) !== void 0 ? n(m) + "px" : "calc(100% - 36px)"
247
+ })
248
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
249
+ ], 64);
250
+ };
251
+ }
252
+ }), ea = /* @__PURE__ */ ee({
253
+ __name: "WidgetCircular",
254
+ props: {
255
+ modelValue: { required: !0 },
256
+ modelModifiers: {}
257
+ },
258
+ emits: ["update:modelValue"],
259
+ setup(e) {
260
+ const t = te(e, "modelValue"), { datalabels: f, legend: a, chartWidth: k, chartHeight: x } = Re(t.value), b = d(() => {
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) => ke({ index: R }))
267
+ }
268
+ ]), _;
269
+ });
270
+ return (_, g) => {
271
+ const R = V("FmPieChart");
272
+ return E(), H(le, null, [
273
+ de(_.$slots, "menu"),
274
+ $(R, {
275
+ class: "circular",
276
+ percentage: "70%",
277
+ datasets: b.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(f),
289
+ "maintain-aspect-ratio": !1,
290
+ style: oe({
291
+ "--chart-width": n(k) !== void 0 ? n(k) + "px" : "100%",
292
+ "--chart-height": n(x) !== void 0 ? n(x) + "px" : "calc(100% - 36px)"
293
+ })
294
+ }, null, 8, ["datasets", "metrics", "legend", "datalabels", "style"])
295
+ ], 64);
296
+ };
297
+ }
298
+ }), ta = { class: "flex flex-col gap-1" }, aa = { class: "fm-typo-en-title-sm-600" }, la = { class: "flex gap-2" }, oa = { key: 0 }, na = { key: 1 }, sa = /* @__PURE__ */ ee({
299
+ __name: "WidgetScorecard",
300
+ props: {
301
+ modelValue: { required: !0 },
302
+ modelModifiers: {}
303
+ },
304
+ emits: ["update:modelValue"],
305
+ setup(e) {
306
+ const t = te(e, "modelValue"), { t: f } = Pe(), { compareDateRange: a, defaultDateSetting: k } = _e(Xe()), { country: x } = Ye(), b = d(() => {
307
+ var m;
308
+ return ((m = t.value.data) == null ? void 0 : m.value) || "";
309
+ }), _ = d(() => {
310
+ const { data: m } = t.value;
311
+ return m != null && m.comparison ? ft(b.value, m.comparison, x) : null;
312
+ });
313
+ function g(m) {
314
+ switch (m) {
315
+ case qe.bar:
316
+ return "bar";
317
+ case qe.line:
318
+ return "line";
319
+ default:
320
+ return "line";
321
+ }
322
+ }
323
+ const R = d(() => {
324
+ var m;
325
+ return (m = t.value.data) == null ? void 0 : m.sparkline;
326
+ }), T = d(() => R.value.datasets.map((m) => ({
327
+ label: m.name,
328
+ data: m.values,
329
+ fill: !0,
330
+ color: "#36a2eb"
331
+ })));
332
+ return (m, i) => {
333
+ var U;
334
+ const r = V("FmIcon"), S = V("FmChip"), L = V("FmTooltip"), M = V("FmLineChart");
335
+ return E(), H("div", ta, [
336
+ de(m.$slots, "menu"),
337
+ B("p", aa, xe(b.value), 1),
338
+ B("div", la, [
339
+ $(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: N(() => [
346
+ _.value ? (E(), O(S, {
347
+ key: 0,
348
+ icon: _.value.icon.name,
349
+ class: Ve(`bg-${_.value.icon.tailwind}`),
350
+ compact: ""
351
+ }, {
352
+ default: N(() => [
353
+ $(r, {
354
+ name: _.value.icon.name,
355
+ color: _.value.icon.color
356
+ }, null, 8, ["name", "color"]),
357
+ B("p", {
358
+ class: "fm-typo-en-body-md-600",
359
+ style: oe({ color: _.value.icon.color })
360
+ }, xe(_.value.value), 5)
361
+ ]),
362
+ _: 1
363
+ }, 8, ["icon", "class"])) : ue("", !0),
364
+ n(a).endDate !== null && n(a).startDate !== null && _.value === null ? (E(), O(S, {
365
+ key: 1,
366
+ compact: ""
367
+ }, {
368
+ default: N(() => [
369
+ $(r, {
370
+ name: "arrow_upward",
371
+ color: "#C7C7CC"
372
+ }),
373
+ i[0] || (i[0] = B("p", { class: "fm-typo-en-body-md-600 text-fm-color-typo-disabled" }, "N/A", -1))
374
+ ]),
375
+ _: 1
376
+ })) : ue("", !0)
377
+ ]),
378
+ _: 1
379
+ }, 8, ["content"])
380
+ ]),
381
+ R.value ? (E(), H("div", oa, [
382
+ g(R.value.type) === "line" ? (E(), O(M, {
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"])) : ue("", !0)
395
+ ])) : (E(), H("div", na, i[1] || (i[1] = [
396
+ B("div", { class: "sparkline" }, [
397
+ B("div", { class: "flex flex-col gap-8" }, [
398
+ B("div"),
399
+ B("div")
400
+ ]),
401
+ B("div", { class: "grow" })
402
+ ], -1)
403
+ ])))
404
+ ]);
405
+ };
406
+ }
407
+ }), ra = {};
408
+ function ia(e, t) {
409
+ const f = V("FmMenuDivider");
410
+ return E(), O(f);
411
+ }
412
+ const ca = /* @__PURE__ */ Yt(ra, [["render", ia]]), ua = "mf-reporttable-dimension", ut = Xt(ua, () => {
413
+ const e = u(0), t = u([]), f = u(!1), a = (h, c) => {
414
+ e.value = h, x(h, c);
415
+ }, k = (h, c, w, F) => {
416
+ t[h] = c, t.value = [...t.value], b(h, c, w, F);
417
+ }, x = (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
+ }, b = (h, c, w, F = !1) => {
424
+ const p = (w == null ? void 0 : w.querySelectorAll("th")) ?? [];
425
+ if (h === void 0) return;
426
+ const D = p[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")), f.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((p) => p.classList.remove("toggleEditResize")), c.forEach((p) => p.classList.remove("toggleEditResize")), w.forEach((p) => p.remove()), F.forEach((p) => p.remove()), f.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((p) => {
444
+ p.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
+ }, m = (h) => {
451
+ const c = document.querySelectorAll("thead tr"), w = document.querySelectorAll("tbody tr"), F = [...c, ...w];
452
+ for (const p of F)
453
+ h ? p.classList.add("highlight-hover-row") : p.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
+ }, S = (h, c) => {
463
+ const w = /* @__PURE__ */ new Map(), F = h.clientX, p = h.target.closest("table"), D = p == null ? void 0 : p.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 C = v.textContent || "", A = window.getComputedStyle(v), P = `${A.fontWeight} ${A.fontSize} ${A.fontFamily}`, I = document.createElement("canvas").getContext("2d");
466
+ if (!I) return;
467
+ I.font = P;
468
+ const X = I.measureText(C), Y = window.getComputedStyle(D), Fe = parseFloat(Y.paddingLeft || "0"), Le = parseFloat(Y.paddingRight || "0"), Te = X.width + Fe + Le;
469
+ T(c, !1);
470
+ const we = (me) => {
471
+ const ne = me.clientX - F, se = Math.max(Te, s + ne);
472
+ if (p) {
473
+ k(c, se, p, !0);
474
+ let ae = 0;
475
+ p.querySelectorAll("th").forEach((G, J) => {
476
+ ae += J === c ? se : t[J] || G.getBoundingClientRect().width;
477
+ }), p.classList.remove("w-full"), p.style.width = `${ae}px`;
478
+ const K = p == null ? void 0 : p.parentElement;
479
+ if (K) {
480
+ const G = K.scrollWidth, J = K.scrollLeft;
481
+ K.offsetWidth + J >= G - 100 && (K.scrollLeft = G);
482
+ }
483
+ }
484
+ }, be = () => {
485
+ const me = (p == null ? void 0 : p.querySelectorAll("th")) ?? [], ne = [...t.value];
486
+ me.forEach((se, ae) => {
487
+ const re = se.getBoundingClientRect().width;
488
+ t[ae] = re, ne[ae] = re;
489
+ }), t.value = ne, r(!1), document.removeEventListener("mousemove", we), document.removeEventListener("mouseup", be);
490
+ };
491
+ document.addEventListener("mousemove", we), document.addEventListener("mouseup", be);
492
+ }, L = (h) => {
493
+ const c = h.clientY, w = h.target.closest("table"), F = e.value || 48;
494
+ m(!1);
495
+ const p = (l) => {
496
+ const s = Math.max(30, F + (l.clientY - c));
497
+ w && a(s, w);
498
+ }, D = () => {
499
+ i(!1), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", D);
500
+ };
501
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", D);
502
+ };
503
+ return {
504
+ rowHeight: e,
505
+ colWidths: t,
506
+ isEditing: f,
507
+ updateRowHeight: a,
508
+ updateColWidth: k,
509
+ setRowHeights: x,
510
+ setColWidths: b,
511
+ enableEditMode: _,
512
+ disableEditMode: g,
513
+ resetStore: R,
514
+ highlightCol: T,
515
+ highlightRows: m,
516
+ removeRowHighlight: i,
517
+ removeColHighlight: r,
518
+ resizeCol: S,
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 p = (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(), S(v, l);
527
+ })) : (s.addEventListener("mouseenter", () => m(!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, C) => {
534
+ const A = p("col", C), P = p("row", C);
535
+ v.appendChild(A), v.appendChild(P);
536
+ });
537
+ }), _();
538
+ },
539
+ cancelResizingChanges: () => {
540
+ g();
541
+ }
542
+ };
543
+ }), da = { class: "my-4" }, ma = {
544
+ class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
545
+ style: { backgroundColor: "#f9f9f9" }
546
+ }, ha = { class: "font-bold" }, pa = { class: "text-fm-color-neutral-gray-300" }, fa = /* @__PURE__ */ ee({
547
+ __name: "WidgetTable",
548
+ props: {
549
+ modelValue: { required: !0 },
550
+ modelModifiers: {}
551
+ },
552
+ emits: ["update:modelValue"],
553
+ setup(e) {
554
+ const { t, te: f } = Pe(), a = te(e, "modelValue"), { country: k } = Ye(), { isEditing: x, colWidths: b, rowHeight: _ } = _e(ut()), { setColWidths: g, setRowHeights: R, enableCellResizing: T } = ut(), m = u(null), i = d(() => {
555
+ var l;
556
+ return ((l = a.value.data) == null ? void 0 : l.columns) || [{ label: "", key: "" }];
557
+ }), r = d(() => {
558
+ var l;
559
+ return ((l = a.value.data) == null ? void 0 : l.rows) || [];
560
+ }), S = d(() => a.value.filterText), L = d(() => {
561
+ var l, s;
562
+ if (!(S.value && S.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 === Q.top || a.value.rollupPosition === void 0)
564
+ return Q.top;
565
+ if (a.value.rollupPosition === Q.bottom)
566
+ return Q.bottom;
567
+ }
568
+ }), M = d(() => {
569
+ const C = L.value !== void 0 ? 1 : 0, A = (m.value ? m.value.$el.offsetHeight : 0) - 48;
570
+ return Math.floor((A - 34.5 - 32) / 48) - C;
571
+ }), U = d(() => {
572
+ var s, v;
573
+ let l = [];
574
+ switch (L.value) {
575
+ case Q.top:
576
+ l = [...((s = r.value[0]) == null ? void 0 : s.cells) || []].map((C, A) => {
577
+ var P;
578
+ return {
579
+ main: C,
580
+ comparison: (P = r.value[0]) == null ? void 0 : P.comparisonCells[A],
581
+ rowType: i.value[A].type
582
+ };
583
+ });
584
+ break;
585
+ case Q.bottom:
586
+ l = [...((v = r.value[r.value.length - 1]) == null ? void 0 : v.cells) || []].map((C, A) => {
587
+ var P;
588
+ return {
589
+ main: C,
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 C = l.comparisonCells[v];
603
+ s[i.value[v].key] = {
604
+ main: l.cells[v],
605
+ comparison: C
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 C = 0; C < a.value.data.columns.length; C++)
616
+ s[a.value.data.columns[C].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: ft(l.main, l.comparison, k)
628
+ };
629
+ }
630
+ const F = d(() => {
631
+ var A, P, j;
632
+ let l = ((A = a.value.data) == null ? void 0 : A.rows) || [];
633
+ switch (L.value) {
634
+ case Q.bottom:
635
+ l = (P = l[l.length - 1]) != null && P.isRollup ? l.slice(0, -1) : l;
636
+ break;
637
+ case Q.top:
638
+ l = (j = l[0]) != null && j.isRollup ? l.slice(1, l.length) : l;
639
+ break;
640
+ }
641
+ const s = l.filter((I) => !(S.value !== "" && (I.isRollup === !0 || !I.cells.some(
642
+ (X) => {
643
+ var Y;
644
+ return ((X == null ? void 0 : X.toLowerCase()) || "").includes((Y = S.value) == null ? void 0 : Y.toLowerCase());
645
+ }
646
+ )))).map((I) => h(I)), v = s.length % M.value;
647
+ let C = 0;
648
+ return v > 0 ? C = Math.abs(v - M.value) : s.length === 0 && (C = M.value), s.push(...c(C)), s;
649
+ }), p = d(
650
+ () => {
651
+ var l;
652
+ return (((l = a.value.colWidths) == null ? void 0 : l.length) ?? 0) > 0 || b.value.length > 0;
653
+ }
654
+ ), D = d(() => {
655
+ var s;
656
+ let l = [];
657
+ return (s = a.value.data) != null && s.columns && (l = [...a.value.data.columns.map((C) => {
658
+ const A = ve(t, f, C.label, "other");
659
+ return {
660
+ accessorKey: C.key,
661
+ header: () => nt(
662
+ "p",
663
+ {
664
+ class: `w-full ${C.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap`
665
+ },
666
+ A
667
+ ),
668
+ cell: (P) => {
669
+ var X, Y;
670
+ const j = w(P.getValue()), I = (Y = (X = P == null ? void 0 : P.row) == null ? void 0 : X.original) == null ? void 0 : Y.isRollup;
671
+ return nt(
672
+ "div",
673
+ {
674
+ class: [
675
+ I ? "fm-typo-en-body-md-600 text-fm-color-typo-secondary" : "fm-typo-en-body-md-400",
676
+ C.type === "NUMERIC" ? "text-right" : "",
677
+ p.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
678
+ ].join(" ")
679
+ },
680
+ [j.main]
681
+ );
682
+ },
683
+ enableSorting: !1
684
+ };
685
+ })]), l;
686
+ });
687
+ return ge(
688
+ () => b.value.length > 0,
689
+ async (l) => {
690
+ l && x.value && (await st(), T());
691
+ }
692
+ ), ge(
693
+ [() => D.value],
694
+ async () => {
695
+ var A;
696
+ await st();
697
+ const l = (A = m.value) == null ? void 0 : A.$el;
698
+ if (!l) return;
699
+ const s = l.querySelector("table");
700
+ if (!s) return;
701
+ s.classList.add(p.value ? "table-fixed" : "table-auto");
702
+ let v, C;
703
+ x.value ? (T(), v = b.value, C = _.value) : (C = a.value.rowHeight, v = a.value.colWidths), typeof C == "number" && R(C, l), v == null || v.forEach((P, j) => {
704
+ g(j, P, l);
705
+ });
706
+ },
707
+ { immediate: !0 }
708
+ ), (l, s) => {
709
+ const v = V("FmTable");
710
+ return E(), H(le, null, [
711
+ B("div", da, [
712
+ de(l.$slots, "menu")
713
+ ]),
714
+ $(v, {
715
+ ref_key: "table",
716
+ ref: m,
717
+ "column-defs": D.value,
718
+ "row-data": F.value,
719
+ "search-value": S.value,
720
+ "page-size": M.value,
721
+ "shrink-at": !1,
722
+ "force-mobile-footer": !0,
723
+ class: "scrollbar-hide-table"
724
+ }, {
725
+ "pin-top": N(() => [
726
+ B("tbody", null, [
727
+ B("tr", ma, [
728
+ (E(!0), H(le, null, dt(U.value, (C, A) => (E(), H("td", {
729
+ key: `${n(ze)()}_${A}`,
730
+ class: "h-[48px] text-fm-color-typo-primary px-16"
731
+ }, [
732
+ B("span", {
733
+ class: Ve([
734
+ "items-center text-fm-color-typo-secondary gap-2",
735
+ C.rowType === "NUMERIC" ? "text-right" : "",
736
+ p.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
737
+ ])
738
+ }, [
739
+ B("p", ha, xe(C.main), 1),
740
+ B("p", pa, xe(C.comparison ? `(${C.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
+ }), va = /* @__PURE__ */ ee({
752
+ __name: "WidgetStackBarChart",
753
+ props: {
754
+ modelValue: { required: !0 },
755
+ modelModifiers: {}
756
+ },
757
+ emits: ["update:modelValue"],
758
+ setup(e) {
759
+ const t = te(e, "modelValue"), f = d(() => {
760
+ var S;
761
+ return ((S = t.value.data) == null ? void 0 : S.xAxis) || [];
762
+ }), a = d(() => {
763
+ var r;
764
+ return ((r = t.value.data) == null ? void 0 : r.datasets) ?? [];
765
+ }), k = u(null), { datalabels: x, xCfg: b, yCfg: _, isTransposed: g, legend: R, chartWidth: T, chartHeight: m } = Re(
766
+ t.value
767
+ ), i = d(() => a.value.length > 0 ? [
768
+ ...a.value.map((r, S) => {
769
+ let L = r.values;
770
+ return {
771
+ label: r.name,
772
+ data: L,
773
+ dash: !!r.isCompare,
774
+ backgroundColor: ke({ index: S, isCompare: r.isCompare })
775
+ };
776
+ })
777
+ ] : []);
778
+ return (r, S) => {
779
+ const L = V("FmBarChart");
780
+ return E(), H(le, null, [
781
+ de(r.$slots, "menu"),
782
+ $(L, {
783
+ ref_key: "chartRef",
784
+ ref: k,
785
+ class: "bar-chart",
786
+ datasets: i.value,
787
+ "x-axis": { categories: f.value },
788
+ "x-cfg": n(b),
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(x),
801
+ "maintain-aspect-ratio": !1,
802
+ style: oe({
803
+ "--chart-width": n(T) !== void 0 ? n(T) + "px" : "100%",
804
+ "--chart-height": n(m) !== void 0 ? n(m) + "px" : "calc(100% - 36px)"
805
+ })
806
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
807
+ ], 64);
808
+ };
809
+ }
810
+ }), ga = /* @__PURE__ */ ee({
811
+ __name: "WidgetStackLineChart",
812
+ props: {
813
+ modelValue: { required: !0 },
814
+ modelModifiers: {}
815
+ },
816
+ emits: ["update:modelValue"],
817
+ setup(e) {
818
+ const t = te(e, "modelValue"), f = d(() => {
819
+ var i;
820
+ return ((i = t.value.data) == null ? void 0 : i.xAxis) ?? [];
821
+ }), a = d(() => {
822
+ var i;
823
+ return ((i = t.value.data) == null ? void 0 : i.datasets) ?? [];
824
+ }), { datalabels: k, xCfg: x, yCfg: b, isTransposed: _, legend: g, chartWidth: R, chartHeight: T } = Re(
825
+ t.value
826
+ ), m = d(() => a.value.length > 0 ? [
827
+ ...a.value.map((i, r) => {
828
+ let S = i.values;
829
+ return {
830
+ label: i.name,
831
+ data: S,
832
+ dash: i.isCompare,
833
+ fill: !1,
834
+ color: ke({ index: r, isCompare: i.isCompare })
835
+ };
836
+ })
837
+ ] : []);
838
+ return (i, r) => {
839
+ const S = V("FmLineChart");
840
+ return E(), H(le, null, [
841
+ de(i.$slots, "menu"),
842
+ $(S, {
843
+ class: "line-chart",
844
+ datasets: m.value,
845
+ "x-axis": { categories: f.value },
846
+ "x-cfg": n(x),
847
+ "y-cfg": n(b),
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: oe({
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
+ }), ye = [
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 ya(e) {
883
+ return e < 12 ? ye[e - 1] : ye[11];
884
+ }
885
+ function wa(e) {
886
+ return e < 12 ? ye[Math.min(11, e * 2 - 1)] : ye[11];
887
+ }
888
+ function ba(e) {
889
+ return e < 12 ? ye[Math.min(11, e * 3 - 1)] : ye[11];
890
+ }
891
+ const Ca = /* @__PURE__ */ ee({
892
+ __name: "WidgetLinechart",
893
+ props: {
894
+ modelValue: { required: !0 },
895
+ modelModifiers: {}
896
+ },
897
+ emits: ["update:modelValue"],
898
+ setup(e) {
899
+ const t = te(e, "modelValue"), f = d(() => {
900
+ var i;
901
+ return ((i = t.value.data) == null ? void 0 : i.xAxis) ?? [];
902
+ }), a = d(() => {
903
+ var i;
904
+ return ((i = t.value.data) == null ? void 0 : i.datasets) ?? [];
905
+ }), { datalabels: k, xCfg: x, yCfg: b, isTransposed: _, legend: g, chartWidth: R, chartHeight: T } = Re(
906
+ t.value
907
+ ), m = d(() => 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: ke({ index: r, isCompare: i.isCompare })
914
+ }))
915
+ ] : []);
916
+ return (i, r) => {
917
+ const S = V("FmLineChart");
918
+ return E(), H(le, null, [
919
+ de(i.$slots, "menu"),
920
+ $(S, {
921
+ class: "line-chart",
922
+ datasets: m.value,
923
+ "x-axis": { categories: f.value },
924
+ "x-cfg": n(x),
925
+ "y-cfg": n(b),
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: oe({
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
+ }), Sa = { class: "flex flex-col gap-16" }, xa = { class: "flex flex-row" }, _a = /* @__PURE__ */ ee({
947
+ __name: "PdfOrientationDialog",
948
+ props: /* @__PURE__ */ mt({
949
+ reportType: {},
950
+ index: {}
951
+ }, {
952
+ modelValue: { type: Boolean, required: !0 },
953
+ modelModifiers: {}
954
+ }),
955
+ emits: ["update:modelValue"],
956
+ setup(e) {
957
+ const { t } = Pe(), { FmForm: f } = Gt, a = e, k = u(), x = te(e, "modelValue"), b = u(!1), _ = pt(), { selectedLocationIds: g, dateRange: R, timeRange: T } = _e(Xe()), m = u(We.PORTRAIT);
958
+ function i() {
959
+ var S;
960
+ (S = k.value) == null || S.validateInputs();
961
+ }
962
+ async function r() {
963
+ b.value = !0;
964
+ try {
965
+ a.index != null && await ht({
966
+ reportType: a.reportType,
967
+ index: a.index,
968
+ orientationTypes: [m.value],
969
+ timeRange: T.value,
970
+ dateRange: R.value,
971
+ locationIds: g.value
972
+ });
973
+ } catch (S) {
974
+ _.open({ message: S.message, type: "error" });
975
+ } finally {
976
+ b.value = !1;
977
+ }
978
+ }
979
+ return (S, L) => {
980
+ const M = V("FmRadio"), U = V("FmRadioGroup"), h = V("FmButton"), c = V("FmDialog");
981
+ return E(), O(c, {
982
+ modelValue: x.value,
983
+ "onUpdate:modelValue": L[2] || (L[2] = (w) => x.value = w),
984
+ overlay: !0,
985
+ "z-index": 10
986
+ }, {
987
+ "dialog-header": N(() => L[3] || (L[3] = [
988
+ Wt("Select Orientation")
989
+ ])),
990
+ default: N(() => [
991
+ $(n(f), {
992
+ ref_key: "form",
993
+ ref: k,
994
+ onValidationSuccess: r
995
+ }, {
996
+ default: N(() => [
997
+ B("div", Sa, [
998
+ $(U, {
999
+ modelValue: m.value,
1000
+ "onUpdate:modelValue": L[0] || (L[0] = (w) => m.value = w)
1001
+ }, {
1002
+ default: N(() => [
1003
+ $(M, {
1004
+ value: n(We).PORTRAIT,
1005
+ label: n(t)("report.common.portrait")
1006
+ }, null, 8, ["value", "label"]),
1007
+ $(M, {
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
+ B("div", xa, [
1016
+ L[4] || (L[4] = B("div", { class: "grow" }, null, -1)),
1017
+ $(h, {
1018
+ label: n(t)("report.common.cancel"),
1019
+ variant: "tertiary",
1020
+ onClick: L[1] || (L[1] = (w) => x.value = !1)
1021
+ }, null, 8, ["label"]),
1022
+ B("div", null, [
1023
+ $(h, {
1024
+ label: n(t)("report.common.download"),
1025
+ loading: b.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
+ }), ka = {
1039
+ key: 1,
1040
+ class: "grow"
1041
+ }, Ra = {
1042
+ key: 2,
1043
+ class: "flex"
1044
+ }, $a = /* @__PURE__ */ ee({
1045
+ __name: "DynamicWidget",
1046
+ props: /* @__PURE__ */ mt({
1047
+ index: {
1048
+ type: Number,
1049
+ default: 0
1050
+ },
1051
+ hideExport: {
1052
+ type: Boolean,
1053
+ default: !1
1054
+ },
1055
+ customScreenWidth: {
1056
+ type: Number,
1057
+ required: !1,
1058
+ default: void 0
1059
+ }
1060
+ }, {
1061
+ modelValue: { required: !0, default: () => {
1062
+ } },
1063
+ modelModifiers: {}
1064
+ }),
1065
+ emits: ["update:modelValue"],
1066
+ setup(e) {
1067
+ const t = u(!0), f = te(e, "modelValue"), a = f.value.widget.config, { t: k, te: x } = Pe(), b = e, _ = u(null), g = u(a.rollup), R = u(ze()), T = u(a.drillDimension), m = d(() => {
1068
+ if (ie.value.length > 0) {
1069
+ const o = ie.value.findIndex(
1070
+ (z) => z.value === T.value
1071
+ );
1072
+ return o >= 0 ? o : 0;
1073
+ } else
1074
+ return -1;
1075
+ }), i = d(() => m.value !== 0), r = d(
1076
+ () => m.value != ie.value.length - 1
1077
+ ), S = u(a.showTitle ?? !0), L = u(a.titleFontSize ?? 14), M = 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), p = u(a.labelAlign ?? Ne.center), D = u(a.labelAnchor ?? Me.center), l = u(a.labelRotation ?? 0), s = u(a.labelOffset ?? 0), v = u(a.labelFontSize ?? 12), C = d(() => a.showSearchBar), A = u(a.showX ?? !0), P = u(a.xPosition ?? Ie.bottom), j = u(a.showXGrid ?? !1), I = u(a.showXTick ?? !0), X = u(a.xTickFontSize ?? 12), Y = u(a.showY ?? !0), Fe = u(a.yPosition ?? Oe.left), Le = u(a.showYGrid ?? !1), Te = u(a.showYTick ?? !0), we = u(a.yTickFontSize ?? 12), be = u(a.showLegend ?? void 0), me = u(a.legendPosition ?? Ue.top), ne = u(a.usePointStyle ?? !0), se = u(a.rowHeight ?? 0), ae = u(a.colWidths ?? []), re = u(!1), K = u(""), { breakpoints: G, getBreakpointsBoundary: J } = jt(), $e = u(), q = d(
1078
+ () => b.customScreenWidth === void 0 ? window.innerWidth : b.customScreenWidth
1079
+ ), vt = d(
1080
+ () => (q == null ? void 0 : q.value) > J("xs")[1] && (q == null ? void 0 : q.value) <= J("sm")[1]
1081
+ ), gt = d(
1082
+ () => (q == null ? void 0 : q.value) > J("sm")[1] && (q == null ? void 0 : q.value) <= J("md")[1]
1083
+ ), yt = d(() => (q == null ? void 0 : q.value) > J("md")[1]), wt = d(() => {
1084
+ const o = f.value.size.width;
1085
+ return yt.value || gt.value ? ya(o) : vt.value ? wa(o) : ba(o);
1086
+ }), Ee = d(
1087
+ () => Jt.find((o) => o.type === f.value.widget.type)
1088
+ ), he = rt(() => {
1089
+ var o;
1090
+ $e.value = kt((o = _.value) == null ? void 0 : o.$el.offsetWidth), R.value = ze();
1091
+ }), bt = d(() => {
1092
+ if (Kt(W.value.type, pe.value))
1093
+ switch (f.value.widget.type) {
1094
+ case y.BarChart:
1095
+ return Qt;
1096
+ case y.StackBarChart:
1097
+ return va;
1098
+ case y.LineChart:
1099
+ return Ca;
1100
+ case y.StackLineChart:
1101
+ return ga;
1102
+ case y.Circular:
1103
+ return ea;
1104
+ case y.Scorecard:
1105
+ return sa;
1106
+ case y.Spacer:
1107
+ return ca;
1108
+ case y.Table:
1109
+ return fa;
1110
+ default:
1111
+ return it;
1112
+ }
1113
+ else
1114
+ return it;
1115
+ }), pe = u(null), { selectedLocationIds: De, dateRange: Ge, compareDateRange: Ct, timeRange: je } = _e(Xe()), { businessId: St } = _e(Ye()), W = d(() => {
1116
+ const o = JSON.parse(JSON.stringify(f.value.widget));
1117
+ return {
1118
+ ...o,
1119
+ config: {
1120
+ ...o.config,
1121
+ rollup: g.value,
1122
+ drillDimension: T.value,
1123
+ showGrandTotal: !1
1124
+ }
1125
+ };
1126
+ });
1127
+ function xt() {
1128
+ return {
1129
+ data: pe.value,
1130
+ showTitle: S.value,
1131
+ titleFontSize: L.value,
1132
+ titleBold: M.value,
1133
+ titleItalic: U.value,
1134
+ titleUnderline: h.value,
1135
+ chartHeight: w.value,
1136
+ chartWidth: c.value,
1137
+ showLabel: F.value,
1138
+ labelAnchor: D.value,
1139
+ labelAlign: p.value,
1140
+ labelRotation: l.value,
1141
+ labelOffset: s.value,
1142
+ labelFontSize: v.value,
1143
+ showX: A.value,
1144
+ xPosition: P.value,
1145
+ showXGrid: j.value,
1146
+ showXTick: I.value,
1147
+ xTickFontSize: X.value,
1148
+ showY: Y.value,
1149
+ yPosition: Fe.value,
1150
+ showYGrid: Le.value,
1151
+ showYTick: Te.value,
1152
+ yTickFontSize: we.value,
1153
+ isTransposed: W.value.config.isTransposed,
1154
+ showLegend: be.value,
1155
+ legendPosition: me.value,
1156
+ usePointStyle: ne.value
1157
+ };
1158
+ }
1159
+ function _t() {
1160
+ return {
1161
+ data: pe.value,
1162
+ filterText: K.value,
1163
+ rollupPosition: W.value.config.rollupPosition,
1164
+ rowHeight: se.value,
1165
+ colWidths: ae.value
1166
+ };
1167
+ }
1168
+ const Je = d(() => {
1169
+ switch (W.value.type) {
1170
+ case y.Table:
1171
+ return _t();
1172
+ case y.BarChart:
1173
+ case y.LineChart:
1174
+ case y.StackBarChart:
1175
+ case y.StackLineChart:
1176
+ case y.Circular:
1177
+ return xt();
1178
+ default:
1179
+ return { data: pe.value };
1180
+ }
1181
+ }), Ke = d(() => {
1182
+ const { config: o } = f.value.widget;
1183
+ if (o.rollup != null) {
1184
+ const z = [...o.dimensions].filter((ce) => !ce.hide);
1185
+ return z.sort(
1186
+ (ce, Ce) => (o.rowIds || []).indexOf(He(ce)) - (o.rowIds || []).indexOf(He(Ce))
1187
+ ), [
1188
+ { label: ve(k, x, "None", "other"), value: null },
1189
+ { label: ve(k, x, "Grand Total", "other"), value: 0 },
1190
+ ...[...z].slice(0, z.length - 1).map((ce, Ce) => ({
1191
+ label: ve(k, x, ce.label, "other"),
1192
+ value: Ce + 1
1193
+ }))
1194
+ ];
1195
+ }
1196
+ return [];
1197
+ }), ie = d(() => {
1198
+ const { config: o } = W.value;
1199
+ return o.isDrillable ? o.dimensions.map((z) => ({
1200
+ label: ve(k, x, z.label, "other"),
1201
+ value: He(z)
1202
+ })) : [];
1203
+ });
1204
+ ge(
1205
+ () => f.value.widget.config,
1206
+ (o) => {
1207
+ g.value = o.rollup, S.value = o.showTitle ?? !0, L.value = o.titleFontSize ?? 14, M.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, p.value = o.labelAlign ?? Ne.center, D.value = o.labelAnchor ?? Me.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 ?? Ie.bottom, j.value = o.showXGrid ?? !1, I.value = o.showXTick ?? !0, X.value = o.xTickFontSize ?? 12, Y.value = o.showY ?? !0, Fe.value = o.yPosition ?? Oe.left, Le.value = o.showYGrid ?? !1, Te.value = o.showYTick ?? !0, we.value = o.yTickFontSize ?? 12, be.value = o.showLegend ?? void 0, me.value = o.legendPosition ?? Ue.top, ne.value = o.usePointStyle ?? !0, se.value = o.rowHeight ?? 0, ae.value = o.colWidths ?? [];
1208
+ },
1209
+ { deep: !0 }
1210
+ ), ge([() => g.value], () => {
1211
+ g.value !== null && (f.value.widget.config.rollup = g.value);
1212
+ }), ge(
1213
+ [
1214
+ () => W.value,
1215
+ () => Ge.value,
1216
+ () => je.value,
1217
+ () => Ct.value,
1218
+ () => De.value,
1219
+ () => St.value
1220
+ ],
1221
+ () => {
1222
+ var o;
1223
+ De.value && ((o = De.value) == null ? void 0 : o.length) > 0 && Qe();
1224
+ },
1225
+ {
1226
+ deep: !0
1227
+ }
1228
+ ), ge(
1229
+ [() => f.value.size],
1230
+ () => {
1231
+ he();
1232
+ },
1233
+ { deep: !0 }
1234
+ ), Ht(() => {
1235
+ he(), G.value.sm || G.value.md || G.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", he)) : addEventListener("resize", he), Qe();
1236
+ }), qt(() => {
1237
+ G.value.sm || G.value.md || G.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", he)) : removeEventListener("resize", he);
1238
+ });
1239
+ const Ze = pt();
1240
+ let Ae;
1241
+ const Qe = rt(async function() {
1242
+ if (W.value.config.schemaNames.length <= 0 && !(W.value.config.dimensions.length <= 0 || W.value.config.metrics.length <= 0)) {
1243
+ Ze.open({
1244
+ message: "schema must not be empty and dimension or metrics must have at least 1 column",
1245
+ type: "info"
1246
+ }), t.value = !1;
1247
+ return;
1248
+ }
1249
+ try {
1250
+ t.value = !0, Ae && Ae.abort(), Ae = new AbortController();
1251
+ const z = Ae.signal;
1252
+ pe.value = await Ut(W.value, z), R.value = ze(), t.value = !1;
1253
+ } catch (z) {
1254
+ pe.value = null, z.code !== "ERR_CANCELED" && (Ze.open({ message: `Invalid chart ${W.value.type}`, type: "error" }), console.log(z), t.value = !1);
1255
+ }
1256
+ });
1257
+ function kt(o) {
1258
+ switch (f.value.widget.type) {
1259
+ case "SPACER":
1260
+ return;
1261
+ case "SCORECARD":
1262
+ return;
1263
+ case "TABLE":
1264
+ return `${f.value.size.height * 100 + (C.value ? 72 : 0) + 96.5}px`;
1265
+ }
1266
+ return `${Math.max(o / f.value.size.width, 90) * f.value.size.height}px`;
1267
+ }
1268
+ function Rt() {
1269
+ const o = m.value - 1;
1270
+ o >= 0 && (T.value = ie.value[o].value);
1271
+ }
1272
+ function Ft() {
1273
+ const o = m.value + 1;
1274
+ o >= 0 && o < ie.value.length && (T.value = ie.value[o].value);
1275
+ }
1276
+ const et = u(Se.EXCEL), tt = u(), Lt = Object.values(Se).map((o) => ({
1277
+ label: Ot(o),
1278
+ value: o,
1279
+ onClick: async () => {
1280
+ o === Se.EXCEL || o === Se.PDFFULLSIZE ? await ht({
1281
+ reportType: o,
1282
+ index: b.index,
1283
+ timeRange: je.value,
1284
+ dateRange: Ge.value,
1285
+ locationIds: De.value
1286
+ }) : o === Se.PDF && (et.value = o, tt.value = b.index, re.value = !0);
1287
+ }
1288
+ })), Tt = W.value.type === y.Spacer ? "flat" : "outlined", Et = W.value.type === y.Spacer ? "p-0" : "p-16";
1289
+ return (o, z) => {
1290
+ const ce = V("FmTooltip"), Ce = V("FmSearch"), Dt = V("FmCheckbox"), Be = V("FmButton"), At = V("FmSelect"), zt = V("FmMenuItem"), Vt = V("FmMenu"), Pt = V("FmForm"), $t = V("FmCircularProgress"), Bt = V("FmCard");
1291
+ return E(), O(Bt, {
1292
+ ref_key: "tileCard",
1293
+ ref: _,
1294
+ class: Ve(`${wt.value} ${n(Et)}`),
1295
+ variant: n(Tt)
1296
+ }, {
1297
+ default: N(() => [
1298
+ $(_a, {
1299
+ modelValue: re.value,
1300
+ "onUpdate:modelValue": z[0] || (z[0] = (fe) => re.value = fe),
1301
+ "report-type": et.value,
1302
+ index: tt.value
1303
+ }, null, 8, ["modelValue", "report-type", "index"]),
1304
+ t.value ? (E(), O($t, { key: 1 })) : (E(), H("div", {
1305
+ key: 0,
1306
+ style: oe({ height: $e.value })
1307
+ }, [
1308
+ (E(), O(Mt(bt.value), {
1309
+ key: R.value,
1310
+ modelValue: Je.value,
1311
+ "onUpdate:modelValue": z[4] || (z[4] = (fe) => Je.value = fe)
1312
+ }, {
1313
+ menu: N(() => [
1314
+ $(Pt, { class: "flex items-center gap-2" }, {
1315
+ default: N(() => {
1316
+ var fe, at, lt, ot;
1317
+ return [
1318
+ $(ce, {
1319
+ variant: "plain",
1320
+ placement: "right",
1321
+ content: W.value.description,
1322
+ "hide-arrow": !0,
1323
+ disabled: !W.value.description
1324
+ }, {
1325
+ default: N(() => [
1326
+ S.value !== !1 ? (E(), H("p", {
1327
+ key: 0,
1328
+ style: oe({
1329
+ fontSize: L.value + "px",
1330
+ fontWeight: M.value ? "bold" : "normal",
1331
+ fontStyle: U.value ? "italic" : "normal",
1332
+ textDecoration: h.value ? "underline" : "none"
1333
+ }),
1334
+ class: Ve(["text-fm-color-typo-secondary line-clamp-1", [
1335
+ L.value <= 18 ? "fm-typo-en-body-md-400" : "",
1336
+ W.value.description ? "border-b-2 border-dashed border-gray-300" : ""
1337
+ ]])
1338
+ }, xe(n(ve)(n(k), n(x), W.value.title, "other")), 7)) : ue("", !0)
1339
+ ]),
1340
+ _: 1
1341
+ }, 8, ["content", "disabled"]),
1342
+ (fe = Ee.value) != null && fe.showSearchBar ? (E(), O(Ce, {
1343
+ key: 0,
1344
+ modelValue: K.value,
1345
+ "onUpdate:modelValue": z[1] || (z[1] = (Z) => K.value = Z),
1346
+ class: "grow"
1347
+ }, null, 8, ["modelValue"])) : (E(), H("div", ka)),
1348
+ Nt($(Dt, {
1349
+ modelValue: F.value,
1350
+ "onUpdate:modelValue": z[2] || (z[2] = (Z) => F.value = Z),
1351
+ label: "Label",
1352
+ value: !1
1353
+ }, null, 8, ["modelValue"]), [
1354
+ [It, (at = Ee.value) == null ? void 0 : at.showLabel]
1355
+ ]),
1356
+ (lt = Ee.value) != null && lt.showDrillDimension && ie.value.length > 0 ? (E(), H("div", Ra, [
1357
+ $(Be, {
1358
+ icon: "arrow_upward",
1359
+ variant: "tertiary",
1360
+ disabled: !i.value,
1361
+ onClick: Rt
1362
+ }, null, 8, ["disabled"]),
1363
+ $(Be, {
1364
+ icon: "arrow_downward",
1365
+ variant: "tertiary",
1366
+ disabled: !r.value,
1367
+ onClick: Ft
1368
+ }, null, 8, ["disabled"])
1369
+ ])) : ue("", !0),
1370
+ (ot = Ee.value) != null && ot.showRollup && Ke.value.length > 0 ? (E(), O(At, {
1371
+ key: 3,
1372
+ modelValue: g.value,
1373
+ "onUpdate:modelValue": z[3] || (z[3] = (Z) => g.value = Z),
1374
+ class: "w-[150px]",
1375
+ items: Ke.value
1376
+ }, null, 8, ["modelValue", "items"])) : ue("", !0),
1377
+ b.hideExport ? ue("", !0) : (E(), O(Vt, {
1378
+ key: 4,
1379
+ shift: !0
1380
+ }, {
1381
+ "menu-button": N(() => [
1382
+ $(Be, {
1383
+ icon: "more_vert",
1384
+ variant: "tertiary"
1385
+ })
1386
+ ]),
1387
+ default: N(() => [
1388
+ (E(!0), H(le, null, dt(n(Lt), (Z) => (E(), O(zt, {
1389
+ key: Z.value,
1390
+ label: Z.label,
1391
+ onClick: Z.onClick
1392
+ }, null, 8, ["label", "onClick"]))), 128))
1393
+ ]),
1394
+ _: 1
1395
+ }))
1396
+ ];
1397
+ }),
1398
+ _: 1
1399
+ })
1400
+ ]),
1401
+ _: 1
1402
+ }, 8, ["modelValue"]))
1403
+ ], 4))
1404
+ ]),
1405
+ _: 1
1406
+ }, 8, ["class", "variant"]);
1407
+ };
1408
+ }
1409
+ });
1410
+ export {
1411
+ Ne as L,
1412
+ Q as R,
1413
+ $a as _,
1414
+ Me as a,
1415
+ He as g,
1416
+ ut as u
1417
+ };