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