@feedmepos/mf-report 5.5.7 → 5.5.8-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/{App-qa6zFB9s.js → App-DkaM-Aez.js} +42 -42
  2. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-C3Dsnzzo.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-CN3UKRaQ.js} +2 -2
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-DS2nqwnE.js → Default.vue_vue_type_script_setup_true_lang-CRgwwEyI.js} +2 -2
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-B2WDEV5d.js +1074 -0
  5. package/dist/{InsightView-CgHLb0pj.js → InsightView-CmffFVNv.js} +6 -6
  6. package/dist/{Integration-BO0D13Xt.js → Integration-CoavOChV.js} +426 -414
  7. package/dist/{Integrations-RluH7jrn.js → Integrations-B6ACZi86.js} +3 -3
  8. package/dist/{Layout-CECk1b5N.js → Layout-CH61R47c.js} +1 -1
  9. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-BYwi5VE5.js → MenuTab.vue_vue_type_script_setup_true_lang-CYsvYTx4.js} +3 -3
  10. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-znAW5Z5k.js → NavigationTab.vue_vue_type_script_setup_true_lang-D0H54ZrA.js} +4582 -4506
  11. package/dist/{NoData.vue_vue_type_script_setup_true_lang-CCA1l-Cz.js → NoData.vue_vue_type_script_setup_true_lang-DI4X_DSc.js} +1 -1
  12. package/dist/{OverviewView-e8IwyK0m.js → OverviewView-CO9DYn6t.js} +5 -5
  13. package/dist/{Report-D5XMD7os.js → Report-rFc95Wze.js} +4 -4
  14. package/dist/{ReportEditor-CSe2hGVY.js → ReportEditor-i4dZSYts.js} +5 -5
  15. package/dist/{ReportView-DNRVEan8.js → ReportView-BnpPbQ6_.js} +7 -7
  16. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-CXYvLXnR.js → SelectComponent.vue_vue_type_script_setup_true_lang-BVs1C4af.js} +1 -1
  17. package/dist/{Setting-BrrYHtcH.js → Setting-Brlnee4y.js} +4 -4
  18. package/dist/TileEditor-DEXkjB7w.js +2514 -0
  19. package/dist/{TransitionFade-CbLx4cDT.js → TransitionFade-BP5asrDn.js} +4 -4
  20. package/dist/app.js +62 -11
  21. package/dist/{global-loader-KvOGLx9k.js → global-loader-BqFQzk46.js} +1 -1
  22. package/dist/{index-CW2xYO89.js → index-DqqTHE7n.js} +1 -1
  23. package/dist/{report-schema-Zw8e6-XZ.js → report-schema-OJAFh4P6.js} +1 -1
  24. package/dist/{v4-BX252AtO.js → v4-Dzkr7vpG.js} +1 -1
  25. package/package.json +1 -1
  26. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-avbAHnBZ.js +0 -1005
  27. package/dist/TileEditor-BoC9U9El.js +0 -2332
