@feedmepos/mf-report 5.14.2 → 5.14.3

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.
@@ -93,7 +93,7 @@ const ge = ["src"], he = ["src"], $e = /* @__PURE__ */ O({
93
93
  }), Z(() => {
94
94
  l(me);
95
95
  }), T(() => {
96
- console.log("5.14.2", !0), window.addEventListener("message", F), window.addEventListener("message", B);
96
+ console.log("5.14.3", !0), window.addEventListener("message", F), window.addEventListener("message", B);
97
97
  });
98
98
  const L = ie(), R = de();
99
99
  M(() => {
@@ -0,0 +1,352 @@
1
+ import { defineComponent as R, computed as W, ref as oe, watch as q, resolveComponent as b, createElementBlock as f, openBlock as u, renderSlot as re, Fragment as D, renderList as U, createBlock as g, unref as r, withCtx as C, createElementVNode as L, createCommentVNode as N, createVNode as p, isRef as S, useModel as ue, normalizeClass as z, toDisplayString as ie } from "vue";
2
+ import { u as me, b as H, d as E, j as de } from "./vue-i18n-Fbuacdec.js";
3
+ import { storeToRefs as T } from "pinia";
4
+ import { a as pe, d as ce } from "./NavigationTab.vue_vue_type_script_setup_true_lang-Bu64bEVK.js";
5
+ import { _ as J, a as fe } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-BLPR2QZJ.js";
6
+ import { a as ve, b as be, D as w, q as _e, W as Y, S as ye } from "./BaseDialog.vue_vue_type_script_setup_true_lang-BRk-mwHe.js";
7
+ import { _ as he } from "./NoData.vue_vue_type_script_setup_true_lang-qEkm--BH.js";
8
+ import { d as ge } from "./helper-8cjX1HJZ.js";
9
+ import { detectLocale as Fe } from "@feedmepos/mf-common";
10
+ import { useBreakpoints as ke } from "@feedmepos/ui-library";
11
+ const xe = { class: "flex flex-wrap gap-2" }, we = { class: "flex flex-col gap-1 p-2 bg-fm-color-neutral-white max-h-[300px] overflow-y-auto relative fm-shadow-light-300" }, Ce = {
12
+ key: 0,
13
+ class: "flex justify-center my-2"
14
+ }, Se = /* @__PURE__ */ R({
15
+ __name: "FilterSelector",
16
+ setup(I) {
17
+ var G;
18
+ const { t: v } = me(), { currentReport: m } = T(ve());
19
+ let { globalFilters: F, isGlobalFiltersLoading: i, timeRange: _, dateRange: y, selectedLocationIds: h } = T(H()), { schemas: $ } = T(be());
20
+ const n = W(() => {
21
+ var e;
22
+ return ((e = m.value) == null ? void 0 : e.id) ?? "";
23
+ }), o = oe([]);
24
+ q(
25
+ ((G = m.value) == null ? void 0 : G.globalFilters) || [],
26
+ () => {
27
+ o.value = F.value.map((e) => ({
28
+ filter: e,
29
+ search: "",
30
+ options: [],
31
+ type: K(e)
32
+ }));
33
+ },
34
+ { deep: !0, immediate: !0 }
35
+ ), q(
36
+ [_, y, h],
37
+ async () => {
38
+ await te();
39
+ },
40
+ { deep: !0, immediate: !0 }
41
+ );
42
+ var k = void 0;
43
+ function K(e) {
44
+ var l;
45
+ const t = (l = $.value.find((a) => a.name === e.schemaName)) == null ? void 0 : l.fields.find((a) => a.name === e.name);
46
+ return t == null ? void 0 : t.type;
47
+ }
48
+ function Q(e) {
49
+ return {
50
+ type: Y.Table,
51
+ config: {
52
+ schemaNames: Array.from(
53
+ /* @__PURE__ */ new Set([e.schemaName, ...(e.filters ?? []).map((t) => t.schemaName)])
54
+ ),
55
+ dimensions: [
56
+ {
57
+ name: e.name ?? "",
58
+ schemaName: e.schemaName ?? "",
59
+ label: e.name ?? "",
60
+ hide: !1,
61
+ option: null
62
+ }
63
+ ],
64
+ rowIds: [],
65
+ metrics: [],
66
+ filters: e.filters || [],
67
+ sorts: [
68
+ {
69
+ name: e.name ?? "",
70
+ schemaName: e.schemaName ?? "",
71
+ type: ye.Asc,
72
+ aggregation: null,
73
+ dimensionOption: null
74
+ }
75
+ ],
76
+ joinDatasources: [],
77
+ limit: null,
78
+ rollup: void 0,
79
+ drillDimension: void 0,
80
+ showGrandTotal: !1,
81
+ breakdownDimension: void 0,
82
+ sparklineDimension: void 0,
83
+ isTransposed: !1,
84
+ isDrillable: !1
85
+ },
86
+ title: ""
87
+ };
88
+ }
89
+ function V(e) {
90
+ return e.options.every((t) => {
91
+ var l;
92
+ return (l = e.filter.values) == null ? void 0 : l.includes(t.value);
93
+ });
94
+ }
95
+ function X(e) {
96
+ V(e) ? e.filter.values = ["NULL"] : e.filter.values = e.options.map((t) => t.value);
97
+ }
98
+ const Z = W(
99
+ () => o.value.map((e) => {
100
+ const t = e.options, l = e.search.toLowerCase() ?? "";
101
+ return t.filter((a) => a.label.toLowerCase().includes(l.toLowerCase()));
102
+ })
103
+ );
104
+ async function ee(e) {
105
+ switch (e.type) {
106
+ case w.String:
107
+ {
108
+ const t = await _e(
109
+ Q(e.filter),
110
+ k.signal
111
+ ), l = (t == null ? void 0 : t.type) === Y.Table ? t.rows.map((a) => {
112
+ var d;
113
+ return ((d = a.cells) == null ? void 0 : d[0]) ?? "";
114
+ }) : [];
115
+ e.options = l.map((a) => ({
116
+ label: a,
117
+ value: a
118
+ })), e.filter.values = l.length ? l : ["NULL"];
119
+ }
120
+ break;
121
+ case w.Bool:
122
+ e.options = [
123
+ { label: "Yes", value: !0 },
124
+ { label: "No", value: !1 }
125
+ ], e.filter.values = [!0, !1];
126
+ break;
127
+ case w.Timestamp:
128
+ case w.Numeric:
129
+ break;
130
+ }
131
+ }
132
+ async function te() {
133
+ if (!(!n.value || !o.value.length)) {
134
+ k && (k == null || k.abort()), k = new AbortController();
135
+ try {
136
+ i.value = !0;
137
+ const e = o.value.map(async (t) => {
138
+ await ee(t);
139
+ });
140
+ await Promise.all(e);
141
+ } finally {
142
+ i.value = !1;
143
+ }
144
+ }
145
+ }
146
+ function le(e, t) {
147
+ var a, d;
148
+ if ((a = e.filter.values) == null ? void 0 : a.includes(t)) {
149
+ let x = (e.filter.values || []).filter((s) => s !== t);
150
+ x.length === 0 && (x = ["NULL"]), e.filter.values = x;
151
+ } else
152
+ (d = e.filter.values) == null || d.push(t);
153
+ }
154
+ function M(e, t) {
155
+ if (t === null)
156
+ e.values = [];
157
+ else {
158
+ const l = E(t.startDate).startOf("day").utc().toISOString(), a = E(t.endDate).endOf("day").utc().toISOString();
159
+ e.values = [l, a];
160
+ }
161
+ }
162
+ function ae(e) {
163
+ var l;
164
+ const t = (l = e.filter.values) == null ? void 0 : l.filter((a) => a !== "NULL");
165
+ return `${v("report.section.filter.selectAll")} (${t == null ? void 0 : t.length}/${e.options.length})`;
166
+ }
167
+ function se(e) {
168
+ const t = e.options.length, l = v("report.section.filter.search"), a = v("report.common.results", { count: t });
169
+ return `${l} (${a})`;
170
+ }
171
+ function O(e) {
172
+ var l, a, d;
173
+ const t = de(e.filter);
174
+ switch (e.type) {
175
+ case w.Timestamp:
176
+ return ((l = e.filter.values) == null ? void 0 : l.length) === 2 ? `${t} is between ${ge({
177
+ startDate: (a = e.filter.values) == null ? void 0 : a[0],
178
+ endDate: (d = e.filter.values) == null ? void 0 : d[1],
179
+ locale: Fe()
180
+ })}` : t;
181
+ default:
182
+ return t;
183
+ }
184
+ }
185
+ return (e, t) => {
186
+ const l = b("FmCircularProgress"), a = b("FmTextField"), d = b("FmMenuItem"), x = b("FmMenu");
187
+ return u(), f("div", xe, [
188
+ (u(!0), f(D, null, U(o.value, (s, ne) => {
189
+ var A, B, j;
190
+ return u(), f("div", {
191
+ key: `${s.filter.schemaName}-${s.filter.name}`
192
+ }, [
193
+ s.type === r(w).Timestamp ? (u(), g(J, {
194
+ key: 0,
195
+ "model-value": { startDate: (A = s.filter.values) == null ? void 0 : A[0], endDate: (B = s.filter.values) == null ? void 0 : B[1] },
196
+ class: "w-full",
197
+ label: O(s),
198
+ removable: ((j = s.filter.values) == null ? void 0 : j.length) === 2,
199
+ onUpdate: (c) => M(s.filter, c),
200
+ onChipClosed: () => M(s.filter, null)
201
+ }, null, 8, ["model-value", "label", "removable", "onUpdate", "onChipClosed"])) : (u(), g(x, {
202
+ key: 1,
203
+ "close-on-click": !1,
204
+ shift: !0
205
+ }, {
206
+ "menu-button": C(() => [
207
+ p(fe, {
208
+ "left-icon": "filter_alt",
209
+ "right-icon": "expand_more",
210
+ label: O(s)
211
+ }, null, 8, ["label"])
212
+ ]),
213
+ "menu-wrapper": C(() => [
214
+ L("div", we, [
215
+ r(i) ? (u(), f("div", Ce, [
216
+ p(l)
217
+ ])) : N("", !0),
218
+ s.options.length > 0 && !r(i) ? (u(), f(D, { key: 1 }, [
219
+ p(a, {
220
+ modelValue: s.search,
221
+ "onUpdate:modelValue": (c) => s.search = c,
222
+ type: "text",
223
+ "prepend-icon": "search",
224
+ placeholder: se(s),
225
+ class: "border px-2 py-1 text-sm mb-1 rounded"
226
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]),
227
+ p(d, {
228
+ label: ae(s),
229
+ "has-checkbox": !0,
230
+ "model-value": V(s),
231
+ indeterminate: !0,
232
+ onClick: (c) => X(s)
233
+ }, null, 8, ["label", "model-value", "onClick"]),
234
+ (u(!0), f(D, null, U(Z.value[ne], (c) => {
235
+ var P;
236
+ return u(), g(d, {
237
+ key: c.value,
238
+ label: c.label,
239
+ "has-checkbox": !0,
240
+ "model-value": (P = s.filter.values) == null ? void 0 : P.includes(c.value),
241
+ onClick: () => le(s, c.value)
242
+ }, null, 8, ["label", "model-value", "onClick"]);
243
+ }), 128))
244
+ ], 64)) : r(i) ? N("", !0) : (u(), g(he, { key: 2 }))
245
+ ])
246
+ ]),
247
+ _: 2
248
+ }, 1024))
249
+ ]);
250
+ }), 128)),
251
+ re(e.$slots, "default")
252
+ ]);
253
+ };
254
+ }
255
+ }), $e = { class: "flex flex-col gap-2 overflow-x-auto overflow-y-hidden scrollbar-hide" }, De = { class: "flex flex-col gap-2 py-2" }, Te = /* @__PURE__ */ R({
256
+ __name: "Filter",
257
+ setup(I) {
258
+ const {
259
+ locations: v,
260
+ selectedLocationIds: m,
261
+ dateRange: F,
262
+ compareDateRange: i,
263
+ timeRange: _,
264
+ defaultDateSetting: y,
265
+ selectTimeDefault: h
266
+ } = T(H());
267
+ return ($, n) => (u(), f("div", $e, [
268
+ L("div", De, [
269
+ p(pe, {
270
+ modelValue: r(m),
271
+ "onUpdate:modelValue": n[5] || (n[5] = (o) => S(m) ? m.value = o : null),
272
+ options: r(v)
273
+ }, {
274
+ default: C(() => [
275
+ p(J, {
276
+ "date-range": r(F),
277
+ "onUpdate:dateRange": n[0] || (n[0] = (o) => S(F) ? F.value = o : null),
278
+ "compare-date-range": r(i),
279
+ "onUpdate:compareDateRange": n[1] || (n[1] = (o) => S(i) ? i.value = o : null),
280
+ "compare-type": r(y).defaultCompareType,
281
+ "onUpdate:compareType": n[2] || (n[2] = (o) => r(y).defaultCompareType = o),
282
+ compare: ""
283
+ }, null, 8, ["date-range", "compare-date-range", "compare-type"]),
284
+ p(ce, {
285
+ "time-range": r(_),
286
+ "onUpdate:timeRange": n[3] || (n[3] = (o) => S(_) ? _.value = o : null),
287
+ "select-time-default": r(h),
288
+ "onUpdate:selectTimeDefault": n[4] || (n[4] = (o) => S(h) ? h.value = o : null),
289
+ "default-date-range": r(y).timeOptions
290
+ }, null, 8, ["time-range", "select-time-default", "default-date-range"]),
291
+ p(Se)
292
+ ]),
293
+ _: 1
294
+ }, 8, ["modelValue", "options"])
295
+ ])
296
+ ]));
297
+ }
298
+ }), Le = { class: "fm-typo-en-body-md-400" }, je = /* @__PURE__ */ R({
299
+ __name: "MenuTab",
300
+ props: {
301
+ modelValue: { required: !1, default: [] },
302
+ modelModifiers: {}
303
+ },
304
+ emits: ["update:modelValue"],
305
+ setup(I) {
306
+ const v = ue(I, "modelValue"), { breakpoints: m } = ke();
307
+ return (F, i) => {
308
+ const _ = b("FmButton"), y = b("FmIcon"), h = b("FmMenuItem"), $ = b("FmMenu");
309
+ return u(), f("div", {
310
+ class: z(["flex items-start pb-2 px-24", `${r(m).lg || r(m).md ? "px-24" : "pl-3"}`])
311
+ }, [
312
+ p(Te),
313
+ i[0] || (i[0] = L("div", { class: "flex grow" }, null, -1)),
314
+ v.value.length > 0 ? (u(), g($, {
315
+ key: 0,
316
+ trigger: "click",
317
+ placement: "left",
318
+ shift: !0,
319
+ class: z(r(m).sm || r(m).xs ? "pr-3" : "")
320
+ }, {
321
+ "menu-button": C(() => [
322
+ p(_, {
323
+ "append-icon": "more_vert",
324
+ variant: "tertiary",
325
+ size: "md",
326
+ class: "w-[36px] bg-none"
327
+ })
328
+ ]),
329
+ default: C(() => [
330
+ (u(!0), f(D, null, U(v.value, (n, o) => (u(), g(h, {
331
+ key: `button-${o}`,
332
+ onClick: n.onClick
333
+ }, {
334
+ label: C(() => [
335
+ n.prependIcon ?? !1 ? (u(), g(y, {
336
+ key: 0,
337
+ name: n.icon
338
+ }, null, 8, ["name"])) : N("", !0),
339
+ L("p", Le, ie(n.label), 1)
340
+ ]),
341
+ _: 2
342
+ }, 1032, ["onClick"]))), 128))
343
+ ]),
344
+ _: 1
345
+ }, 8, ["class"])) : N("", !0)
346
+ ], 2);
347
+ };
348
+ }
349
+ });
350
+ export {
351
+ je as _
352
+ };
@@ -5,7 +5,7 @@ import { a as P } from "./BaseDialog.vue_vue_type_script_setup_true_lang-BRk-mwH
5
5
  import { storeToRefs as R } from "pinia";
6
6
  import { _ as S } from "./NoData.vue_vue_type_script_setup_true_lang-qEkm--BH.js";
7
7
  import { useBreakpoints as V } from "@feedmepos/ui-library";
8
- import { _ as z } from "./MenuTab.vue_vue_type_script_setup_true_lang-6I99YY2U.js";
8
+ import { _ as z } from "./MenuTab.vue_vue_type_script_setup_true_lang-Ch4dfAbj.js";
9
9
  import { useI18n as D } from "@feedmepos/mf-common";
10
10
  const G = /* @__PURE__ */ g({
11
11
  __name: "OverviewView",
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as z, computed as v, resolveComponent as H, createBlock as g, openBlock as u, withCtx as M, createVNode as h, createElementVNode as D, unref as o, normalizeStyle as Y, normalizeClass as R, createElementBlock as $, Fragment as G, renderList as Q } from "vue";
2
- import { _ as U } from "./MenuTab.vue_vue_type_script_setup_true_lang-6I99YY2U.js";
2
+ import { _ as U } from "./MenuTab.vue_vue_type_script_setup_true_lang-Ch4dfAbj.js";
3
3
  import { _ as W } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-BE9jLROO.js";
4
4
  import { useRouter as K, useRoute as X } from "vue-router";
5
5
  import { _ as Z } from "./Default.vue_vue_type_script_setup_true_lang-CUUKwwv6.js";
package/dist/app.js CHANGED
@@ -4707,7 +4707,7 @@ const a = {
4707
4707
  path: "/overview",
4708
4708
  alias: ["/"],
4709
4709
  name: "overview",
4710
- component: () => import("./OverviewView-N0NfgdDr.js")
4710
+ component: () => import("./OverviewView-CrN83kjc.js")
4711
4711
  },
4712
4712
  {
4713
4713
  path: "/report",
@@ -4722,7 +4722,7 @@ const a = {
4722
4722
  {
4723
4723
  path: "/report-view",
4724
4724
  name: "reportView",
4725
- component: () => import("./ReportView-nvpOI3qk.js")
4725
+ component: () => import("./ReportView-DPA3futC.js")
4726
4726
  },
4727
4727
  {
4728
4728
  path: "/report-editor",
@@ -4775,7 +4775,7 @@ const u = {
4775
4775
  "zh-CN": m,
4776
4776
  "th-TH": c,
4777
4777
  "zh-Hant": p
4778
- }, h = e(() => import("./App-B42aRUhC.js"));
4778
+ }, h = e(() => import("./App-C2Zq5-lG.js"));
4779
4779
  export {
4780
4780
  h as FmApp,
4781
4781
  u as i18nMessages,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-report",
3
- "version": "5.14.2",
3
+ "version": "5.14.3",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,361 +0,0 @@
1
- import { defineComponent as R, computed as q, ref as oe, watch as z, resolveComponent as h, createElementBlock as v, openBlock as i, renderSlot as re, Fragment as D, renderList as I, createBlock as g, unref as r, withCtx as S, createElementVNode as T, createCommentVNode as U, createVNode as p, isRef as C, useModel as ie, normalizeClass as E, toDisplayString as ue } from "vue";
2
- import { u as me, b as J, d as Y, j as de } from "./vue-i18n-Fbuacdec.js";
3
- import { storeToRefs as N } from "pinia";
4
- import { a as pe, d as ce } from "./NavigationTab.vue_vue_type_script_setup_true_lang-Bu64bEVK.js";
5
- import { _ as K, a as fe } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-BLPR2QZJ.js";
6
- import { a as ve, b as be, D as w, q as he, W as H, S as _e } from "./BaseDialog.vue_vue_type_script_setup_true_lang-BRk-mwHe.js";
7
- import { _ as ye } from "./NoData.vue_vue_type_script_setup_true_lang-qEkm--BH.js";
8
- import { d as Fe } from "./helper-8cjX1HJZ.js";
9
- import { detectLocale as ge } from "@feedmepos/mf-common";
10
- import { useBreakpoints as ke } from "@feedmepos/ui-library";
11
- const xe = { class: "flex flex-wrap gap-2" }, we = { class: "flex flex-col gap-1 p-2 bg-fm-color-neutral-white max-h-[300px] overflow-y-auto relative fm-shadow-light-300" }, Se = {
12
- key: 0,
13
- class: "flex justify-center my-2"
14
- }, Ce = /* @__PURE__ */ R({
15
- __name: "FilterSelector",
16
- setup(V) {
17
- var G;
18
- const { t: b } = me(), { currentReport: d } = N(ve());
19
- let { globalFilters: k, isGlobalFiltersLoading: m, timeRange: _, dateRange: y, selectedLocationIds: F } = N(J()), { schemas: L } = N(be());
20
- const n = q(() => {
21
- var e;
22
- return ((e = d.value) == null ? void 0 : e.id) ?? "";
23
- }), o = oe([]);
24
- z(
25
- ((G = d.value) == null ? void 0 : G.globalFilters) || [],
26
- () => {
27
- o.value = k.value.map((e) => ({
28
- filter: e,
29
- search: "",
30
- options: [],
31
- type: Q(e)
32
- }));
33
- },
34
- { deep: !0, immediate: !0 }
35
- ), z(
36
- [_, y, F],
37
- async () => {
38
- await le();
39
- },
40
- { deep: !0, immediate: !0 }
41
- );
42
- var x = void 0;
43
- function Q(e) {
44
- var a;
45
- const t = (a = L.value.find((s) => s.name === e.schemaName)) == null ? void 0 : a.fields.find((s) => s.name === e.name);
46
- return t == null ? void 0 : t.type;
47
- }
48
- function X(e) {
49
- return {
50
- type: H.Table,
51
- config: {
52
- schemaNames: Array.from(
53
- /* @__PURE__ */ new Set([e.schemaName, ...(e.filters ?? []).map((t) => t.schemaName)])
54
- ),
55
- dimensions: [
56
- {
57
- name: e.name ?? "",
58
- schemaName: e.schemaName ?? "",
59
- label: e.name ?? "",
60
- hide: !1,
61
- option: null
62
- }
63
- ],
64
- rowIds: [],
65
- metrics: [],
66
- filters: e.filters || [],
67
- sorts: [
68
- {
69
- name: e.name ?? "",
70
- schemaName: e.schemaName ?? "",
71
- type: _e.Asc,
72
- aggregation: null,
73
- dimensionOption: null
74
- }
75
- ],
76
- joinDatasources: [],
77
- limit: null,
78
- rollup: void 0,
79
- drillDimension: void 0,
80
- showGrandTotal: !1,
81
- breakdownDimension: void 0,
82
- sparklineDimension: void 0,
83
- isTransposed: !1,
84
- isDrillable: !1
85
- },
86
- title: ""
87
- };
88
- }
89
- function M(e) {
90
- return e.options.every((t) => {
91
- var a;
92
- return (a = e.filter.values) == null ? void 0 : a.includes(t.value);
93
- });
94
- }
95
- function Z(e) {
96
- M(e) ? e.filter.values = ["NULL"] : e.filter.values = e.options.map((t) => t.value);
97
- }
98
- const ee = q(
99
- () => o.value.map((e) => {
100
- const t = e.options, a = e.search.toLowerCase() ?? "";
101
- return t.filter((s) => s.label.toLowerCase().includes(a.toLowerCase()));
102
- })
103
- );
104
- async function te(e) {
105
- switch (e.type) {
106
- case w.String:
107
- case w.Numeric:
108
- {
109
- const t = await he(
110
- X(e.filter),
111
- x.signal
112
- ), a = (t == null ? void 0 : t.type) === H.Table ? t.rows.map((u) => {
113
- var l;
114
- return ((l = u.cells) == null ? void 0 : l[0]) ?? "";
115
- }) : [];
116
- e.options = a.map((u) => ({
117
- label: u,
118
- value: u
119
- }));
120
- const s = e.filter.values || [];
121
- if (!s.some((u) => u !== "NULL"))
122
- e.filter.values = a.length ? a : ["NULL"];
123
- else {
124
- const u = new Set(a), l = s.filter(
125
- ($) => $ === "NULL" || u.has($)
126
- );
127
- e.filter.values = l.length ? l : ["NULL"];
128
- }
129
- }
130
- break;
131
- case w.Bool:
132
- e.options = [
133
- { label: "Yes", value: !0 },
134
- { label: "No", value: !1 }
135
- ], (!e.filter.values || e.filter.values.length === 0) && (e.filter.values = [!0, !1]);
136
- break;
137
- case w.Timestamp:
138
- break;
139
- }
140
- }
141
- async function le() {
142
- if (!(!n.value || !o.value.length)) {
143
- x && (x == null || x.abort()), x = new AbortController();
144
- try {
145
- m.value = !0;
146
- const e = o.value.map(async (t) => {
147
- await te(t);
148
- });
149
- await Promise.all(e);
150
- } finally {
151
- m.value = !1;
152
- }
153
- }
154
- }
155
- function ae(e, t) {
156
- var s, c;
157
- if ((s = e.filter.values) == null ? void 0 : s.includes(t)) {
158
- let u = (e.filter.values || []).filter((l) => l !== t);
159
- u.length === 0 && (u = ["NULL"]), e.filter.values = u;
160
- } else
161
- (c = e.filter.values) == null || c.push(t);
162
- }
163
- function O(e, t) {
164
- if (t === null)
165
- e.values = [];
166
- else {
167
- const a = Y(t.startDate).startOf("day").utc().toISOString(), s = Y(t.endDate).endOf("day").utc().toISOString();
168
- e.values = [a, s];
169
- }
170
- }
171
- function se(e) {
172
- var a;
173
- const t = (a = e.filter.values) == null ? void 0 : a.filter((s) => s !== "NULL");
174
- return `${b("report.section.filter.selectAll")} (${t == null ? void 0 : t.length}/${e.options.length})`;
175
- }
176
- function ne(e) {
177
- const t = e.options.length, a = b("report.section.filter.search"), s = b("report.common.results", { count: t });
178
- return `${a} (${s})`;
179
- }
180
- function A(e) {
181
- var a, s, c;
182
- const t = de(e.filter);
183
- switch (e.type) {
184
- case w.Timestamp:
185
- return ((a = e.filter.values) == null ? void 0 : a.length) === 2 ? `${t} is between ${Fe({
186
- startDate: (s = e.filter.values) == null ? void 0 : s[0],
187
- endDate: (c = e.filter.values) == null ? void 0 : c[1],
188
- locale: ge()
189
- })}` : t;
190
- default:
191
- return t;
192
- }
193
- }
194
- return (e, t) => {
195
- const a = h("FmCircularProgress"), s = h("FmTextField"), c = h("FmMenuItem"), u = h("FmMenu");
196
- return i(), v("div", xe, [
197
- (i(!0), v(D, null, I(o.value, (l, $) => {
198
- var B, j, P;
199
- return i(), v("div", {
200
- key: `${l.filter.schemaName}-${l.filter.name}`
201
- }, [
202
- l.type === r(w).Timestamp ? (i(), g(K, {
203
- key: 0,
204
- "model-value": { startDate: (B = l.filter.values) == null ? void 0 : B[0], endDate: (j = l.filter.values) == null ? void 0 : j[1] },
205
- class: "w-full",
206
- label: A(l),
207
- removable: ((P = l.filter.values) == null ? void 0 : P.length) === 2,
208
- onUpdate: (f) => O(l.filter, f),
209
- onChipClosed: () => O(l.filter, null)
210
- }, null, 8, ["model-value", "label", "removable", "onUpdate", "onChipClosed"])) : (i(), g(u, {
211
- key: 1,
212
- "close-on-click": !1,
213
- shift: !0
214
- }, {
215
- "menu-button": S(() => [
216
- p(fe, {
217
- "left-icon": "filter_alt",
218
- "right-icon": "expand_more",
219
- label: A(l)
220
- }, null, 8, ["label"])
221
- ]),
222
- "menu-wrapper": S(() => [
223
- T("div", we, [
224
- r(m) ? (i(), v("div", Se, [
225
- p(a)
226
- ])) : U("", !0),
227
- l.options.length > 0 && !r(m) ? (i(), v(D, { key: 1 }, [
228
- p(s, {
229
- modelValue: l.search,
230
- "onUpdate:modelValue": (f) => l.search = f,
231
- type: "text",
232
- "prepend-icon": "search",
233
- placeholder: ne(l),
234
- class: "border px-2 py-1 text-sm mb-1 rounded"
235
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]),
236
- p(c, {
237
- label: se(l),
238
- "has-checkbox": !0,
239
- "model-value": M(l),
240
- indeterminate: !0,
241
- onClick: (f) => Z(l)
242
- }, null, 8, ["label", "model-value", "onClick"]),
243
- (i(!0), v(D, null, I(ee.value[$], (f) => {
244
- var W;
245
- return i(), g(c, {
246
- key: f.value,
247
- label: f.label,
248
- "has-checkbox": !0,
249
- "model-value": (W = l.filter.values) == null ? void 0 : W.includes(f.value),
250
- onClick: () => ae(l, f.value)
251
- }, null, 8, ["label", "model-value", "onClick"]);
252
- }), 128))
253
- ], 64)) : r(m) ? U("", !0) : (i(), g(ye, { key: 2 }))
254
- ])
255
- ]),
256
- _: 2
257
- }, 1024))
258
- ]);
259
- }), 128)),
260
- re(e.$slots, "default")
261
- ]);
262
- };
263
- }
264
- }), Le = { class: "flex flex-col gap-2 overflow-x-auto overflow-y-hidden scrollbar-hide" }, $e = { class: "flex flex-col gap-2 py-2" }, De = /* @__PURE__ */ R({
265
- __name: "Filter",
266
- setup(V) {
267
- const {
268
- locations: b,
269
- selectedLocationIds: d,
270
- dateRange: k,
271
- compareDateRange: m,
272
- timeRange: _,
273
- defaultDateSetting: y,
274
- selectTimeDefault: F
275
- } = N(J());
276
- return (L, n) => (i(), v("div", Le, [
277
- T("div", $e, [
278
- p(pe, {
279
- modelValue: r(d),
280
- "onUpdate:modelValue": n[5] || (n[5] = (o) => C(d) ? d.value = o : null),
281
- options: r(b)
282
- }, {
283
- default: S(() => [
284
- p(K, {
285
- "date-range": r(k),
286
- "onUpdate:dateRange": n[0] || (n[0] = (o) => C(k) ? k.value = o : null),
287
- "compare-date-range": r(m),
288
- "onUpdate:compareDateRange": n[1] || (n[1] = (o) => C(m) ? m.value = o : null),
289
- "compare-type": r(y).defaultCompareType,
290
- "onUpdate:compareType": n[2] || (n[2] = (o) => r(y).defaultCompareType = o),
291
- compare: ""
292
- }, null, 8, ["date-range", "compare-date-range", "compare-type"]),
293
- p(ce, {
294
- "time-range": r(_),
295
- "onUpdate:timeRange": n[3] || (n[3] = (o) => C(_) ? _.value = o : null),
296
- "select-time-default": r(F),
297
- "onUpdate:selectTimeDefault": n[4] || (n[4] = (o) => C(F) ? F.value = o : null),
298
- "default-date-range": r(y).timeOptions
299
- }, null, 8, ["time-range", "select-time-default", "default-date-range"]),
300
- p(Ce)
301
- ]),
302
- _: 1
303
- }, 8, ["modelValue", "options"])
304
- ])
305
- ]));
306
- }
307
- }), Ne = { class: "fm-typo-en-body-md-400" }, je = /* @__PURE__ */ R({
308
- __name: "MenuTab",
309
- props: {
310
- modelValue: { required: !1, default: [] },
311
- modelModifiers: {}
312
- },
313
- emits: ["update:modelValue"],
314
- setup(V) {
315
- const b = ie(V, "modelValue"), { breakpoints: d } = ke();
316
- return (k, m) => {
317
- const _ = h("FmButton"), y = h("FmIcon"), F = h("FmMenuItem"), L = h("FmMenu");
318
- return i(), v("div", {
319
- class: E(["flex items-start pb-2 px-24", `${r(d).lg || r(d).md ? "px-24" : "pl-3"}`])
320
- }, [
321
- p(De),
322
- m[0] || (m[0] = T("div", { class: "flex grow" }, null, -1)),
323
- b.value.length > 0 ? (i(), g(L, {
324
- key: 0,
325
- trigger: "click",
326
- placement: "left",
327
- shift: !0,
328
- class: E(r(d).sm || r(d).xs ? "pr-3" : "")
329
- }, {
330
- "menu-button": S(() => [
331
- p(_, {
332
- "append-icon": "more_vert",
333
- variant: "tertiary",
334
- size: "md",
335
- class: "w-[36px] bg-none"
336
- })
337
- ]),
338
- default: S(() => [
339
- (i(!0), v(D, null, I(b.value, (n, o) => (i(), g(F, {
340
- key: `button-${o}`,
341
- onClick: n.onClick
342
- }, {
343
- label: S(() => [
344
- n.prependIcon ?? !1 ? (i(), g(y, {
345
- key: 0,
346
- name: n.icon
347
- }, null, 8, ["name"])) : U("", !0),
348
- T("p", Ne, ue(n.label), 1)
349
- ]),
350
- _: 2
351
- }, 1032, ["onClick"]))), 128))
352
- ]),
353
- _: 1
354
- }, 8, ["class"])) : U("", !0)
355
- ], 2);
356
- };
357
- }
358
- });
359
- export {
360
- je as _
361
- };