@feedmepos/mf-report 5.4.15-beta.1 → 5.4.15-beta.3

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