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