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