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