@feedmepos/mf-report 5.4.36 → 5.5.0-beta.1

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