@feedmepos/mf-report 5.5.22 → 5.6.0-beta.1

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