@feedmepos/mf-report 5.7.1 → 5.7.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/{App-BuPfdYFT.js → App-g70gjVg5.js} +42 -42
  2. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-Bi_BES93.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-BD2DnN09.js} +2 -2
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-C6ZScbW9.js → Default.vue_vue_type_script_setup_true_lang-DA7ZPTMu.js} +2 -2
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-CzeKUdlZ.js +1390 -0
  5. package/dist/{InsightView-Df3r1SIZ.js → InsightView-BgZN-puI.js} +6 -6
  6. package/dist/{Integration-9ahqwmBM.js → Integration-Bu0y1MDy.js} +3 -3
  7. package/dist/{Integrations-BiJVCGrp.js → Integrations-DS6q4VX4.js} +3 -3
  8. package/dist/{Layout-DzM5U91z.js → Layout-BEv71fRc.js} +1 -1
  9. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-M-v_jPRR.js → MenuTab.vue_vue_type_script_setup_true_lang-C_XDMF54.js} +3 -3
  10. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-D-g5xCo7.js → NavigationTab.vue_vue_type_script_setup_true_lang-20jP9Afi.js} +5200 -5177
  11. package/dist/{NoData.vue_vue_type_script_setup_true_lang-CdFXBqlX.js → NoData.vue_vue_type_script_setup_true_lang-EVDtMqna.js} +1 -1
  12. package/dist/{OverviewView-De1U7FMY.js → OverviewView-DNi0LbGr.js} +5 -5
  13. package/dist/{Report-BZjd3vzV.js → Report-DISFMEyR.js} +4 -4
  14. package/dist/{ReportEditor-9JfaoQnu.js → ReportEditor-CZPw2Jgp.js} +5 -5
  15. package/dist/{ReportView-DhM6dHM7.js → ReportView-CEXLqC8H.js} +7 -7
  16. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-N2Lg1Vpt.js → SelectComponent.vue_vue_type_script_setup_true_lang-Cpjinmn4.js} +1 -1
  17. package/dist/{Setting-BsawF0vk.js → Setting-WreFZCg_.js} +4 -4
  18. package/dist/TileEditor-DDtOoCz1.js +3016 -0
  19. package/dist/{TransitionFade-OVG1ERGf.js → TransitionFade-DBnslQJr.js} +4 -4
  20. package/dist/app.js +11 -11
  21. package/dist/{global-loader-CbmVhJAK.js → global-loader-DqYGIXIo.js} +1 -1
  22. package/dist/{index-BWqDfeY6.js → index-BChph3k1.js} +1 -1
  23. package/dist/{report-schema-BnzKoFjx.js → report-schema-CbMyeD7Q.js} +1 -1
  24. package/dist/{v4-CJZMeb87.js → v4-Dg_nqjTJ.js} +198 -196
  25. package/package.json +1 -1
  26. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-Nk_mV6TX.js +0 -1303
  27. package/dist/TileEditor-njxrJOwv.js +0 -3017
