@feedmepos/mf-report 5.8.2 → 5.9.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 (37) hide show
  1. package/dist/{App-C6VF9T5V.js → App-CSOLBHvz.js} +6 -7
  2. package/dist/DateRangeSelect.vue_vue_type_script_setup_true_lang-DFhiXlTW.js +180 -0
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-B0_QlxYu.js → Default.vue_vue_type_script_setup_true_lang-Bk5Aw-iX.js} +2 -2
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-zgh_zMvL.js +1447 -0
  5. package/dist/{InsightView-BQlzh0ue.js → InsightView-Bwh7zRnV.js} +7 -8
  6. package/dist/Integration-C6jAZ1_i.js +5222 -0
  7. package/dist/Integrations-BGmJBj90.js +338 -0
  8. package/dist/{Layout-RhBG3zKc.js → Layout-Db6yStGK.js} +1 -1
  9. package/dist/MenuTab.vue_vue_type_script_setup_true_lang-BEHjV9yH.js +342 -0
  10. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-BdzurgE4.js → NavigationTab.vue_vue_type_script_setup_true_lang-gDVPczBf.js} +1078 -1080
  11. package/dist/NoData.vue_vue_type_script_setup_true_lang-D-J81GXC.js +38 -0
  12. package/dist/{OverviewView-Boq9rgbj.js → OverviewView-WOEuALSq.js} +5 -5
  13. package/dist/{Report-C7GvAhoG.js → Report-_YQ9GpRY.js} +4 -4
  14. package/dist/ReportEditor-C9W5Dkcl.js +968 -0
  15. package/dist/{ReportView-DMLyspIY.js → ReportView-B2dPbjug.js} +7 -7
  16. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-CGlkGXWL.js +110 -0
  17. package/dist/{Setting-CLBZdtvx.js → Setting-BONU5EUv.js} +26 -23
  18. package/dist/TileEditor-B_5Z6Y4K.js +3080 -0
  19. package/dist/{TransitionFade-D3megUTB.js → TransitionFade-nQahFBUN.js} +207 -203
  20. package/dist/app.js +59 -19
  21. package/dist/helper-CFNxnCtm.js +75 -0
  22. package/dist/style.css +1 -1
  23. package/dist/{v4-Bi2F4URu.js → v4-CboKZWvc.js} +1955 -1844
  24. package/dist/{global-loader-CEOgl5uZ.js → vue-i18n-DX0diAld.js} +2057 -1976
  25. package/package.json +1 -1
  26. package/dist/DateRangeSelect.vue_vue_type_script_setup_true_lang-CpakO4U-.js +0 -162
  27. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-BO_HTvjY.js +0 -1417
  28. package/dist/Integration-CB31rvSG.js +0 -4751
  29. package/dist/Integrations-DGlzyZMR.js +0 -334
  30. package/dist/MenuTab.vue_vue_type_script_setup_true_lang-DsY5W3k7.js +0 -101
  31. package/dist/NoData.vue_vue_type_script_setup_true_lang-DZJxcekm.js +0 -31
  32. package/dist/ReportEditor-CwzONBLC.js +0 -621
  33. package/dist/SelectComponent.vue_vue_type_script_setup_true_lang-C23-eIYF.js +0 -104
  34. package/dist/TileEditor-CtVM3IbI.js +0 -3016
  35. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  36. package/dist/index-CH1WFv_s.js +0 -147
  37. package/dist/report-schema-C3sI223M.js +0 -31