@@ -0,0 +1,1074 @@
1
+ import { computed as u, defineComponent as O, useModel as X, ref as g, resolveComponent as x, createElementBlock as L, openBlock as b, Fragment as W, renderSlot as E, createVNode as D, unref as C, createElementVNode as T, toDisplayString as ee, withCtx as V, createBlock as $, createCommentVNode as K, normalizeClass as ie, normalizeStyle as Ie, h as Be, renderList as Ne, mergeModels as ua, watch as ne, onMounted as ca, onUnmounted as da, resolveDynamicComponent as ma, withDirectives as pa, vShow as fa } from "vue";
2
+ import { W as i, v as re, R as va, g as ha, d as ga, q as ba } from "./v4-Dzkr7vpG.js";
3
+ import { u as ye, b as We, a as we } from "./global-loader-BqFQzk46.js";
4
+ import { d as Pe } from "./index-DqqTHE7n.js";
5
+ import { storeToRefs as pe } from "pinia";
6
+ import { _ as ya } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
+ import { _ as Ae } from "./NoData.vue_vue_type_script_setup_true_lang-DI4X_DSc.js";
8
+ import { useBreakpoints as wa, useSnackbar as Ca } from "@feedmepos/ui-library";
9
+ var fe = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(fe || {}), I = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(I || {}), ve = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(ve || {}), he = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(he || {}), ge = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(ge || {}), be = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(be || {});
10
+ i.Circular, i.Table, i.BarChart, i.LineChart, i.StackBarChart, i.StackLineChart, i.Scorecard, i.Spacer;
11
+ const _a = [
12
+ {
13
+ type: i.Circular,
14
+ showLabel: !1,
15
+ // TODO: temporarily removed show label as it has no function
16
+ showDrillDimension: !0,
17
+ showRollup: !1,
18
+ showSearchBar: !1
19
+ },
20
+ {
21
+ type: i.Table,
22
+ showLabel: !1,
23
+ showDrillDimension: !0,
24
+ showRollup: !0,
25
+ showSearchBar: !0
26
+ },
27
+ {
28
+ type: i.BarChart,
29
+ showLabel: !1,
30
+ // TODO: temporarily removed show label as it has no function
31
+ showDrillDimension: !0,
32
+ showRollup: !1,
33
+ showSearchBar: !1
34
+ },
35
+ {
36
+ type: i.LineChart,
37
+ showLabel: !1,
38
+ // TODO: temporarily removed show label as it has no function
39
+ showDrillDimension: !0,
40
+ showRollup: !0,
41
+ showSearchBar: !1
42
+ },
43
+ {
44
+ type: i.StackBarChart,
45
+ showLabel: !1,
46
+ // TODO: temporarily removed show label as it has no function
47
+ showDrillDimension: !0,
48
+ showRollup: !0,
49
+ showSearchBar: !1
50
+ },
51
+ {
52
+ type: i.StackLineChart,
53
+ showLabel: !1,
54
+ // TODO: temporarily removed show label as it has no function
55
+ showDrillDimension: !0,
56
+ showRollup: !0,
57
+ showSearchBar: !1
58
+ },
59
+ {
60
+ type: i.Scorecard,
61
+ showLabel: !1,
62
+ showDrillDimension: !1,
63
+ showRollup: !1,
64
+ showSearchBar: !1
65
+ },
66
+ {
67
+ type: i.Spacer,
68
+ showLabel: !1,
69
+ showDrillDimension: !1,
70
+ showRollup: !1,
71
+ showSearchBar: !1
72
+ }
73
+ ];
74
+ function me(e) {
75
+ const a = [e.schemaName, e.name];
76
+ return "option" in e && e.option && a.push(e.option), "aggregation" in e && e.aggregation && a.push(e.aggregation), a.push(e.label.replace(/[^a-zA-Z0-9]/g, "")), a.join("_").toLowerCase();
77
+ }
78
+ function xa(e, a) {
79
+ switch (e) {
80
+ case i.BarChart:
81
+ case i.LineChart:
82
+ case i.StackBarChart:
83
+ case i.StackLineChart:
84
+ return Array.isArray(a == null ? void 0 : a.datasets) && Array.isArray(a == null ? void 0 : a.xAxis) && a.datasets.length > 0 && a.xAxis.length > 0;
85
+ case i.Table:
86
+ return Array.isArray(a == null ? void 0 : a.rows) && Array.isArray(a == null ? void 0 : a.columns) && a.rows.length > 0 && a.columns.length > 0;
87
+ case i.Circular:
88
+ return Array.isArray(a == null ? void 0 : a.datasets) && a.datasets.length > 0;
89
+ case i.Scorecard:
90
+ return !0;
91
+ case i.Spacer:
92
+ return !0;
93
+ }
94
+ }
95
+ const Me = [
96
+ "54, 162, 235",
97
+ //8CE6D7
98
+ "0, 123, 167",
99
+ //007BA7
100
+ "255, 93, 83",
101
+ //FF5D53
102
+ "115, 200, 230",
103
+ //73C8E6
104
+ "252, 162, 62",
105
+ //FCA23E
106
+ "240, 155, 190",
107
+ //F09BBE
108
+ "255, 210, 50",
109
+ //FFD232
110
+ "80, 190, 155",
111
+ //50BE9B
112
+ "131, 88, 212",
113
+ //8358D4
114
+ "155, 80, 70"
115
+ //9B5046
116
+ ];
117
+ function ae({
118
+ index: e,
119
+ isCompare: a,
120
+ opacity: o
121
+ }) {
122
+ let s = typeof o == "number" ? o : 1;
123
+ return a && (s = s * 0.6), `rgba(${Me[e % Me.length]}, ${s})`;
124
+ }
125
+ function Oe(e, a, o) {
126
+ if (e === "" || a === "")
127
+ return null;
128
+ let s = (v) => v == null ? void 0 : v.replace(/,/g, "");
129
+ o === "ID" && (s = (v) => v == null ? void 0 : v.replace(/\./g, "").replace(/,/g, "."));
130
+ const r = Number(s(e)), y = Number(s(a));
131
+ if (isNaN(r) || isNaN(y))
132
+ return null;
133
+ let p = 0;
134
+ y === 0 ? r === 0 ? p = 0 : p = 1 : p = (r - y) / y;
135
+ const f = ka(p);
136
+ return {
137
+ value: isNaN(p) ? "" : `${(p * 100).toFixed(0)}%`,
138
+ icon: f
139
+ };
140
+ }
141
+ function ka(e) {
142
+ return e > 0 ? {
143
+ name: "moving",
144
+ color: "#1F7735",
145
+ tailwind: "fm-color-system-success-100"
146
+ } : e < 0 ? {
147
+ name: "trending_down",
148
+ color: "#99231D",
149
+ tailwind: "fm-color-system-error-100"
150
+ } : {
151
+ name: "equal",
152
+ color: "#C7C7CC",
153
+ tailwind: "fm-color-neutral-gray-100"
154
+ };
155
+ }
156
+ function te(e) {
157
+ const a = u(() => ({
158
+ display: e.showLabel,
159
+ align: e.labelAlign,
160
+ anchor: e.labelAnchor,
161
+ rotation: e.labelRotation,
162
+ offset: e.labelOffset,
163
+ font: {
164
+ size: e.labelFontSize
165
+ }
166
+ })), o = u(() => ({
167
+ display: e.showX,
168
+ position: e.xPosition,
169
+ grid: {
170
+ display: e.showXGrid
171
+ },
172
+ ticks: {
173
+ display: e.showXTick,
174
+ font: {
175
+ size: e.xTickFontSize
176
+ }
177
+ }
178
+ })), s = u(() => ({
179
+ display: e.showY,
180
+ position: e.yPosition,
181
+ grid: {
182
+ display: e.showYGrid
183
+ },
184
+ ticks: {
185
+ display: e.showYTick,
186
+ font: {
187
+ size: e.yTickFontSize
188
+ }
189
+ }
190
+ })), r = u(() => e.isTransposed);
191
+ return { datalabels: a, xCfg: o, yCfg: s, isTransposed: r };
192
+ }
193
+ const Sa = /* @__PURE__ */ O({
194
+ __name: "WidgetBarchart",
195
+ props: {
196
+ modelValue: { required: !0 },
197
+ modelModifiers: {}
198
+ },
199
+ emits: ["update:modelValue"],
200
+ setup(e) {
201
+ const a = X(e, "modelValue"), o = u(() => {
202
+ var d;
203
+ return ((d = a.value.data) == null ? void 0 : d.xAxis) ?? [];
204
+ }), s = u(() => {
205
+ var d;
206
+ return ((d = a.value.data) == null ? void 0 : d.datasets) ?? [];
207
+ }), r = g(null), { datalabels: y, xCfg: p, yCfg: f, isTransposed: v } = te(a.value), n = u(() => s.value.length > 0 ? [
208
+ ...s.value.map((d, c) => ({
209
+ label: d.name,
210
+ data: d.values,
211
+ dash: !!d.isCompare,
212
+ backgroundColor: ae({ index: c, isCompare: d.isCompare })
213
+ }))
214
+ ] : []);
215
+ return (d, c) => {
216
+ const R = x("FmBarChart");
217
+ return b(), L(W, null, [
218
+ E(d.$slots, "menu"),
219
+ D(R, {
220
+ ref_key: "chartRef",
221
+ ref: r,
222
+ class: "bar-chart",
223
+ datasets: n.value,
224
+ "x-axis": { categories: o.value },
225
+ xCfg: C(p),
226
+ yCfg: C(f),
227
+ transpose: C(v),
228
+ legend: {
229
+ display: !1,
230
+ position: "bottom",
231
+ maxHeight: 54,
232
+ labels: {
233
+ usePointStyle: !0
234
+ }
235
+ },
236
+ datalabels: C(y),
237
+ "maintain-aspect-ratio": !1
238
+ }, null, 8, ["datasets", "x-axis", "xCfg", "yCfg", "transpose", "datalabels"])
239
+ ], 64);
240
+ };
241
+ }
242
+ }), Fa = /* @__PURE__ */ O({
243
+ __name: "WidgetCircular",
244
+ props: {
245
+ modelValue: { required: !0 },
246
+ modelModifiers: {}
247
+ },
248
+ emits: ["update:modelValue"],
249
+ setup(e) {
250
+ const a = X(e, "modelValue"), { datalabels: o } = te(a.value), s = u(() => {
251
+ let r = [];
252
+ return a.value.data.datasets && a.value.data.metrics && a.value.data.datasets.length > 0 && a.value.data.metrics.length > 0 && (r = [
253
+ {
254
+ label: a.value.data.metrics[0],
255
+ data: a.value.data.datasets.map((y) => y.value),
256
+ backgroundColor: a.value.data.datasets.map((y, p) => ae({ index: p }))
257
+ }
258
+ ]), r;
259
+ });
260
+ return (r, y) => {
261
+ const p = x("FmPieChart");
262
+ return b(), L(W, null, [
263
+ E(r.$slots, "menu"),
264
+ D(p, {
265
+ class: "circular",
266
+ percentage: "70%",
267
+ datasets: s.value,
268
+ metrics: a.value.data.datasets.map((f) => f.name),
269
+ variant: "doughnut",
270
+ legend: {
271
+ display: !0,
272
+ position: "top",
273
+ maxHeight: 54,
274
+ labels: {
275
+ usePointStyle: !0
276
+ }
277
+ },
278
+ datalabels: C(o),
279
+ "maintain-aspect-ratio": !1
280
+ }, null, 8, ["datasets", "metrics", "datalabels"])
281
+ ], 64);
282
+ };
283
+ }
284
+ }), Ta = { class: "flex flex-col gap-1" }, Da = { class: "fm-typo-en-title-sm-600" }, La = { class: "flex gap-2" }, Ra = { key: 0 }, $a = { key: 1 }, Va = /* @__PURE__ */ O({
285
+ __name: "WidgetScorecard",
286
+ props: {
287
+ modelValue: { required: !0 },
288
+ modelModifiers: {}
289
+ },
290
+ emits: ["update:modelValue"],
291
+ setup(e) {
292
+ const a = X(e, "modelValue"), { t: o } = ye(), { compareDateRange: s, defaultDateSetting: r } = pe(We()), { country: y } = we(), p = u(() => {
293
+ var c;
294
+ return ((c = a.value.data) == null ? void 0 : c.value) || "";
295
+ }), f = u(() => {
296
+ const { data: c } = a.value;
297
+ return c != null && c.comparison ? Oe(p.value, c.comparison, y) : null;
298
+ });
299
+ function v(c) {
300
+ switch (c) {
301
+ case fe.bar:
302
+ return "bar";
303
+ case fe.line:
304
+ return "line";
305
+ default:
306
+ return "line";
307
+ }
308
+ }
309
+ const n = u(() => {
310
+ var c;
311
+ return (c = a.value.data) == null ? void 0 : c.sparkline;
312
+ }), d = u(() => n.value.datasets.map((c) => ({
313
+ label: c.name,
314
+ data: c.values,
315
+ fill: !0,
316
+ color: "#36a2eb"
317
+ })));
318
+ return (c, R) => {
319
+ var m;
320
+ const q = x("FmIcon"), z = x("FmChip"), U = x("FmTooltip"), t = x("FmLineChart");
321
+ return b(), L("div", Ta, [
322
+ E(c.$slots, "menu"),
323
+ T("p", Da, ee(p.value), 1),
324
+ T("div", La, [
325
+ D(U, {
326
+ content: `vs. ${(m = C(r).defaultCompareType) == null ? void 0 : m.split("_").join(" ")}`,
327
+ placement: "right",
328
+ "hide-arrow": "",
329
+ variant: "plain"
330
+ }, {
331
+ default: V(() => [
332
+ f.value ? (b(), $(z, {
333
+ key: 0,
334
+ icon: f.value.icon.name,
335
+ class: ie(`bg-${f.value.icon.tailwind}`),
336
+ compact: ""
337
+ }, {
338
+ default: V(() => [
339
+ D(q, {
340
+ name: f.value.icon.name,
341
+ color: f.value.icon.color
342
+ }, null, 8, ["name", "color"]),
343
+ T("p", {
344
+ class: "fm-typo-en-body-md-600",
345
+ style: Ie({ color: f.value.icon.color })
346
+ }, ee(f.value.value), 5)
347
+ ]),
348
+ _: 1
349
+ }, 8, ["icon", "class"])) : K("", !0),
350
+ C(s).endDate !== null && C(s).startDate !== null && f.value === null ? (b(), $(z, {
351
+ key: 1,
352
+ compact: ""
353
+ }, {
354
+ default: V(() => [
355
+ D(q, {
356
+ name: "arrow_upward",
357
+ color: "#C7C7CC"
358
+ }),
359
+ R[0] || (R[0] = T("p", { class: "fm-typo-en-body-md-600 text-fm-color-typo-disabled" }, "N/A", -1))
360
+ ]),
361
+ _: 1
362
+ })) : K("", !0)
363
+ ]),
364
+ _: 1
365
+ }, 8, ["content"])
366
+ ]),
367
+ n.value ? (b(), L("div", Ra, [
368
+ v(n.value.type) === "line" ? (b(), $(t, {
369
+ key: 0,
370
+ class: "sparkline",
371
+ datasets: d.value,
372
+ legend: {
373
+ display: !1
374
+ },
375
+ datalabels: { display: !1 },
376
+ "x-axis": { categories: n.value.dimensions },
377
+ yCfg: { display: !1 },
378
+ xCfg: { display: !1 },
379
+ "maintain-aspect-ratio": !1
380
+ }, null, 8, ["datasets", "x-axis"])) : K("", !0)
381
+ ])) : (b(), L("div", $a, R[1] || (R[1] = [
382
+ T("div", { class: "sparkline" }, [
383
+ T("div", { class: "flex flex-col gap-8" }, [
384
+ T("div"),
385
+ T("div")
386
+ ]),
387
+ T("div", { class: "grow" })
388
+ ], -1)
389
+ ])))
390
+ ]);
391
+ };
392
+ }
393
+ }), za = {};
394
+ function Ba(e, a) {
395
+ const o = x("FmMenuDivider");
396
+ return b(), $(o);
397
+ }
398
+ const Pa = /* @__PURE__ */ ya(za, [["render", Ba]]), Aa = { class: "my-4" }, Ma = {
399
+ class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
400
+ style: { backgroundColor: "#f9f9f9" }
401
+ }, Ia = { class: "font-bold" }, Na = { class: "text-fm-color-neutral-gray-300" }, Wa = /* @__PURE__ */ O({
402
+ __name: "WidgetTable",
403
+ props: {
404
+ modelValue: { required: !0 },
405
+ modelModifiers: {}
406
+ },
407
+ emits: ["update:modelValue"],
408
+ setup(e) {
409
+ const { t: a } = ye(), o = X(e, "modelValue"), { country: s } = we(), r = g(null), y = u(() => {
410
+ var t;
411
+ return ((t = o.value.data) == null ? void 0 : t.columns) || [{ label: "", key: "" }];
412
+ }), p = u(() => {
413
+ var t;
414
+ return ((t = o.value.data) == null ? void 0 : t.rows) || [];
415
+ }), f = u(() => o.value.filterText), v = u(() => {
416
+ var t, m;
417
+ if (!(f.value && f.value.trim().length > 0 || !((t = p.value[0]) != null && t.isRollup) && !((m = p.value[p.value.length - 1]) != null && m.isRollup))) {
418
+ if (o.value.rollupPosition === I.top || o.value.rollupPosition === void 0)
419
+ return I.top;
420
+ if (o.value.rollupPosition === I.bottom)
421
+ return I.bottom;
422
+ }
423
+ }), n = u(() => {
424
+ const h = v.value !== void 0 ? 1 : 0, S = (r.value ? r.value.$el.offsetHeight : 0) - 48;
425
+ return Math.floor((S - 34.5 - 32) / 48) - h;
426
+ }), d = u(() => {
427
+ var m, _;
428
+ let t = [];
429
+ switch (v.value) {
430
+ case I.top:
431
+ t = [...((m = p.value[0]) == null ? void 0 : m.cells) || []].map((h, S) => {
432
+ var F;
433
+ return {
434
+ main: h,
435
+ comparison: (F = p.value[0]) == null ? void 0 : F.comparisonCells[S],
436
+ rowType: y.value[S].type
437
+ };
438
+ });
439
+ break;
440
+ case I.bottom:
441
+ t = [...((_ = p.value[p.value.length - 1]) == null ? void 0 : _.cells) || []].map((h, S) => {
442
+ var F;
443
+ return {
444
+ main: h,
445
+ comparison: (F = p.value[0]) == null ? void 0 : F.comparisonCells[S],
446
+ rowType: y.value[S].type
447
+ };
448
+ });
449
+ break;
450
+ }
451
+ return t.length > 0 && t[0].main === "" && (t[0].main = "Grand total"), t;
452
+ });
453
+ function c(t) {
454
+ const m = {};
455
+ for (let _ = 0; _ < y.value.length; _++)
456
+ if (y.value[_].key !== "") {
457
+ const h = t.comparisonCells[_];
458
+ m[y.value[_].key] = {
459
+ main: t.cells[_],
460
+ comparison: h
461
+ }, m.isRollup = t.isRollup;
462
+ }
463
+ return m;
464
+ }
465
+ function R(t) {
466
+ return [...new Array(t < 0 ? 0 : t)].map(() => {
467
+ var _;
468
+ const m = {};
469
+ if ((_ = o.value.data) != null && _.columns)
470
+ for (let h = 0; h < o.value.data.columns.length; h++)
471
+ m[o.value.data.columns[h].key] = void 0;
472
+ return m;
473
+ });
474
+ }
475
+ function q(t) {
476
+ let m = (t == null ? void 0 : t.main) || "";
477
+ return m.includes("#") && !m.startsWith("#") && (m = m.split("#")[0]), !t || t.main === "" || t.comparison === "" ? {
478
+ main: m
479
+ } : {
480
+ main: m,
481
+ comparison: t == null ? void 0 : t.comparison,
482
+ difference: Oe(t.main, t.comparison, s)
483
+ };
484
+ }
485
+ const z = u(() => {
486
+ var S, F, Y;
487
+ let t = ((S = o.value.data) == null ? void 0 : S.rows) || [];
488
+ switch (v.value) {
489
+ case I.bottom:
490
+ t = (F = t[t.length - 1]) != null && F.isRollup ? t.slice(0, -1) : t;
491
+ break;
492
+ case I.top:
493
+ t = (Y = t[0]) != null && Y.isRollup ? t.slice(1, t.length) : t;
494
+ break;
495
+ }
496
+ const m = t.filter((B) => !(f.value !== "" && (B.isRollup === !0 || !B.cells.some(
497
+ (P) => {
498
+ var N;
499
+ return ((P == null ? void 0 : P.toLowerCase()) || "").includes((N = f.value) == null ? void 0 : N.toLowerCase());
500
+ }
501
+ )))).map((B) => c(B)), _ = m.length % n.value;
502
+ let h = 0;
503
+ return _ > 0 ? h = Math.abs(_ - n.value) : m.length === 0 && (h = n.value), m.push(...R(h)), m;
504
+ }), U = u(() => {
505
+ var m;
506
+ let t = [];
507
+ return (m = o.value.data) != null && m.columns && (t = [...o.value.data.columns.map((h) => {
508
+ const S = h.label;
509
+ return {
510
+ accessorKey: h.key,
511
+ header: () => Be(
512
+ "p",
513
+ {
514
+ class: `min-w-[110px] w-full text-nowrap ${h.type === "NUMERIC" ? "text-right" : ""}`
515
+ },
516
+ S
517
+ ),
518
+ cell: (F) => {
519
+ var P, N;
520
+ const Y = q(F.getValue()), B = (N = (P = F == null ? void 0 : F.row) == null ? void 0 : P.original) == null ? void 0 : N.isRollup;
521
+ return Be(
522
+ "div",
523
+ {
524
+ class: `${B ? "fm-typo-en-body-md-600 text-fm-color-typo-secondary" : "fm-typo-en-body-md-400"} ${h.type === "NUMERIC" ? "text-right" : ""} text-nowrap whitespace-pre`
525
+ },
526
+ [Y.main]
527
+ );
528
+ },
529
+ meta: () => ({
530
+ cellClass: "subtotal-row"
531
+ }),
532
+ enableSorting: !1
533
+ };
534
+ })]), t;
535
+ });
536
+ return (t, m) => {
537
+ const _ = x("FmTable");
538
+ return b(), L(W, null, [
539
+ T("div", Aa, [
540
+ E(t.$slots, "menu")
541
+ ]),
542
+ D(_, {
543
+ ref_key: "table",
544
+ ref: r,
545
+ "column-defs": U.value,
546
+ "row-data": z.value,
547
+ "search-value": f.value,
548
+ "page-size": n.value,
549
+ "shrink-at": !1,
550
+ "force-mobile-footer": !0,
551
+ class: "scrollbar-hide-table"
552
+ }, {
553
+ "pin-top": V(() => [
554
+ T("tbody", null, [
555
+ T("tr", Ma, [
556
+ (b(!0), L(W, null, Ne(d.value, (h, S) => (b(), L("td", {
557
+ key: `${C(re)()}_${S}`,
558
+ class: "h-[48px] text-fm-color-typo-primary px-16"
559
+ }, [
560
+ T("span", {
561
+ class: ie(`items-center text-fm-color-typo-secondary gap-2 line-clamp-2 text-ellipsis ${h.rowType === "NUMERIC" ? "text-right" : ""}`)
562
+ }, [
563
+ T("p", Ia, ee(h.main), 1),
564
+ T("p", Na, ee(h.comparison ? `(${h.comparison})` : ""), 1)
565
+ ], 2)
566
+ ]))), 128))
567
+ ])
568
+ ])
569
+ ]),
570
+ _: 1
571
+ }, 8, ["column-defs", "row-data", "search-value", "page-size"])
572
+ ], 64);
573
+ };
574
+ }
575
+ }), Oa = /* @__PURE__ */ O({
576
+ __name: "WidgetStackBarChart",
577
+ props: {
578
+ modelValue: { required: !0 },
579
+ modelModifiers: {}
580
+ },
581
+ emits: ["update:modelValue"],
582
+ setup(e) {
583
+ const a = X(e, "modelValue"), o = u(() => {
584
+ var c;
585
+ return ((c = a.value.data) == null ? void 0 : c.xAxis) || [];
586
+ }), s = u(() => {
587
+ var d;
588
+ return ((d = a.value.data) == null ? void 0 : d.datasets) ?? [];
589
+ }), r = g(null), { datalabels: y, xCfg: p, yCfg: f, isTransposed: v } = te(a.value), n = u(() => s.value.length > 0 ? [
590
+ ...s.value.map((d, c) => {
591
+ let R = d.values;
592
+ return {
593
+ label: d.name,
594
+ data: R,
595
+ dash: !!d.isCompare,
596
+ backgroundColor: ae({ index: c, isCompare: d.isCompare })
597
+ };
598
+ })
599
+ ] : []);
600
+ return (d, c) => {
601
+ const R = x("FmBarChart");
602
+ return b(), L(W, null, [
603
+ E(d.$slots, "menu"),
604
+ D(R, {
605
+ ref_key: "chartRef",
606
+ ref: r,
607
+ class: "bar-chart",
608
+ datasets: n.value,
609
+ "x-axis": { categories: o.value },
610
+ xCfg: C(p),
611
+ yCfg: C(f),
612
+ transpose: C(v),
613
+ stacked: !0,
614
+ legend: {
615
+ display: !1,
616
+ position: "bottom",
617
+ maxHeight: 54,
618
+ labels: {
619
+ usePointStyle: !0
620
+ }
621
+ },
622
+ datalabels: C(y),
623
+ "maintain-aspect-ratio": !1
624
+ }, null, 8, ["datasets", "x-axis", "xCfg", "yCfg", "transpose", "datalabels"])
625
+ ], 64);
626
+ };
627
+ }
628
+ }), Xa = /* @__PURE__ */ O({
629
+ __name: "WidgetStackLineChart",
630
+ props: {
631
+ modelValue: { required: !0 },
632
+ modelModifiers: {}
633
+ },
634
+ emits: ["update:modelValue"],
635
+ setup(e) {
636
+ const a = X(e, "modelValue"), o = u(() => {
637
+ var n;
638
+ return ((n = a.value.data) == null ? void 0 : n.xAxis) ?? [];
639
+ }), s = u(() => {
640
+ var n;
641
+ return ((n = a.value.data) == null ? void 0 : n.datasets) ?? [];
642
+ }), { datalabels: r, xCfg: y, yCfg: p, isTransposed: f } = te(a.value), v = u(() => s.value.length > 0 ? [
643
+ ...s.value.map((n, d) => {
644
+ let c = n.values;
645
+ return {
646
+ label: n.name,
647
+ data: c,
648
+ dash: n.isCompare,
649
+ fill: !1,
650
+ color: ae({ index: d, isCompare: n.isCompare })
651
+ };
652
+ })
653
+ ] : []);
654
+ return (n, d) => {
655
+ const c = x("FmLineChart");
656
+ return b(), L(W, null, [
657
+ E(n.$slots, "menu"),
658
+ D(c, {
659
+ class: "line-chart",
660
+ datasets: v.value,
661
+ "x-axis": { categories: o.value },
662
+ xCfg: C(y),
663
+ yCfg: C(p),
664
+ transpose: C(f),
665
+ legend: {
666
+ display: !1,
667
+ position: "bottom",
668
+ maxHeight: 54,
669
+ labels: {
670
+ usePointStyle: !0
671
+ }
672
+ },
673
+ stacked: !0,
674
+ datalabels: C(r),
675
+ "maintain-aspect-ratio": !1
676
+ }, null, 8, ["datasets", "x-axis", "xCfg", "yCfg", "transpose", "datalabels"])
677
+ ], 64);
678
+ };
679
+ }
680
+ }), Q = [
681
+ "col-span-1",
682
+ "col-span-2",
683
+ "col-span-3",
684
+ "col-span-4",
685
+ "col-span-5",
686
+ "col-span-6",
687
+ "col-span-7",
688
+ "col-span-8",
689
+ "col-span-9",
690
+ "col-span-10",
691
+ "col-span-11",
692
+ "col-span-12"
693
+ ];
694
+ function Ya(e) {
695
+ return e < 12 ? Q[e - 1] : Q[11];
696
+ }
697
+ function Ga(e) {
698
+ return e < 12 ? Q[Math.min(11, e * 2 - 1)] : Q[11];
699
+ }
700
+ function Ha(e) {
701
+ return e < 12 ? Q[Math.min(11, e * 3 - 1)] : Q[11];
702
+ }
703
+ const Ea = /* @__PURE__ */ O({
704
+ __name: "WidgetLinechart",
705
+ props: {
706
+ modelValue: { required: !0 },
707
+ modelModifiers: {}
708
+ },
709
+ emits: ["update:modelValue"],
710
+ setup(e) {
711
+ const a = X(e, "modelValue"), o = u(() => {
712
+ var n;
713
+ return ((n = a.value.data) == null ? void 0 : n.xAxis) ?? [];
714
+ }), s = u(() => {
715
+ var n;
716
+ return ((n = a.value.data) == null ? void 0 : n.datasets) ?? [];
717
+ }), { datalabels: r, xCfg: y, yCfg: p, isTransposed: f } = te(a.value), v = u(() => s.value.length > 0 ? [
718
+ ...s.value.map((n, d) => ({
719
+ label: n.name,
720
+ data: n.values,
721
+ dash: !!n.isCompare,
722
+ fill: !1,
723
+ color: ae({ index: d, isCompare: n.isCompare })
724
+ }))
725
+ ] : []);
726
+ return (n, d) => {
727
+ const c = x("FmLineChart");
728
+ return b(), L(W, null, [
729
+ E(n.$slots, "menu"),
730
+ D(c, {
731
+ class: "line-chart",
732
+ datasets: v.value,
733
+ "x-axis": { categories: o.value },
734
+ xCfg: C(y),
735
+ yCfg: C(p),
736
+ transpose: C(f),
737
+ legend: {
738
+ display: !1,
739
+ position: "bottom",
740
+ maxHeight: 54,
741
+ labels: {
742
+ usePointStyle: !0
743
+ }
744
+ },
745
+ datalabels: C(r),
746
+ "maintain-aspect-ratio": !1
747
+ }, null, 8, ["datasets", "x-axis", "xCfg", "yCfg", "transpose", "datalabels"])
748
+ ], 64);
749
+ };
750
+ }
751
+ }), qa = {
752
+ key: 1,
753
+ class: "grow"
754
+ }, Ua = {
755
+ key: 2,
756
+ class: "flex"
757
+ }, lt = /* @__PURE__ */ O({
758
+ __name: "DynamicWidget",
759
+ props: /* @__PURE__ */ ua({
760
+ index: {
761
+ type: Number,
762
+ default: 0
763
+ },
764
+ hideExport: {
765
+ type: Boolean,
766
+ default: !1
767
+ }
768
+ }, {
769
+ modelValue: { required: !0, default: () => {
770
+ } },
771
+ modelModifiers: {}
772
+ }),
773
+ emits: ["update:modelValue"],
774
+ setup(e) {
775
+ const a = g(!0), o = X(e, "modelValue"), s = o.value.widget.config, r = (l, w) => l ?? w, { t: y } = ye(), p = e, f = g(null), v = g(s.rollup), n = g(re()), d = g(s.drillDimension), c = u(() => {
776
+ if (G.value.length > 0) {
777
+ const l = G.value.findIndex(
778
+ (w) => w.value === d.value
779
+ );
780
+ return l >= 0 ? l : 0;
781
+ } else
782
+ return -1;
783
+ }), R = u(() => c.value !== 0), q = u(
784
+ () => c.value != G.value.length - 1
785
+ ), z = g(r(s.showLabel, !1)), U = g(r(s.labelAlign, he.center)), t = g(r(s.labelAnchor, ve.center)), m = g(r(s.labelRotation, 0)), _ = g(r(s.labelOffset, 0)), h = g(r(s.labelFontSize, 12)), S = u(() => s.showSearchBar), F = g(r(s.showX, !0)), Y = g(r(s.xPosition, ge.bottom)), B = g(r(s.showXGrid, !1)), P = g(r(s.showXTick, !0)), N = g(r(s.xTickFontSize, 12)), Ce = g(r(s.showY, !0)), _e = g(r(s.yPosition, be.left)), xe = g(r(s.showYGrid, !1)), ke = g(r(s.showYTick, !0)), Se = g(r(s.yTickFontSize, 12)), ue = g(""), { breakpoints: A } = wa(), Fe = g(), Xe = u(() => A.value.lg || A.value.md ? Ya(o.value.size.width) : A.value.sm ? Ga(o.value.size.width) : Ha(o.value.size.width)), le = u(
786
+ () => _a.find((l) => l.type === o.value.widget.type)
787
+ ), j = Pe(() => {
788
+ var l;
789
+ Fe.value = Je((l = f.value) == null ? void 0 : l.$el.offsetWidth), n.value = re();
790
+ }), Ye = u(() => {
791
+ if (xa(k.value.type, J.value))
792
+ switch (o.value.widget.type) {
793
+ case i.BarChart:
794
+ return Sa;
795
+ case i.StackBarChart:
796
+ return Oa;
797
+ case i.LineChart:
798
+ return Ea;
799
+ case i.StackLineChart:
800
+ return Xa;
801
+ case i.Circular:
802
+ return Fa;
803
+ case i.Scorecard:
804
+ return Va;
805
+ case i.Spacer:
806
+ return Pa;
807
+ case i.Table:
808
+ return Wa;
809
+ default:
810
+ return Ae;
811
+ }
812
+ else
813
+ return Ae;
814
+ }), J = g(null), { selectedLocationIds: ce, dateRange: Ge, compareDateRange: He, timeRange: Ee } = pe(We()), { businessId: qe } = pe(we()), k = u(() => {
815
+ const l = JSON.parse(JSON.stringify(o.value.widget));
816
+ return {
817
+ ...l,
818
+ config: {
819
+ ...l.config,
820
+ rollup: v.value,
821
+ drillDimension: d.value,
822
+ showGrandTotal: !1
823
+ }
824
+ };
825
+ });
826
+ function Ue() {
827
+ return {
828
+ data: J.value,
829
+ showLabel: z.value,
830
+ labelAnchor: t.value,
831
+ labelAlign: U.value,
832
+ labelRotation: m.value,
833
+ labelOffset: _.value,
834
+ labelFontSize: h.value,
835
+ showX: F.value,
836
+ xPosition: Y.value,
837
+ showXGrid: B.value,
838
+ showXTick: P.value,
839
+ xTickFontSize: N.value,
840
+ showY: Ce.value,
841
+ yPosition: _e.value,
842
+ showYGrid: xe.value,
843
+ showYTick: ke.value,
844
+ yTickFontSize: Se.value,
845
+ isTransposed: k.value.config.isTransposed
846
+ };
847
+ }
848
+ function je() {
849
+ return {
850
+ data: J.value,
851
+ filterText: ue.value,
852
+ rollupPosition: k.value.config.rollupPosition
853
+ };
854
+ }
855
+ const Te = u(() => {
856
+ switch (k.value.type) {
857
+ case i.Table:
858
+ return je();
859
+ case i.BarChart:
860
+ case i.LineChart:
861
+ case i.StackBarChart:
862
+ case i.StackLineChart:
863
+ case i.Circular:
864
+ return Ue();
865
+ default:
866
+ return { data: J.value };
867
+ }
868
+ }), De = u(() => {
869
+ const { config: l } = o.value.widget;
870
+ if (l.rollup != null) {
871
+ const w = [...l.dimensions].filter((H) => !H.hide);
872
+ return w.sort(
873
+ (H, Z) => (l.rowIds || []).indexOf(me(H)) - (l.rowIds || []).indexOf(me(Z))
874
+ ), [
875
+ { label: "None", value: null },
876
+ { label: "Grand Total", value: 0 },
877
+ ...[...w].slice(0, w.length - 1).map((H, Z) => ({ label: H.label, value: Z + 1 }))
878
+ ];
879
+ }
880
+ return [];
881
+ }), G = u(() => {
882
+ const { config: l } = k.value;
883
+ return l.isDrillable ? l.dimensions.map((w) => ({
884
+ label: w.label,
885
+ value: me(w)
886
+ })) : [];
887
+ });
888
+ ne(() => o.value.widget.config, (l) => {
889
+ v.value = l.rollup, z.value = l.showLabel ?? !1, U.value = l.labelAlign ?? he.center, t.value = l.labelAnchor ?? ve.center, m.value = l.labelRotation ?? 0, _.value = l.labelOffset ?? 0, h.value = l.labelFontSize ?? 12, F.value = l.showX ?? !0, Y.value = l.xPosition ?? ge.bottom, B.value = l.showXGrid ?? !1, P.value = l.showXTick ?? !0, N.value = l.xTickFontSize ?? 12, Ce.value = l.showY ?? !0, _e.value = l.yPosition ?? be.left, xe.value = l.showYGrid ?? !1, ke.value = l.showYTick ?? !0, Se.value = l.yTickFontSize ?? 12;
890
+ }, { deep: !0 }), ne([() => v.value], () => {
891
+ v.value !== null && (o.value.widget.config.rollup = v.value);
892
+ }), ne(
893
+ [
894
+ () => k.value,
895
+ () => Ge.value,
896
+ () => Ee.value,
897
+ () => He.value,
898
+ () => ce.value,
899
+ () => qe.value
900
+ ],
901
+ () => {
902
+ var l;
903
+ ce.value && ((l = ce.value) == null ? void 0 : l.length) > 0 && Re();
904
+ },
905
+ {
906
+ deep: !0
907
+ }
908
+ ), ne(
909
+ [() => o.value.size],
910
+ () => {
911
+ j();
912
+ },
913
+ { deep: !0 }
914
+ ), ca(() => {
915
+ j(), A.value.sm || A.value.md || A.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", j)) : addEventListener("resize", j), Re();
916
+ }), da(() => {
917
+ A.value.sm || A.value.md || A.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", j)) : removeEventListener("resize", j);
918
+ });
919
+ const Le = Ca();
920
+ let oe;
921
+ const Re = Pe(async function() {
922
+ if (k.value.config.schemaNames.length <= 0 && !(k.value.config.dimensions.length <= 0 || k.value.config.metrics.length <= 0)) {
923
+ Le.open({
924
+ message: "schema must not be empty and dimension or metrics must have at least 1 column",
925
+ type: "info"
926
+ }), a.value = !1;
927
+ return;
928
+ }
929
+ try {
930
+ a.value = !0, oe && oe.abort(), oe = new AbortController();
931
+ const w = oe.signal;
932
+ J.value = await ba(k.value, w), n.value = re(), a.value = !1;
933
+ } catch (w) {
934
+ J.value = null, w.code !== "ERR_CANCELED" && (Le.open({ message: `Invalid chart ${k.value.type}`, type: "error" }), console.log(w), a.value = !1);
935
+ }
936
+ });
937
+ function Je(l) {
938
+ switch (o.value.widget.type) {
939
+ case "SPACER":
940
+ return;
941
+ case "SCORECARD":
942
+ return;
943
+ case "TABLE":
944
+ return `${o.value.size.height * 100 + (S.value ? 72 : 0) + 96.5}px`;
945
+ }
946
+ return `${Math.max(l / o.value.size.width, 90) * o.value.size.height}px`;
947
+ }
948
+ function Ke() {
949
+ const l = c.value - 1;
950
+ l >= 0 && (d.value = G.value[l].value);
951
+ }
952
+ function Qe() {
953
+ const l = c.value + 1;
954
+ l >= 0 && l < G.value.length && (d.value = G.value[l].value);
955
+ }
956
+ const Ze = Object.values(va).map((l) => ({
957
+ label: ha(l),
958
+ value: l,
959
+ onClick: async () => {
960
+ await ga(l, p.index);
961
+ }
962
+ })), ea = k.value.type === i.Spacer ? "flat" : "outlined", aa = k.value.type === i.Spacer ? "p-0" : "p-16";
963
+ return (l, w) => {
964
+ const H = x("FmTooltip"), Z = x("FmSearch"), ta = x("FmCheckbox"), de = x("FmButton"), la = x("FmSelect"), oa = x("FmMenuItem"), sa = x("FmMenu"), na = x("FmForm"), ra = x("FmCircularProgress"), ia = x("FmCard");
965
+ return b(), $(ia, {
966
+ ref_key: "tileCard",
967
+ ref: f,
968
+ class: ie(`${Xe.value} ${C(aa)}`),
969
+ variant: C(ea)
970
+ }, {
971
+ default: V(() => [
972
+ a.value ? (b(), $(ra, { key: 1 })) : (b(), L("div", {
973
+ key: 0,
974
+ style: Ie({ height: Fe.value })
975
+ }, [
976
+ (b(), $(ma(Ye.value), {
977
+ key: n.value,
978
+ modelValue: Te.value,
979
+ "onUpdate:modelValue": w[3] || (w[3] = (se) => Te.value = se)
980
+ }, {
981
+ menu: V(() => [
982
+ D(na, { class: "flex items-center gap-2" }, {
983
+ default: V(() => {
984
+ var se, $e, Ve, ze;
985
+ return [
986
+ D(H, {
987
+ variant: "plain",
988
+ placement: "right",
989
+ content: k.value.description,
990
+ "hide-arrow": !0,
991
+ disabled: !k.value.description
992
+ }, {
993
+ default: V(() => [
994
+ T("p", {
995
+ class: ie(["fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary", `${k.value.description ? "border-b-2 border-dashed border-gray-300" : ""}`])
996
+ }, ee(k.value.title || " "), 3)
997
+ ]),
998
+ _: 1
999
+ }, 8, ["content", "disabled"]),
1000
+ (se = le.value) != null && se.showSearchBar ? (b(), $(Z, {
1001
+ key: 0,
1002
+ modelValue: ue.value,
1003
+ "onUpdate:modelValue": w[0] || (w[0] = (M) => ue.value = M),
1004
+ class: "grow"
1005
+ }, null, 8, ["modelValue"])) : (b(), L("div", qa)),
1006
+ pa(D(ta, {
1007
+ modelValue: z.value,
1008
+ "onUpdate:modelValue": w[1] || (w[1] = (M) => z.value = M),
1009
+ label: "Label",
1010
+ value: !1
1011
+ }, null, 8, ["modelValue"]), [
1012
+ [fa, ($e = le.value) == null ? void 0 : $e.showLabel]
1013
+ ]),
1014
+ (Ve = le.value) != null && Ve.showDrillDimension && G.value.length > 0 ? (b(), L("div", Ua, [
1015
+ D(de, {
1016
+ icon: "arrow_upward",
1017
+ variant: "tertiary",
1018
+ disabled: !R.value,
1019
+ onClick: Ke
1020
+ }, null, 8, ["disabled"]),
1021
+ D(de, {
1022
+ icon: "arrow_downward",
1023
+ variant: "tertiary",
1024
+ disabled: !q.value,
1025
+ onClick: Qe
1026
+ }, null, 8, ["disabled"])
1027
+ ])) : K("", !0),
1028
+ (ze = le.value) != null && ze.showRollup && De.value.length > 0 ? (b(), $(la, {
1029
+ key: 3,
1030
+ modelValue: v.value,
1031
+ "onUpdate:modelValue": w[2] || (w[2] = (M) => v.value = M),
1032
+ class: "w-[150px]",
1033
+ items: De.value
1034
+ }, null, 8, ["modelValue", "items"])) : K("", !0),
1035
+ p.hideExport ? K("", !0) : (b(), $(sa, {
1036
+ key: 4,
1037
+ shift: !0
1038
+ }, {
1039
+ "menu-button": V(() => [
1040
+ D(de, {
1041
+ icon: "more_vert",
1042
+ variant: "tertiary"
1043
+ })
1044
+ ]),
1045
+ default: V(() => [
1046
+ (b(!0), L(W, null, Ne(C(Ze), (M) => (b(), $(oa, {
1047
+ key: M.value,
1048
+ label: M.label,
1049
+ onClick: M.onClick
1050
+ }, null, 8, ["label", "onClick"]))), 128))
1051
+ ]),
1052
+ _: 1
1053
+ }))
1054
+ ];
1055
+ }),
1056
+ _: 1
1057
+ })
1058
+ ]),
1059
+ _: 1
1060
+ }, 8, ["modelValue"]))
1061
+ ], 4))
1062
+ ]),
1063
+ _: 1
1064
+ }, 8, ["class", "variant"]);
1065
+ };
1066
+ }
1067
+ });
1068
+ export {
1069
+ I as R,
1070
+ lt as _,
1071
+ ve as a,
1072
+ me as g,
1073
+ he as l
1074
+ };