@@ -1,1303 +0,0 @@
1
- import { computed as h, defineComponent as G, useModel as j, ref as y, resolveComponent as F, createElementBlock as z, openBlock as _, Fragment as U, renderSlot as Z, createVNode as H, normalizeStyle as Y, unref as r, createElementVNode as A, toDisplayString as ne, withCtx as V, createBlock as M, createCommentVNode as Q, normalizeClass as me, watch as le, nextTick as je, h as Je, renderList as et, mergeModels as xt, onMounted as kt, onUnmounted as Rt, resolveDynamicComponent as Lt, withDirectives as Ft, vShow as Et } from "vue";
2
- import { W as v, v as he, R as Tt, g as Wt, d as zt, q as Dt } from "./v4-CJZMeb87.js";
3
- import { u as Re, b as tt, a as Le } from "./global-loader-CbmVhJAK.js";
4
- import { d as Ke } from "./index-BWqDfeY6.js";
5
- import { storeToRefs as we, defineStore as At } from "pinia";
6
- import { _ as Ht } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
- import { r as ae } from "./i18n-Cif1I9J2.js";
8
- import { _ as Qe } from "./NoData.vue_vue_type_script_setup_true_lang-CdFXBqlX.js";
9
- import { useBreakpoints as $t, useSnackbar as Pt } from "@feedmepos/ui-library";
10
- var be = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(be || {}), O = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(O || {}), Ce = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(Ce || {}), Se = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(Se || {}), _e = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(_e || {}), xe = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(xe || {}), ke = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(ke || {});
11
- v.Circular, v.Table, v.BarChart, v.LineChart, v.StackBarChart, v.StackLineChart, v.Scorecard, v.Spacer;
12
- const Bt = [
13
- {
14
- type: v.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: v.Table,
23
- showLabel: !1,
24
- showDrillDimension: !0,
25
- showRollup: !0,
26
- showSearchBar: !0
27
- },
28
- {
29
- type: v.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: v.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: v.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: v.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: v.Scorecard,
62
- showLabel: !1,
63
- showDrillDimension: !1,
64
- showRollup: !1,
65
- showSearchBar: !1
66
- },
67
- {
68
- type: v.Spacer,
69
- showLabel: !1,
70
- showDrillDimension: !1,
71
- showRollup: !1,
72
- showSearchBar: !1
73
- }
74
- ];
75
- function ye(e) {
76
- const t = [e.schemaName, e.name];
77
- return "option" in e && e.option && t.push(e.option), "aggregation" in e && e.aggregation && t.push(e.aggregation), t.push(e.label.replace(/[^a-zA-Z0-9]/g, "")), t.join("_").toLowerCase();
78
- }
79
- function Mt(e, t) {
80
- switch (e) {
81
- case v.BarChart:
82
- case v.LineChart:
83
- case v.StackBarChart:
84
- case v.StackLineChart:
85
- return Array.isArray(t == null ? void 0 : t.datasets) && Array.isArray(t == null ? void 0 : t.xAxis) && t.datasets.length > 0 && t.xAxis.length > 0;
86
- case v.Table:
87
- return Array.isArray(t == null ? void 0 : t.rows) && Array.isArray(t == null ? void 0 : t.columns) && t.rows.length > 0 && t.columns.length > 0;
88
- case v.Circular:
89
- return Array.isArray(t == null ? void 0 : t.datasets) && t.datasets.length > 0;
90
- case v.Scorecard:
91
- return !0;
92
- case v.Spacer:
93
- return !0;
94
- }
95
- }
96
- const Ze = [
97
- "54, 162, 235",
98
- //8CE6D7
99
- "0, 123, 167",
100
- //007BA7
101
- "255, 93, 83",
102
- //FF5D53
103
- "115, 200, 230",
104
- //73C8E6
105
- "252, 162, 62",
106
- //FCA23E
107
- "240, 155, 190",
108
- //F09BBE
109
- "255, 210, 50",
110
- //FFD232
111
- "80, 190, 155",
112
- //50BE9B
113
- "131, 88, 212",
114
- //8358D4
115
- "155, 80, 70"
116
- //9B5046
117
- ];
118
- function re({
119
- index: e,
120
- isCompare: t,
121
- opacity: o
122
- }) {
123
- let a = typeof o == "number" ? o : 1;
124
- return t && (a = a * 0.6), `rgba(${Ze[e % Ze.length]}, ${a})`;
125
- }
126
- function at(e, t, o) {
127
- if (e === "" || t === "")
128
- return null;
129
- let a = (c) => c == null ? void 0 : c.replace(/,/g, "");
130
- o === "ID" && (a = (c) => c == null ? void 0 : c.replace(/\./g, "").replace(/,/g, "."));
131
- const n = Number(a(e)), i = Number(a(t));
132
- if (isNaN(n) || isNaN(i))
133
- return null;
134
- let d = 0;
135
- i === 0 ? n === 0 ? d = 0 : d = 1 : d = (n - i) / i;
136
- const u = Vt(d);
137
- return {
138
- value: isNaN(d) ? "" : `${(d * 100).toFixed(0)}%`,
139
- icon: u
140
- };
141
- }
142
- function Vt(e) {
143
- return e > 0 ? {
144
- name: "moving",
145
- color: "#1F7735",
146
- tailwind: "fm-color-system-success-100"
147
- } : e < 0 ? {
148
- name: "trending_down",
149
- color: "#99231D",
150
- tailwind: "fm-color-system-error-100"
151
- } : {
152
- name: "equal",
153
- color: "#C7C7CC",
154
- tailwind: "fm-color-neutral-gray-100"
155
- };
156
- }
157
- function ie(e) {
158
- const t = h(() => ({
159
- display: e.showLabel,
160
- align: e.labelAlign,
161
- anchor: e.labelAnchor,
162
- rotation: e.labelRotation,
163
- offset: e.labelOffset,
164
- font: {
165
- size: e.labelFontSize
166
- }
167
- })), o = h(() => ({
168
- display: e.showX,
169
- position: e.xPosition,
170
- grid: {
171
- display: e.showXGrid
172
- },
173
- ticks: {
174
- display: e.showXTick,
175
- font: {
176
- size: e.xTickFontSize
177
- }
178
- }
179
- })), a = h(() => ({
180
- display: e.showY,
181
- position: e.yPosition,
182
- grid: {
183
- display: e.showYGrid
184
- },
185
- ticks: {
186
- display: e.showYTick,
187
- font: {
188
- size: e.yTickFontSize
189
- }
190
- }
191
- })), n = h(() => ({
192
- display: e.showLegend,
193
- position: e.legendPosition,
194
- usePointStyle: e.usePointStyle
195
- })), i = h(() => e.isTransposed), d = h(() => e.chartWidth), u = h(() => e.chartHeight);
196
- return { datalabels: t, xCfg: o, yCfg: a, isTransposed: i, legend: n, chartWidth: d, chartHeight: u };
197
- }
198
- const qt = /* @__PURE__ */ G({
199
- __name: "WidgetBarchart",
200
- props: {
201
- modelValue: { required: !0 },
202
- modelModifiers: {}
203
- },
204
- emits: ["update:modelValue"],
205
- setup(e) {
206
- const t = j(e, "modelValue"), o = h(() => {
207
- var f;
208
- return ((f = t.value.data) == null ? void 0 : f.xAxis) ?? [];
209
- }), a = h(() => {
210
- var f;
211
- return ((f = t.value.data) == null ? void 0 : f.datasets) ?? [];
212
- }), n = y(null), { datalabels: i, xCfg: d, yCfg: u, isTransposed: c, legend: w, chartWidth: C, chartHeight: m } = ie(
213
- t.value
214
- ), g = h(() => a.value.length > 0 ? [
215
- ...a.value.map((f, k) => ({
216
- label: f.name,
217
- data: f.values,
218
- dash: !!f.isCompare,
219
- backgroundColor: re({ index: k, isCompare: f.isCompare })
220
- }))
221
- ] : []);
222
- return (f, k) => {
223
- const E = F("FmBarChart");
224
- return _(), z(U, null, [
225
- Z(f.$slots, "menu"),
226
- H(E, {
227
- ref_key: "chartRef",
228
- ref: n,
229
- class: "bar-chart",
230
- datasets: g.value,
231
- "x-axis": { categories: o.value },
232
- "x-cfg": r(d),
233
- "y-cfg": r(u),
234
- transpose: r(c),
235
- legend: {
236
- display: r(w).display ?? !1,
237
- position: r(w).position,
238
- labels: {
239
- usePointStyle: r(w).usePointStyle ?? !0
240
- }
241
- },
242
- datalabels: r(i),
243
- "maintain-aspect-ratio": !1,
244
- style: Y({
245
- "--chart-width": r(C) !== void 0 ? r(C) + "px" : "100%",
246
- "--chart-height": r(m) !== void 0 ? r(m) + "px" : "calc(100% - 36px)"
247
- })
248
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
249
- ], 64);
250
- };
251
- }
252
- }), Nt = /* @__PURE__ */ G({
253
- __name: "WidgetCircular",
254
- props: {
255
- modelValue: { required: !0 },
256
- modelModifiers: {}
257
- },
258
- emits: ["update:modelValue"],
259
- setup(e) {
260
- const t = j(e, "modelValue"), { datalabels: o, legend: a, chartWidth: n, chartHeight: i } = ie(t.value), d = h(() => {
261
- let u = [];
262
- return t.value.data.datasets && t.value.data.metrics && t.value.data.datasets.length > 0 && t.value.data.metrics.length > 0 && (u = [
263
- {
264
- label: t.value.data.metrics[0],
265
- data: t.value.data.datasets.map((c) => c.value),
266
- backgroundColor: t.value.data.datasets.map((c, w) => re({ index: w }))
267
- }
268
- ]), u;
269
- });
270
- return (u, c) => {
271
- const w = F("FmPieChart");
272
- return _(), z(U, null, [
273
- Z(u.$slots, "menu"),
274
- H(w, {
275
- class: "circular",
276
- percentage: "70%",
277
- datasets: d.value,
278
- metrics: t.value.data.datasets.map((C) => C.name),
279
- variant: "doughnut",
280
- legend: {
281
- display: r(a).display ?? !0,
282
- position: r(a).position ?? "top",
283
- maxHeight: r(a).display === !0 ? void 0 : 54,
284
- labels: {
285
- usePointStyle: r(a).usePointStyle ?? !0
286
- }
287
- },
288
- datalabels: r(o),
289
- "maintain-aspect-ratio": !1,
290
- style: Y({
291
- "--chart-width": r(n) !== void 0 ? r(n) + "px" : "100%",
292
- "--chart-height": r(i) !== void 0 ? r(i) + "px" : "calc(100% - 36px)"
293
- })
294
- }, null, 8, ["datasets", "metrics", "legend", "datalabels", "style"])
295
- ], 64);
296
- };
297
- }
298
- }), It = { class: "flex flex-col gap-1" }, Ot = { class: "fm-typo-en-title-sm-600" }, Xt = { class: "flex gap-2" }, Ut = { key: 0 }, Yt = { key: 1 }, Gt = /* @__PURE__ */ G({
299
- __name: "WidgetScorecard",
300
- props: {
301
- modelValue: { required: !0 },
302
- modelModifiers: {}
303
- },
304
- emits: ["update:modelValue"],
305
- setup(e) {
306
- const t = j(e, "modelValue"), { t: o } = Re(), { compareDateRange: a, defaultDateSetting: n } = we(tt()), { country: i } = Le(), d = h(() => {
307
- var m;
308
- return ((m = t.value.data) == null ? void 0 : m.value) || "";
309
- }), u = h(() => {
310
- const { data: m } = t.value;
311
- return m != null && m.comparison ? at(d.value, m.comparison, i) : null;
312
- });
313
- function c(m) {
314
- switch (m) {
315
- case be.bar:
316
- return "bar";
317
- case be.line:
318
- return "line";
319
- default:
320
- return "line";
321
- }
322
- }
323
- const w = h(() => {
324
- var m;
325
- return (m = t.value.data) == null ? void 0 : m.sparkline;
326
- }), C = h(() => w.value.datasets.map((m) => ({
327
- label: m.name,
328
- data: m.values,
329
- fill: !0,
330
- color: "#36a2eb"
331
- })));
332
- return (m, g) => {
333
- var P;
334
- const f = F("FmIcon"), k = F("FmChip"), E = F("FmTooltip"), q = F("FmLineChart");
335
- return _(), z("div", It, [
336
- Z(m.$slots, "menu"),
337
- A("p", Ot, ne(d.value), 1),
338
- A("div", Xt, [
339
- H(E, {
340
- content: `vs. ${(P = r(n).defaultCompareType) == null ? void 0 : P.split("_").join(" ")}`,
341
- placement: "right",
342
- "hide-arrow": "",
343
- variant: "plain"
344
- }, {
345
- default: V(() => [
346
- u.value ? (_(), M(k, {
347
- key: 0,
348
- icon: u.value.icon.name,
349
- class: me(`bg-${u.value.icon.tailwind}`),
350
- compact: ""
351
- }, {
352
- default: V(() => [
353
- H(f, {
354
- name: u.value.icon.name,
355
- color: u.value.icon.color
356
- }, null, 8, ["name", "color"]),
357
- A("p", {
358
- class: "fm-typo-en-body-md-600",
359
- style: Y({ color: u.value.icon.color })
360
- }, ne(u.value.value), 5)
361
- ]),
362
- _: 1
363
- }, 8, ["icon", "class"])) : Q("", !0),
364
- r(a).endDate !== null && r(a).startDate !== null && u.value === null ? (_(), M(k, {
365
- key: 1,
366
- compact: ""
367
- }, {
368
- default: V(() => [
369
- H(f, {
370
- name: "arrow_upward",
371
- color: "#C7C7CC"
372
- }),
373
- g[0] || (g[0] = A("p", { class: "fm-typo-en-body-md-600 text-fm-color-typo-disabled" }, "N/A", -1))
374
- ]),
375
- _: 1
376
- })) : Q("", !0)
377
- ]),
378
- _: 1
379
- }, 8, ["content"])
380
- ]),
381
- w.value ? (_(), z("div", Ut, [
382
- c(w.value.type) === "line" ? (_(), M(q, {
383
- key: 0,
384
- class: "sparkline",
385
- datasets: C.value,
386
- legend: {
387
- display: !1
388
- },
389
- datalabels: { display: !1 },
390
- "x-axis": { categories: w.value.dimensions },
391
- "y-cfg": { display: !1 },
392
- "x-cfg": { display: !1 },
393
- "maintain-aspect-ratio": !1
394
- }, null, 8, ["datasets", "x-axis"])) : Q("", !0)
395
- ])) : (_(), z("div", Yt, g[1] || (g[1] = [
396
- A("div", { class: "sparkline" }, [
397
- A("div", { class: "flex flex-col gap-8" }, [
398
- A("div"),
399
- A("div")
400
- ]),
401
- A("div", { class: "grow" })
402
- ], -1)
403
- ])))
404
- ]);
405
- };
406
- }
407
- }), jt = {};
408
- function Jt(e, t) {
409
- const o = F("FmMenuDivider");
410
- return _(), M(o);
411
- }
412
- const Kt = /* @__PURE__ */ Ht(jt, [["render", Jt]]), Qt = "mf-reporttable-dimension", Zt = At(Qt, {
413
- state: () => ({
414
- rowHeight: 0,
415
- colWidths: [],
416
- isEditing: !1
417
- }),
418
- actions: {
419
- updateRowHeight(e, t) {
420
- this.rowHeight = e, this.setRowHeights(e, t);
421
- },
422
- updateColWidth(e, t, o, a) {
423
- this.colWidths[e] = t, this.setColWidths(e, t, o, a);
424
- },
425
- setRowHeights(e, t) {
426
- const o = (t == null ? void 0 : t.querySelectorAll("thead tr")) ?? [], a = (t == null ? void 0 : t.querySelectorAll("tbody tr")) ?? [];
427
- [...o, ...a].forEach((i) => {
428
- const d = i;
429
- d && (d.style.height = `${e}px`);
430
- });
431
- },
432
- setColWidths(e, t, o, a = !1) {
433
- const n = (o == null ? void 0 : o.querySelectorAll("th")) ?? [];
434
- if (e === void 0) return;
435
- const i = n[e], d = a ? this.colWidths[e] : t;
436
- if (!i || d === void 0) return;
437
- const u = () => {
438
- i.style.width = `${d}px`;
439
- };
440
- a ? requestAnimationFrame(u) : u();
441
- },
442
- enableEditMode() {
443
- const e = document.querySelectorAll("th"), t = document.querySelectorAll("td"), o = document.querySelector("table");
444
- o == null || o.classList.add("table-fixed"), e.forEach((a) => a.classList.add("toggleEditResize")), t.forEach((a) => a.classList.add("toggleEditResize")), this.isEditing = !0;
445
- },
446
- disableEditMode() {
447
- const e = document.querySelectorAll("th"), t = document.querySelectorAll("td"), o = document.querySelectorAll(".col-resize-handle"), a = document.querySelectorAll(".row-resize-handle");
448
- e.forEach((n) => n.classList.remove("toggleEditResize")), t.forEach((n) => n.classList.remove("toggleEditResize")), o.forEach((n) => n.remove()), a.forEach((n) => n.remove()), this.isEditing = !1;
449
- },
450
- resetStore() {
451
- this.rowHeight = 0, this.colWidths = [];
452
- },
453
- highlightCol(e, t) {
454
- if (t) {
455
- const o = document.querySelectorAll(`thead th:nth-child(${e + 1})`), a = document.querySelectorAll(`tbody td:nth-child(${e + 1})`);
456
- [...o, ...a].forEach((n) => {
457
- n.classList.add("highlight-hover-col");
458
- });
459
- } else
460
- document.querySelectorAll(
461
- `thead th:nth-child(${e + 1}), tbody td:nth-child(${e + 1})`
462
- ).forEach((o) => o.classList.add("highlight-col"));
463
- },
464
- highlightRows(e) {
465
- const t = document.querySelectorAll("thead tr"), o = document.querySelectorAll("tbody tr"), a = [...t, ...o];
466
- for (const n of a)
467
- e ? n.classList.add("highlight-hover-row") : n.classList.add("highlight-row");
468
- },
469
- removeRowHighlight(e) {
470
- const t = e ? ".highlight-hover-row" : ".highlight-row", o = document.querySelectorAll(t);
471
- for (const a of o)
472
- a.classList.remove(t.slice(1));
473
- },
474
- removeColHighlight(e) {
475
- e ? document.querySelectorAll(".highlight-hover-col").forEach((t) => {
476
- t.classList.remove("highlight-hover-col");
477
- }) : document.querySelectorAll(".highlight-col").forEach((t) => t.classList.remove("highlight-col"));
478
- },
479
- resizeCol(e, t) {
480
- const o = /* @__PURE__ */ new Map(), a = e.clientX, n = e.target.closest("table"), i = n == null ? void 0 : n.querySelectorAll("th")[t], d = i == null ? void 0 : i.getBoundingClientRect().width, u = o.get(t) ? this.colWidths[t.toString()] || 60 : (o.set(t, !0), d || this.colWidths[t.toString()] || 60), c = i == null ? void 0 : i.querySelector("p");
481
- if (!c) return;
482
- const w = c.textContent || "", C = window.getComputedStyle(c), m = `${C.fontWeight} ${C.fontSize} ${C.fontFamily}`, f = document.createElement("canvas").getContext("2d");
483
- if (!f) return;
484
- f.font = m;
485
- const k = f.measureText(w), E = window.getComputedStyle(i), q = parseFloat(E.paddingLeft || "0"), P = parseFloat(E.paddingRight || "0"), X = k.width + q + P;
486
- this.highlightCol(t, !1);
487
- const l = (S) => {
488
- const b = S.clientX - a, x = Math.max(X, u + b);
489
- if (n) {
490
- this.updateColWidth(t, x, n, !0);
491
- let R = 0;
492
- n.querySelectorAll("th").forEach((D, $) => {
493
- R += $ === t ? x : this.colWidths[$] || D.getBoundingClientRect().width;
494
- }), n.classList.remove("w-full"), n.style.width = `${R}px`;
495
- const T = n == null ? void 0 : n.parentElement;
496
- if (T) {
497
- const D = T.scrollWidth, $ = T.scrollLeft;
498
- T.offsetWidth + $ >= D - 100 && (T.scrollLeft = D);
499
- }
500
- }
501
- }, p = () => {
502
- ((n == null ? void 0 : n.querySelectorAll("th")) ?? []).forEach((b, x) => {
503
- const R = b.getBoundingClientRect().width;
504
- this.colWidths[x] = R;
505
- }), this.removeColHighlight(!1), document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", p);
506
- };
507
- document.addEventListener("mousemove", l), document.addEventListener("mouseup", p);
508
- },
509
- resizeRow(e) {
510
- const t = e.clientY, o = e.target.closest("table"), a = this.rowHeight || 48;
511
- this.highlightRows(!1);
512
- const n = (d) => {
513
- const u = Math.max(30, a + (d.clientY - t));
514
- o && this.updateRowHeight(u, o);
515
- }, i = () => {
516
- this.removeRowHighlight(!1), document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", i);
517
- };
518
- document.addEventListener("mousemove", n), document.addEventListener("mouseup", i);
519
- },
520
- enableCellResizing() {
521
- const e = document.querySelector("thead"), t = document.querySelectorAll("thead tr"), o = document.querySelectorAll("tbody tr"), a = [...t, ...o];
522
- e && e.classList.remove("sticky");
523
- const n = (i, d) => {
524
- const u = document.createElement("div");
525
- return u.className = `${i}-resize-handle`, i === "col" ? (u.addEventListener("mouseenter", () => this.highlightCol(d, !0)), u.addEventListener("mouseleave", () => this.removeColHighlight(!0)), u.addEventListener("mousedown", (c) => {
526
- c.stopPropagation(), this.resizeCol(c, d);
527
- })) : (u.addEventListener("mouseenter", () => this.highlightRows(!0)), u.addEventListener("mouseleave", () => this.removeRowHighlight(!0)), u.addEventListener("mousedown", (c) => {
528
- c.stopPropagation(), this.resizeRow(c);
529
- })), u;
530
- };
531
- a.forEach((i) => {
532
- const d = i.closest("thead") !== null;
533
- i.querySelectorAll(d ? "th" : "td").forEach((c, w) => {
534
- const C = n("col", w), m = n("row", w);
535
- c.appendChild(C), c.appendChild(m);
536
- });
537
- }), this.enableEditMode();
538
- },
539
- cancelResizingChanges() {
540
- this.disableEditMode();
541
- }
542
- }
543
- }), ea = { class: "my-4" }, ta = {
544
- class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
545
- style: { backgroundColor: "#f9f9f9" }
546
- }, aa = { class: "font-bold" }, la = { class: "text-fm-color-neutral-gray-300" }, oa = /* @__PURE__ */ G({
547
- __name: "WidgetTable",
548
- props: {
549
- modelValue: { required: !0 },
550
- modelModifiers: {}
551
- },
552
- emits: ["update:modelValue"],
553
- setup(e) {
554
- const { t, te: o } = Re(), a = j(e, "modelValue"), { country: n } = Le(), i = Zt(), d = y(null), u = h(() => {
555
- var l;
556
- return ((l = a.value.data) == null ? void 0 : l.columns) || [{ label: "", key: "" }];
557
- }), c = h(() => {
558
- var l;
559
- return ((l = a.value.data) == null ? void 0 : l.rows) || [];
560
- }), w = h(() => a.value.filterText), C = h(() => {
561
- var l, p;
562
- if (!(w.value && w.value.trim().length > 0 || !((l = c.value[0]) != null && l.isRollup) && !((p = c.value[c.value.length - 1]) != null && p.isRollup))) {
563
- if (a.value.rollupPosition === O.top || a.value.rollupPosition === void 0)
564
- return O.top;
565
- if (a.value.rollupPosition === O.bottom)
566
- return O.bottom;
567
- }
568
- }), m = h(() => {
569
- const b = C.value !== void 0 ? 1 : 0, x = (d.value ? d.value.$el.offsetHeight : 0) - 48;
570
- return Math.floor((x - 34.5 - 32) / 48) - b;
571
- }), g = h(() => {
572
- var p, S;
573
- let l = [];
574
- switch (C.value) {
575
- case O.top:
576
- l = [...((p = c.value[0]) == null ? void 0 : p.cells) || []].map((b, x) => {
577
- var R;
578
- return {
579
- main: b,
580
- comparison: (R = c.value[0]) == null ? void 0 : R.comparisonCells[x],
581
- rowType: u.value[x].type
582
- };
583
- });
584
- break;
585
- case O.bottom:
586
- l = [...((S = c.value[c.value.length - 1]) == null ? void 0 : S.cells) || []].map((b, x) => {
587
- var R;
588
- return {
589
- main: b,
590
- comparison: (R = c.value[0]) == null ? void 0 : R.comparisonCells[x],
591
- rowType: u.value[x].type
592
- };
593
- });
594
- break;
595
- }
596
- return l.length > 0 && l[0].main === "" && (l[0].main = "Grand total"), l;
597
- });
598
- function f(l) {
599
- const p = {};
600
- for (let S = 0; S < u.value.length; S++)
601
- if (u.value[S].key !== "") {
602
- const b = l.comparisonCells[S];
603
- p[u.value[S].key] = {
604
- main: l.cells[S],
605
- comparison: b
606
- }, p.isRollup = l.isRollup;
607
- }
608
- return p;
609
- }
610
- function k(l) {
611
- return [...new Array(l < 0 ? 0 : l)].map(() => {
612
- var S;
613
- const p = {};
614
- if ((S = a.value.data) != null && S.columns)
615
- for (let b = 0; b < a.value.data.columns.length; b++)
616
- p[a.value.data.columns[b].key] = void 0;
617
- return p;
618
- });
619
- }
620
- function E(l) {
621
- let p = (l == null ? void 0 : l.main) || "";
622
- return p.includes("#") && !p.startsWith("#") && (p = p.split("#")[0]), !l || l.main === "" || l.comparison === "" ? {
623
- main: p
624
- } : {
625
- main: p,
626
- comparison: l == null ? void 0 : l.comparison,
627
- difference: at(l.main, l.comparison, n)
628
- };
629
- }
630
- const q = h(() => {
631
- var x, R, B;
632
- let l = ((x = a.value.data) == null ? void 0 : x.rows) || [];
633
- switch (C.value) {
634
- case O.bottom:
635
- l = (R = l[l.length - 1]) != null && R.isRollup ? l.slice(0, -1) : l;
636
- break;
637
- case O.top:
638
- l = (B = l[0]) != null && B.isRollup ? l.slice(1, l.length) : l;
639
- break;
640
- }
641
- const p = l.filter((T) => !(w.value !== "" && (T.isRollup === !0 || !T.cells.some(
642
- (D) => {
643
- var $;
644
- return ((D == null ? void 0 : D.toLowerCase()) || "").includes(($ = w.value) == null ? void 0 : $.toLowerCase());
645
- }
646
- )))).map((T) => f(T)), S = p.length % m.value;
647
- let b = 0;
648
- return S > 0 ? b = Math.abs(S - m.value) : p.length === 0 && (b = m.value), p.push(...k(b)), p;
649
- }), P = h(() => {
650
- var l, p;
651
- return !!((l = a.value.colWidths) != null && l.length) || !!((p = i.colWidths) != null && p.length);
652
- });
653
- le(
654
- P,
655
- async (l) => {
656
- l && i.isEditing && (await je(), i.enableCellResizing());
657
- },
658
- { immediate: !0 }
659
- );
660
- const X = h(() => {
661
- var p;
662
- let l = [];
663
- return (p = a.value.data) != null && p.columns && (l = [...a.value.data.columns.map((b) => {
664
- const x = ae(t, o, b.label, "other");
665
- return {
666
- accessorKey: b.key,
667
- header: () => Je(
668
- "p",
669
- {
670
- class: `w-full ${b.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap`
671
- },
672
- x
673
- ),
674
- cell: (R) => {
675
- var D, $;
676
- const B = E(R.getValue()), T = ($ = (D = R == null ? void 0 : R.row) == null ? void 0 : D.original) == null ? void 0 : $.isRollup;
677
- return Je(
678
- "div",
679
- {
680
- class: [
681
- T ? "fm-typo-en-body-md-600 text-fm-color-typo-secondary" : "fm-typo-en-body-md-400",
682
- b.type === "NUMERIC" ? "text-right" : "",
683
- P.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
684
- ].join(" ")
685
- },
686
- [B.main]
687
- );
688
- },
689
- enableSorting: !1
690
- };
691
- })]), l;
692
- });
693
- return le(
694
- [() => X.value],
695
- async () => {
696
- var R, B;
697
- await je();
698
- const l = (R = d.value) == null ? void 0 : R.$el;
699
- if (!l) return;
700
- const p = l.querySelector("table");
701
- if (!p) return;
702
- const S = !!((B = a.value.colWidths) != null && B.length);
703
- p.classList.add(S ? "table-fixed" : "table-auto"), i.isEditing && i.enableCellResizing();
704
- const b = i.rowHeight || a.value.rowHeight;
705
- typeof b == "number" && i.setRowHeights(b, l);
706
- const x = a.value.colWidths ?? i.colWidths;
707
- x == null || x.forEach((T, D) => {
708
- i.setColWidths(D, T, l);
709
- });
710
- },
711
- { immediate: !0 }
712
- ), (l, p) => {
713
- const S = F("FmTable");
714
- return _(), z(U, null, [
715
- A("div", ea, [
716
- Z(l.$slots, "menu")
717
- ]),
718
- H(S, {
719
- ref_key: "table",
720
- ref: d,
721
- "column-defs": X.value,
722
- "row-data": q.value,
723
- "search-value": w.value,
724
- "page-size": m.value,
725
- "shrink-at": !1,
726
- "force-mobile-footer": !0,
727
- class: "scrollbar-hide-table"
728
- }, {
729
- "pin-top": V(() => [
730
- A("tbody", null, [
731
- A("tr", ta, [
732
- (_(!0), z(U, null, et(g.value, (b, x) => (_(), z("td", {
733
- key: `${r(he)()}_${x}`,
734
- class: "h-[48px] text-fm-color-typo-primary px-16"
735
- }, [
736
- A("span", {
737
- class: me([
738
- "items-center text-fm-color-typo-secondary gap-2",
739
- b.rowType === "NUMERIC" ? "text-right" : "",
740
- P.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
741
- ])
742
- }, [
743
- A("p", aa, ne(b.main), 1),
744
- A("p", la, ne(b.comparison ? `(${b.comparison})` : ""), 1)
745
- ], 2)
746
- ]))), 128))
747
- ])
748
- ])
749
- ]),
750
- _: 1
751
- }, 8, ["column-defs", "row-data", "search-value", "page-size"])
752
- ], 64);
753
- };
754
- }
755
- }), sa = /* @__PURE__ */ G({
756
- __name: "WidgetStackBarChart",
757
- props: {
758
- modelValue: { required: !0 },
759
- modelModifiers: {}
760
- },
761
- emits: ["update:modelValue"],
762
- setup(e) {
763
- const t = j(e, "modelValue"), o = h(() => {
764
- var k;
765
- return ((k = t.value.data) == null ? void 0 : k.xAxis) || [];
766
- }), a = h(() => {
767
- var f;
768
- return ((f = t.value.data) == null ? void 0 : f.datasets) ?? [];
769
- }), n = y(null), { datalabels: i, xCfg: d, yCfg: u, isTransposed: c, legend: w, chartWidth: C, chartHeight: m } = ie(
770
- t.value
771
- ), g = h(() => a.value.length > 0 ? [
772
- ...a.value.map((f, k) => {
773
- let E = f.values;
774
- return {
775
- label: f.name,
776
- data: E,
777
- dash: !!f.isCompare,
778
- backgroundColor: re({ index: k, isCompare: f.isCompare })
779
- };
780
- })
781
- ] : []);
782
- return (f, k) => {
783
- const E = F("FmBarChart");
784
- return _(), z(U, null, [
785
- Z(f.$slots, "menu"),
786
- H(E, {
787
- ref_key: "chartRef",
788
- ref: n,
789
- class: "bar-chart",
790
- datasets: g.value,
791
- "x-axis": { categories: o.value },
792
- "x-cfg": r(d),
793
- "y-cfg": r(u),
794
- transpose: r(c),
795
- stacked: !0,
796
- legend: {
797
- display: r(w).display ?? !1,
798
- position: r(w).position,
799
- maxHeight: 54,
800
- labels: {
801
- usePointStyle: r(w).usePointStyle ?? !0
802
- }
803
- },
804
- datalabels: r(i),
805
- "maintain-aspect-ratio": !1,
806
- style: Y({
807
- "--chart-width": r(C) !== void 0 ? r(C) + "px" : "100%",
808
- "--chart-height": r(m) !== void 0 ? r(m) + "px" : "calc(100% - 36px)"
809
- })
810
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
811
- ], 64);
812
- };
813
- }
814
- }), na = /* @__PURE__ */ G({
815
- __name: "WidgetStackLineChart",
816
- props: {
817
- modelValue: { required: !0 },
818
- modelModifiers: {}
819
- },
820
- emits: ["update:modelValue"],
821
- setup(e) {
822
- const t = j(e, "modelValue"), o = h(() => {
823
- var g;
824
- return ((g = t.value.data) == null ? void 0 : g.xAxis) ?? [];
825
- }), a = h(() => {
826
- var g;
827
- return ((g = t.value.data) == null ? void 0 : g.datasets) ?? [];
828
- }), { datalabels: n, xCfg: i, yCfg: d, isTransposed: u, legend: c, chartWidth: w, chartHeight: C } = ie(
829
- t.value
830
- ), m = h(() => a.value.length > 0 ? [
831
- ...a.value.map((g, f) => {
832
- let k = g.values;
833
- return {
834
- label: g.name,
835
- data: k,
836
- dash: g.isCompare,
837
- fill: !1,
838
- color: re({ index: f, isCompare: g.isCompare })
839
- };
840
- })
841
- ] : []);
842
- return (g, f) => {
843
- const k = F("FmLineChart");
844
- return _(), z(U, null, [
845
- Z(g.$slots, "menu"),
846
- H(k, {
847
- class: "line-chart",
848
- datasets: m.value,
849
- "x-axis": { categories: o.value },
850
- "x-cfg": r(i),
851
- "y-cfg": r(d),
852
- transpose: r(u),
853
- legend: {
854
- display: r(c).display ?? !1,
855
- position: r(c).position,
856
- maxHeight: 54,
857
- labels: {
858
- usePointStyle: r(c).usePointStyle ?? !0
859
- }
860
- },
861
- stacked: !0,
862
- datalabels: r(n),
863
- "maintain-aspect-ratio": !1,
864
- style: Y({
865
- "--chart-width": r(w) !== void 0 ? r(w) + "px" : "97%",
866
- "--chart-height": r(C) !== void 0 ? r(C) + "px" : "calc(100% - 36px)"
867
- })
868
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
869
- ], 64);
870
- };
871
- }
872
- }), oe = [
873
- "col-span-1",
874
- "col-span-2",
875
- "col-span-3",
876
- "col-span-4",
877
- "col-span-5",
878
- "col-span-6",
879
- "col-span-7",
880
- "col-span-8",
881
- "col-span-9",
882
- "col-span-10",
883
- "col-span-11",
884
- "col-span-12"
885
- ];
886
- function ra(e) {
887
- return e < 12 ? oe[e - 1] : oe[11];
888
- }
889
- function ia(e) {
890
- return e < 12 ? oe[Math.min(11, e * 2 - 1)] : oe[11];
891
- }
892
- function ca(e) {
893
- return e < 12 ? oe[Math.min(11, e * 3 - 1)] : oe[11];
894
- }
895
- const ua = /* @__PURE__ */ G({
896
- __name: "WidgetLinechart",
897
- props: {
898
- modelValue: { required: !0 },
899
- modelModifiers: {}
900
- },
901
- emits: ["update:modelValue"],
902
- setup(e) {
903
- const t = j(e, "modelValue"), o = h(() => {
904
- var g;
905
- return ((g = t.value.data) == null ? void 0 : g.xAxis) ?? [];
906
- }), a = h(() => {
907
- var g;
908
- return ((g = t.value.data) == null ? void 0 : g.datasets) ?? [];
909
- }), { datalabels: n, xCfg: i, yCfg: d, isTransposed: u, legend: c, chartWidth: w, chartHeight: C } = ie(
910
- t.value
911
- ), m = h(() => a.value.length > 0 ? [
912
- ...a.value.map((g, f) => ({
913
- label: g.name,
914
- data: g.values,
915
- dash: !!g.isCompare,
916
- fill: !1,
917
- color: re({ index: f, isCompare: g.isCompare })
918
- }))
919
- ] : []);
920
- return (g, f) => {
921
- const k = F("FmLineChart");
922
- return _(), z(U, null, [
923
- Z(g.$slots, "menu"),
924
- H(k, {
925
- class: "line-chart",
926
- datasets: m.value,
927
- "x-axis": { categories: o.value },
928
- "x-cfg": r(i),
929
- "y-cfg": r(d),
930
- transpose: r(u),
931
- legend: {
932
- display: r(c).display ?? !1,
933
- position: r(c).position,
934
- position: "bottom",
935
- maxHeight: 54,
936
- labels: {
937
- usePointStyle: r(c).usePointStyle ?? !0
938
- }
939
- },
940
- datalabels: r(n),
941
- "maintain-aspect-ratio": !1,
942
- style: Y({
943
- "--chart-width": r(w) !== void 0 ? r(w) + "px" : "97%",
944
- "--chart-height": r(C) !== void 0 ? r(C) + "px" : "calc(100% - 36px)"
945
- })
946
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
947
- ], 64);
948
- };
949
- }
950
- }), da = {
951
- key: 1,
952
- class: "grow"
953
- }, ha = {
954
- key: 2,
955
- class: "flex"
956
- }, Sa = /* @__PURE__ */ G({
957
- __name: "DynamicWidget",
958
- props: /* @__PURE__ */ xt({
959
- index: {
960
- type: Number,
961
- default: 0
962
- },
963
- hideExport: {
964
- type: Boolean,
965
- default: !1
966
- }
967
- }, {
968
- modelValue: { required: !0, default: () => {
969
- } },
970
- modelModifiers: {}
971
- }),
972
- emits: ["update:modelValue"],
973
- setup(e) {
974
- const t = y(!0), o = j(e, "modelValue"), a = o.value.widget.config, { t: n, te: i } = Re(), d = e, u = y(null), c = y(a.rollup), w = y(he()), C = y(a.drillDimension), m = h(() => {
975
- if (J.value.length > 0) {
976
- const s = J.value.findIndex(
977
- (L) => L.value === C.value
978
- );
979
- return s >= 0 ? s : 0;
980
- } else
981
- return -1;
982
- }), g = h(() => m.value !== 0), f = h(
983
- () => m.value != J.value.length - 1
984
- ), k = y(a.showTitle ?? !0), E = y(a.titleFontSize ?? 14), q = y(a.titleBold ?? !1), P = y(a.titleItalic ?? !1), X = y(a.titleUnderline ?? !1), l = y(a.chartWidth ?? void 0), p = y(a.chartHeight ?? void 0), S = y(a.showLabel ?? !1), b = y(a.labelAlign ?? Se.center), x = y(a.labelAnchor ?? Ce.center), R = y(a.labelRotation ?? 0), B = y(a.labelOffset ?? 0), T = y(a.labelFontSize ?? 12), D = h(() => a.showSearchBar), $ = y(a.showX ?? !0), pe = y(a.xPosition ?? _e.bottom), Fe = y(a.showXGrid ?? !1), Ee = y(a.showXTick ?? !0), Te = y(a.xTickFontSize ?? 12), We = y(a.showY ?? !0), ze = y(a.yPosition ?? xe.left), De = y(a.showYGrid ?? !1), Ae = y(a.showYTick ?? !0), He = y(a.yTickFontSize ?? 12), $e = y(a.showLegend ?? void 0), Pe = y(a.legendPosition ?? ke.top), Be = y(a.usePointStyle ?? !0), Me = y(a.rowHeight ?? 0), Ve = y(a.colWidths ?? []), fe = y(""), { breakpoints: N } = $t(), qe = y(), lt = h(() => N.value.lg || N.value.md ? ra(o.value.size.width) : N.value.sm ? ia(o.value.size.width) : ca(o.value.size.width)), ce = h(
985
- () => Bt.find((s) => s.type === o.value.widget.type)
986
- ), ee = Ke(() => {
987
- var s;
988
- qe.value = dt((s = u.value) == null ? void 0 : s.$el.offsetWidth), w.value = he();
989
- }), ot = h(() => {
990
- if (Mt(W.value.type, te.value))
991
- switch (o.value.widget.type) {
992
- case v.BarChart:
993
- return qt;
994
- case v.StackBarChart:
995
- return sa;
996
- case v.LineChart:
997
- return ua;
998
- case v.StackLineChart:
999
- return na;
1000
- case v.Circular:
1001
- return Nt;
1002
- case v.Scorecard:
1003
- return Gt;
1004
- case v.Spacer:
1005
- return Kt;
1006
- case v.Table:
1007
- return oa;
1008
- default:
1009
- return Qe;
1010
- }
1011
- else
1012
- return Qe;
1013
- }), te = y(null), { selectedLocationIds: ve, dateRange: st, compareDateRange: nt, timeRange: rt } = we(tt()), { businessId: it } = we(Le()), W = h(() => {
1014
- const s = JSON.parse(JSON.stringify(o.value.widget));
1015
- return {
1016
- ...s,
1017
- config: {
1018
- ...s.config,
1019
- rollup: c.value,
1020
- drillDimension: C.value,
1021
- showGrandTotal: !1
1022
- }
1023
- };
1024
- });
1025
- function ct() {
1026
- return {
1027
- data: te.value,
1028
- showTitle: k.value,
1029
- titleFontSize: E.value,
1030
- titleBold: q.value,
1031
- titleItalic: P.value,
1032
- titleUnderline: X.value,
1033
- chartHeight: p.value,
1034
- chartWidth: l.value,
1035
- showLabel: S.value,
1036
- labelAnchor: x.value,
1037
- labelAlign: b.value,
1038
- labelRotation: R.value,
1039
- labelOffset: B.value,
1040
- labelFontSize: T.value,
1041
- showX: $.value,
1042
- xPosition: pe.value,
1043
- showXGrid: Fe.value,
1044
- showXTick: Ee.value,
1045
- xTickFontSize: Te.value,
1046
- showY: We.value,
1047
- yPosition: ze.value,
1048
- showYGrid: De.value,
1049
- showYTick: Ae.value,
1050
- yTickFontSize: He.value,
1051
- isTransposed: W.value.config.isTransposed,
1052
- showLegend: $e.value,
1053
- legendPosition: Pe.value,
1054
- usePointStyle: Be.value
1055
- };
1056
- }
1057
- function ut() {
1058
- return {
1059
- data: te.value,
1060
- filterText: fe.value,
1061
- rollupPosition: W.value.config.rollupPosition,
1062
- rowHeight: Me.value,
1063
- colWidths: Ve.value
1064
- };
1065
- }
1066
- const Ne = h(() => {
1067
- switch (W.value.type) {
1068
- case v.Table:
1069
- return ut();
1070
- case v.BarChart:
1071
- case v.LineChart:
1072
- case v.StackBarChart:
1073
- case v.StackLineChart:
1074
- case v.Circular:
1075
- return ct();
1076
- default:
1077
- return { data: te.value };
1078
- }
1079
- }), Ie = h(() => {
1080
- const { config: s } = o.value.widget;
1081
- if (s.rollup != null) {
1082
- const L = [...s.dimensions].filter((K) => !K.hide);
1083
- return L.sort(
1084
- (K, se) => (s.rowIds || []).indexOf(ye(K)) - (s.rowIds || []).indexOf(ye(se))
1085
- ), [
1086
- { label: ae(n, i, "None", "other"), value: null },
1087
- { label: ae(n, i, "Grand Total", "other"), value: 0 },
1088
- ...[...L].slice(0, L.length - 1).map((K, se) => ({
1089
- label: ae(n, i, K.label, "other"),
1090
- value: se + 1
1091
- }))
1092
- ];
1093
- }
1094
- return [];
1095
- }), J = h(() => {
1096
- const { config: s } = W.value;
1097
- return s.isDrillable ? s.dimensions.map((L) => ({
1098
- label: ae(n, i, L.label, "other"),
1099
- value: ye(L)
1100
- })) : [];
1101
- });
1102
- le(
1103
- () => o.value.widget.config,
1104
- (s) => {
1105
- c.value = s.rollup, k.value = s.showTitle ?? !0, E.value = s.titleFontSize ?? 14, q.value = s.titleBold ?? !1, P.value = s.titleItalic ?? !1, X.value = s.titleUnderline ?? !1, p.value = s.chartHeight ?? void 0, l.value = s.chartWidth ?? void 0, S.value = s.showLabel ?? !1, b.value = s.labelAlign ?? Se.center, x.value = s.labelAnchor ?? Ce.center, R.value = s.labelRotation ?? 0, B.value = s.labelOffset ?? 0, T.value = s.labelFontSize ?? 12, $.value = s.showX ?? !0, pe.value = s.xPosition ?? _e.bottom, Fe.value = s.showXGrid ?? !1, Ee.value = s.showXTick ?? !0, Te.value = s.xTickFontSize ?? 12, We.value = s.showY ?? !0, ze.value = s.yPosition ?? xe.left, De.value = s.showYGrid ?? !1, Ae.value = s.showYTick ?? !0, He.value = s.yTickFontSize ?? 12, $e.value = s.showLegend ?? void 0, Pe.value = s.legendPosition ?? ke.top, Be.value = s.usePointStyle ?? !0, Me.value = s.rowHeight ?? 0, Ve.value = s.colWidths ?? [];
1106
- },
1107
- { deep: !0 }
1108
- ), le([() => c.value], () => {
1109
- c.value !== null && (o.value.widget.config.rollup = c.value);
1110
- }), le(
1111
- [
1112
- () => W.value,
1113
- () => st.value,
1114
- () => rt.value,
1115
- () => nt.value,
1116
- () => ve.value,
1117
- () => it.value
1118
- ],
1119
- () => {
1120
- var s;
1121
- ve.value && ((s = ve.value) == null ? void 0 : s.length) > 0 && Xe();
1122
- },
1123
- {
1124
- deep: !0
1125
- }
1126
- ), le(
1127
- [() => o.value.size],
1128
- () => {
1129
- ee();
1130
- },
1131
- { deep: !0 }
1132
- ), kt(() => {
1133
- ee(), N.value.sm || N.value.md || N.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", ee)) : addEventListener("resize", ee), Xe();
1134
- }), Rt(() => {
1135
- N.value.sm || N.value.md || N.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", ee)) : removeEventListener("resize", ee);
1136
- });
1137
- const Oe = Pt();
1138
- let ue;
1139
- const Xe = Ke(async function() {
1140
- if (W.value.config.schemaNames.length <= 0 && !(W.value.config.dimensions.length <= 0 || W.value.config.metrics.length <= 0)) {
1141
- Oe.open({
1142
- message: "schema must not be empty and dimension or metrics must have at least 1 column",
1143
- type: "info"
1144
- }), t.value = !1;
1145
- return;
1146
- }
1147
- try {
1148
- t.value = !0, ue && ue.abort(), ue = new AbortController();
1149
- const L = ue.signal;
1150
- te.value = await Dt(W.value, L), w.value = he(), t.value = !1;
1151
- } catch (L) {
1152
- te.value = null, L.code !== "ERR_CANCELED" && (Oe.open({ message: `Invalid chart ${W.value.type}`, type: "error" }), console.log(L), t.value = !1);
1153
- }
1154
- });
1155
- function dt(s) {
1156
- switch (o.value.widget.type) {
1157
- case "SPACER":
1158
- return;
1159
- case "SCORECARD":
1160
- return;
1161
- case "TABLE":
1162
- return `${o.value.size.height * 100 + (D.value ? 72 : 0) + 96.5}px`;
1163
- }
1164
- return `${Math.max(s / o.value.size.width, 90) * o.value.size.height}px`;
1165
- }
1166
- function ht() {
1167
- const s = m.value - 1;
1168
- s >= 0 && (C.value = J.value[s].value);
1169
- }
1170
- function mt() {
1171
- const s = m.value + 1;
1172
- s >= 0 && s < J.value.length && (C.value = J.value[s].value);
1173
- }
1174
- const pt = Object.values(Tt).map((s) => ({
1175
- label: Wt(s),
1176
- value: s,
1177
- onClick: async () => {
1178
- await zt(s, d.index);
1179
- }
1180
- })), ft = W.value.type === v.Spacer ? "flat" : "outlined", vt = W.value.type === v.Spacer ? "p-0" : "p-16";
1181
- return (s, L) => {
1182
- const K = F("FmTooltip"), se = F("FmSearch"), gt = F("FmCheckbox"), ge = F("FmButton"), yt = F("FmSelect"), wt = F("FmMenuItem"), bt = F("FmMenu"), Ct = F("FmForm"), St = F("FmCircularProgress"), _t = F("FmCard");
1183
- return _(), M(_t, {
1184
- ref_key: "tileCard",
1185
- ref: u,
1186
- class: me(`${lt.value} ${r(vt)}`),
1187
- variant: r(ft)
1188
- }, {
1189
- default: V(() => [
1190
- t.value ? (_(), M(St, { key: 1 })) : (_(), z("div", {
1191
- key: 0,
1192
- style: Y({ height: qe.value })
1193
- }, [
1194
- (_(), M(Lt(ot.value), {
1195
- key: w.value,
1196
- modelValue: Ne.value,
1197
- "onUpdate:modelValue": L[3] || (L[3] = (de) => Ne.value = de)
1198
- }, {
1199
- menu: V(() => [
1200
- H(Ct, { class: "flex items-center gap-2" }, {
1201
- default: V(() => {
1202
- var de, Ue, Ye, Ge;
1203
- return [
1204
- H(K, {
1205
- variant: "plain",
1206
- placement: "right",
1207
- content: W.value.description,
1208
- "hide-arrow": !0,
1209
- disabled: !W.value.description
1210
- }, {
1211
- default: V(() => [
1212
- k.value !== !1 ? (_(), z("p", {
1213
- key: 0,
1214
- style: Y({
1215
- fontSize: E.value + "px",
1216
- fontWeight: q.value ? "bold" : "normal",
1217
- fontStyle: P.value ? "italic" : "normal",
1218
- textDecoration: X.value ? "underline" : "none"
1219
- }),
1220
- class: me(["text-fm-color-typo-secondary line-clamp-1", [
1221
- E.value <= 18 ? "fm-typo-en-body-md-400" : "",
1222
- W.value.description ? "border-b-2 border-dashed border-gray-300" : ""
1223
- ]])
1224
- }, ne(r(ae)(r(n), r(i), W.value.title, "other")), 7)) : Q("", !0)
1225
- ]),
1226
- _: 1
1227
- }, 8, ["content", "disabled"]),
1228
- (de = ce.value) != null && de.showSearchBar ? (_(), M(se, {
1229
- key: 0,
1230
- modelValue: fe.value,
1231
- "onUpdate:modelValue": L[0] || (L[0] = (I) => fe.value = I),
1232
- class: "grow"
1233
- }, null, 8, ["modelValue"])) : (_(), z("div", da)),
1234
- Ft(H(gt, {
1235
- modelValue: S.value,
1236
- "onUpdate:modelValue": L[1] || (L[1] = (I) => S.value = I),
1237
- label: "Label",
1238
- value: !1
1239
- }, null, 8, ["modelValue"]), [
1240
- [Et, (Ue = ce.value) == null ? void 0 : Ue.showLabel]
1241
- ]),
1242
- (Ye = ce.value) != null && Ye.showDrillDimension && J.value.length > 0 ? (_(), z("div", ha, [
1243
- H(ge, {
1244
- icon: "arrow_upward",
1245
- variant: "tertiary",
1246
- disabled: !g.value,
1247
- onClick: ht
1248
- }, null, 8, ["disabled"]),
1249
- H(ge, {
1250
- icon: "arrow_downward",
1251
- variant: "tertiary",
1252
- disabled: !f.value,
1253
- onClick: mt
1254
- }, null, 8, ["disabled"])
1255
- ])) : Q("", !0),
1256
- (Ge = ce.value) != null && Ge.showRollup && Ie.value.length > 0 ? (_(), M(yt, {
1257
- key: 3,
1258
- modelValue: c.value,
1259
- "onUpdate:modelValue": L[2] || (L[2] = (I) => c.value = I),
1260
- class: "w-[150px]",
1261
- items: Ie.value
1262
- }, null, 8, ["modelValue", "items"])) : Q("", !0),
1263
- d.hideExport ? Q("", !0) : (_(), M(bt, {
1264
- key: 4,
1265
- shift: !0
1266
- }, {
1267
- "menu-button": V(() => [
1268
- H(ge, {
1269
- icon: "more_vert",
1270
- variant: "tertiary"
1271
- })
1272
- ]),
1273
- default: V(() => [
1274
- (_(!0), z(U, null, et(r(pt), (I) => (_(), M(wt, {
1275
- key: I.value,
1276
- label: I.label,
1277
- onClick: I.onClick
1278
- }, null, 8, ["label", "onClick"]))), 128))
1279
- ]),
1280
- _: 1
1281
- }))
1282
- ];
1283
- }),
1284
- _: 1
1285
- })
1286
- ]),
1287
- _: 1
1288
- }, 8, ["modelValue"]))
1289
- ], 4))
1290
- ]),
1291
- _: 1
1292
- }, 8, ["class", "variant"]);
1293
- };
1294
- }
1295
- });
1296
- export {
1297
- Se as L,
1298
- O as R,
1299
- Sa as _,
1300
- Ce as a,
1301
- ye as g,
1302
- Zt as u
1303
- };