@@ -0,0 +1,968 @@
1
+ import { defineComponent as G, mergeModels as J, useModel as j, ref as W, computed as N, resolveComponent as v, createBlock as x, openBlock as i, withCtx as s, createElementVNode as b, createVNode as a, unref as e, normalizeClass as le, createTextVNode as ue, toDisplayString as P, createElementBlock as S, Fragment as L, renderSlot as Ce, createCommentVNode as Y, watch as de, renderList as Q, resolveDynamicComponent as Be, isRef as ke, normalizeStyle as me, onMounted as Ue } from "vue";
2
+ import { W as De, i as We, S as he, d as ye, T as Re, _ as qe } from "./TransitionFade-nQahFBUN.js";
3
+ import { D as K, c as Ie, C as _e, a as Ve, b as Pe, v as ee } from "./v4-CboKZWvc.js";
4
+ import { storeToRefs as ce } from "pinia";
5
+ import { useRouter as Se, useRoute as $e } from "vue-router";
6
+ import { useBreakpoints as ae, useSnackbar as Oe, FmButtonColorThemeVariant as X } from "@feedmepos/ui-library";
7
+ import { u as Te } from "./message-dialog-UoMWOnil.js";
8
+ import { u as te, j as re, f as Ee } from "./vue-i18n-DX0diAld.js";
9
+ import { _ as ie } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-zgh_zMvL.js";
10
+ import { _ as se } from "./NoData.vue_vue_type_script_setup_true_lang-D-J81GXC.js";
11
+ import { r as we } from "./i18n-Cif1I9J2.js";
12
+ import { _ as Fe } from "./SelectComponent.vue_vue_type_script_setup_true_lang-CGlkGXWL.js";
13
+ const ze = /* @__PURE__ */ G({
14
+ __name: "WidgetDialog",
15
+ props: /* @__PURE__ */ J({
16
+ isOpen: { type: Boolean }
17
+ }, {
18
+ modelValue: {},
19
+ modelModifiers: {}
20
+ }),
21
+ emits: /* @__PURE__ */ J(["update:isOpen"], ["update:modelValue"]),
22
+ setup(F, { emit: u }) {
23
+ const { t: n } = te(), { breakpoints: r } = ae(), y = j(F, "modelValue"), d = F, w = u;
24
+ function m() {
25
+ w("update:isOpen", !1);
26
+ }
27
+ function C() {
28
+ c.value && (y.value = c.value, c.value = void 0, w("update:isOpen", !1));
29
+ }
30
+ const c = W(), R = N(() => !c.value);
31
+ return (q, O) => {
32
+ const B = v("FmButton"), g = v("FmDialog");
33
+ return i(), x(g, {
34
+ "model-value": d.isOpen
35
+ }, {
36
+ "dialog-header": s(() => [
37
+ ue(P(e(n)("report.widget.type")), 1)
38
+ ]),
39
+ default: s(() => [
40
+ a(De, {
41
+ modelValue: c.value,
42
+ "onUpdate:modelValue": O[0] || (O[0] = ($) => c.value = $),
43
+ class: le(`grid ${e(r).lg || e(r).md ? "grid-cols-3 gap-3" : "grid-cols-2 gap-3"}`),
44
+ "child-class": "p-[8px] flex flex-col"
45
+ }, null, 8, ["modelValue", "class"])
46
+ ]),
47
+ "dialog-footer": s(() => [
48
+ O[1] || (O[1] = b("div", { class: "grow" }, null, -1)),
49
+ a(B, {
50
+ label: e(n)("report.common.cancel"),
51
+ variant: "tertiary",
52
+ onClick: m
53
+ }, null, 8, ["label"]),
54
+ a(B, {
55
+ label: e(n)("report.common.confirm"),
56
+ disabled: R.value,
57
+ onClick: C
58
+ }, null, 8, ["label", "disabled"])
59
+ ]),
60
+ _: 1
61
+ }, 8, ["model-value"]);
62
+ };
63
+ }
64
+ }), He = { class: "fm-typo-en-body-lg-600" }, pe = /* @__PURE__ */ G({
65
+ __name: "ReportEditorTabHeader",
66
+ props: /* @__PURE__ */ J({
67
+ icon: {
68
+ type: String,
69
+ required: !0
70
+ }
71
+ }, {
72
+ modelValue: { type: Boolean, required: !0, default: !1 },
73
+ modelModifiers: {}
74
+ }),
75
+ emits: ["update:modelValue"],
76
+ setup(F) {
77
+ const { t: u } = te(), n = j(F, "modelValue"), r = F;
78
+ return (y, d) => {
79
+ const w = v("FmIcon");
80
+ return i(), S("div", {
81
+ class: "px-6 py-16 flex items-center gap-2 bg-fm-color-neutral-white border cursor-pointer",
82
+ onClick: d[0] || (d[0] = (m) => n.value = !n.value)
83
+ }, [
84
+ b("p", He, P(e(u)("report.editor.customizeReport")), 1),
85
+ d[1] || (d[1] = b("div", { class: "grow" }, null, -1)),
86
+ a(w, {
87
+ name: r.icon
88
+ }, null, 8, ["name"])
89
+ ]);
90
+ };
91
+ }
92
+ }), Le = /* @__PURE__ */ G({
93
+ __name: "ReportEditorTabDesktop",
94
+ props: {
95
+ modelValue: { required: !0, default: !1 },
96
+ modelModifiers: {}
97
+ },
98
+ emits: ["update:modelValue"],
99
+ setup(F) {
100
+ const u = j(F, "modelValue");
101
+ return (n, r) => (i(), S(L, null, [
102
+ a(pe, {
103
+ modelValue: u.value,
104
+ "onUpdate:modelValue": r[0] || (r[0] = (y) => u.value = y),
105
+ icon: "keyboard_double_arrow_left"
106
+ }, null, 8, ["modelValue"]),
107
+ Ce(n.$slots, "default")
108
+ ], 64));
109
+ }
110
+ }), Je = /* @__PURE__ */ G({
111
+ __name: "ReportEditorTabMobile",
112
+ props: {
113
+ modelValue: { required: !0, default: !1 },
114
+ modelModifiers: {}
115
+ },
116
+ emits: ["update:modelValue"],
117
+ setup(F) {
118
+ const u = j(F, "modelValue");
119
+ return (n, r) => {
120
+ const y = v("FmTopSheet"), d = v("FmCard");
121
+ return i(), x(d, { class: "fixed bottom-0 w-full" }, {
122
+ default: s(() => [
123
+ a(pe, {
124
+ modelValue: u.value,
125
+ "onUpdate:modelValue": r[0] || (r[0] = (w) => u.value = w),
126
+ icon: "keyboard_double_arrow_up"
127
+ }, null, 8, ["modelValue"]),
128
+ a(y, {
129
+ modelValue: u.value,
130
+ "onUpdate:modelValue": r[2] || (r[2] = (w) => u.value = w),
131
+ "fullscreen-size": "sm"
132
+ }, {
133
+ default: s(() => [
134
+ a(pe, {
135
+ modelValue: u.value,
136
+ "onUpdate:modelValue": r[1] || (r[1] = (w) => u.value = w),
137
+ icon: "keyboard_double_arrow_down"
138
+ }, null, 8, ["modelValue"]),
139
+ u.value ? Ce(n.$slots, "default", { key: 0 }) : Y("", !0)
140
+ ]),
141
+ _: 3
142
+ }, 8, ["modelValue"])
143
+ ]),
144
+ _: 3
145
+ });
146
+ };
147
+ }
148
+ }), je = {
149
+ key: 0,
150
+ class: "flex flex-col gap-2"
151
+ }, Ge = /* @__PURE__ */ G({
152
+ __name: "GlobalFilterDialog",
153
+ props: /* @__PURE__ */ J({
154
+ schemas: {
155
+ type: Array,
156
+ default: () => []
157
+ },
158
+ tiles: {
159
+ type: Array,
160
+ required: !0
161
+ }
162
+ }, {
163
+ globalFilter: {
164
+ default: () => null
165
+ },
166
+ globalFilterModifiers: {},
167
+ isOpen: { type: Boolean, default: () => !1, required: !0 },
168
+ isOpenModifiers: {}
169
+ }),
170
+ emits: ["update:globalFilter", "update:isOpen"],
171
+ setup(F) {
172
+ const { t: u } = te(), n = j(F, "globalFilter"), r = j(F, "isOpen"), y = Oe(), d = F, w = W(), m = W(), C = W(), c = W([]);
173
+ de(r, (p) => {
174
+ var t, V, U;
175
+ p && (w.value = ((t = n.value) == null ? void 0 : t.label) || "", m.value = d.schemas.find(
176
+ (D) => {
177
+ var T;
178
+ return D.name === ((T = n.value) == null ? void 0 : T.schemaName);
179
+ }
180
+ ), C.value = (V = q.value.find(
181
+ (D) => {
182
+ var T;
183
+ return D.value.name === ((T = n.value) == null ? void 0 : T.name);
184
+ }
185
+ )) == null ? void 0 : V.value, c.value = ((U = n.value) == null ? void 0 : U.tileIds) || []);
186
+ });
187
+ const R = N(
188
+ () => d.schemas.map((p) => ({
189
+ label: p.label,
190
+ value: p
191
+ }))
192
+ ), q = N(() => {
193
+ var p;
194
+ return (((p = m.value) == null ? void 0 : p.fields) || []).reduce(
195
+ (t, V) => ([K.Bool, K.String, K.Timestamp].includes(V.type) && t.push({
196
+ label: V.label,
197
+ value: V
198
+ }), t),
199
+ []
200
+ );
201
+ }), O = N(() => d.tiles.reduce((p, t, V) => {
202
+ var T, z;
203
+ const U = t.widget.config.schemaNames ?? [], D = (t.widget.config.joinDatasources ?? []).flatMap(
204
+ (_) => _.schemaNames ?? []
205
+ );
206
+ return [...U, ...D].includes(((T = m.value) == null ? void 0 : T.name) || "") && p.push({
207
+ label: (z = t == null ? void 0 : t.widget.title) != null && z.trim() ? t.widget.title : `Widget ${V + 1}`,
208
+ value: t.id
209
+ }), p;
210
+ }, []));
211
+ function B(p) {
212
+ var t;
213
+ p.name !== ((t = m.value) == null ? void 0 : t.name) && (m.value = p, C.value = void 0);
214
+ }
215
+ function g(p) {
216
+ C.value = p;
217
+ }
218
+ function $(p) {
219
+ switch (p) {
220
+ case K.Timestamp:
221
+ return _e.Between;
222
+ case K.Bool:
223
+ case K.String:
224
+ return _e.Equal;
225
+ default:
226
+ throw new Error(`Unsupported data type: ${p}`);
227
+ }
228
+ }
229
+ function A() {
230
+ if (!m.value) {
231
+ y.open({ message: "Invalid schema", type: "error" });
232
+ return;
233
+ }
234
+ C.value || y.open({ message: "Invalid dimension", type: "error" }), n.value = {
235
+ schemaName: m.value.name,
236
+ name: C.value.name,
237
+ label: w.value || name,
238
+ operator: $(C.value.type),
239
+ option: C.value.type === K.Timestamp ? Ie.DateTime : null,
240
+ tileIds: [...c.value],
241
+ filters: []
242
+ }, k();
243
+ }
244
+ function k() {
245
+ r.value = !1;
246
+ }
247
+ return (p, t) => {
248
+ const V = v("FmTextField"), U = v("FmLabel"), D = v("FmCheckbox"), T = v("FmForm"), z = v("FmButton"), _ = v("FmDialog");
249
+ return i(), x(_, {
250
+ modelValue: r.value,
251
+ "onUpdate:modelValue": t[4] || (t[4] = (o) => r.value = o),
252
+ overlay: !0,
253
+ "z-index": 10
254
+ }, {
255
+ "dialog-header": s(() => [
256
+ ue(P(e(u)("report.section.filter.globalFilter")), 1)
257
+ ]),
258
+ default: s(() => [
259
+ a(T, {
260
+ ref: "form",
261
+ class: "flex flex-col gap-2 w-[490px]"
262
+ }, {
263
+ default: s(() => [
264
+ a(V, {
265
+ modelValue: w.value,
266
+ "onUpdate:modelValue": t[0] || (t[0] = (o) => w.value = o),
267
+ placeholder: e(u)("report.section.filter.displayName"),
268
+ label: e(u)("report.section.filter.displayName"),
269
+ class: "mb-2"
270
+ }, null, 8, ["modelValue", "placeholder", "label"]),
271
+ a(Fe, {
272
+ "model-value": m.value,
273
+ items: R.value,
274
+ placeholder: e(u)("report.section.schema.title"),
275
+ label: e(u)("report.section.schema.title"),
276
+ "onUpdate:modelValue": t[1] || (t[1] = (o) => B(o))
277
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
278
+ a(Fe, {
279
+ "model-value": C.value,
280
+ items: q.value,
281
+ placeholder: e(u)("report.section.dimension.Dimension"),
282
+ label: e(u)("report.section.dimension.Dimension"),
283
+ "onUpdate:modelValue": t[2] || (t[2] = (o) => g(o))
284
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
285
+ a(U, { class: "mt-2 fm-typo-en-body-lg-600" }, {
286
+ default: s(() => [
287
+ ue(P(e(u)("report.section.filter.applyWidget")), 1)
288
+ ]),
289
+ _: 1
290
+ }),
291
+ F.tiles.length > 0 ? (i(), S("div", je, [
292
+ (i(!0), S(L, null, Q(O.value, (o) => (i(), x(D, {
293
+ key: o.value,
294
+ modelValue: c.value,
295
+ "onUpdate:modelValue": t[3] || (t[3] = (l) => c.value = l),
296
+ label: o.label,
297
+ value: o.value
298
+ }, null, 8, ["modelValue", "label", "value"]))), 128))
299
+ ])) : (i(), x(U, {
300
+ key: 1,
301
+ class: "fm-typo-en-body-lg-400",
302
+ label: e(u)("report.section.filter.noWidget")
303
+ }, null, 8, ["label"]))
304
+ ]),
305
+ _: 1
306
+ }, 512)
307
+ ]),
308
+ "dialog-footer": s(() => [
309
+ t[5] || (t[5] = b("div", { class: "grow" }, null, -1)),
310
+ a(z, {
311
+ label: e(u)("report.common.cancel"),
312
+ variant: "tertiary",
313
+ onClick: k
314
+ }, null, 8, ["label"]),
315
+ a(z, {
316
+ label: e(u)("report.common.confirm"),
317
+ onClick: A
318
+ }, null, 8, ["label"])
319
+ ]),
320
+ _: 1
321
+ }, 8, ["modelValue"]);
322
+ };
323
+ }
324
+ }), Ae = { class: "flex flex-col gap-24 top-0 bg-fm-color-neutral-white z-10" }, Ke = { class: "flex flex-col gap-24 top-0 bg-fm-color-neutral-white z-10" }, Qe = { class: "flex items-center gap-1 max-w-[195px] w-[195px]" }, Xe = { class: "line-clamp-2 overflow-hidden max-w-[195px] w-[195px]" }, Ye = { class: "flex flex-col gap-24" }, Ze = { class: "line-clamp-2 overflow-hidden max-w-[195px] w-[195px]" }, xe = /* @__PURE__ */ G({
325
+ __name: "ReportEditorTab",
326
+ props: /* @__PURE__ */ J({
327
+ hideConfiguration: {
328
+ type: Boolean,
329
+ default: !1
330
+ }
331
+ }, {
332
+ modelValue: { required: !0 },
333
+ modelModifiers: {}
334
+ }),
335
+ emits: /* @__PURE__ */ J(["hideConfiguration"], ["update:modelValue"]),
336
+ setup(F, { emit: u }) {
337
+ const n = j(F, "modelValue"), { breakpoints: r } = ae(), y = F, d = u, w = Se(), m = $e(), C = W(), {
338
+ currentSelectWidgetType: c,
339
+ categories: R,
340
+ editingTile: q,
341
+ editingTileIndex: O,
342
+ editingGlobalFilter: B,
343
+ editingGlobalFilterIndex: g
344
+ } = ce(Ve()), { schemas: $ } = ce(Pe()), { promptMessage: A } = Te(), k = W(!1), p = W(!1), { t, te: V } = te(), U = W(void 0), D = N(() => {
345
+ const o = n.value.tiles.flatMap((l) => {
346
+ var f;
347
+ const I = l.widget.config.schemaNames ?? [], M = ((f = l.widget.config.joinDatasources) == null ? void 0 : f.flatMap((E) => E.schemaNames ?? [])) ?? [];
348
+ return [...I, ...M];
349
+ });
350
+ return [...new Set(o)].reduce((l, I) => {
351
+ const M = $.value.find((f) => f.name === I);
352
+ return M && l.push(M), l;
353
+ }, []);
354
+ });
355
+ de(
356
+ () => c.value,
357
+ () => {
358
+ c.value !== void 0 && (U.value = We(c.value), q.value = U.value, O.value = -1, w.push({
359
+ name: "tileEditor",
360
+ query: m.query
361
+ }));
362
+ },
363
+ { immediate: !0 }
364
+ ), de(
365
+ () => n.value.tiles,
366
+ (o) => {
367
+ o.forEach((l) => {
368
+ l.id || (l.id = ee());
369
+ });
370
+ },
371
+ { immediate: !0, deep: !0 }
372
+ );
373
+ const T = [
374
+ {
375
+ label: t("report.common.edit"),
376
+ selected: !1,
377
+ variant: "tertiary",
378
+ onClick: (o) => {
379
+ O.value = o, q.value = JSON.parse(JSON.stringify(n.value.tiles[o])), w.push({
380
+ name: "tileEditor",
381
+ query: m.query
382
+ });
383
+ }
384
+ },
385
+ {
386
+ label: t("report.common.duplicate"),
387
+ selected: !1,
388
+ variant: "tertiary",
389
+ onClick: (o) => {
390
+ const l = {
391
+ ...JSON.parse(JSON.stringify(n.value.tiles[o])),
392
+ id: ee()
393
+ };
394
+ n.value.tiles.push(l);
395
+ }
396
+ },
397
+ {
398
+ label: t("report.common.remove"),
399
+ selected: !1,
400
+ variant: "destructive",
401
+ onClick: async (o) => {
402
+ if (await A({
403
+ title: t("report.editor.deleteWidget"),
404
+ message: t("report.editor.deleteWidgetConfirm", {
405
+ title: n.value.tiles[o].widget.title
406
+ })
407
+ })) {
408
+ const I = n.value.tiles[o].id;
409
+ n.value.tiles.splice(o, 1), n.value.globalFilters && n.value.globalFilters.forEach((M) => {
410
+ var f;
411
+ M.tileIds = (f = M.tileIds) == null ? void 0 : f.filter((E) => E !== I);
412
+ });
413
+ }
414
+ }
415
+ }
416
+ ], z = [
417
+ {
418
+ label: t("report.common.edit"),
419
+ selected: !1,
420
+ variant: "tertiary",
421
+ onClick: (o) => {
422
+ var l;
423
+ g.value = o, B.value = JSON.parse(JSON.stringify((l = n.value.globalFilters) == null ? void 0 : l[o])), k.value = !0;
424
+ }
425
+ },
426
+ {
427
+ label: t("report.common.remove"),
428
+ selected: !1,
429
+ variant: "destructive",
430
+ onClick: async (o) => {
431
+ var M, f;
432
+ const l = (M = n.value.globalFilters) == null ? void 0 : M[o];
433
+ if (!l) return;
434
+ await A({
435
+ title: t("report.editor.deleteWidget"),
436
+ message: t("report.editor.deleteWidgetConfirm", {
437
+ title: re(l)
438
+ })
439
+ }) && ((f = n.value.globalFilters) == null || f.splice(o, 1));
440
+ }
441
+ }
442
+ ], _ = N(() => R.value.map((o) => ({
443
+ label: t(`report.category.${o.name}`),
444
+ value: o.id
445
+ })));
446
+ return (o, l) => {
447
+ const I = v("FmTextField"), M = v("FmSelect"), f = v("FmButton"), E = v("FmIcon"), oe = v("FmTooltip"), ve = v("FmMenuItem"), fe = v("FmMenu"), ge = v("FmListItem"), be = v("FmList"), Me = v("FmForm");
448
+ return i(), x(Be(e(r).lg || e(r).md ? Le : Je), {
449
+ "model-value": y.hideConfiguration,
450
+ "onUpdate:modelValue": l[8] || (l[8] = (h) => d("hideConfiguration", h))
451
+ }, {
452
+ default: s(() => [
453
+ a(Ge, {
454
+ "is-open": k.value,
455
+ "onUpdate:isOpen": l[0] || (l[0] = (h) => k.value = h),
456
+ "global-filter": e(B),
457
+ tiles: n.value.tiles,
458
+ schemas: D.value,
459
+ "onUpdate:globalFilter": l[1] || (l[1] = (h) => {
460
+ !h || !n.value.globalFilters || (typeof e(g) == "number" && e(g) >= 0 ? n.value.globalFilters[e(g)] = h : n.value.globalFilters.push(h));
461
+ })
462
+ }, null, 8, ["is-open", "global-filter", "tiles", "schemas"]),
463
+ a(ze, {
464
+ modelValue: e(c),
465
+ "onUpdate:modelValue": l[2] || (l[2] = (h) => ke(c) ? c.value = h : null),
466
+ "is-open": p.value,
467
+ "onUpdate:isOpen": l[3] || (l[3] = (h) => p.value = h)
468
+ }, null, 8, ["modelValue", "is-open"]),
469
+ a(Me, {
470
+ ref_key: "form",
471
+ ref: C,
472
+ class: "px-6 py-16 flex flex-col gap-24 overflow-y-auto overflow-x-hidden"
473
+ }, {
474
+ default: s(() => [
475
+ a(he, { class: "border-solid" }, {
476
+ header: s(() => [
477
+ b("p", null, P(e(t)("report.editor.reportInfo")), 1),
478
+ l[9] || (l[9] = b("div", { class: "grow" }, null, -1))
479
+ ]),
480
+ content: s(() => [
481
+ b("div", Ae, [
482
+ a(I, {
483
+ modelValue: n.value.name,
484
+ "onUpdate:modelValue": l[4] || (l[4] = (h) => n.value.name = h),
485
+ label: e(t)("report.editor.reportTitle"),
486
+ placeholder: e(t)("report.editor.placeholder")
487
+ }, null, 8, ["modelValue", "label", "placeholder"]),
488
+ a(M, {
489
+ modelValue: n.value.category,
490
+ "onUpdate:modelValue": l[5] || (l[5] = (h) => n.value.category = h),
491
+ label: e(t)("report.common.category"),
492
+ items: _.value
493
+ }, null, 8, ["modelValue", "label", "items"])
494
+ ])
495
+ ]),
496
+ _: 1
497
+ }),
498
+ a(he, {
499
+ class: "border-solid",
500
+ "is-open": !1
501
+ }, {
502
+ header: s(() => [
503
+ b("p", null, P(e(t)("report.section.filter.globalFilter")), 1),
504
+ l[10] || (l[10] = b("div", { class: "grow" }, null, -1))
505
+ ]),
506
+ content: s(() => [
507
+ b("div", Ke, [
508
+ a(f, {
509
+ label: e(t)("report.section.filter.addGlobalFilter"),
510
+ variant: "secondary",
511
+ icon: "add",
512
+ "icon-position": "prepend",
513
+ "border-color": e(X).ColorPrimary,
514
+ "text-color": e(X).ColorPrimary,
515
+ onClick: l[6] || (l[6] = () => {
516
+ g.value = null, B.value = null, k.value = !0;
517
+ })
518
+ }, null, 8, ["label", "border-color", "text-color"]),
519
+ a(be, null, {
520
+ default: s(() => [
521
+ a(e(ye), {
522
+ list: n.value.globalFilters,
523
+ "item-key": "`${element.schemaName}-${element.name}`",
524
+ class: "flex flex-col gap-2 cursor-grab",
525
+ handle: ".handle"
526
+ }, {
527
+ item: s(({ element: h, index: Z }) => [
528
+ a(ge, { class: "!cursor-grab border rounded-md border-neutral-300" }, {
529
+ default: s(() => [
530
+ a(E, {
531
+ name: "drag_handle",
532
+ class: "handle"
533
+ }),
534
+ b("div", Qe, [
535
+ a(oe, {
536
+ "z-index": 99,
537
+ content: e(re)(h),
538
+ class: "handle"
539
+ }, {
540
+ default: s(() => [
541
+ b("p", Xe, P(e(re)(h)), 1)
542
+ ]),
543
+ _: 2
544
+ }, 1032, ["content"]),
545
+ D.value.find(
546
+ (H) => H.name === h.schemaName
547
+ ) ? Y("", !0) : (i(), x(oe, {
548
+ key: 0,
549
+ content: "Missing schema",
550
+ "z-index": 99
551
+ }, {
552
+ default: s(() => [
553
+ a(E, {
554
+ name: "warning",
555
+ class: "text-fm-color-system-error-300"
556
+ })
557
+ ]),
558
+ _: 1
559
+ }))
560
+ ]),
561
+ l[11] || (l[11] = b("div", { class: "grow" }, null, -1)),
562
+ a(fe, {
563
+ trigger: "click",
564
+ shift: !0,
565
+ "stop-click-propagation": !0
566
+ }, {
567
+ "menu-button": s(() => [
568
+ a(f, {
569
+ "append-icon": "more_vert",
570
+ variant: "tertiary"
571
+ })
572
+ ]),
573
+ default: s(() => [
574
+ (i(), S(L, null, Q(z, (H, ne) => a(ve, {
575
+ key: ne,
576
+ onClick: (Ne) => H.onClick(Z)
577
+ }, {
578
+ label: s(() => [
579
+ b("p", {
580
+ class: le(
581
+ H.variant === "destructive" ? " text-fm-color-system-error-300" : ""
582
+ )
583
+ }, P(H.label), 3)
584
+ ]),
585
+ _: 2
586
+ }, 1032, ["onClick"])), 64))
587
+ ]),
588
+ _: 2
589
+ }, 1024)
590
+ ]),
591
+ _: 2
592
+ }, 1024)
593
+ ]),
594
+ _: 1
595
+ }, 8, ["list"])
596
+ ]),
597
+ _: 1
598
+ })
599
+ ])
600
+ ]),
601
+ _: 1
602
+ }),
603
+ b("div", Ye, [
604
+ a(f, {
605
+ label: e(t)("report.editor.addWidget"),
606
+ variant: "secondary",
607
+ icon: "add",
608
+ "icon-position": "prepend",
609
+ "border-color": e(X).ColorPrimary,
610
+ "text-color": e(X).ColorPrimary,
611
+ onClick: l[7] || (l[7] = (h) => p.value = !0)
612
+ }, null, 8, ["label", "border-color", "text-color"]),
613
+ a(be, null, {
614
+ default: s(() => [
615
+ a(e(ye), {
616
+ list: n.value.tiles,
617
+ "item-key": "id",
618
+ class: "flex flex-col gap-2 cursor-grab",
619
+ handle: ".handle"
620
+ }, {
621
+ item: s(({ element: h, index: Z }) => [
622
+ a(ge, { class: "!cursor-grab border rounded-md border-neutral-300" }, {
623
+ default: s(() => [
624
+ a(E, {
625
+ name: "drag_handle",
626
+ class: "handle"
627
+ }),
628
+ a(oe, {
629
+ content: h.widget.title ? e(we)(e(t), e(V), h.widget.title, "other") : e(t)("report.editor.widget", { index: Z + 1 }),
630
+ class: "handle"
631
+ }, {
632
+ default: s(() => [
633
+ b("p", Ze, P(h.widget.title ? e(we)(e(t), e(V), h.widget.title, "other") : e(t)("report.editor.widget", { index: Z + 1 })), 1)
634
+ ]),
635
+ _: 2
636
+ }, 1032, ["content"]),
637
+ l[12] || (l[12] = b("div", { class: "grow" }, null, -1)),
638
+ a(fe, {
639
+ trigger: "click",
640
+ shift: !0,
641
+ "stop-click-propagation": !0
642
+ }, {
643
+ "menu-button": s(() => [
644
+ a(f, {
645
+ "append-icon": "more_vert",
646
+ variant: "tertiary"
647
+ })
648
+ ]),
649
+ default: s(() => [
650
+ (i(), S(L, null, Q(T, (H, ne) => a(ve, {
651
+ key: ne,
652
+ onClick: (Ne) => H.onClick(Z)
653
+ }, {
654
+ label: s(() => [
655
+ b("p", {
656
+ class: le(
657
+ H.variant === "destructive" ? " text-fm-color-system-error-300" : ""
658
+ )
659
+ }, P(H.label), 3)
660
+ ]),
661
+ _: 2
662
+ }, 1032, ["onClick"])), 64))
663
+ ]),
664
+ _: 2
665
+ }, 1024)
666
+ ]),
667
+ _: 2
668
+ }, 1024)
669
+ ]),
670
+ _: 1
671
+ }, 8, ["list"])
672
+ ]),
673
+ _: 1
674
+ })
675
+ ])
676
+ ]),
677
+ _: 1
678
+ }, 512)
679
+ ]),
680
+ _: 1
681
+ }, 8, ["model-value"]);
682
+ };
683
+ }
684
+ }), el = { class: "h-full w-full overflow-x-hidden" }, ll = { class: "flex flex-col bg-fm-color-neutral-white w-[400px]" }, tl = { class: "flex bg-fm-color-neutral-white w-[88px]" }, ol = {
685
+ key: 1,
686
+ class: "w-full overflow-y-auto"
687
+ }, al = {
688
+ key: 0,
689
+ class: "w-full grid grid-cols-12 gap-[24px] p-24"
690
+ }, nl = { key: 2 }, rl = {
691
+ key: 0,
692
+ class: "grid grid-cols-12 gap-[16px]"
693
+ }, il = {
694
+ key: 3,
695
+ class: "h-full w-full flex items-start justify-center bg-fm-color-neutral-white py-24",
696
+ style: { backgroundColor: "#F6F8FC" }
697
+ }, sl = {
698
+ key: 0,
699
+ class: "w-full grid grid-cols-12 gap-[24px] p-24"
700
+ }, ul = /* @__PURE__ */ G({
701
+ __name: "ReportEditorViewport",
702
+ props: /* @__PURE__ */ J({
703
+ hideConfiguration: { type: Boolean, required: !1, default: !1 },
704
+ previewWidth: { type: Number, required: !0 },
705
+ previewHeight: { type: Number, required: !0 },
706
+ previewScale: { type: Number, required: !0 }
707
+ }, {
708
+ modelValue: { required: !0, default: () => {
709
+ } },
710
+ modelModifiers: {}
711
+ }),
712
+ emits: /* @__PURE__ */ J(["hideConfiguration"], ["update:modelValue"]),
713
+ setup(F, { emit: u }) {
714
+ const { breakpoints: n } = ae(), r = j(F, "modelValue"), y = F, d = N(() => y.previewWidth > 0 && y.previewHeight > 0), w = N(() => n.value.sm || n.value.xs), m = u;
715
+ return (C, c) => {
716
+ const R = v("FmCircularProgress"), q = v("FmButton"), O = v("FmMenuDivider"), B = v("FmCard");
717
+ return i(), S("div", el, [
718
+ r.value ? (i(), S(L, { key: 1 }, [
719
+ d.value ? Y("", !0) : (i(), x(Re, {
720
+ key: 0,
721
+ "model-value": !y.hideConfiguration
722
+ }, {
723
+ right: s(() => [
724
+ b("div", ll, [
725
+ r.value ? (i(), x(xe, {
726
+ key: 0,
727
+ modelValue: r.value,
728
+ "onUpdate:modelValue": c[0] || (c[0] = (g) => r.value = g),
729
+ "hide-configuration": y.hideConfiguration,
730
+ onHideConfiguration: c[1] || (c[1] = (g) => m("hideConfiguration", g))
731
+ }, null, 8, ["modelValue", "hide-configuration"])) : Y("", !0)
732
+ ])
733
+ ]),
734
+ left: s(() => [
735
+ b("div", tl, [
736
+ a(q, {
737
+ variant: "secondary",
738
+ icon: "keyboard_double_arrow_right",
739
+ "border-color": e(X).ColorPrimary,
740
+ "text-color": e(X).ColorPrimary,
741
+ class: "m-24 my-16",
742
+ size: "md",
743
+ onClick: c[2] || (c[2] = (g) => m("hideConfiguration", !y.hideConfiguration))
744
+ }, null, 8, ["border-color", "text-color"])
745
+ ])
746
+ ]),
747
+ _: 1
748
+ }, 8, ["model-value"])),
749
+ a(O, {
750
+ vertical: "",
751
+ style: { margin: "0px" }
752
+ }),
753
+ !w.value && !d.value ? (i(), S("div", ol, [
754
+ r.value.tiles.length > 0 ? (i(), S("div", al, [
755
+ (i(!0), S(L, null, Q(r.value.tiles, (g, $) => (i(), x(ie, {
756
+ key: `${e(ee)()}_${$}`,
757
+ "model-value": g,
758
+ index: $,
759
+ "hide-export": !0
760
+ }, null, 8, ["model-value", "index"]))), 128))
761
+ ])) : (i(), x(se, { key: 1 }))
762
+ ])) : w.value && !d.value ? (i(), S("div", nl, [
763
+ a(B, { class: "px-5 pb-28" }, {
764
+ default: s(() => [
765
+ r.value.tiles.length > 0 ? (i(), S("div", rl, [
766
+ (i(!0), S(L, null, Q(r.value.tiles, (g, $) => (i(), x(ie, {
767
+ key: `${e(ee)()}_${$}`,
768
+ "model-value": g,
769
+ index: $,
770
+ "hide-export": !0
771
+ }, null, 8, ["model-value", "index"]))), 128))
772
+ ])) : (i(), x(se, { key: 1 }))
773
+ ]),
774
+ _: 1
775
+ }),
776
+ r.value ? (i(), x(xe, {
777
+ key: 0,
778
+ modelValue: r.value,
779
+ "onUpdate:modelValue": c[3] || (c[3] = (g) => r.value = g),
780
+ "hide-configuration": y.hideConfiguration,
781
+ onHideConfiguration: c[4] || (c[4] = (g) => {
782
+ m("hideConfiguration", g);
783
+ })
784
+ }, null, 8, ["modelValue", "hide-configuration"])) : Y("", !0)
785
+ ])) : (i(), S("div", il, [
786
+ b("div", {
787
+ style: me({
788
+ transformOrigin: "top center",
789
+ transform: `scale(${y.previewScale})`
790
+ })
791
+ }, [
792
+ b("div", {
793
+ class: "overflow-y-auto bg-white rounded-lg",
794
+ style: me({
795
+ width: y.previewWidth + "px",
796
+ height: y.previewHeight + "px"
797
+ })
798
+ }, [
799
+ r.value.tiles.length > 0 ? (i(), S("div", sl, [
800
+ (i(!0), S(L, null, Q(r.value.tiles, (g, $) => (i(), x(ie, {
801
+ key: `${e(ee)()}_${$}`,
802
+ "model-value": g,
803
+ index: $,
804
+ "hide-export": !0,
805
+ "custom-screen-width": y.previewWidth
806
+ }, null, 8, ["model-value", "index", "custom-screen-width"]))), 128))
807
+ ])) : (i(), x(se, { key: 1 }))
808
+ ], 4)
809
+ ], 4)
810
+ ]))
811
+ ], 64)) : (i(), x(R, { key: 0 }))
812
+ ]);
813
+ };
814
+ }
815
+ }), dl = { class: "flex items-center gap-4" }, ml = { class: "flex justify-center items-center gap-2 w-full" }, cl = { class: "flex gap-4" }, kl = /* @__PURE__ */ G({
816
+ __name: "ReportEditor",
817
+ setup(F) {
818
+ const u = Se(), n = $e(), r = Ve(), { promptLoader: y } = Ee(), { t: d } = te(), { currentReport: w, editingReport: m } = ce(r), { breakpoints: C } = ae(), c = N(() => {
819
+ var _;
820
+ return !((_ = m.value) != null && _.editable);
821
+ }), R = N(() => {
822
+ var _;
823
+ return ((_ = m.value) == null ? void 0 : _.name) ?? d("report.editor.newReport");
824
+ }), q = Oe(), { promptMessage: O } = Te(), B = W(!1);
825
+ async function g() {
826
+ if (!m.value || m.value.tiles.length === 0) {
827
+ q.open({ message: d("report.messages.noWidget"), type: "error" });
828
+ return;
829
+ }
830
+ const _ = c.value ? d("report.common.clone") : d("report.common.save");
831
+ if (await O({
832
+ title: `${d("report.messages.saveReport")}`,
833
+ message: d("report.messages.confirmAction", { action: _, name: R.value })
834
+ }))
835
+ try {
836
+ await y(async () => {
837
+ if (c.value) {
838
+ const l = JSON.parse(JSON.stringify(m.value));
839
+ l.editable = !0, l.id = "", l.name = `${l.name} ${d("report.common.duplicate")}`, await r.createOrUpdateReport(l);
840
+ } else
841
+ m.value && await r.createOrUpdateReport(m.value);
842
+ u.push({
843
+ name: "reportView",
844
+ query: n.query
845
+ });
846
+ });
847
+ } catch (l) {
848
+ console.log(l), q.open({
849
+ message: d("report.messages.failedToAction", { action: _ }),
850
+ type: "error"
851
+ });
852
+ }
853
+ }
854
+ async function $() {
855
+ var o;
856
+ if (!m.value) return;
857
+ await O({
858
+ title: d("report.common.report", 1),
859
+ message: d("report.editor.notSaved", { name: (o = m.value) == null ? void 0 : o.name })
860
+ }) && (m.value = JSON.parse(JSON.stringify(w.value)), u.back());
861
+ }
862
+ Ue(() => {
863
+ m.value || u.push({ name: "reports" });
864
+ });
865
+ const A = [
866
+ {
867
+ label: d("report.common.default"),
868
+ width: void 0,
869
+ height: void 0
870
+ },
871
+ {
872
+ label: d("report.editor.devices.desktop"),
873
+ width: 1920,
874
+ height: 1080
875
+ },
876
+ {
877
+ label: d("report.editor.devices.tablet"),
878
+ width: 820,
879
+ height: 1180
880
+ },
881
+ {
882
+ label: d("report.editor.devices.phone"),
883
+ width: 390,
884
+ height: 859
885
+ }
886
+ ], k = W(A[0]), p = W(!1), t = N(() => p.value ? Math.max(k.value.width || 0, k.value.height || 0) : Math.min(k.value.width || 0, k.value.height || 0)), V = N(() => p.value ? Math.min(k.value.width || 0, k.value.height || 0) : Math.max(k.value.width || 0, k.value.height || 0)), U = N(() => window.innerHeight - 72 - 56), D = N(() => {
887
+ if (!t.value) return 1;
888
+ let _ = (U.value - 48) / t.value, o = V.value * _;
889
+ return o > window.innerWidth && (_ = window.innerWidth / V.value, o = V.value * _), _ > 1 ? 1 : _;
890
+ });
891
+ function T(_) {
892
+ k.value = _;
893
+ }
894
+ function z() {
895
+ p.value = !p.value;
896
+ }
897
+ return (_, o) => {
898
+ const l = v("FmTooltip"), I = v("FmButton"), M = v("FmPageHead");
899
+ return i(), x(qe, null, {
900
+ default: s(() => [
901
+ a(M, {
902
+ actions: [
903
+ { label: e(d)("report.common.cancel"), value: "cancel", isPrimary: !1 },
904
+ { label: "Save Report", value: "save", isPrimary: !0, prependIcon: "download" }
905
+ ],
906
+ "onClick:action": o[0] || (o[0] = (f) => {
907
+ f === "cancel" && $(), f === "save" && g();
908
+ })
909
+ }, {
910
+ title: s(() => [
911
+ b("div", dl, [
912
+ a(l, {
913
+ content: R.value,
914
+ placement: "bottom"
915
+ }, {
916
+ default: s(() => [
917
+ b("p", {
918
+ class: le(`${e(C).sm || e(C).xs ? "hidden" : ""} text-ellipsis overflow-hidden text-nowrap fm-typo-en-title-md-600 w-[250px]`)
919
+ }, P(R.value), 3)
920
+ ]),
921
+ _: 1
922
+ }, 8, ["content"]),
923
+ b("div", ml, [
924
+ b("div", cl, [
925
+ (i(), S(L, null, Q(A, (f) => {
926
+ var E;
927
+ return a(I, {
928
+ key: f.label,
929
+ label: f.label,
930
+ variant: ((E = k.value) == null ? void 0 : E.label) === f.label ? "primary" : "secondary",
931
+ size: "md",
932
+ onClick: (oe) => T(f)
933
+ }, null, 8, ["label", "variant", "onClick"]);
934
+ }), 64))
935
+ ]),
936
+ a(I, {
937
+ icon: "screen_rotation",
938
+ variant: "tertiary",
939
+ size: "md",
940
+ class: "text-fm-color-typo-primary",
941
+ onClick: z
942
+ })
943
+ ])
944
+ ])
945
+ ]),
946
+ _: 1
947
+ }, 8, ["actions"]),
948
+ e(m) ? (i(), x(ul, {
949
+ key: 0,
950
+ modelValue: e(m),
951
+ "onUpdate:modelValue": o[1] || (o[1] = (f) => ke(m) ? m.value = f : null),
952
+ style: me({ height: U.value + "px" }),
953
+ class: le(e(C).lg || e(C).md ? "flex" : ""),
954
+ "hide-configuration": B.value,
955
+ "preview-width": V.value,
956
+ "preview-height": t.value,
957
+ "preview-scale": D.value,
958
+ onHideConfiguration: o[2] || (o[2] = (f) => B.value = f)
959
+ }, null, 8, ["modelValue", "style", "class", "hide-configuration", "preview-width", "preview-height", "preview-scale"])) : Y("", !0)
960
+ ]),
961
+ _: 1
962
+ });
963
+ };
964
+ }
965
+ });
966
+ export {
967
+ kl as default
968
+ };