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

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