@feedmepos/mf-report 5.21.8 → 5.21.9

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 (19) hide show
  1. package/dist/{App-CeJpDwr6.js → App-BldH4lfX.js} +3 -3
  2. package/dist/{BaseDialog.vue_vue_type_script_setup_true_lang-D8B07yTS.js → BaseDialog.vue_vue_type_script_setup_true_lang-geRM2Oed.js} +3 -3
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-CvXrokyz.js → Default.vue_vue_type_script_setup_true_lang-D4wHkMoh.js} +1 -1
  4. package/dist/FilterSelector.vue_vue_type_script_setup_true_lang-2rRVA20p.js +2443 -0
  5. package/dist/{InsightView-DrnotG7Z.js → InsightView-BDcZif2-.js} +2 -2
  6. package/dist/{Layout-BvO2OI5t.js → Layout-B63eRFpp.js} +1 -1
  7. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-BbijlCFH.js → MenuTab.vue_vue_type_script_setup_true_lang-BJhLdhAs.js} +3 -3
  8. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-BY8mogXn.js → NavigationTab.vue_vue_type_script_setup_true_lang-DMvt7llN.js} +1 -1
  9. package/dist/{OverviewView-BdboVIf3.js → OverviewView-Y8PR2IAN.js} +4 -4
  10. package/dist/{Report-IgEocSBo.js → Report-Bk2gvswN.js} +2 -2
  11. package/dist/{ReportEditor-Cnl7YJ49.js → ReportEditor-BEkhWwDc.js} +3 -3
  12. package/dist/{ReportView-qsbMlGws.js → ReportView-92_Xd7Y6.js} +5 -5
  13. package/dist/{Setting-B6bq7bjI.js → Setting-BvhSn9lR.js} +2 -2
  14. package/dist/TileEditor-CxUUdory.js +2820 -0
  15. package/dist/{TransitionFade-DPmXyftE.js → TransitionFade-nRtG3ig3.js} +2 -2
  16. package/dist/app.js +17 -9
  17. package/package.json +1 -1
  18. package/dist/FilterSelector.vue_vue_type_script_setup_true_lang-CyUEHyk-.js +0 -2437
  19. package/dist/TileEditor-BnxQfQUO.js +0 -2766
