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