@@ -1,2437 +0,0 @@
1
- import { computed as k, defineComponent as Le, mergeModels as Ie, useModel as Me, ref as h, onMounted as Ue, nextTick as we, watch as he, resolveComponent as O, createElementBlock as te, openBlock as $, Fragment as be, renderSlot as Ne, createVNode as B, normalizeStyle as Ee, unref as s, createElementVNode as H, toDisplayString as Te, withCtx as oe, createBlock as re, createCommentVNode as Fe, normalizeClass as qe, h as st, renderList as nt, toRaw as fl, markRaw as vl, createTextVNode as ht, onUnmounted as gl, resolveDynamicComponent as yl, withDirectives as bl, vShow as wl, withModifiers as ct } from "vue";
2
- import { W as A, e as et, f as xl, S as Be, v as ot, g as Sl, h as dt, i as Bt, q as Ot, R as je, j as Cl, D as ze, c as pe, C as Ce, a as kl, b as _l, _ as Tl } from "./BaseDialog.vue_vue_type_script_setup_true_lang-D8B07yTS.js";
3
- import { u as tt, b as Qe, a as St, d as Ke, i as Fl } from "./vue-i18n-CMOl_N2v.js";
4
- import { d as Mt, _ as Ll, a as Dl, b as Rl, c as Vl } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-D9jFJLmv.js";
5
- import { storeToRefs as $e, defineStore as Ht } from "pinia";
6
- import { useBreakpoints as qt, useSnackbar as Ct, components as zl } from "@feedmepos/ui-library";
7
- import { a as $l } from "./SelectComponent.vue_vue_type_script_setup_true_lang-eyldXQxi.js";
8
- import { r as Oe } from "./i18n-DQxDgiLO.js";
9
- import { _ as ft } from "./NoData.vue_vue_type_script_setup_true_lang-Cp2mQEY3.js";
10
- var vt = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(vt || {}), Pe = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(Pe || {}), gt = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(gt || {}), yt = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(yt || {}), bt = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(bt || {}), wt = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(wt || {}), xt = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(xt || {});
11
- A.Circular, A.Table, A.BarChart, A.LineChart, A.StackBarChart, A.StackLineChart, A.Scorecard, A.Spacer;
12
- const Al = [
13
- {
14
- type: A.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: A.Table,
23
- showLabel: !1,
24
- showDrillDimension: !0,
25
- showRollup: !0,
26
- showSearchBar: !0
27
- },
28
- {
29
- type: A.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: A.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: A.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: A.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: A.Scorecard,
62
- showLabel: !1,
63
- showDrillDimension: !1,
64
- showRollup: !1,
65
- showSearchBar: !1
66
- },
67
- {
68
- type: A.Spacer,
69
- showLabel: !1,
70
- showDrillDimension: !1,
71
- showRollup: !1,
72
- showSearchBar: !1
73
- }
74
- ];
75
- function mt(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 El(e, a) {
80
- switch (e) {
81
- case A.BarChart:
82
- case A.LineChart:
83
- case A.StackBarChart:
84
- case A.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 A.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 A.Circular:
89
- return Array.isArray(a == null ? void 0 : a.datasets) && a.datasets.length > 0;
90
- case A.Scorecard:
91
- return !0;
92
- case A.Spacer:
93
- return !0;
94
- }
95
- }
96
- const It = [
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 Ae({
119
- index: e,
120
- isCompare: a,
121
- opacity: o
122
- }) {
123
- let l = typeof o == "number" ? o : 1;
124
- return a && (l = l * 0.6), `rgba(${It[e % It.length]}, ${l})`;
125
- }
126
- function Ut(e, a, o) {
127
- if (e === "" || a === "")
128
- return null;
129
- let l = (z) => z == null ? void 0 : z.replace(/,/g, "");
130
- o === "ID" && (l = (z) => z == null ? void 0 : z.replace(/\./g, "").replace(/,/g, "."));
131
- const g = Number(l(e)), _ = Number(l(a));
132
- if (isNaN(g) || isNaN(_))
133
- return null;
134
- let D = 0;
135
- _ === 0 ? g === 0 ? D = 0 : D = 1 : D = (g - _) / _;
136
- const R = Ml(D);
137
- return {
138
- value: isNaN(D) ? "" : `${(D * 100).toFixed(0)}%`,
139
- icon: R
140
- };
141
- }
142
- function Ml(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 lt(e) {
158
- function a(c, p, d) {
159
- if (c.measureText(p).width <= d) return p;
160
- const i = "…";
161
- let w = 0, x = p.length;
162
- for (; w < x; ) {
163
- const C = Math.floor((w + x) / 2), y = p.slice(0, C) + i;
164
- c.measureText(y).width <= d ? w = C + 1 : x = C;
165
- }
166
- return p.slice(0, w - 1) + i;
167
- }
168
- const o = k(() => ({
169
- display: e.showLabel,
170
- align: e.labelAlign,
171
- anchor: e.labelAnchor,
172
- rotation: e.labelRotation,
173
- offset: e.labelOffset,
174
- font: {
175
- size: e.labelFontSize
176
- },
177
- color: (c) => {
178
- const p = c.chart.data.datasets[c.datasetIndex];
179
- return p.borderColor ? Array.isArray(p.borderColor) ? p.borderColor[c.dataIndex] : p.borderColor : p.backgroundColor ? Array.isArray(p.backgroundColor) ? p.backgroundColor[c.dataIndex] : p.backgroundColor : "#000";
180
- },
181
- formatter: (c) => c === 0 ? "" : c.toLocaleString("en-US")
182
- })), l = k(() => ({
183
- display: e.showX,
184
- position: e.xPosition,
185
- grid: {
186
- display: e.showXGrid
187
- },
188
- ticks: {
189
- display: e.showXTick,
190
- callback: function(c) {
191
- if ((e == null ? void 0 : e.isTransposed) === !0) return String(c);
192
- let d = String(c);
193
- const i = this;
194
- i && typeof i.getLabelForValue == "function" && (d = i.getLabelForValue(c));
195
- const w = i == null ? void 0 : i.chart, x = i == null ? void 0 : i.ctx, C = w.height * 0.25;
196
- if (x && C > 0) {
197
- x.save();
198
- const W = x.measureText(d).width > C ? a(x, d, C) : d;
199
- return x.restore(), W;
200
- }
201
- return d;
202
- },
203
- font: {
204
- size: e.xTickFontSize
205
- }
206
- },
207
- title: {
208
- display: e.showXTitle,
209
- text: e.xTitle,
210
- font: {
211
- size: e.xTitleFontSize
212
- }
213
- },
214
- afterBuildTicks: (c) => {
215
- const p = Array.isArray(c == null ? void 0 : c.ticks) ? c.ticks : [];
216
- if (p.length === 0) return;
217
- const d = c.getLabelForValue(p[0].value), i = !isNaN(Number(d));
218
- c.options.ticks.minRotation = i || p.length < 10 ? 0 : 90;
219
- },
220
- afterFit: (c) => {
221
- if (!(e != null && e.isTransposed)) {
222
- const p = c.chart.height * 0.4;
223
- c.height > p && (c.height = p);
224
- }
225
- }
226
- })), g = k(() => ({
227
- display: e.showY,
228
- position: e.yPosition,
229
- grid: {
230
- display: e.showYGrid
231
- },
232
- ticks: {
233
- display: e.showYTick,
234
- font: {
235
- size: e.yTickFontSize
236
- },
237
- callback: function(c) {
238
- if (!((e == null ? void 0 : e.isTransposed) === !0)) return String(c);
239
- let d = String(c);
240
- const i = this;
241
- i && typeof i.getLabelForValue == "function" && (d = i.getLabelForValue(c));
242
- const w = i == null ? void 0 : i.chart, x = i == null ? void 0 : i.ctx, C = w.width * 0.4;
243
- if (x && C > 0) {
244
- x.save();
245
- const W = x.measureText(d).width > C ? a(x, d, C) : d;
246
- return x.restore(), W;
247
- }
248
- return d;
249
- }
250
- },
251
- title: {
252
- display: e.showYTitle,
253
- text: e.yTitle,
254
- font: {
255
- size: e.yTitleFontSize
256
- }
257
- }
258
- })), _ = k(() => ({
259
- display: e.showLegend,
260
- position: e.legendPosition,
261
- usePointStyle: e.usePointStyle,
262
- maxHeight: e.legendMaxHeight,
263
- maxWidth: e.legendMaxWidth,
264
- labels: {
265
- usePointStyle: e.usePointStyle ?? !0,
266
- generateLabels: (c) => {
267
- var d;
268
- const p = ((d = c == null ? void 0 : c.data) == null ? void 0 : d.datasets) || [];
269
- if (p.length === 0) return [];
270
- if (p.length === 1 && Array.isArray(p[0].backgroundColor) && p[0].backgroundColor.length > 1 && Array.isArray(p[0].data)) {
271
- const i = p[0];
272
- return c.data.labels.map((x, C) => {
273
- const y = i.backgroundColor[C];
274
- return {
275
- text: x,
276
- fontColor: "#6b6b6b",
277
- fillStyle: y,
278
- strokeStyle: y,
279
- datasetIndex: 0,
280
- index: C,
281
- hidden: c.getDataVisibility ? !c.getDataVisibility(C) : !1
282
- };
283
- });
284
- }
285
- return c.data.datasets.map((i, w) => {
286
- const x = i.borderColor || i.backgroundColor;
287
- return {
288
- text: i.label,
289
- fontColor: "#6b6b6b",
290
- fillStyle: x,
291
- strokeStyle: x,
292
- datasetIndex: w,
293
- hidden: !c.isDatasetVisible(w)
294
- };
295
- });
296
- }
297
- }
298
- })), D = k(() => e.isTransposed), R = k(() => e.chartWidth), z = k(() => e.chartHeight);
299
- return { datalabels: o, xCfg: l, yCfg: g, isTransposed: D, legend: _, chartWidth: R, chartHeight: z };
300
- }
301
- const Il = /* @__PURE__ */ Le({
302
- __name: "WidgetBarchart",
303
- props: /* @__PURE__ */ Ie({
304
- tileIndex: {}
305
- }, {
306
- modelValue: { required: !0 },
307
- modelModifiers: {}
308
- }),
309
- emits: ["update:modelValue"],
310
- setup(e) {
311
- const a = e, o = Me(e, "modelValue"), l = h(null), g = k(() => {
312
- var y;
313
- return ((y = o.value.data) == null ? void 0 : y.xAxis) ?? [];
314
- }), _ = k(() => {
315
- var y;
316
- return ((y = o.value.data) == null ? void 0 : y.datasets) ?? [];
317
- }), { datalabels: D, xCfg: R, yCfg: z, isTransposed: c, legend: p, chartWidth: d, chartHeight: i } = lt(
318
- o.value
319
- ), w = k(() => _.value.length > 0 ? [
320
- ..._.value.map((y, W) => ({
321
- label: y.name,
322
- data: y.values,
323
- dash: !!y.isCompare,
324
- backgroundColor: Ae({ index: W, isCompare: y.isCompare })
325
- }))
326
- ] : []), x = et();
327
- function C() {
328
- return x.extractChartSize(l.value, a.tileIndex) || { width: 0, height: 0 };
329
- }
330
- return Ue(() => {
331
- we(() => {
332
- C();
333
- });
334
- }), he([w], () => {
335
- we(() => C());
336
- }), (y, W) => {
337
- const v = O("FmBarChart");
338
- return $(), te(be, null, [
339
- Ne(y.$slots, "menu"),
340
- B(v, {
341
- ref_key: "chartRef",
342
- ref: l,
343
- class: "bar-chart",
344
- datasets: w.value,
345
- "x-axis": { categories: g.value },
346
- "x-cfg": s(R),
347
- "y-cfg": s(z),
348
- transpose: s(c),
349
- legend: {
350
- display: s(p).display ?? !1,
351
- position: s(p).position,
352
- maxHeight: s(p).maxHeight,
353
- maxWidth: s(p).maxWidth,
354
- labels: s(p).labels
355
- },
356
- datalabels: s(D),
357
- "maintain-aspect-ratio": !1,
358
- style: Ee({
359
- "--chart-width": s(d) !== void 0 ? s(d) + "px" : "100%",
360
- "--chart-height": s(i) !== void 0 ? s(i) + "px" : "calc(100% - 36px)"
361
- })
362
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
363
- ], 64);
364
- };
365
- }
366
- }), Nl = /* @__PURE__ */ Le({
367
- __name: "WidgetCircular",
368
- props: /* @__PURE__ */ Ie({
369
- tileIndex: {}
370
- }, {
371
- modelValue: { required: !0 },
372
- modelModifiers: {}
373
- }),
374
- emits: ["update:modelValue"],
375
- setup(e) {
376
- const a = e, o = Me(e, "modelValue"), { breakpoints: l } = qt(), g = h(null), { datalabels: _, legend: D, chartWidth: R, chartHeight: z } = lt(o.value), c = k(() => {
377
- let w = [];
378
- return o.value.data.datasets && o.value.data.metrics && o.value.data.datasets.length > 0 && o.value.data.metrics.length > 0 && (w = [
379
- {
380
- label: o.value.data.metrics[0],
381
- data: o.value.data.datasets.map((x) => x.value),
382
- backgroundColor: o.value.data.datasets.map((x, C) => Ae({ index: C }))
383
- }
384
- ]), w;
385
- }), p = et();
386
- function d() {
387
- return p.extractChartSize(g.value, a.tileIndex) || { width: 0, height: 0 };
388
- }
389
- Ue(() => {
390
- we(() => {
391
- d();
392
- });
393
- }), he([c], () => {
394
- we(() => d());
395
- });
396
- const i = k(() => l.value.lg ? 12 : 8);
397
- return (w, x) => {
398
- const C = O("FmPieChart");
399
- return $(), te(be, null, [
400
- Ne(w.$slots, "menu"),
401
- B(C, {
402
- ref_key: "chartRef",
403
- ref: g,
404
- class: "circular",
405
- percentage: "70%",
406
- datasets: c.value,
407
- metrics: o.value.data.datasets.map((y) => y.name),
408
- variant: "doughnut",
409
- legend: {
410
- display: s(D).display ?? !0,
411
- position: s(D).position ?? "top",
412
- maxHeight: s(D).maxHeight,
413
- maxWidth: s(D).maxWidth,
414
- labels: {
415
- ...s(D).labels,
416
- font: {
417
- size: i.value
418
- }
419
- }
420
- },
421
- datalabels: s(_),
422
- "maintain-aspect-ratio": !1,
423
- style: Ee({
424
- "--chart-width": s(R) !== void 0 ? s(R) + "px" : "100%",
425
- "--chart-height": s(z) !== void 0 ? s(z) + "px" : "calc(100% - 36px)"
426
- })
427
- }, null, 8, ["datasets", "metrics", "legend", "datalabels", "style"])
428
- ], 64);
429
- };
430
- }
431
- }), Wl = { class: "flex flex-col gap-1" }, Pl = { class: "fm-typo-en-title-sm-600" }, Bl = { class: "flex gap-2" }, Ol = { key: 0 }, Hl = { key: 1 }, ql = /* @__PURE__ */ Le({
432
- __name: "WidgetScorecard",
433
- props: {
434
- modelValue: { required: !0 },
435
- modelModifiers: {}
436
- },
437
- emits: ["update:modelValue"],
438
- setup(e) {
439
- const a = Me(e, "modelValue"), { t: o } = tt(), { compareDateRange: l, defaultDateSetting: g } = $e(Qe()), { country: _ } = St(), D = k(() => {
440
- var d;
441
- return ((d = a.value.data) == null ? void 0 : d.value) || "";
442
- }), R = k(() => {
443
- const { data: d } = a.value;
444
- return d != null && d.comparison ? Ut(D.value, d.comparison, _) : null;
445
- });
446
- function z(d) {
447
- switch (d) {
448
- case vt.bar:
449
- return "bar";
450
- case vt.line:
451
- return "line";
452
- default:
453
- return "line";
454
- }
455
- }
456
- const c = k(() => {
457
- var d;
458
- return (d = a.value.data) == null ? void 0 : d.sparkline;
459
- }), p = k(() => c.value.datasets.map((d) => ({
460
- label: d.name,
461
- data: d.values,
462
- fill: !0,
463
- color: "#36a2eb"
464
- })));
465
- return (d, i) => {
466
- var W;
467
- const w = O("FmIcon"), x = O("FmChip"), C = O("FmTooltip"), y = O("FmLineChart");
468
- return $(), te("div", Wl, [
469
- Ne(d.$slots, "menu"),
470
- H("p", Pl, Te(D.value), 1),
471
- H("div", Bl, [
472
- B(C, {
473
- content: `vs. ${(W = s(g).defaultCompareType) == null ? void 0 : W.split("_").join(" ")}`,
474
- placement: "right",
475
- "hide-arrow": "",
476
- variant: "plain"
477
- }, {
478
- default: oe(() => [
479
- R.value ? ($(), re(x, {
480
- key: 0,
481
- icon: R.value.icon.name,
482
- class: qe(`bg-${R.value.icon.tailwind}`),
483
- compact: ""
484
- }, {
485
- default: oe(() => [
486
- B(w, {
487
- name: R.value.icon.name,
488
- color: R.value.icon.color
489
- }, null, 8, ["name", "color"]),
490
- H("p", {
491
- class: "fm-typo-en-body-md-600",
492
- style: Ee({ color: R.value.icon.color })
493
- }, Te(R.value.value), 5)
494
- ]),
495
- _: 1
496
- }, 8, ["icon", "class"])) : Fe("", !0),
497
- s(l).endDate !== null && s(l).startDate !== null && R.value === null ? ($(), re(x, {
498
- key: 1,
499
- compact: ""
500
- }, {
501
- default: oe(() => [
502
- B(w, {
503
- name: "arrow_upward",
504
- color: "#C7C7CC"
505
- }),
506
- i[0] || (i[0] = H("p", { class: "fm-typo-en-body-md-600 text-fm-color-typo-disabled" }, "N/A", -1))
507
- ]),
508
- _: 1
509
- })) : Fe("", !0)
510
- ]),
511
- _: 1
512
- }, 8, ["content"])
513
- ]),
514
- c.value ? ($(), te("div", Ol, [
515
- z(c.value.type) === "line" ? ($(), re(y, {
516
- key: 0,
517
- class: "sparkline",
518
- datasets: p.value,
519
- legend: {
520
- display: !1
521
- },
522
- datalabels: { display: !1 },
523
- "x-axis": { categories: c.value.dimensions },
524
- "y-cfg": { display: !1 },
525
- "x-cfg": { display: !1 },
526
- "maintain-aspect-ratio": !1
527
- }, null, 8, ["datasets", "x-axis"])) : Fe("", !0)
528
- ])) : ($(), te("div", Hl, i[1] || (i[1] = [
529
- H("div", { class: "sparkline" }, [
530
- H("div", { class: "flex flex-col gap-8" }, [
531
- H("div"),
532
- H("div")
533
- ]),
534
- H("div", { class: "grow" })
535
- ], -1)
536
- ])))
537
- ]);
538
- };
539
- }
540
- }), Ul = {};
541
- function Gl(e, a) {
542
- const o = O("FmMenuDivider");
543
- return $(), re(o);
544
- }
545
- const Yl = /* @__PURE__ */ $l(Ul, [["render", Gl]]), Xl = "mf-reporttable-dimension", Nt = Ht(Xl, () => {
546
- const e = h(0), a = h([]), o = h(!1), l = (v, n) => {
547
- e.value = v, _(v, n);
548
- }, g = (v, n, T, m) => {
549
- a[v] = n, a.value = [...a.value], D(v, n, T, m);
550
- }, _ = (v, n) => {
551
- const T = (n == null ? void 0 : n.querySelectorAll("thead tr")) ?? [], m = (n == null ? void 0 : n.querySelectorAll("tbody tr")) ?? [];
552
- [...T, ...m].forEach((U) => {
553
- const K = U;
554
- K && (K.style.height = `${v}px`);
555
- });
556
- }, D = (v, n, T, m = !1) => {
557
- const L = (T == null ? void 0 : T.querySelectorAll("th")) ?? [];
558
- if (v === void 0) return;
559
- const U = L[v], K = m ? a[v] : n;
560
- if (!U || K === void 0) return;
561
- const ee = () => {
562
- U.style.width = `${K}px`;
563
- };
564
- m ? requestAnimationFrame(ee) : ee();
565
- }, R = () => {
566
- const v = document.querySelectorAll("th"), n = document.querySelectorAll("td"), T = document.querySelector("table");
567
- T == null || T.classList.add("table-fixed"), v.forEach((m) => m.classList.add("toggleEditResize")), n.forEach((m) => m.classList.add("toggleEditResize")), o.value = !0;
568
- }, z = () => {
569
- const v = document.querySelectorAll("th"), n = document.querySelectorAll("td"), T = document.querySelectorAll(".col-resize-handle"), m = document.querySelectorAll(".row-resize-handle");
570
- v.forEach((L) => L.classList.remove("toggleEditResize")), n.forEach((L) => L.classList.remove("toggleEditResize")), T.forEach((L) => L.remove()), m.forEach((L) => L.remove()), o.value = !1;
571
- }, c = () => {
572
- e.value = 0, a.value = [];
573
- }, p = (v, n) => {
574
- if (n) {
575
- const T = document.querySelectorAll(`thead th:nth-child(${v + 1})`), m = document.querySelectorAll(`tbody td:nth-child(${v + 1})`);
576
- [...T, ...m].forEach((L) => {
577
- L.classList.add("highlight-hover-col");
578
- });
579
- } else
580
- document.querySelectorAll(
581
- `thead th:nth-child(${v + 1}), tbody td:nth-child(${v + 1})`
582
- ).forEach((T) => T.classList.add("highlight-col"));
583
- }, d = (v) => {
584
- const n = document.querySelectorAll("thead tr"), T = document.querySelectorAll("tbody tr"), m = [...n, ...T];
585
- for (const L of m)
586
- v ? L.classList.add("highlight-hover-row") : L.classList.add("highlight-row");
587
- }, i = (v) => {
588
- const n = v ? ".highlight-hover-row" : ".highlight-row", T = document.querySelectorAll(n);
589
- for (const m of T)
590
- m.classList.remove(n.slice(1));
591
- }, w = (v) => {
592
- v ? document.querySelectorAll(".highlight-hover-col").forEach((n) => {
593
- n.classList.remove("highlight-hover-col");
594
- }) : document.querySelectorAll(".highlight-col").forEach((n) => n.classList.remove("highlight-col"));
595
- }, x = (v, n) => {
596
- const T = /* @__PURE__ */ new Map(), m = v.clientX, L = v.target.closest("table"), U = L == null ? void 0 : L.querySelectorAll("th")[n], K = U == null ? void 0 : U.getBoundingClientRect().width, ee = T.get(n) ? a[n.toString()] || 60 : (T.set(n, !0), K || a[n.toString()] || 60), se = U == null ? void 0 : U.querySelector("p");
597
- if (!se) return;
598
- const ke = se.textContent || "", ve = window.getComputedStyle(se), _e = `${ve.fontWeight} ${ve.fontSize} ${ve.fontFamily}`, fe = document.createElement("canvas").getContext("2d");
599
- if (!fe) return;
600
- fe.font = _e;
601
- const b = fe.measureText(ke), V = window.getComputedStyle(U), G = parseFloat(V.paddingLeft || "0"), P = parseFloat(V.paddingRight || "0"), I = b.width + G + P;
602
- p(n, !1);
603
- const M = (xe) => {
604
- const Se = xe.clientX - m, ge = Math.max(I, ee + Se);
605
- if (L) {
606
- g(n, ge, L, !0);
607
- let t = 0;
608
- L.querySelectorAll("th").forEach((S, N) => {
609
- t += N === n ? ge : a[N] || S.getBoundingClientRect().width;
610
- }), L.classList.remove("w-full"), L.style.width = `${t}px`;
611
- const F = L == null ? void 0 : L.parentElement;
612
- if (F) {
613
- const S = F.scrollWidth, N = F.scrollLeft;
614
- F.offsetWidth + N >= S - 100 && (F.scrollLeft = S);
615
- }
616
- }
617
- }, ie = () => {
618
- const xe = (L == null ? void 0 : L.querySelectorAll("th")) ?? [], Se = [...a.value];
619
- xe.forEach((ge, t) => {
620
- const f = ge.getBoundingClientRect().width;
621
- a[t] = f, Se[t] = f;
622
- }), a.value = Se, w(!1), document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", ie);
623
- };
624
- document.addEventListener("mousemove", M), document.addEventListener("mouseup", ie);
625
- }, C = (v) => {
626
- const n = v.clientY, T = v.target.closest("table"), m = e.value || 48;
627
- d(!1);
628
- const L = (K) => {
629
- const ee = Math.max(30, m + (K.clientY - n));
630
- T && l(ee, T);
631
- }, U = () => {
632
- i(!1), document.removeEventListener("mousemove", L), document.removeEventListener("mouseup", U);
633
- };
634
- document.addEventListener("mousemove", L), document.addEventListener("mouseup", U);
635
- };
636
- return {
637
- rowHeight: e,
638
- colWidths: a,
639
- isEditing: o,
640
- updateRowHeight: l,
641
- updateColWidth: g,
642
- setRowHeights: _,
643
- setColWidths: D,
644
- enableEditMode: R,
645
- disableEditMode: z,
646
- resetStore: c,
647
- highlightCol: p,
648
- highlightRows: d,
649
- removeRowHighlight: i,
650
- removeColHighlight: w,
651
- resizeCol: x,
652
- resizeRow: C,
653
- enableCellResizing: () => {
654
- const v = document.querySelector("thead"), n = document.querySelectorAll("thead tr"), T = document.querySelectorAll("tbody tr"), m = [...n, ...T];
655
- v && v.classList.remove("sticky");
656
- const L = (U, K) => {
657
- const ee = document.createElement("div");
658
- return ee.className = `${U}-resize-handle`, U === "col" ? (ee.addEventListener("mouseenter", () => p(K, !0)), ee.addEventListener("mouseleave", () => w(!0)), ee.addEventListener("mousedown", (se) => {
659
- se.stopPropagation(), x(se, K);
660
- })) : (ee.addEventListener("mouseenter", () => d(!0)), ee.addEventListener("mouseleave", () => i(!0)), ee.addEventListener("mousedown", (se) => {
661
- se.stopPropagation(), C(se);
662
- })), ee;
663
- };
664
- m.forEach((U) => {
665
- const K = U.closest("thead") !== null;
666
- U.querySelectorAll(K ? "th" : "td").forEach((se, ke) => {
667
- const ve = L("col", ke), _e = L("row", ke);
668
- se.appendChild(ve), se.appendChild(_e);
669
- });
670
- }), R();
671
- },
672
- cancelResizingChanges: () => {
673
- z();
674
- }
675
- };
676
- });
677
- function pt(e) {
678
- if (e == null || e === "")
679
- return "";
680
- const a = String(e), o = Number(a);
681
- if (isNaN(o)) return a;
682
- const [l, g] = a.split("."), _ = new Intl.NumberFormat("en-US").format(Number(l));
683
- return g !== void 0 ? `${_}.${g}` : _;
684
- }
685
- const jl = "/assets/processTableData.worker-B_-FBESg.js", Kl = { class: "my-4" }, Jl = {
686
- class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
687
- style: { backgroundColor: "#f9f9f9" }
688
- }, Zl = { class: "font-bold" }, Ql = { class: "text-fm-color-neutral-gray-300" }, ea = /* @__PURE__ */ Le({
689
- __name: "WidgetTable",
690
- props: /* @__PURE__ */ Ie({
691
- tileIndex: {}
692
- }, {
693
- modelValue: { required: !0 },
694
- modelModifiers: {}
695
- }),
696
- emits: ["update:modelValue"],
697
- setup(e) {
698
- const { t: a, te: o } = tt(), l = Me(e, "modelValue"), { country: g } = St(), { clearTileSorts: _, setTileSorts: D } = xl(), R = Ct(), z = e, c = h([]), { isEditing: p, colWidths: d, rowHeight: i } = $e(Nt()), { setColWidths: w, setRowHeights: x, enableCellResizing: C } = Nt(), y = h(null), W = k(() => {
699
- var b;
700
- return ((b = l.value.data) == null ? void 0 : b.columns) || [{ label: "", key: "" }];
701
- }), v = k(() => {
702
- var b;
703
- return ((b = l.value.data) == null ? void 0 : b.rows) || [];
704
- }), n = k(() => l.value.filterText), T = k(() => {
705
- var b, V;
706
- if (!(n.value && n.value.trim().length > 0 || !((b = v.value[0]) != null && b.isRollup) && !((V = v.value[v.value.length - 1]) != null && V.isRollup))) {
707
- if (l.value.rollupPosition === Pe.top || l.value.rollupPosition === void 0)
708
- return Pe.top;
709
- if (l.value.rollupPosition === Pe.bottom)
710
- return Pe.bottom;
711
- }
712
- }), m = k(() => {
713
- const P = T.value !== void 0 ? 1 : 0, I = (y.value ? y.value.$el.offsetHeight : 0) - 48;
714
- return Math.floor((I - 34.5 - 32) / 48) - P;
715
- }), L = k(() => {
716
- var V, G;
717
- let b = [];
718
- switch (T.value) {
719
- case Pe.top:
720
- b = [...((V = v.value[0]) == null ? void 0 : V.cells) || []].map((P, I) => {
721
- var M;
722
- return {
723
- main: P,
724
- comparison: (M = v.value[0]) == null ? void 0 : M.comparisonCells[I],
725
- rowType: W.value[I].type
726
- };
727
- });
728
- break;
729
- case Pe.bottom:
730
- b = [...((G = v.value[v.value.length - 1]) == null ? void 0 : G.cells) || []].map((P, I) => {
731
- var M;
732
- return {
733
- main: P,
734
- comparison: (M = v.value[0]) == null ? void 0 : M.comparisonCells[I],
735
- rowType: W.value[I].type
736
- };
737
- });
738
- break;
739
- }
740
- return b.length > 0 && b[0].main === "" && (b[0].main = Oe(a, o, "Grand Total", "other")), b;
741
- });
742
- function U(b) {
743
- let V = (b == null ? void 0 : b.main) || "";
744
- return !b || b.main === "" || !b.comparison ? {
745
- main: V
746
- } : (V.includes("#") && !V.startsWith("#") && (V = V.split("#")[0]), {
747
- main: V,
748
- comparison: b == null ? void 0 : b.comparison,
749
- difference: Ut(b.main, b.comparison, g)
750
- });
751
- }
752
- Ue(() => {
753
- _();
754
- });
755
- const K = h([]);
756
- let ee = 0, se;
757
- function ke() {
758
- var I;
759
- if (!((I = l.value) != null && I.data)) {
760
- K.value = [];
761
- return;
762
- }
763
- const b = ++ee, V = (l.value.data.rows || []).map((M) => ({
764
- isRollup: M.isRollup,
765
- cells: Array.isArray(M.cells) ? [...M.cells] : [],
766
- comparisonCells: Array.isArray(M.comparisonCells) ? [...M.comparisonCells] : []
767
- })), G = (l.value.data.columns || []).map((M) => ({
768
- key: M.key,
769
- type: M.type,
770
- label: M.label
771
- })), P = {
772
- rows: V,
773
- columns: G,
774
- filter: n.value ?? "",
775
- globalSorts: fl(c.value).map((M) => ({
776
- key: M.key,
777
- type: M.type
778
- })),
779
- grandTotalPosition: T.value,
780
- pageSize: m.value
781
- };
782
- Sl(jl, P).then((M) => {
783
- b === ee && (M != null && M.error ? (R.open({ message: "Failed to process table data. Please retry.", type: "error" }), console.log(M.error), K.value = []) : K.value = vl(M.data || []));
784
- });
785
- }
786
- he(
787
- () => c.value,
788
- (b) => {
789
- z.tileIndex === void 0 || z.tileIndex === null || D(z.tileIndex, b);
790
- },
791
- { immediate: !0, deep: !0 }
792
- );
793
- const ve = k(() => {
794
- var G, P;
795
- const b = ((G = l.value.data) == null ? void 0 : G.rows) || [], V = ((P = l.value.data) == null ? void 0 : P.columns) || [];
796
- return JSON.stringify({
797
- rowsLength: b.length,
798
- columns: V.map((I) => ({ key: I.key, type: I.type, label: I.label })),
799
- filter: n.value ?? "",
800
- globalSorts: c.value.map((I) => ({ key: I.key, type: I.type })),
801
- grandTotalPosition: T.value,
802
- pageSize: m.value
803
- });
804
- });
805
- he(
806
- () => ve.value,
807
- () => {
808
- clearTimeout(se), se = setTimeout(ke, 200);
809
- },
810
- { immediate: !0 }
811
- );
812
- function _e(b) {
813
- const V = c.value.find((G) => G.key === b);
814
- if (!V) {
815
- c.value.push({ key: b, type: Be.Asc });
816
- return;
817
- }
818
- V.type === Be.Asc ? V.type = Be.Desc : V.type === Be.Desc && (c.value = c.value.filter((G) => G.key !== b));
819
- }
820
- const De = k(
821
- () => {
822
- var b;
823
- return (((b = l.value.colWidths) == null ? void 0 : b.length) ?? 0) > 0 || d.value.length > 0;
824
- }
825
- ), fe = k(() => {
826
- var b;
827
- return (b = l.value.data) != null && b.columns ? l.value.data.columns.map((V) => {
828
- const G = Oe(a, o, V.label, "other"), P = c.value.find((ie) => ie.key === V.key), I = !!P, M = I ? P.type === Be.Asc ? "arrow_upward" : "arrow_downward" : "unfold_more";
829
- return {
830
- accessorKey: V.key,
831
- header: () => {
832
- const ie = O("FmIcon");
833
- return st(
834
- "button",
835
- {
836
- type: "button",
837
- class: `w-full flex items-center gap-1 group/select-header select-none ${V.type === "NUMERIC" ? "justify-end" : "justify-start"} ${I ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-400"}`,
838
- onClick: () => _e(V.key)
839
- },
840
- [
841
- st(
842
- "span",
843
- { class: `${V.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap` },
844
- G
845
- ),
846
- st(ie, {
847
- name: M,
848
- color: I ? "primary" : "neutral-gray-400",
849
- size: "sm",
850
- class: "transition-transform",
851
- style: M === "arrow_upward" ? "transform: translateY(-1px);" : ""
852
- })
853
- ]
854
- );
855
- },
856
- cell: (ie) => {
857
- var ge, t;
858
- const xe = U(ie.getValue()), Se = (t = (ge = ie == null ? void 0 : ie.row) == null ? void 0 : ge.original) == null ? void 0 : t.isRollup;
859
- return st(
860
- "div",
861
- {
862
- class: [
863
- Se ? "fm-typo-en-body-md-600 text-fm-color-typo-secondary" : "fm-typo-en-body-md-400",
864
- V.type === "NUMERIC" ? "text-right" : "",
865
- De.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
866
- ].join(" ")
867
- },
868
- [V.type === "NUMERIC" ? pt(xe.main) : xe.main]
869
- );
870
- },
871
- enableSorting: !1
872
- };
873
- }) : [];
874
- });
875
- return he(
876
- () => d.value.length > 0,
877
- async (b) => {
878
- b && p.value && (await we(), C());
879
- }
880
- ), he(
881
- [() => fe.value],
882
- async () => {
883
- var I;
884
- await we();
885
- const b = (I = y.value) == null ? void 0 : I.$el;
886
- if (!b) return;
887
- const V = b.querySelector("table");
888
- if (!V) return;
889
- V.classList.add(De.value ? "table-fixed" : "table-auto");
890
- let G, P;
891
- p.value ? (C(), G = d.value, P = i.value) : (P = l.value.rowHeight, G = l.value.colWidths), typeof P == "number" && x(P, b), G == null || G.forEach((M, ie) => {
892
- w(ie, M, b);
893
- });
894
- },
895
- { immediate: !0 }
896
- ), (b, V) => {
897
- const G = O("FmTable");
898
- return $(), te(be, null, [
899
- H("div", Kl, [
900
- Ne(b.$slots, "menu")
901
- ]),
902
- B(G, {
903
- ref_key: "table",
904
- ref: y,
905
- "column-defs": fe.value,
906
- "row-data": K.value,
907
- "search-value": n.value,
908
- "page-size": m.value,
909
- "shrink-at": !1,
910
- "force-mobile-footer": !0,
911
- class: "scrollbar-hide-table"
912
- }, {
913
- "pin-top": oe(() => [
914
- H("tbody", null, [
915
- H("tr", Jl, [
916
- ($(!0), te(be, null, nt(L.value, (P, I) => ($(), te("td", {
917
- key: `${s(ot)()}_${I}`,
918
- class: "h-[48px] text-fm-color-typo-primary px-16"
919
- }, [
920
- H("span", {
921
- class: qe([
922
- "items-center text-fm-color-typo-secondary gap-2",
923
- P.rowType === "NUMERIC" ? "text-right" : "",
924
- De.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
925
- ])
926
- }, [
927
- H("p", Zl, Te(P.rowType === "NUMERIC" ? s(pt)(P.main) : P.main), 1),
928
- H("p", Ql, Te(P.comparison ? P.rowType === "NUMERIC" ? `(${s(pt)(P.comparison)})` : `(${P.comparison})` : ""), 1)
929
- ], 2)
930
- ]))), 128))
931
- ])
932
- ])
933
- ]),
934
- _: 1
935
- }, 8, ["column-defs", "row-data", "search-value", "page-size"])
936
- ], 64);
937
- };
938
- }
939
- }), ta = /* @__PURE__ */ Le({
940
- __name: "WidgetStackBarChart",
941
- props: /* @__PURE__ */ Ie({
942
- tileIndex: {}
943
- }, {
944
- modelValue: { required: !0 },
945
- modelModifiers: {}
946
- }),
947
- emits: ["update:modelValue"],
948
- setup(e) {
949
- const a = e, o = Me(e, "modelValue"), l = h(null), g = k(() => {
950
- var W;
951
- return ((W = o.value.data) == null ? void 0 : W.xAxis) || [];
952
- }), _ = k(() => {
953
- var y;
954
- return ((y = o.value.data) == null ? void 0 : y.datasets) ?? [];
955
- }), { datalabels: D, xCfg: R, yCfg: z, isTransposed: c, legend: p, chartWidth: d, chartHeight: i } = lt(
956
- o.value
957
- ), w = k(() => _.value.length > 0 ? [
958
- ..._.value.map((y, W) => {
959
- let v = y.values;
960
- return {
961
- label: y.name,
962
- data: v,
963
- dash: !!y.isCompare,
964
- backgroundColor: Ae({ index: W, isCompare: y.isCompare })
965
- };
966
- })
967
- ] : []), x = et();
968
- function C() {
969
- return x.extractChartSize(l.value, a.tileIndex) || { width: 0, height: 0 };
970
- }
971
- return Ue(() => {
972
- we(() => {
973
- C();
974
- });
975
- }), he([w], () => {
976
- we(() => C());
977
- }), (y, W) => {
978
- const v = O("FmBarChart");
979
- return $(), te(be, null, [
980
- Ne(y.$slots, "menu"),
981
- B(v, {
982
- ref_key: "chartRef",
983
- ref: l,
984
- class: "bar-chart",
985
- datasets: w.value,
986
- "x-axis": { categories: g.value },
987
- "x-cfg": s(R),
988
- "y-cfg": s(z),
989
- transpose: s(c),
990
- stacked: !0,
991
- legend: {
992
- display: s(p).display ?? !1,
993
- position: s(p).position,
994
- maxHeight: s(p).maxHeight,
995
- maxWidth: s(p).maxWidth,
996
- labels: s(p).labels
997
- },
998
- datalabels: s(D),
999
- "maintain-aspect-ratio": !1,
1000
- style: Ee({
1001
- "--chart-width": s(d) !== void 0 ? s(d) + "px" : "100%",
1002
- "--chart-height": s(i) !== void 0 ? s(i) + "px" : "calc(100% - 36px)"
1003
- })
1004
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1005
- ], 64);
1006
- };
1007
- }
1008
- }), la = /* @__PURE__ */ Le({
1009
- __name: "WidgetStackLineChart",
1010
- props: /* @__PURE__ */ Ie({
1011
- tileIndex: {}
1012
- }, {
1013
- modelValue: { required: !0 },
1014
- modelModifiers: {}
1015
- }),
1016
- emits: ["update:modelValue"],
1017
- setup(e) {
1018
- var v;
1019
- const a = e, o = Me(e, "modelValue"), l = ((v = o.value.data) == null ? void 0 : v.xAxis) ?? [], g = k(
1020
- () => l.length === 1 && R.value.length > 0 && R.value.every((n) => n.values.length === 1)
1021
- ), _ = k(() => g.value ? ["", l[0], ""] : l), D = h(null), R = k(() => {
1022
- var n;
1023
- return ((n = o.value.data) == null ? void 0 : n.datasets) ?? [];
1024
- }), { datalabels: z, xCfg: c, yCfg: p, isTransposed: d, legend: i, chartWidth: w, chartHeight: x } = lt(
1025
- o.value
1026
- ), C = k(() => R.value.length > 0 ? [
1027
- ...R.value.map((n, T) => {
1028
- let m = n.values;
1029
- return g.value && (m = [NaN, m[0], NaN]), {
1030
- label: n.name,
1031
- data: m,
1032
- dash: n.isCompare,
1033
- fill: !1,
1034
- color: Ae({ index: T, isCompare: n.isCompare }),
1035
- pointRadius: g.value ? 4 : void 0,
1036
- pointHoverRadius: g.value ? 6 : void 0,
1037
- pointBackgroundColor: g.value ? Ae({ index: T, isCompare: n.isCompare }) : void 0,
1038
- pointBorderColor: g.value ? Ae({ index: T, isCompare: n.isCompare }) : void 0,
1039
- pointBorderWidth: g.value ? 2 : void 0
1040
- };
1041
- })
1042
- ] : []), y = et();
1043
- function W() {
1044
- return y.extractChartSize(D.value, a.tileIndex) || { width: 0, height: 0 };
1045
- }
1046
- return Ue(() => {
1047
- we(() => {
1048
- W();
1049
- });
1050
- }), he([C], () => {
1051
- we(() => W());
1052
- }), (n, T) => {
1053
- const m = O("FmLineChart");
1054
- return $(), te(be, null, [
1055
- Ne(n.$slots, "menu"),
1056
- B(m, {
1057
- ref_key: "chartRef",
1058
- ref: D,
1059
- class: "line-chart",
1060
- datasets: C.value,
1061
- "x-axis": { categories: _.value },
1062
- "x-cfg": s(c),
1063
- "y-cfg": s(p),
1064
- transpose: s(d),
1065
- legend: {
1066
- display: s(i).display ?? !1,
1067
- position: s(i).position,
1068
- maxHeight: s(i).maxHeight,
1069
- maxWidth: s(i).maxWidth,
1070
- labels: s(i).labels
1071
- },
1072
- stacked: !0,
1073
- datalabels: s(z),
1074
- "maintain-aspect-ratio": !1,
1075
- style: Ee({
1076
- "--chart-width": s(w) !== void 0 ? s(w) + "px" : "100%",
1077
- "--chart-height": s(x) !== void 0 ? s(x) + "px" : "calc(100% - 36px)"
1078
- })
1079
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1080
- ], 64);
1081
- };
1082
- }
1083
- }), Je = [
1084
- "col-span-1",
1085
- "col-span-2",
1086
- "col-span-3",
1087
- "col-span-4",
1088
- "col-span-5",
1089
- "col-span-6",
1090
- "col-span-7",
1091
- "col-span-8",
1092
- "col-span-9",
1093
- "col-span-10",
1094
- "col-span-11",
1095
- "col-span-12"
1096
- ];
1097
- function aa(e) {
1098
- return e < 12 ? Je[e - 1] : Je[11];
1099
- }
1100
- function sa(e) {
1101
- return e < 12 ? Je[Math.min(11, e * 2 - 1)] : Je[11];
1102
- }
1103
- function oa(e) {
1104
- return e < 12 ? Je[Math.min(11, e * 3 - 1)] : Je[11];
1105
- }
1106
- const na = /* @__PURE__ */ Le({
1107
- __name: "WidgetLinechart",
1108
- props: /* @__PURE__ */ Ie({
1109
- tileIndex: {}
1110
- }, {
1111
- modelValue: { required: !0 },
1112
- modelModifiers: {}
1113
- }),
1114
- emits: ["update:modelValue"],
1115
- setup(e) {
1116
- var v;
1117
- const a = e, o = Me(e, "modelValue"), l = ((v = o.value.data) == null ? void 0 : v.xAxis) ?? [], g = k(
1118
- () => l.length === 1 && R.value.length > 0 && R.value.every((n) => n.values.length === 1)
1119
- ), _ = k(() => g.value ? ["", l[0], ""] : l), D = h(null), R = k(() => {
1120
- var n;
1121
- return ((n = o.value.data) == null ? void 0 : n.datasets) ?? [];
1122
- }), { datalabels: z, xCfg: c, yCfg: p, isTransposed: d, legend: i, chartWidth: w, chartHeight: x } = lt(
1123
- o.value
1124
- ), C = k(() => R.value.length > 0 ? [
1125
- ...R.value.map((n, T) => {
1126
- let m = n.values;
1127
- return g.value && (m = [NaN, m[0], NaN]), {
1128
- label: n.name,
1129
- data: m,
1130
- dash: !!n.isCompare,
1131
- fill: !1,
1132
- color: Ae({ index: T, isCompare: n.isCompare }),
1133
- pointRadius: g.value ? 4 : void 0,
1134
- pointHoverRadius: g.value ? 6 : void 0,
1135
- pointBackgroundColor: g.value ? Ae({ index: T, isCompare: n.isCompare }) : void 0,
1136
- pointBorderColor: g.value ? Ae({ index: T, isCompare: n.isCompare }) : void 0,
1137
- pointBorderWidth: g.value ? 2 : void 0
1138
- };
1139
- })
1140
- ] : []), y = et();
1141
- function W() {
1142
- return y.extractChartSize(D.value, a.tileIndex) || { width: 0, height: 0 };
1143
- }
1144
- return Ue(() => {
1145
- we(() => {
1146
- W();
1147
- });
1148
- }), he([C], () => {
1149
- we(() => W());
1150
- }), (n, T) => {
1151
- const m = O("FmLineChart");
1152
- return $(), te(be, null, [
1153
- Ne(n.$slots, "menu"),
1154
- B(m, {
1155
- ref_key: "chartRef",
1156
- ref: D,
1157
- class: "line-chart",
1158
- datasets: C.value,
1159
- "x-axis": { categories: _.value },
1160
- "x-cfg": s(c),
1161
- "y-cfg": s(p),
1162
- transpose: s(d),
1163
- legend: {
1164
- display: s(i).display ?? !1,
1165
- position: s(i).position,
1166
- maxHeight: s(i).maxHeight,
1167
- maxWidth: s(i).maxWidth,
1168
- labels: s(i).labels
1169
- },
1170
- datalabels: s(z),
1171
- "maintain-aspect-ratio": !1,
1172
- style: Ee({
1173
- "--chart-width": s(w) !== void 0 ? s(w) + "px" : "100%",
1174
- "--chart-height": s(x) !== void 0 ? s(x) + "px" : "calc(100% - 36px)"
1175
- })
1176
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1177
- ], 64);
1178
- };
1179
- }
1180
- }), ra = { class: "flex flex-col gap-16" }, ia = { class: "flex flex-row" }, ua = /* @__PURE__ */ Le({
1181
- __name: "PdfOrientationDialog",
1182
- props: /* @__PURE__ */ Ie({
1183
- reportType: {},
1184
- index: {}
1185
- }, {
1186
- modelValue: { type: Boolean, required: !0 },
1187
- modelModifiers: {}
1188
- }),
1189
- emits: ["update:modelValue"],
1190
- setup(e) {
1191
- const { t: a } = tt(), { FmForm: o } = zl, l = e, g = h(), _ = Me(e, "modelValue"), D = h(!0), R = h(!1), z = Ct(), { selectedLocationIds: c, dateRange: p, timeRange: d } = $e(Qe()), i = h(dt.PORTRAIT);
1192
- function w() {
1193
- var C;
1194
- (C = g.value) == null || C.validateInputs();
1195
- }
1196
- async function x() {
1197
- R.value = !0;
1198
- try {
1199
- l.index != null && await Bt({
1200
- reportType: l.reportType,
1201
- index: l.index,
1202
- orientationTypes: [i.value],
1203
- isCombinedLocationLayout: D.value,
1204
- timeRange: d.value,
1205
- dateRange: p.value,
1206
- locationIds: c.value
1207
- });
1208
- } catch (C) {
1209
- z.open({ message: C.message, type: "error" });
1210
- } finally {
1211
- R.value = !1;
1212
- }
1213
- }
1214
- return (C, y) => {
1215
- const W = O("FmRadio"), v = O("FmRadioGroup"), n = O("FmButton"), T = O("FmDialog");
1216
- return $(), re(T, {
1217
- modelValue: _.value,
1218
- "onUpdate:modelValue": y[2] || (y[2] = (m) => _.value = m),
1219
- overlay: !0,
1220
- "z-index": 10
1221
- }, {
1222
- "dialog-header": oe(() => y[3] || (y[3] = [
1223
- ht("Select Orientation")
1224
- ])),
1225
- default: oe(() => [
1226
- B(s(o), {
1227
- ref_key: "form",
1228
- ref: g,
1229
- onValidationSuccess: x
1230
- }, {
1231
- default: oe(() => [
1232
- H("div", ra, [
1233
- B(v, {
1234
- modelValue: i.value,
1235
- "onUpdate:modelValue": y[0] || (y[0] = (m) => i.value = m)
1236
- }, {
1237
- default: oe(() => [
1238
- B(W, {
1239
- value: s(dt).PORTRAIT,
1240
- label: s(a)("report.common.portrait")
1241
- }, null, 8, ["value", "label"]),
1242
- B(W, {
1243
- value: s(dt).LANDSCAPE,
1244
- label: s(a)("report.common.landscape")
1245
- }, null, 8, ["value", "label"])
1246
- ]),
1247
- _: 1
1248
- }, 8, ["modelValue"])
1249
- ]),
1250
- H("div", ia, [
1251
- y[4] || (y[4] = H("div", { class: "grow" }, null, -1)),
1252
- B(n, {
1253
- label: s(a)("report.common.cancel"),
1254
- variant: "tertiary",
1255
- onClick: y[1] || (y[1] = (m) => _.value = !1)
1256
- }, null, 8, ["label"]),
1257
- H("div", null, [
1258
- B(n, {
1259
- label: s(a)("report.common.download"),
1260
- loading: R.value,
1261
- onClick: w
1262
- }, null, 8, ["label", "loading"])
1263
- ])
1264
- ])
1265
- ]),
1266
- _: 1
1267
- }, 512)
1268
- ]),
1269
- _: 1
1270
- }, 8, ["modelValue"]);
1271
- };
1272
- }
1273
- }), ca = {
1274
- key: 1,
1275
- class: "grow"
1276
- }, da = {
1277
- key: 2,
1278
- class: "flex"
1279
- }, Pa = /* @__PURE__ */ Le({
1280
- __name: "DynamicWidget",
1281
- props: /* @__PURE__ */ Ie({
1282
- index: {
1283
- type: Number,
1284
- default: 0
1285
- },
1286
- hideExport: {
1287
- type: Boolean,
1288
- default: !1
1289
- },
1290
- customScreenWidth: {
1291
- type: Number,
1292
- required: !1,
1293
- default: void 0
1294
- }
1295
- }, {
1296
- modelValue: { required: !0, default: () => {
1297
- } },
1298
- modelModifiers: {}
1299
- }),
1300
- emits: ["update:modelValue"],
1301
- setup(e) {
1302
- const a = h(!0), o = Me(e, "modelValue"), l = o.value.widget.config, { t: g, te: _ } = tt(), D = e, R = h(null), z = h(l.rollup), c = h(ot()), p = h(l.drillDimension), d = k(() => {
1303
- if (We.value.length > 0) {
1304
- const r = We.value.findIndex(
1305
- (Q) => Q.value === p.value
1306
- );
1307
- return r >= 0 ? r : 0;
1308
- } else
1309
- return -1;
1310
- }), i = k(() => d.value !== 0), w = k(
1311
- () => d.value != We.value.length - 1
1312
- ), x = h(l.showTitle ?? !0), C = h(l.titleFontSize ?? 14), y = h(l.titleBold ?? !1), W = h(l.titleItalic ?? !1), v = h(l.titleUnderline ?? !1), n = h(l.chartWidth ?? void 0), T = h(l.chartHeight ?? void 0), m = h(l.showLabel ?? !1), L = h(l.labelAlign ?? yt.center), U = h(l.labelAnchor ?? gt.center), K = h(l.labelRotation ?? 0), ee = h(l.labelOffset ?? 0), se = h(l.labelFontSize ?? 12), ke = k(() => l.showSearchBar), ve = h(l.showX ?? !0), _e = h(l.xPosition ?? bt.bottom), De = h(l.showXGrid ?? !1), fe = h(l.showXTick ?? !0), b = h(l.xTickFontSize ?? 12), V = h(l.showXTitle ?? !1), G = h(l.xTitle ?? ""), P = h(l.xTitleFontSize ?? 12), I = h(l.showY ?? !0), M = h(l.yPosition ?? wt.left), ie = h(l.showYGrid ?? !1), xe = h(l.showYTick ?? !0), Se = h(l.yTickFontSize ?? 12), ge = h(l.showYTitle ?? !1), t = h(l.yTitle ?? ""), f = h(l.yTitleFontSize ?? 12), F = h(l.showLegend ?? void 0), S = h(l.legendPosition ?? xt.top), N = h(l.usePointStyle ?? !0), le = h(l.legendMaxHeight), de = h(l.legendMaxWidth), me = h(l.rowHeight ?? 0), J = h(l.colWidths ?? []), E = h(!1), u = h(""), { breakpoints: X, getBreakpointsBoundary: j } = qt(), Z = h(), q = k(
1313
- () => D.customScreenWidth === void 0 ? window.innerWidth : D.customScreenWidth
1314
- ), ne = k(
1315
- () => (q == null ? void 0 : q.value) > j("xs")[1] && (q == null ? void 0 : q.value) <= j("sm")[1]
1316
- ), ae = k(
1317
- () => (q == null ? void 0 : q.value) > j("sm")[1] && (q == null ? void 0 : q.value) <= j("md")[1]
1318
- ), ye = k(() => (q == null ? void 0 : q.value) > j("md")[1]), ue = k(() => {
1319
- const r = o.value.size.width;
1320
- return ye.value || ae.value ? aa(r) : ne.value ? sa(r) : oa(r);
1321
- }), Ge = k(
1322
- () => Al.find((r) => r.type === o.value.widget.type)
1323
- ), Y = Mt(() => {
1324
- var r;
1325
- Z.value = ll((r = R.value) == null ? void 0 : r.$el.offsetWidth), c.value = ot();
1326
- }), Yt = k(() => {
1327
- if (El(ce.value.type, Ye.value))
1328
- switch (o.value.widget.type) {
1329
- case A.BarChart:
1330
- return Il;
1331
- case A.StackBarChart:
1332
- return ta;
1333
- case A.LineChart:
1334
- return na;
1335
- case A.StackLineChart:
1336
- return la;
1337
- case A.Circular:
1338
- return Nl;
1339
- case A.Scorecard:
1340
- return ql;
1341
- case A.Spacer:
1342
- return Yl;
1343
- case A.Table:
1344
- return ea;
1345
- default:
1346
- return ft;
1347
- }
1348
- else
1349
- return ft;
1350
- }), Ye = h(null), {
1351
- selectedLocationIds: rt,
1352
- dateRange: kt,
1353
- compareDateRange: Xt,
1354
- timeRange: _t,
1355
- globalFilters: jt,
1356
- isGlobalFiltersLoading: Tt
1357
- } = $e(Qe()), { businessId: Kt } = $e(St()), { businessLoadedId: Jt, businessDataVersion: it } = $e(Qe());
1358
- k(() => Jt.value === Kt.value && rt.value.length > 0 && !Tt.value);
1359
- const Zt = h(!0), ce = k(() => {
1360
- const r = JSON.parse(JSON.stringify(o.value.widget));
1361
- return {
1362
- ...r,
1363
- config: {
1364
- ...r.config,
1365
- rollup: z.value,
1366
- drillDimension: p.value,
1367
- showGrandTotal: !1
1368
- }
1369
- };
1370
- });
1371
- function Qt() {
1372
- return {
1373
- data: Ye.value,
1374
- showTitle: x.value,
1375
- titleFontSize: C.value,
1376
- titleBold: y.value,
1377
- titleItalic: W.value,
1378
- titleUnderline: v.value,
1379
- chartHeight: T.value,
1380
- chartWidth: n.value,
1381
- showLabel: m.value,
1382
- labelAnchor: U.value,
1383
- labelAlign: L.value,
1384
- labelRotation: K.value,
1385
- labelOffset: ee.value,
1386
- labelFontSize: se.value,
1387
- showX: ve.value,
1388
- xPosition: _e.value,
1389
- showXGrid: De.value,
1390
- showXTick: fe.value,
1391
- xTickFontSize: b.value,
1392
- showXTitle: V.value,
1393
- xTitle: G.value,
1394
- xTitleFontSize: P.value,
1395
- showY: I.value,
1396
- yPosition: M.value,
1397
- showYGrid: ie.value,
1398
- showYTick: xe.value,
1399
- yTitle: t.value,
1400
- showYTitle: ge.value,
1401
- yTitleFontSize: f.value,
1402
- yTickFontSize: Se.value,
1403
- isTransposed: ce.value.config.isTransposed,
1404
- showLegend: F.value,
1405
- legendPosition: S.value,
1406
- usePointStyle: N.value,
1407
- legendMaxHeight: le.value,
1408
- legendMaxWidth: de.value
1409
- };
1410
- }
1411
- function el() {
1412
- return {
1413
- data: Ye.value,
1414
- filterText: u.value,
1415
- rollupPosition: ce.value.config.rollupPosition,
1416
- rowHeight: me.value,
1417
- colWidths: J.value
1418
- };
1419
- }
1420
- const Ft = k(() => {
1421
- switch (ce.value.type) {
1422
- case A.Table:
1423
- return el();
1424
- case A.BarChart:
1425
- case A.LineChart:
1426
- case A.StackBarChart:
1427
- case A.StackLineChart:
1428
- case A.Circular:
1429
- return Qt();
1430
- default:
1431
- return { data: Ye.value };
1432
- }
1433
- }), Lt = k(() => {
1434
- const { config: r } = o.value.widget;
1435
- if (r.rollup != null) {
1436
- const Q = [...r.dimensions].filter((Re) => !Re.hide);
1437
- return Q.sort(
1438
- (Re, Ze) => (r.rowIds || []).indexOf(mt(Re)) - (r.rowIds || []).indexOf(mt(Ze))
1439
- ), [
1440
- { label: Oe(g, _, "None", "other"), value: "none" },
1441
- { label: Oe(g, _, "Grand Total", "other"), value: 0 },
1442
- ...[...Q].slice(0, Q.length - 1).map((Re, Ze) => ({
1443
- label: Oe(g, _, Re.label, "other"),
1444
- value: Ze + 1
1445
- }))
1446
- ];
1447
- }
1448
- return [];
1449
- }), We = k(() => {
1450
- const { config: r } = ce.value;
1451
- return r.isDrillable ? r.dimensions.map((Q) => ({
1452
- label: Oe(g, _, Q.label, "other"),
1453
- value: mt(Q)
1454
- })) : [];
1455
- }), tl = k(() => {
1456
- const r = o.value.id;
1457
- return (jt.value || []).filter(
1458
- (Q) => Array.isArray(Q.tileIds) && Q.tileIds.includes(r)
1459
- );
1460
- });
1461
- he(
1462
- () => o.value.widget.config,
1463
- (r) => {
1464
- z.value = r.rollup, x.value = r.showTitle ?? !0, C.value = r.titleFontSize ?? 14, y.value = r.titleBold ?? !1, W.value = r.titleItalic ?? !1, v.value = r.titleUnderline ?? !1, T.value = r.chartHeight ?? void 0, n.value = r.chartWidth ?? void 0, m.value = r.showLabel ?? !1, L.value = r.labelAlign ?? yt.center, U.value = r.labelAnchor ?? gt.center, K.value = r.labelRotation ?? 0, ee.value = r.labelOffset ?? 0, se.value = r.labelFontSize ?? 12, ve.value = r.showX ?? !0, _e.value = r.xPosition ?? bt.bottom, De.value = r.showXGrid ?? !1, fe.value = r.showXTick ?? !0, b.value = r.xTickFontSize ?? 12, V.value = r.showXTitle ?? !1, G.value = r.xTitle ?? "", P.value = r.xTitleFontSize ?? 12, I.value = r.showY ?? !0, M.value = r.yPosition ?? wt.left, ie.value = r.showYGrid ?? !1, xe.value = r.showYTick ?? !0, Se.value = r.yTickFontSize ?? 12, ge.value = r.showYTitle ?? !1, t.value = r.yTitle ?? "", f.value = r.yTitleFontSize ?? 12, F.value = r.showLegend ?? void 0, S.value = r.legendPosition ?? xt.top, N.value = r.usePointStyle ?? !0, le.value = r.legendMaxHeight, de.value = r.legendMaxWidth, me.value = r.rowHeight ?? 0, J.value = r.colWidths ?? [];
1465
- },
1466
- { deep: !0 }
1467
- ), he([() => z.value], () => {
1468
- z.value !== null && (o.value.widget.config.rollup = z.value);
1469
- }), he(
1470
- [
1471
- () => ce.value,
1472
- () => kt.value,
1473
- () => _t.value,
1474
- () => Xt.value,
1475
- () => rt.value,
1476
- () => tl.value,
1477
- () => it.value
1478
- ],
1479
- () => {
1480
- Rt();
1481
- },
1482
- { deep: !0 }
1483
- ), he(
1484
- [() => o.value.size],
1485
- () => {
1486
- Y();
1487
- },
1488
- { deep: !0 }
1489
- ), Ue(() => {
1490
- Y(), X.value.sm || X.value.md || X.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", Y)) : addEventListener("resize", Y), Rt();
1491
- }), gl(() => {
1492
- X.value.sm || X.value.md || X.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", Y)) : removeEventListener("resize", Y);
1493
- });
1494
- const Dt = Ct();
1495
- let at;
1496
- async function Rt() {
1497
- if (ce.value.config.schemaNames.length <= 0 && !(ce.value.config.dimensions.length <= 0 || ce.value.config.metrics.length <= 0)) {
1498
- Dt.open({
1499
- message: "schema must not be empty and dimension or metrics must have at least 1 column",
1500
- type: "info"
1501
- }), a.value = !1;
1502
- return;
1503
- }
1504
- try {
1505
- a.value = !0, at && at.abort(), at = new AbortController();
1506
- const r = at.signal, Q = it.value, Re = await Mt(Ot, 500)(ce.value, r, o.value.id);
1507
- it.value === Q && (Ye.value = Re, c.value = ot()), a.value = !1;
1508
- } catch (r) {
1509
- r.code !== "ERR_CANCELED" && (Ye.value = null, Dt.open({ message: `Invalid chart ${ce.value.type}`, type: "error" }), console.log(r), a.value = !1);
1510
- }
1511
- }
1512
- function ll(r) {
1513
- switch (o.value.widget.type) {
1514
- case "SPACER":
1515
- return;
1516
- case "SCORECARD":
1517
- return;
1518
- case "TABLE":
1519
- return `${o.value.size.height * 100 + (ke.value ? 72 : 0) + 96.5}px`;
1520
- }
1521
- return `${Math.max(r / o.value.size.width, 90) * o.value.size.height}px`;
1522
- }
1523
- function al() {
1524
- const r = d.value - 1;
1525
- r >= 0 && (p.value = We.value[r].value);
1526
- }
1527
- function sl() {
1528
- const r = d.value + 1;
1529
- r >= 0 && r < We.value.length && (p.value = We.value[r].value);
1530
- }
1531
- const Vt = h(je.EXCEL), zt = h(), ol = Object.values(je).map((r) => ({
1532
- label: Cl(r),
1533
- value: r,
1534
- onClick: async () => {
1535
- r === je.EXCEL || r === je.PDFFULLSIZE || r === je.PDFRECEIPT ? await Bt({
1536
- reportType: r,
1537
- index: D.index,
1538
- isCombinedLocationLayout: Zt.value,
1539
- timeRange: _t.value,
1540
- dateRange: kt.value,
1541
- locationIds: rt.value
1542
- }) : r === je.PDF && (Vt.value = r, zt.value = D.index, E.value = !0);
1543
- }
1544
- })), nl = ce.value.type === A.Spacer ? "flat" : "outlined", rl = ce.value.type === A.Spacer ? "p-0" : "p-16";
1545
- return (r, Q) => {
1546
- const Re = O("FmTooltip"), Ze = O("FmSearch"), il = O("FmCheckbox"), ut = O("FmButton"), ul = O("FmSelect"), cl = O("FmMenuItem"), dl = O("FmMenu"), ml = O("FmForm"), pl = O("FmCircularProgress"), hl = O("FmCard");
1547
- return $(), re(hl, {
1548
- ref_key: "tileCard",
1549
- ref: R,
1550
- class: qe(`${ue.value} ${s(rl)}`),
1551
- variant: s(nl)
1552
- }, {
1553
- default: oe(() => [
1554
- B(ua, {
1555
- modelValue: E.value,
1556
- "onUpdate:modelValue": Q[0] || (Q[0] = (Xe) => E.value = Xe),
1557
- "report-type": Vt.value,
1558
- index: zt.value
1559
- }, null, 8, ["modelValue", "report-type", "index"]),
1560
- !a.value && !s(Tt) ? ($(), te("div", {
1561
- key: 0,
1562
- style: Ee({ height: Z.value })
1563
- }, [
1564
- ($(), re(yl(Yt.value), {
1565
- key: c.value,
1566
- modelValue: Ft.value,
1567
- "onUpdate:modelValue": Q[4] || (Q[4] = (Xe) => Ft.value = Xe),
1568
- "tile-index": D.index
1569
- }, {
1570
- menu: oe(() => [
1571
- B(ml, { class: "flex items-center gap-2" }, {
1572
- default: oe(() => {
1573
- var Xe, $t, At, Et;
1574
- return [
1575
- B(Re, {
1576
- variant: "plain",
1577
- placement: "right",
1578
- content: ce.value.description,
1579
- "hide-arrow": !0,
1580
- disabled: !ce.value.description
1581
- }, {
1582
- default: oe(() => [
1583
- x.value !== !1 ? ($(), te("p", {
1584
- key: 0,
1585
- style: Ee({
1586
- fontSize: C.value + "px",
1587
- fontWeight: y.value ? "bold" : "normal",
1588
- fontStyle: W.value ? "italic" : "normal",
1589
- textDecoration: v.value ? "underline" : "none"
1590
- }),
1591
- class: qe(["text-fm-color-typo-secondary line-clamp-1", [
1592
- C.value <= 18 ? "fm-typo-en-body-md-400" : "",
1593
- ce.value.description ? "border-b-2 border-dashed border-gray-300" : ""
1594
- ]])
1595
- }, Te(s(Oe)(s(g), s(_), ce.value.title, "other")), 7)) : Fe("", !0)
1596
- ]),
1597
- _: 1
1598
- }, 8, ["content", "disabled"]),
1599
- (Xe = Ge.value) != null && Xe.showSearchBar ? ($(), re(Ze, {
1600
- key: 0,
1601
- modelValue: u.value,
1602
- "onUpdate:modelValue": Q[1] || (Q[1] = (Ve) => u.value = Ve),
1603
- class: "grow"
1604
- }, null, 8, ["modelValue"])) : ($(), te("div", ca)),
1605
- bl(B(il, {
1606
- modelValue: m.value,
1607
- "onUpdate:modelValue": Q[2] || (Q[2] = (Ve) => m.value = Ve),
1608
- label: "Label",
1609
- value: !1
1610
- }, null, 8, ["modelValue"]), [
1611
- [wl, ($t = Ge.value) == null ? void 0 : $t.showLabel]
1612
- ]),
1613
- (At = Ge.value) != null && At.showDrillDimension && We.value.length > 0 ? ($(), te("div", da, [
1614
- B(ut, {
1615
- icon: "arrow_upward",
1616
- variant: "tertiary",
1617
- disabled: !i.value,
1618
- onClick: al
1619
- }, null, 8, ["disabled"]),
1620
- B(ut, {
1621
- icon: "arrow_downward",
1622
- variant: "tertiary",
1623
- disabled: !w.value,
1624
- onClick: sl
1625
- }, null, 8, ["disabled"])
1626
- ])) : Fe("", !0),
1627
- (Et = Ge.value) != null && Et.showRollup && Lt.value.length > 0 ? ($(), re(ul, {
1628
- key: 3,
1629
- modelValue: z.value,
1630
- "onUpdate:modelValue": Q[3] || (Q[3] = (Ve) => z.value = Ve),
1631
- class: "w-[150px]",
1632
- items: Lt.value
1633
- }, null, 8, ["modelValue", "items"])) : Fe("", !0),
1634
- D.hideExport ? Fe("", !0) : ($(), re(dl, {
1635
- key: 4,
1636
- shift: !0
1637
- }, {
1638
- "menu-button": oe(() => [
1639
- B(ut, {
1640
- icon: "more_vert",
1641
- variant: "tertiary"
1642
- })
1643
- ]),
1644
- default: oe(() => [
1645
- ($(!0), te(be, null, nt(s(ol), (Ve) => ($(), re(cl, {
1646
- key: Ve.value,
1647
- label: Ve.label,
1648
- onClick: Ve.onClick
1649
- }, null, 8, ["label", "onClick"]))), 128))
1650
- ]),
1651
- _: 1
1652
- }))
1653
- ];
1654
- }),
1655
- _: 1
1656
- })
1657
- ]),
1658
- _: 1
1659
- }, 8, ["modelValue", "tile-index"]))
1660
- ], 4)) : ($(), re(pl, { key: 1 }))
1661
- ]),
1662
- _: 1
1663
- }, 8, ["class", "variant"]);
1664
- };
1665
- }
1666
- });
1667
- var He = /* @__PURE__ */ ((e) => (e.Select = "Select", e.TextField = "TextField", e.Timestamp = "Timestamp", e))(He || {});
1668
- function ma(e) {
1669
- let a = !1, o = 1;
1670
- switch (e) {
1671
- case Ce.Equal:
1672
- case Ce.NotEqual:
1673
- case Ce.Like:
1674
- case Ce.NotLike:
1675
- a = !1, o = 1;
1676
- break;
1677
- case Ce.GreaterThan:
1678
- case Ce.GreaterThanOrEqual:
1679
- case Ce.LessThan:
1680
- case Ce.LessThanOrEqual:
1681
- a = !0, o = 1;
1682
- break;
1683
- case Ce.Between:
1684
- a = !0, o = 2;
1685
- break;
1686
- }
1687
- return {
1688
- fixed: a,
1689
- count: o
1690
- };
1691
- }
1692
- function Ba({
1693
- operator: e,
1694
- dimensionOption: a,
1695
- dataType: o,
1696
- t: l
1697
- }) {
1698
- const { fixed: g, count: _ } = ma(e);
1699
- switch (o) {
1700
- case ze.String:
1701
- return {
1702
- type: "TextField",
1703
- fixed: g,
1704
- count: _,
1705
- dataType: void 0,
1706
- default: ""
1707
- };
1708
- case ze.Numeric:
1709
- return {
1710
- type: "TextField",
1711
- fixed: g,
1712
- count: _,
1713
- dataType: "number",
1714
- default: 0
1715
- };
1716
- case ze.Bool:
1717
- return {
1718
- type: "Select",
1719
- fixed: g,
1720
- count: _,
1721
- options: [
1722
- { label: l("report.common.yes"), value: !0 },
1723
- { label: l("report.common.no"), value: !1 }
1724
- ],
1725
- default: !0
1726
- };
1727
- case ze.Timestamp:
1728
- return Gt({
1729
- dimensionOption: a,
1730
- fixed: g,
1731
- count: _,
1732
- t: l
1733
- });
1734
- }
1735
- return {
1736
- type: "TextField",
1737
- fixed: g,
1738
- count: _,
1739
- dataType: void 0,
1740
- default: ""
1741
- };
1742
- }
1743
- function Oa(e) {
1744
- switch (e) {
1745
- case pe.HourOfDay:
1746
- return 0;
1747
- case pe.DayOfMonth:
1748
- return 1;
1749
- default:
1750
- return;
1751
- }
1752
- }
1753
- function Ha(e) {
1754
- switch (e) {
1755
- case pe.HourOfDay:
1756
- return 23;
1757
- case pe.DayOfMonth:
1758
- return 31;
1759
- default:
1760
- return;
1761
- }
1762
- }
1763
- function Gt({
1764
- dimensionOption: e,
1765
- fixed: a,
1766
- count: o,
1767
- t: l
1768
- }) {
1769
- switch (e) {
1770
- case pe.HourOfDay:
1771
- return {
1772
- type: He.Select,
1773
- fixed: a,
1774
- count: o,
1775
- options: Array.from({ length: 24 }, (g, _) => ({
1776
- label: _.toString().padStart(2, "0"),
1777
- value: _.toString()
1778
- })),
1779
- default: "0"
1780
- };
1781
- case pe.DayOfWeek:
1782
- return {
1783
- type: He.Select,
1784
- fixed: a,
1785
- count: o,
1786
- options: [
1787
- { label: l("report.days.sunday"), value: "1" },
1788
- { label: l("report.days.monday"), value: "2" },
1789
- { label: l("report.days.tuesday"), value: "3" },
1790
- { label: l("report.days.wednesday"), value: "4" },
1791
- { label: l("report.days.thursday"), value: "5" },
1792
- { label: l("report.days.friday"), value: "6" },
1793
- { label: l("report.days.saturday"), value: "7" }
1794
- ],
1795
- default: "1"
1796
- };
1797
- case pe.DayOfMonth:
1798
- return {
1799
- type: He.Select,
1800
- fixed: a,
1801
- count: o,
1802
- options: Array.from({ length: 31 }, (g, _) => ({
1803
- label: (_ + 1).toString(),
1804
- value: (_ + 1).toString()
1805
- })),
1806
- default: "1"
1807
- };
1808
- case pe.MonthOfYear:
1809
- return {
1810
- type: He.Select,
1811
- fixed: a,
1812
- count: o,
1813
- options: [
1814
- { label: l("report.months.january"), value: "1" },
1815
- { label: l("report.months.february"), value: "2" },
1816
- { label: l("report.months.march"), value: "3" },
1817
- { label: l("report.months.april"), value: "4" },
1818
- { label: l("report.months.may"), value: "5" },
1819
- { label: l("report.months.june"), value: "6" },
1820
- { label: l("report.months.july"), value: "7" },
1821
- { label: l("report.months.august"), value: "8" },
1822
- { label: l("report.months.september"), value: "9" },
1823
- { label: l("report.months.october"), value: "10" },
1824
- { label: l("report.months.november"), value: "11" },
1825
- { label: l("report.months.december"), value: "12" }
1826
- ],
1827
- default: "1"
1828
- };
1829
- default:
1830
- return {
1831
- type: He.Timestamp,
1832
- fixed: a,
1833
- count: o,
1834
- default: (/* @__PURE__ */ new Date()).toISOString()
1835
- };
1836
- }
1837
- }
1838
- function Wt({
1839
- dimensionOption: e,
1840
- t: a
1841
- }) {
1842
- const o = Gt({
1843
- dimensionOption: e,
1844
- fixed: !1,
1845
- count: 1,
1846
- t: a
1847
- });
1848
- return o.type === He.Select ? o.options : [];
1849
- }
1850
- const pa = "mf-reportglobalFilter";
1851
- function Pt(e, a) {
1852
- var o;
1853
- return [
1854
- a,
1855
- e.schemaName,
1856
- e.name,
1857
- e.operator ?? "",
1858
- e.option ?? "",
1859
- e.dataFormula ?? "",
1860
- ((o = e.tileIds) == null ? void 0 : o.join(",")) ?? ""
1861
- ].join("|");
1862
- }
1863
- const ha = Ht(pa, () => {
1864
- const e = h({}), a = h(!1), o = h(null), l = () => ({
1865
- search: "",
1866
- selectedValues: [],
1867
- keepSelection: !1,
1868
- showAdvanced: !1,
1869
- visibleCount: 50
1870
- });
1871
- function g(i, w) {
1872
- const x = Pt(i, w);
1873
- return e.value[x] || (e.value[x] = l()), e.value[x];
1874
- }
1875
- const _ = k(() => e.value), D = (i) => o.value === i;
1876
- function R(i, w, x, C) {
1877
- g(i, w)[x] = C;
1878
- }
1879
- function z(i, w, x = 50) {
1880
- g(i, w).visibleCount += x;
1881
- }
1882
- function c(i) {
1883
- a.value = i;
1884
- }
1885
- function p(i) {
1886
- o.value = i;
1887
- }
1888
- function d() {
1889
- o.value = null;
1890
- }
1891
- return {
1892
- allStates: _,
1893
- includeUnavailable: a,
1894
- openMenuKey: o,
1895
- getGlobalFilter: g,
1896
- isMenuOpen: D,
1897
- setGlobalFilter: R,
1898
- showMore: z,
1899
- setIncludeUnavailable: c,
1900
- openMenu: p,
1901
- closeMenu: d,
1902
- getKey: Pt
1903
- };
1904
- }), fa = { class: "flex flex-row flex-wrap gap-2" }, va = { class: "inline-flex max-w-[460px]" }, ga = {
1905
- key: 0,
1906
- class: "flex justify-center my-2"
1907
- }, ya = { class: "px-2 pb-8" }, ba = { class: "flex-1 overflow-y-auto overflow-x-hidden" }, wa = { class: "px-2 pb-8" }, xa = { class: "flex items-start w-full" }, Sa = ["onClick"], Ca = { class: "fm-typo-en-body-md-400" }, ka = { key: 0 }, _a = { class: "px-12 py-3" }, Ta = { class: "flex items-center justify-between" }, Fa = ["onClick"], La = { class: "fm-typo-en-body-md-400" }, Da = { class: "text-xs max-w-[200px]" }, Ra = { class: "px-4 py-3 flex flex-row justify-end gap-2 bg-white" }, qa = /* @__PURE__ */ Le({
1908
- __name: "FilterSelector",
1909
- setup(e) {
1910
- const { t: a, locale: o } = tt(), { currentReport: l, editingTile: g } = $e(kl());
1911
- let { globalFilters: _, isGlobalFiltersLoading: D, timeRange: R, dateRange: z, selectedLocationIds: c } = $e(Qe()), { schemas: p } = $e(_l()), {
1912
- showMore: d,
1913
- getGlobalFilter: i,
1914
- setGlobalFilter: w,
1915
- setIncludeUnavailable: x,
1916
- getKey: C,
1917
- isMenuOpen: y,
1918
- openMenu: W,
1919
- closeMenu: v
1920
- } = ha(), n = null;
1921
- const T = h(!1), m = k(() => {
1922
- var t;
1923
- return ((t = l.value) == null ? void 0 : t.id) ?? "";
1924
- }), L = h([]);
1925
- function U(t) {
1926
- const F = i(t.filter, m.value).selectedValues;
1927
- t.selectedValues = t.keepSelection ? F : t.options.map((S) => S.value), t.filter.values = [...t.selectedValues], w(t.filter, m.value, "selectedValues", t.selectedValues);
1928
- }
1929
- he(
1930
- () => ({
1931
- reportId: m.value,
1932
- globalFilters: _.value
1933
- }),
1934
- () => {
1935
- L.value = (_.value || []).map((t) => {
1936
- const f = i(t, m.value), F = f.selectedValues.length ? [...f.selectedValues] : [...t.values ?? []];
1937
- return {
1938
- id: C(t, m.value),
1939
- filter: t,
1940
- search: f.search,
1941
- options: [],
1942
- type: K(t),
1943
- selectedValues: F,
1944
- visibleCount: f.visibleCount,
1945
- keepSelection: f.keepSelection,
1946
- showAdvanced: f.showAdvanced
1947
- };
1948
- }), fe();
1949
- },
1950
- { immediate: !0 }
1951
- ), he(
1952
- [R, z, c],
1953
- async () => {
1954
- await fe();
1955
- },
1956
- { deep: !0, immediate: !0 }
1957
- ), he(
1958
- [() => g.value],
1959
- async () => {
1960
- L.value.forEach((t) => {
1961
- t.options = [];
1962
- }), await fe();
1963
- },
1964
- { deep: !0 }
1965
- );
1966
- function K(t) {
1967
- var F;
1968
- const f = (F = p.value.find((S) => S.name === t.schemaName)) == null ? void 0 : F.fields.find((S) => S.name === t.name);
1969
- return f == null ? void 0 : f.type;
1970
- }
1971
- function ee(t) {
1972
- var me;
1973
- if (!l.value && !g.value) return [];
1974
- const f = g.value ? [g.value] : [...((me = l.value) == null ? void 0 : me.tiles) ?? []], { name: F = "", schemaName: S = "" } = t, N = f.filter((J) => {
1975
- var Z, q;
1976
- const E = (Z = J == null ? void 0 : J.widget) == null ? void 0 : Z.config;
1977
- if (!E || (q = t.tileIds) != null && q.length && !t.tileIds.includes(J.id)) return !1;
1978
- const u = (E.dimensions ?? []).some(
1979
- (ne) => ne.schemaName === S && ne.name === F
1980
- ), X = (E.joinDatasources ?? []).some(
1981
- (ne) => (ne.dimensions ?? []).some((ae) => ae.schemaName === S && ae.name === F)
1982
- ), j = (E.schemaNames ?? []).includes(S);
1983
- return u || X || j;
1984
- });
1985
- if (!N.length) return [];
1986
- const le = (J, E) => {
1987
- const u = /* @__PURE__ */ new Map(), X = (j) => {
1988
- const Z = `${j.schemaName}:${j.name}:${j.operator}`, q = u.get(Z);
1989
- q ? [Ce.Like, Ce.NotLike].includes(j.operator) ? q.values = Array.from(/* @__PURE__ */ new Set([...q.values ?? [], ...j.values ?? []])) : u.set(Z, { ...j }) : u.set(Z, { ...j });
1990
- };
1991
- return J.forEach(X), E.forEach(X), Array.from(u.values());
1992
- }, de = (J) => {
1993
- var u;
1994
- const E = (u = J.dimensions) == null ? void 0 : u.find(
1995
- (X) => X.schemaName === S && X.name === F
1996
- );
1997
- return {
1998
- name: F,
1999
- schemaName: S,
2000
- label: (E == null ? void 0 : E.label) ?? F,
2001
- hide: !1,
2002
- option: t.option ?? null,
2003
- dataFormula: E == null ? void 0 : E.dataFormula
2004
- };
2005
- };
2006
- return N.map((J) => {
2007
- var ne, ae;
2008
- const E = (ne = J == null ? void 0 : J.widget) == null ? void 0 : ne.config;
2009
- if (!E) return null;
2010
- const u = de(E), X = (E.dimensions ?? []).some((ye) => ye.schemaName === S) || (E.schemaNames ?? []).includes(S), j = le(
2011
- E.filters ?? [],
2012
- (t.filters ?? []).filter((ye) => {
2013
- var ue;
2014
- return (ue = E.schemaNames) == null ? void 0 : ue.includes(ye.schemaName);
2015
- })
2016
- ), Z = (ae = E.joinDatasources) == null ? void 0 : ae.find(
2017
- (ye) => (ye.schemaNames ?? []).includes(S) || (ye.dimensions ?? []).some((ue) => ue.schemaName === S)
2018
- ), q = le(
2019
- (Z == null ? void 0 : Z.filters) ?? [],
2020
- (t.filters ?? []).filter((ye) => {
2021
- var ue;
2022
- return (ue = Z == null ? void 0 : Z.schemaNames) == null ? void 0 : ue.includes(ye.schemaName);
2023
- })
2024
- );
2025
- return {
2026
- type: A.Table,
2027
- title: "Global Filter",
2028
- config: {
2029
- schemaNames: E.schemaNames,
2030
- schemas: E.schemas,
2031
- dimensions: X ? [u] : [],
2032
- filters: j,
2033
- sorts: X ? [{ name: F, schemaName: S, type: Be.Asc, aggregation: null, dimensionOption: null }] : [],
2034
- joinDatasources: !X && Z ? [
2035
- {
2036
- ...Z,
2037
- dimensions: [u],
2038
- sorts: [
2039
- {
2040
- name: F,
2041
- schemaName: S,
2042
- type: Be.Asc,
2043
- aggregation: null,
2044
- dimensionOption: null
2045
- }
2046
- ],
2047
- filters: q
2048
- }
2049
- ] : [],
2050
- rowIds: [],
2051
- metrics: [],
2052
- limit: null,
2053
- rollup: void 0,
2054
- drillDimension: void 0,
2055
- showGrandTotal: !1,
2056
- breakdownDimension: void 0,
2057
- sparklineDimension: void 0,
2058
- isTransposed: !1,
2059
- isDrillable: !1,
2060
- isBlend: !1
2061
- }
2062
- };
2063
- }).filter(Boolean);
2064
- }
2065
- function se(t) {
2066
- return t.options.every((f) => {
2067
- var F;
2068
- return (F = t.selectedValues) == null ? void 0 : F.includes(f.value);
2069
- });
2070
- }
2071
- function ke(t) {
2072
- se(t) ? t.selectedValues = ["(EMPTY)"] : t.selectedValues = t.options.map((f) => f.value);
2073
- }
2074
- const ve = k(
2075
- () => L.value.map((t) => {
2076
- const f = t.options, F = t.search.toLowerCase() ?? "";
2077
- return f.filter(
2078
- (N) => N.label.toLowerCase().includes(F.toLowerCase())
2079
- ).slice(0, t.visibleCount);
2080
- })
2081
- );
2082
- function _e(t) {
2083
- t.visibleCount += 50, d(t.filter, m.value, 50);
2084
- }
2085
- async function De(t, f) {
2086
- var F;
2087
- if (!(!t.type && (t.type = K(t.filter), !t.type)))
2088
- switch (t.type) {
2089
- case ze.String:
2090
- try {
2091
- const S = ee(t.filter);
2092
- if (!S.length) {
2093
- t.options = [];
2094
- return;
2095
- }
2096
- const N = [];
2097
- for (const E of S) {
2098
- const u = await Ot(E, f);
2099
- (u == null ? void 0 : u.type) === A.Table && N.push(...u.rows.map((X) => {
2100
- var j;
2101
- return ((j = X.cells) == null ? void 0 : j[0]) ?? " ";
2102
- }));
2103
- }
2104
- const le = Array.from(new Set(N)), de = (F = i(t.filter, m.value).selectedValues) != null && F.length ? i(t.filter, m.value).selectedValues : t.selectedValues || [], me = t.keepSelection ? Array.from(/* @__PURE__ */ new Set([...le, ...de])) : le, J = new Set(N);
2105
- t.options = me.map((E) => ({
2106
- label: String(E),
2107
- value: E,
2108
- available: t.keepSelection ? J.has(E) : new Set(le).has(E)
2109
- })), U(t);
2110
- } catch (S) {
2111
- if ((S == null ? void 0 : S.code) === "ERR_CANCELED" || (S == null ? void 0 : S.name) === "CanceledError")
2112
- return;
2113
- throw S;
2114
- }
2115
- break;
2116
- case ze.Bool: {
2117
- t.options = [
2118
- { label: "Yes", value: !0 },
2119
- { label: "No", value: !1 }
2120
- ], U(t);
2121
- break;
2122
- }
2123
- case ze.Timestamp:
2124
- if (t.filter.option !== pe.DateTime && t.filter.option !== pe.TimeOfDay) {
2125
- const S = t.filter.option;
2126
- t.options = Wt({ dimensionOption: S, t: a }), t.filter.values = t.options.length ? t.options.map((N) => N.value) : ["NULL"];
2127
- }
2128
- U(t);
2129
- break;
2130
- case ze.Numeric:
2131
- break;
2132
- }
2133
- }
2134
- async function fe(t = !1) {
2135
- if (!m.value || !L.value.length) return;
2136
- n == null || n.abort();
2137
- const f = new AbortController();
2138
- n = f;
2139
- try {
2140
- t || (D.value = !0), T.value = !0, await Promise.all(
2141
- L.value.map((F) => De(F, f.signal))
2142
- );
2143
- } finally {
2144
- n === f && (t || (D.value = !1), T.value = !1);
2145
- }
2146
- }
2147
- function b(t, f) {
2148
- var S;
2149
- if ((S = t.selectedValues) == null ? void 0 : S.includes(f)) {
2150
- let N = (t.selectedValues || []).filter((le) => le !== f && le !== "(EMPTY)");
2151
- t.selectedValues = N.length > 0 ? N : ["(EMPTY)"];
2152
- } else
2153
- t.selectedValues = [...(t.selectedValues || []).filter((N) => N !== "(EMPTY)"), f];
2154
- w(t.filter, m.value, "selectedValues", t.selectedValues);
2155
- }
2156
- function V(t, f) {
2157
- if (f === null)
2158
- t.values = [];
2159
- else {
2160
- const S = Ke(f.startDate).startOf("day").utc().toISOString(), N = Ke(f.endDate).endOf("day").utc().toISOString();
2161
- t.values = [S, N];
2162
- }
2163
- const F = L.value.find((S) => S.id === C(t, m.value));
2164
- F && (F.keepSelection = f !== null, w(F.filter, m.value, "keepSelection", F.keepSelection));
2165
- }
2166
- function G(t) {
2167
- const f = (t.selectedValues || []).filter((F) => F !== "(EMPTY)");
2168
- return `${a("report.section.filter.selectAll")} (${f.length}/${t.options.length})`;
2169
- }
2170
- function P(t) {
2171
- const f = t.options.length, F = a("report.section.filter.search"), S = a("report.common.results", { count: f });
2172
- return `${F} (${S})`;
2173
- }
2174
- function I(t) {
2175
- var le, de, me, J, E;
2176
- const f = Fl(t.filter);
2177
- if (t.type === ze.Timestamp) {
2178
- const u = ((le = t.filter.values) == null ? void 0 : le.length) === 2;
2179
- if (t.filter.option === pe.DateTime)
2180
- return { preview: u ? `${f} is between ${Rl({
2181
- startDate: ((de = t.filter.values) == null ? void 0 : de[0]) || null,
2182
- endDate: ((me = t.filter.values) == null ? void 0 : me[1]) || null,
2183
- locale: o.value
2184
- })}` : f, suffix: "" };
2185
- if (t.filter.option === pe.TimeOfDay) {
2186
- const X = (J = t.filter.values) != null && J[0] ? Ke(t.filter.values[0]) : null, j = (E = t.filter.values) != null && E[1] ? Ke(t.filter.values[1]) : null, Z = (ne) => ne && ne.isValid() ? { hour: ne.hour(), minute: ne.minute() } : null;
2187
- return { preview: u ? `${f} is between ${Vl({
2188
- startTime: Z(X),
2189
- endTime: Z(j),
2190
- locale: o.value
2191
- })}` : f, suffix: "" };
2192
- }
2193
- if (t.filter.option !== pe.DateTime && t.filter.option !== pe.TimeOfDay) {
2194
- const X = Wt({
2195
- dimensionOption: t.filter.option,
2196
- t: a
2197
- }), j = new Map(X.map((ae) => [String(ae.value), ae.label])), q = (t.selectedValues || []).filter((ae) => ae !== "(EMPTY)").map((ae) => j.get(String(ae)) ?? String(ae)), ne = q.map((ae) => ae.length > 20 ? `${ae.slice(0, 20)}…` : ae).join(", ");
2198
- return q.length ? {
2199
- preview: `${f}: ${ne}`,
2200
- suffix: `(${q.length} selected)`
2201
- } : { preview: f, suffix: "" };
2202
- }
2203
- }
2204
- const S = (t.selectedValues || []).filter((u) => u !== "(EMPTY)").map((u) => u === !0 ? a("report.common.yes") || "Yes" : u === !1 ? a("report.common.no") || "No" : String(u)), N = S.map((u) => u.length > 20 ? `${u.slice(0, 20)}…` : u).join(", ");
2205
- return S.length ? {
2206
- preview: `${f}: ${N}`,
2207
- suffix: `(${S.length} selected)`
2208
- } : { preview: N, suffix: `${f}` };
2209
- }
2210
- function M(t) {
2211
- t.filter.values = [...t.selectedValues || []], w(t.filter, m.value, "selectedValues", t.selectedValues), v();
2212
- }
2213
- function ie(t) {
2214
- t.showAdvanced = !t.showAdvanced, w(t.filter, m.value, "showAdvanced", t.showAdvanced);
2215
- }
2216
- function xe(t) {
2217
- t.keepSelection = !t.keepSelection, x(t.keepSelection), w(t.filter, m.value, "keepSelection", t.keepSelection), t.options = [], fe(!0);
2218
- }
2219
- function Se(t, f) {
2220
- return t ? t.length > f ? `${t.slice(0, f)}…` : t : "";
2221
- }
2222
- function ge(t, f) {
2223
- var S, N, le, de;
2224
- if (f === null)
2225
- t.values = [];
2226
- else {
2227
- const me = Ke().set("hour", Number((S = f.start) == null ? void 0 : S.hour)).set("minute", Number((N = f.start) == null ? void 0 : N.minute)).toISOString(), J = Ke().set("hour", Number((le = f.end) == null ? void 0 : le.hour)).set("minute", Number((de = f.end) == null ? void 0 : de.minute)).toISOString();
2228
- t.values = [me, J];
2229
- }
2230
- const F = L.value.find((me) => me.id === C(t, m.value));
2231
- F && (F.keepSelection = f !== null, w(F.filter, m.value, "keepSelection", F.keepSelection));
2232
- }
2233
- return (t, f) => {
2234
- const F = O("FmCircularProgress"), S = O("FmTextField"), N = O("FmMenuItem"), le = O("FmTooltip"), de = O("FmIcon"), me = O("FmMenuDivider"), J = O("FmButton"), E = O("FmMenu");
2235
- return $(), te("div", fa, [
2236
- ($(!0), te(be, null, nt(L.value, (u, X) => {
2237
- var j, Z, q, ne, ae, ye;
2238
- return $(), te("div", {
2239
- key: `${u.id}`
2240
- }, [
2241
- u.filter.option === s(pe).DateTime ? ($(), re(Ll, {
2242
- key: 0,
2243
- "model-value": { startDate: (j = u.filter.values) == null ? void 0 : j[0], endDate: (Z = u.filter.values) == null ? void 0 : Z[1] },
2244
- class: "w-full",
2245
- label: I(u).preview,
2246
- removable: ((q = u.filter.values) == null ? void 0 : q.length) === 2,
2247
- onUpdate: (ue) => V(u.filter, ue),
2248
- onChipClosed: () => V(u.filter, null)
2249
- }, null, 8, ["model-value", "label", "removable", "onUpdate", "onChipClosed"])) : u.filter.option === s(pe).TimeOfDay ? ($(), re(Tl, {
2250
- key: 1,
2251
- "model-value": { start: (ne = u.filter.values) == null ? void 0 : ne[0], end: (ae = u.filter.values) == null ? void 0 : ae[1] },
2252
- class: "w-full",
2253
- label: I(u).preview,
2254
- removable: ((ye = u.filter.values) == null ? void 0 : ye.length) === 2,
2255
- onUpdate: (ue) => ge(u.filter, ue),
2256
- onChipClosed: () => ge(u.filter, null)
2257
- }, null, 8, ["model-value", "label", "removable", "onUpdate", "onChipClosed"])) : ($(), re(E, {
2258
- key: 2,
2259
- "close-on-click": !1,
2260
- shift: !0,
2261
- open: s(y)(u.id),
2262
- onMenuChanged: (ue) => ue ? s(W)(u.id) : s(v)()
2263
- }, {
2264
- "menu-button": oe(() => [
2265
- H("div", va, [
2266
- B(Dl, {
2267
- "left-icon": "filter_alt",
2268
- "trailing-icon": "expand_more",
2269
- label: I(u).preview,
2270
- class: "w-full"
2271
- }, {
2272
- default: oe(() => [
2273
- ht(Te(I(u).suffix), 1)
2274
- ]),
2275
- _: 2
2276
- }, 1032, ["label"])
2277
- ])
2278
- ]),
2279
- "menu-wrapper": oe(({ maxHeight: ue, width: Ge }) => [
2280
- H("div", {
2281
- class: "flex flex-col bg-fm-color-neutral-white p-2 rounded-lg shadow-light-300",
2282
- style: Ee({ maxHeight: `${ue}px`, width: Ge })
2283
- }, [
2284
- T.value ? ($(), te("div", ga, [
2285
- B(F)
2286
- ])) : u.options.length > 0 && !s(D) ? ($(), te(be, { key: 1 }, [
2287
- H("div", ya, [
2288
- B(S, {
2289
- modelValue: u.search,
2290
- "onUpdate:modelValue": [
2291
- (Y) => u.search = Y,
2292
- (Y) => s(w)(u.filter, m.value, "search", Y)
2293
- ],
2294
- type: "text",
2295
- "prepend-icon": "search",
2296
- placeholder: P(u),
2297
- class: "border px-2 pb-8 text-sm mb-1 rounded"
2298
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
2299
- ]),
2300
- H("div", ba, [
2301
- H("div", wa, [
2302
- B(N, {
2303
- label: G(u),
2304
- "has-checkbox": !0,
2305
- "model-value": se(u),
2306
- indeterminate: !0,
2307
- onClick: (Y) => ke(u)
2308
- }, null, 8, ["label", "model-value", "onClick"]),
2309
- ($(!0), te(be, null, nt(ve.value[X], (Y) => ($(), te(be, {
2310
- key: Y.value
2311
- }, [
2312
- Y.label && Y.label.length > 110 ? ($(), re(le, {
2313
- key: 0,
2314
- placement: "right",
2315
- "hide-arrow": !0,
2316
- "z-index": 2e3
2317
- }, {
2318
- content: oe(() => [
2319
- ht(Te(Y.label), 1)
2320
- ]),
2321
- default: oe(() => [
2322
- H("div", xa, [
2323
- B(N, {
2324
- label: Se(Y.label, 110),
2325
- "has-checkbox": !0,
2326
- "model-value": u.selectedValues.includes(Y.value),
2327
- class: qe([
2328
- "flex-1 text-left",
2329
- { "bg-gray-200": Y.available === !1 }
2330
- ]),
2331
- onClick: () => b(u, Y.value)
2332
- }, null, 8, ["label", "model-value", "class", "onClick"])
2333
- ])
2334
- ]),
2335
- _: 2
2336
- }, 1024)) : ($(), re(N, {
2337
- key: 1,
2338
- label: Y.label,
2339
- "has-checkbox": !0,
2340
- "model-value": u.selectedValues.includes(Y.value),
2341
- class: qe(["flex-1 text-left", { "bg-gray-100": Y.available === !1 }]),
2342
- onClick: () => b(u, Y.value)
2343
- }, null, 8, ["label", "model-value", "class", "onClick"]))
2344
- ], 64))), 128)),
2345
- ve.value[X].length < u.options.length && !u.search ? ($(), re(N, {
2346
- key: 0,
2347
- class: "fm-typo-en-body-md-400 -ml-2",
2348
- label: s(a)("report.section.filter.loadMore"),
2349
- onClick: ct((Y) => _e(u), ["stop"]),
2350
- icon: "autorenew"
2351
- }, null, 8, ["label", "onClick"])) : Fe("", !0)
2352
- ])
2353
- ]),
2354
- H("div", {
2355
- class: "px-12 py-2 flex items-center gap-2 cursor-pointer hover:bg-fm-color-neutral-50 transition-colors",
2356
- onClick: (Y) => ie(u)
2357
- }, [
2358
- B(de, {
2359
- name: u.showAdvanced ? "keyboard_arrow_up" : "keyboard_arrow_down",
2360
- size: "md",
2361
- class: ""
2362
- }, null, 8, ["name"]),
2363
- H("span", Ca, Te(s(a)("report.section.filter.advanced")), 1)
2364
- ], 8, Sa),
2365
- B(me),
2366
- u.showAdvanced ? ($(), te("div", ka, [
2367
- H("div", _a, [
2368
- H("div", Ta, [
2369
- H("div", {
2370
- class: "flex items-center gap-2 cursor-pointer",
2371
- onClick: (Y) => xe(u)
2372
- }, [
2373
- B(de, {
2374
- name: u.keepSelection ? "check_box" : "check_box_outline_blank",
2375
- size: "md",
2376
- class: qe(
2377
- u.keepSelection ? "text-fm-color-primary" : "text-fm-color-neutral-gray-400"
2378
- )
2379
- }, null, 8, ["name", "class"]),
2380
- H("span", La, Te(s(a)("report.section.filter.keepSelection")), 1)
2381
- ], 8, Fa),
2382
- B(le, {
2383
- placement: "top",
2384
- "z-index": 2e3
2385
- }, {
2386
- content: oe(() => [
2387
- H("div", Da, Te(s(a)("report.section.filter.keepSelectionTooltip")), 1)
2388
- ]),
2389
- default: oe(() => [
2390
- B(de, {
2391
- name: "info",
2392
- size: "md",
2393
- class: "text-fm-color-primary"
2394
- })
2395
- ]),
2396
- _: 1
2397
- })
2398
- ])
2399
- ])
2400
- ])) : Fe("", !0),
2401
- H("div", Ra, [
2402
- B(J, {
2403
- variant: "tertiary",
2404
- label: s(a)("report.common.cancel"),
2405
- onClick: f[0] || (f[0] = ct((Y) => s(v)(), ["stop"]))
2406
- }, null, 8, ["label"]),
2407
- B(J, {
2408
- color: "primary",
2409
- onClick: ct((Y) => M(u), ["stop"]),
2410
- label: s(a)("report.common.apply")
2411
- }, null, 8, ["onClick", "label"])
2412
- ])
2413
- ], 64)) : s(D) ? Fe("", !0) : ($(), re(ft, { key: 2 }))
2414
- ], 4)
2415
- ]),
2416
- _: 2
2417
- }, 1032, ["open", "onMenuChanged"]))
2418
- ]);
2419
- }), 128)),
2420
- Ne(t.$slots, "default")
2421
- ]);
2422
- };
2423
- }
2424
- });
2425
- export {
2426
- He as I,
2427
- yt as L,
2428
- Pe as R,
2429
- Pa as _,
2430
- qa as a,
2431
- gt as b,
2432
- Oa as c,
2433
- Ha as d,
2434
- Ba as e,
2435
- mt as g,
2436
- Nt as u
2437
- };