@feedmepos/mf-report 5.12.0 → 5.13.0-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 (29) hide show
  1. package/dist/{App-DwuW8zUX.js → App-Ct3yuLBM.js} +33 -33
  2. package/dist/{v4-YwtleMoY.js → BaseDialog.vue_vue_type_script_setup_true_lang-BVh9CBG8.js} +582 -508
  3. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-CgLjbbN6.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-DIO5R9yT.js} +2 -2
  4. package/dist/{Default.vue_vue_type_script_setup_true_lang-DwqjvaFk.js → Default.vue_vue_type_script_setup_true_lang-Dm_oN-5O.js} +2 -2
  5. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-EBVDgb_-.js → DynamicWidget.vue_vue_type_script_setup_true_lang-wpgkxZrA.js} +5 -5
  6. package/dist/{InsightView-B-ucnMqx.js → InsightView-DRwRR0H4.js} +5 -5
  7. package/dist/{Integration-BRgyDCRz.js → Integration-BLRYZdC-.js} +2 -2
  8. package/dist/{Integrations-DnfCNEU_.js → Integrations-Ca0Xbhk1.js} +3 -3
  9. package/dist/{Layout-Dd8UMqWh.js → Layout-C1VAizPU.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-DKoZ_qKe.js → MenuTab.vue_vue_type_script_setup_true_lang-BUhdTqWm.js} +27 -25
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-BkZmOyj6.js → NavigationTab.vue_vue_type_script_setup_true_lang-CyvrW5EA.js} +26 -27
  12. package/dist/{NoData.vue_vue_type_script_setup_true_lang-Gln3UbEF.js → NoData.vue_vue_type_script_setup_true_lang-DB3zDUVV.js} +1 -1
  13. package/dist/{OverviewView-fZ064EjC.js → OverviewView-CyMUY5vR.js} +5 -5
  14. package/dist/{Report-BCQvcNyE.js → Report-C5VE4kBy.js} +4 -4
  15. package/dist/ReportEditor-JeuV4I-i.js +1017 -0
  16. package/dist/{ReportView-DbD_wg7H.js → ReportView-Cdotft9j.js} +7 -7
  17. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-CJBY5CtV.js → SelectComponent.vue_vue_type_script_setup_true_lang-D_NmiN5U.js} +1 -1
  18. package/dist/{Setting-CZNRgVs2.js → Setting-T1QsZfb_.js} +4 -4
  19. package/dist/TileEditor-CjtPunhn.js +2735 -0
  20. package/dist/TransitionFade-lILBAWNM.js +2499 -0
  21. package/dist/app.js +23 -11
  22. package/dist/assets/{formatChartData.worker-qsKmK9pO.js → formatChartData.worker-CvTUNmfE.js} +2 -2
  23. package/dist/{helper-DgCafQmS.js → helper-D4-BWsJj.js} +1 -1
  24. package/dist/{vue-i18n-B1WI_h8l.js → vue-i18n-BMM8dWbV.js} +1 -1
  25. package/package.json +1 -1
  26. package/dist/BaseDialog.vue_vue_type_script_setup_true_lang-DTNiGKgd.js +0 -59
  27. package/dist/ReportEditor-NAPs19Fu.js +0 -972
  28. package/dist/TileEditor-C6Xs--mw.js +0 -3252
  29. package/dist/TransitionFade-BFqs60q_.js +0 -1980
@@ -1,972 +0,0 @@
1
- import { defineComponent as G, mergeModels as J, useModel as j, ref as R, computed as N, resolveComponent as v, createBlock as k, openBlock as i, withCtx as s, createElementVNode as h, createVNode as a, unref as e, normalizeClass as le, createTextVNode as de, toDisplayString as E, createElementBlock as S, Fragment as L, renderSlot as Ce, createCommentVNode as Y, watch as me, renderList as Q, resolveDynamicComponent as Be, isRef as ke, normalizeStyle as ce, onMounted as Ue } from "vue";
2
- import { W as We, i as De, S as he, d as ye, T as Re, _ as qe } from "./TransitionFade-BFqs60q_.js";
3
- import { D as K, c as Ie, C as we, a as Ve, b as Ee, v as ee } from "./v4-YwtleMoY.js";
4
- import { storeToRefs as ae } from "pinia";
5
- import { useRouter as Se, useRoute as $e } from "vue-router";
6
- import { useBreakpoints as ne, 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 ie, f as He } from "./vue-i18n-B1WI_h8l.js";
9
- import { _ as se } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-EBVDgb_-.js";
10
- import { _ as ue } from "./NoData.vue_vue_type_script_setup_true_lang-Gln3UbEF.js";
11
- import { r as _e } from "./i18n-Cif1I9J2.js";
12
- import { _ as Fe } from "./SelectComponent.vue_vue_type_script_setup_true_lang-CJBY5CtV.js";
13
- const Pe = /* @__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(x, { emit: d }) {
23
- const { t: n } = te(), { breakpoints: r } = ne(), w = j(x, "modelValue"), m = x, _ = d;
24
- function u() {
25
- _("update:isOpen", !1);
26
- }
27
- function V() {
28
- c.value && (w.value = c.value, c.value = void 0, _("update:isOpen", !1));
29
- }
30
- const c = R(), q = N(() => !c.value);
31
- return (I, T) => {
32
- const B = v("FmButton"), b = v("FmDialog");
33
- return i(), k(b, {
34
- "model-value": m.isOpen
35
- }, {
36
- "dialog-header": s(() => [
37
- de(E(e(n)("report.widget.type")), 1)
38
- ]),
39
- default: s(() => [
40
- a(We, {
41
- modelValue: c.value,
42
- "onUpdate:modelValue": T[0] || (T[0] = (O) => c.value = O),
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
- T[1] || (T[1] = h("div", { class: "grow" }, null, -1)),
49
- a(B, {
50
- label: e(n)("report.common.cancel"),
51
- variant: "tertiary",
52
- onClick: u
53
- }, null, 8, ["label"]),
54
- a(B, {
55
- label: e(n)("report.common.confirm"),
56
- disabled: q.value,
57
- onClick: V
58
- }, null, 8, ["label", "disabled"])
59
- ]),
60
- _: 1
61
- }, 8, ["model-value"]);
62
- };
63
- }
64
- }), ze = { 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(x) {
77
- const { t: d } = te(), n = j(x, "modelValue"), r = x;
78
- return (w, m) => {
79
- const _ = 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: m[0] || (m[0] = (u) => n.value = !n.value)
83
- }, [
84
- h("p", ze, E(e(d)("report.editor.customizeReport")), 1),
85
- m[1] || (m[1] = h("div", { class: "grow" }, null, -1)),
86
- a(_, {
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(x) {
100
- const d = j(x, "modelValue");
101
- return (n, r) => (i(), S(L, null, [
102
- a(pe, {
103
- modelValue: d.value,
104
- "onUpdate:modelValue": r[0] || (r[0] = (w) => d.value = w),
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(x) {
118
- const d = j(x, "modelValue");
119
- return (n, r) => {
120
- const w = v("FmTopSheet"), m = v("FmCard");
121
- return i(), k(m, { class: "fixed bottom-0 w-full" }, {
122
- default: s(() => [
123
- a(pe, {
124
- modelValue: d.value,
125
- "onUpdate:modelValue": r[0] || (r[0] = (_) => d.value = _),
126
- icon: "keyboard_double_arrow_up"
127
- }, null, 8, ["modelValue"]),
128
- a(w, {
129
- modelValue: d.value,
130
- "onUpdate:modelValue": r[2] || (r[2] = (_) => d.value = _),
131
- "fullscreen-size": "sm"
132
- }, {
133
- default: s(() => [
134
- a(pe, {
135
- modelValue: d.value,
136
- "onUpdate:modelValue": r[1] || (r[1] = (_) => d.value = _),
137
- icon: "keyboard_double_arrow_down"
138
- }, null, 8, ["modelValue"]),
139
- d.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(x) {
172
- const { t: d } = te(), n = j(x, "globalFilter"), r = j(x, "isOpen"), w = Oe(), m = x, _ = R(), u = R(), V = R(), c = R([]);
173
- me(r, (p) => {
174
- var l, C, U;
175
- p && (_.value = ((l = n.value) == null ? void 0 : l.label) || "", u.value = m.schemas.find(
176
- (W) => {
177
- var M;
178
- return W.name === ((M = n.value) == null ? void 0 : M.schemaName);
179
- }
180
- ), V.value = (C = I.value.find(
181
- (W) => {
182
- var M;
183
- return W.value.name === ((M = n.value) == null ? void 0 : M.name);
184
- }
185
- )) == null ? void 0 : C.value, c.value = ((U = n.value) == null ? void 0 : U.tileIds) || []);
186
- });
187
- const q = N(
188
- () => m.schemas.map((p) => ({
189
- label: p.label || p.name,
190
- value: p
191
- }))
192
- ), I = N(() => {
193
- var p;
194
- return (((p = u.value) == null ? void 0 : p.fields) || []).reduce(
195
- (l, C) => ([K.Bool, K.String, K.Timestamp].includes(C.type) && l.push({
196
- label: C.label || C.name,
197
- value: C
198
- }), l),
199
- []
200
- );
201
- }), T = N(() => m.tiles.reduce((p, l, C) => {
202
- var M, P;
203
- const U = l.widget.config.schemaNames ?? [], W = (l.widget.config.joinDatasources ?? []).flatMap(
204
- (F) => F.schemaNames ?? []
205
- );
206
- return [...U, ...W].includes(((M = u.value) == null ? void 0 : M.name) || "") && p.push({
207
- label: (P = l == null ? void 0 : l.widget.title) != null && P.trim() ? l.widget.title : `Widget ${C + 1}`,
208
- value: l.id
209
- }), p;
210
- }, []));
211
- function B(p) {
212
- var l;
213
- p.name !== ((l = u.value) == null ? void 0 : l.name) && (u.value = p, V.value = void 0);
214
- }
215
- function b(p) {
216
- V.value = p;
217
- }
218
- function O(p) {
219
- switch (p) {
220
- case K.Timestamp:
221
- return we.Between;
222
- case K.Bool:
223
- case K.String:
224
- return we.Equal;
225
- default:
226
- throw new Error(`Unsupported data type: ${p}`);
227
- }
228
- }
229
- function A() {
230
- if (!u.value) {
231
- w.open({ message: "Invalid schema", type: "error" });
232
- return;
233
- }
234
- V.value || w.open({ message: "Invalid dimension", type: "error" }), n.value = {
235
- schemaName: u.value.name,
236
- name: V.value.name,
237
- label: _.value || name,
238
- operator: O(V.value.type),
239
- option: V.value.type === K.Timestamp ? Ie.DateTime : null,
240
- tileIds: [...c.value],
241
- filters: []
242
- }, r.value = !1;
243
- }
244
- function $() {
245
- r.value = !1;
246
- }
247
- return (p, l) => {
248
- const C = v("FmTextField"), U = v("FmLabel"), W = v("FmCheckbox"), M = v("FmForm"), P = v("FmButton"), F = v("FmDialog");
249
- return i(), k(F, {
250
- modelValue: r.value,
251
- "onUpdate:modelValue": l[4] || (l[4] = (o) => r.value = o),
252
- overlay: !0,
253
- "z-index": 10
254
- }, {
255
- "dialog-header": s(() => [
256
- de(E(e(d)("report.section.filter.globalFilter")), 1)
257
- ]),
258
- default: s(() => [
259
- a(M, {
260
- ref: "form",
261
- class: "flex flex-col gap-2 w-[490px]"
262
- }, {
263
- default: s(() => [
264
- a(C, {
265
- modelValue: _.value,
266
- "onUpdate:modelValue": l[0] || (l[0] = (o) => _.value = o),
267
- placeholder: e(d)("report.section.filter.displayName"),
268
- label: e(d)("report.section.filter.displayName"),
269
- class: "mb-2"
270
- }, null, 8, ["modelValue", "placeholder", "label"]),
271
- a(Fe, {
272
- "model-value": u.value,
273
- items: q.value,
274
- placeholder: e(d)("report.section.schema.title"),
275
- label: e(d)("report.section.schema.title"),
276
- "onUpdate:modelValue": l[1] || (l[1] = (o) => B(o))
277
- }, null, 8, ["model-value", "items", "placeholder", "label"]),
278
- a(Fe, {
279
- "model-value": V.value,
280
- items: I.value,
281
- placeholder: e(d)("report.section.dimension.Dimension"),
282
- label: e(d)("report.section.dimension.Dimension"),
283
- "onUpdate:modelValue": l[2] || (l[2] = (o) => b(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
- de(E(e(d)("report.section.filter.applyWidget")), 1)
288
- ]),
289
- _: 1
290
- }),
291
- x.tiles.length > 0 ? (i(), S("div", je, [
292
- (i(!0), S(L, null, Q(T.value, (o) => (i(), k(W, {
293
- key: o.value,
294
- modelValue: c.value,
295
- "onUpdate:modelValue": l[3] || (l[3] = (t) => c.value = t),
296
- label: o.label,
297
- value: o.value
298
- }, null, 8, ["modelValue", "label", "value"]))), 128))
299
- ])) : (i(), k(U, {
300
- key: 1,
301
- class: "fm-typo-en-body-lg-400",
302
- label: e(d)("report.section.filter.noWidget")
303
- }, null, 8, ["label"]))
304
- ]),
305
- _: 1
306
- }, 512)
307
- ]),
308
- "dialog-footer": s(() => [
309
- l[5] || (l[5] = h("div", { class: "grow" }, null, -1)),
310
- a(P, {
311
- label: e(d)("report.common.cancel"),
312
- variant: "tertiary",
313
- onClick: $
314
- }, null, 8, ["label"]),
315
- a(P, {
316
- label: e(d)("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(x, { emit: d }) {
337
- const n = j(x, "modelValue"), { breakpoints: r } = ne(), w = x, m = d, _ = Se(), u = $e(), V = R(), {
338
- currentSelectWidgetType: c,
339
- categories: q,
340
- editingTile: I,
341
- editingTileIndex: T,
342
- editingGlobalFilter: B,
343
- editingGlobalFilterIndex: b
344
- } = ae(Ve()), { schemas: O } = ae(Ee()), { promptMessage: A } = Te(), $ = R(!1), p = R(!1), { t: l, te: C } = te(), U = R(void 0), W = N(() => {
345
- const o = n.value.tiles.flatMap((t) => {
346
- var g;
347
- const D = t.widget.config.schemaNames ?? [], f = ((g = t.widget.config.joinDatasources) == null ? void 0 : g.flatMap((H) => H.schemaNames ?? [])) ?? [];
348
- return [...D, ...f];
349
- });
350
- return [...new Set(o)].reduce((t, D) => {
351
- const f = O.value.find((g) => g.name === D);
352
- return f && t.push(f), t;
353
- }, []);
354
- });
355
- me(
356
- () => c.value,
357
- () => {
358
- c.value !== void 0 && (U.value = De(c.value), I.value = U.value, T.value = -1, _.push({
359
- name: "tileEditor",
360
- query: u.query
361
- }));
362
- },
363
- { immediate: !0 }
364
- ), me(
365
- () => n.value.tiles,
366
- (o) => {
367
- o.forEach((t) => {
368
- t.id || (t.id = ee());
369
- });
370
- },
371
- { immediate: !0, deep: !0 }
372
- );
373
- const M = [
374
- {
375
- label: l("report.common.edit"),
376
- selected: !1,
377
- variant: "tertiary",
378
- onClick: (o) => {
379
- T.value = o, I.value = JSON.parse(JSON.stringify(n.value.tiles[o])), _.push({
380
- name: "tileEditor",
381
- query: u.query
382
- });
383
- }
384
- },
385
- {
386
- label: l("report.common.duplicate"),
387
- selected: !1,
388
- variant: "tertiary",
389
- onClick: (o) => {
390
- const t = {
391
- ...JSON.parse(JSON.stringify(n.value.tiles[o])),
392
- id: ee()
393
- };
394
- n.value.tiles.push(t);
395
- }
396
- },
397
- {
398
- label: l("report.common.remove"),
399
- selected: !1,
400
- variant: "destructive",
401
- onClick: async (o) => {
402
- if (await A({
403
- title: l("report.editor.deleteWidget"),
404
- message: l("report.editor.deleteWidgetConfirm", {
405
- title: n.value.tiles[o].widget.title
406
- })
407
- })) {
408
- const D = n.value.tiles[o].id;
409
- n.value.tiles.splice(o, 1), n.value.globalFilters && n.value.globalFilters.forEach((f) => {
410
- var g;
411
- f.tileIds = (g = f.tileIds) == null ? void 0 : g.filter((H) => H !== D);
412
- });
413
- }
414
- }
415
- }
416
- ], P = [
417
- {
418
- label: l("report.common.edit"),
419
- selected: !1,
420
- variant: "tertiary",
421
- onClick: (o) => {
422
- var t;
423
- b.value = o, B.value = JSON.parse(JSON.stringify((t = n.value.globalFilters) == null ? void 0 : t[o])), $.value = !0;
424
- }
425
- },
426
- {
427
- label: l("report.common.remove"),
428
- selected: !1,
429
- variant: "destructive",
430
- onClick: async (o) => {
431
- var f, g;
432
- const t = (f = n.value.globalFilters) == null ? void 0 : f[o];
433
- if (!t) return;
434
- await A({
435
- title: l("report.editor.deleteWidget"),
436
- message: l("report.editor.deleteWidgetConfirm", {
437
- title: ie(t)
438
- })
439
- }) && ((g = n.value.globalFilters) == null || g.splice(o, 1));
440
- }
441
- }
442
- ], F = N(() => q.value.map((o) => ({
443
- label: l(`report.category.${o.name}`),
444
- value: o.id
445
- })));
446
- return (o, t) => {
447
- const D = v("FmTextField"), f = v("FmSelect"), g = v("FmButton"), H = v("FmIcon"), oe = v("FmTooltip"), ve = v("FmMenuItem"), fe = v("FmMenu"), ge = v("FmListItem"), be = v("FmList"), Me = v("FmForm");
448
- return i(), k(Be(e(r).lg || e(r).md ? Le : Je), {
449
- "model-value": w.hideConfiguration,
450
- "onUpdate:modelValue": t[8] || (t[8] = (y) => m("hideConfiguration", y))
451
- }, {
452
- default: s(() => [
453
- a(Ge, {
454
- "is-open": $.value,
455
- "onUpdate:isOpen": t[0] || (t[0] = (y) => $.value = y),
456
- "global-filter": e(B),
457
- tiles: n.value.tiles,
458
- schemas: W.value,
459
- "onUpdate:globalFilter": t[1] || (t[1] = (y) => {
460
- y && (n.value.globalFilters || (n.value.globalFilters = []), typeof e(b) == "number" && e(b) >= 0 ? n.value.globalFilters[e(b)] = y : n.value.globalFilters.push(y));
461
- })
462
- }, null, 8, ["is-open", "global-filter", "tiles", "schemas"]),
463
- a(Pe, {
464
- modelValue: e(c),
465
- "onUpdate:modelValue": t[2] || (t[2] = (y) => ke(c) ? c.value = y : null),
466
- "is-open": p.value,
467
- "onUpdate:isOpen": t[3] || (t[3] = (y) => p.value = y)
468
- }, null, 8, ["modelValue", "is-open"]),
469
- a(Me, {
470
- ref_key: "form",
471
- ref: V,
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
- h("p", null, E(e(l)("report.editor.reportInfo")), 1),
478
- t[9] || (t[9] = h("div", { class: "grow" }, null, -1))
479
- ]),
480
- content: s(() => [
481
- h("div", Ae, [
482
- a(D, {
483
- modelValue: n.value.name,
484
- "onUpdate:modelValue": t[4] || (t[4] = (y) => n.value.name = y),
485
- label: e(l)("report.editor.reportTitle"),
486
- placeholder: e(l)("report.editor.placeholder")
487
- }, null, 8, ["modelValue", "label", "placeholder"]),
488
- a(f, {
489
- modelValue: n.value.category,
490
- "onUpdate:modelValue": t[5] || (t[5] = (y) => n.value.category = y),
491
- label: e(l)("report.common.category"),
492
- items: F.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
- h("p", null, E(e(l)("report.section.filter.globalFilter")), 1),
504
- t[10] || (t[10] = h("div", { class: "grow" }, null, -1))
505
- ]),
506
- content: s(() => [
507
- h("div", Ke, [
508
- a(g, {
509
- label: e(l)("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: t[6] || (t[6] = () => {
516
- b.value = null, B.value = null, $.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: y, index: Z }) => [
528
- a(ge, { class: "!cursor-grab border rounded-md border-neutral-300" }, {
529
- default: s(() => [
530
- a(H, {
531
- name: "drag_handle",
532
- class: "handle"
533
- }),
534
- h("div", Qe, [
535
- a(oe, {
536
- "z-index": 99,
537
- content: e(ie)(y),
538
- class: "handle"
539
- }, {
540
- default: s(() => [
541
- h("p", Xe, E(e(ie)(y)), 1)
542
- ]),
543
- _: 2
544
- }, 1032, ["content"]),
545
- W.value.find(
546
- (z) => z.name === y.schemaName
547
- ) ? Y("", !0) : (i(), k(oe, {
548
- key: 0,
549
- content: "Missing schema",
550
- "z-index": 99
551
- }, {
552
- default: s(() => [
553
- a(H, {
554
- name: "warning",
555
- class: "text-fm-color-system-error-300"
556
- })
557
- ]),
558
- _: 1
559
- }))
560
- ]),
561
- t[11] || (t[11] = h("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(g, {
569
- "append-icon": "more_vert",
570
- variant: "tertiary"
571
- })
572
- ]),
573
- default: s(() => [
574
- (i(), S(L, null, Q(P, (z, re) => a(ve, {
575
- key: re,
576
- onClick: (Ne) => z.onClick(Z)
577
- }, {
578
- label: s(() => [
579
- h("p", {
580
- class: le(
581
- z.variant === "destructive" ? " text-fm-color-system-error-300" : ""
582
- )
583
- }, E(z.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
- h("div", Ye, [
604
- a(g, {
605
- label: e(l)("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: t[7] || (t[7] = (y) => 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: y, index: Z }) => [
622
- a(ge, { class: "!cursor-grab border rounded-md border-neutral-300" }, {
623
- default: s(() => [
624
- a(H, {
625
- name: "drag_handle",
626
- class: "handle"
627
- }),
628
- a(oe, {
629
- content: y.widget.title ? e(_e)(e(l), e(C), y.widget.title, "other") : e(l)("report.editor.widget", { index: Z + 1 }),
630
- class: "handle"
631
- }, {
632
- default: s(() => [
633
- h("p", Ze, E(y.widget.title ? e(_e)(e(l), e(C), y.widget.title, "other") : e(l)("report.editor.widget", { index: Z + 1 })), 1)
634
- ]),
635
- _: 2
636
- }, 1032, ["content"]),
637
- t[12] || (t[12] = h("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(g, {
645
- "append-icon": "more_vert",
646
- variant: "tertiary"
647
- })
648
- ]),
649
- default: s(() => [
650
- (i(), S(L, null, Q(M, (z, re) => a(ve, {
651
- key: re,
652
- onClick: (Ne) => z.onClick(Z)
653
- }, {
654
- label: s(() => [
655
- h("p", {
656
- class: le(
657
- z.variant === "destructive" ? " text-fm-color-system-error-300" : ""
658
- )
659
- }, E(z.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(x, { emit: d }) {
714
- const { breakpoints: n } = ne(), r = j(x, "modelValue"), w = x, m = N(() => w.previewWidth > 0 && w.previewHeight > 0), _ = N(() => n.value.sm || n.value.xs), u = d;
715
- return (V, c) => {
716
- const q = v("FmCircularProgress"), I = v("FmButton"), T = v("FmMenuDivider"), B = v("FmCard");
717
- return i(), S("div", el, [
718
- r.value ? (i(), S(L, { key: 1 }, [
719
- m.value ? Y("", !0) : (i(), k(Re, {
720
- key: 0,
721
- "model-value": !w.hideConfiguration
722
- }, {
723
- right: s(() => [
724
- h("div", ll, [
725
- r.value ? (i(), k(xe, {
726
- key: 0,
727
- modelValue: r.value,
728
- "onUpdate:modelValue": c[0] || (c[0] = (b) => r.value = b),
729
- "hide-configuration": w.hideConfiguration,
730
- onHideConfiguration: c[1] || (c[1] = (b) => u("hideConfiguration", b))
731
- }, null, 8, ["modelValue", "hide-configuration"])) : Y("", !0)
732
- ])
733
- ]),
734
- left: s(() => [
735
- h("div", tl, [
736
- a(I, {
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] = (b) => u("hideConfiguration", !w.hideConfiguration))
744
- }, null, 8, ["border-color", "text-color"])
745
- ])
746
- ]),
747
- _: 1
748
- }, 8, ["model-value"])),
749
- a(T, {
750
- vertical: "",
751
- style: { margin: "0px" }
752
- }),
753
- !_.value && !m.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, (b, O) => (i(), k(se, {
756
- key: `${e(ee)()}_${O}`,
757
- "model-value": b,
758
- index: O,
759
- "hide-export": !0
760
- }, null, 8, ["model-value", "index"]))), 128))
761
- ])) : (i(), k(ue, { key: 1 }))
762
- ])) : _.value && !m.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, (b, O) => (i(), k(se, {
767
- key: `${e(ee)()}_${O}`,
768
- "model-value": b,
769
- index: O,
770
- "hide-export": !0
771
- }, null, 8, ["model-value", "index"]))), 128))
772
- ])) : (i(), k(ue, { key: 1 }))
773
- ]),
774
- _: 1
775
- }),
776
- r.value ? (i(), k(xe, {
777
- key: 0,
778
- modelValue: r.value,
779
- "onUpdate:modelValue": c[3] || (c[3] = (b) => r.value = b),
780
- "hide-configuration": w.hideConfiguration,
781
- onHideConfiguration: c[4] || (c[4] = (b) => {
782
- u("hideConfiguration", b);
783
- })
784
- }, null, 8, ["modelValue", "hide-configuration"])) : Y("", !0)
785
- ])) : (i(), S("div", il, [
786
- h("div", {
787
- style: ce({
788
- transformOrigin: "top center",
789
- transform: `scale(${w.previewScale})`
790
- })
791
- }, [
792
- h("div", {
793
- class: "overflow-y-auto bg-white rounded-lg",
794
- style: ce({
795
- width: w.previewWidth + "px",
796
- height: w.previewHeight + "px"
797
- })
798
- }, [
799
- r.value.tiles.length > 0 ? (i(), S("div", sl, [
800
- (i(!0), S(L, null, Q(r.value.tiles, (b, O) => (i(), k(se, {
801
- key: `${e(ee)()}_${O}`,
802
- "model-value": b,
803
- index: O,
804
- "hide-export": !0,
805
- "custom-screen-width": w.previewWidth
806
- }, null, 8, ["model-value", "index", "custom-screen-width"]))), 128))
807
- ])) : (i(), k(ue, { key: 1 }))
808
- ], 4)
809
- ], 4)
810
- ]))
811
- ], 64)) : (i(), k(q, { 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(x) {
818
- const d = Se(), n = $e(), r = Ve(), { promptLoader: w } = He(), { t: m } = te(), { currentReport: _, editingReport: u } = ae(r), { breakpoints: V } = ne(), c = N(() => {
819
- var F;
820
- return !((F = u.value) != null && F.editable);
821
- }), q = N(() => {
822
- var F;
823
- return ((F = u.value) == null ? void 0 : F.name) ?? m("report.editor.newReport");
824
- }), I = Oe(), { promptMessage: T } = Te(), B = R(!1);
825
- async function b() {
826
- if (!u.value || u.value.tiles.length === 0) {
827
- I.open({ message: m("report.messages.noWidget"), type: "error" });
828
- return;
829
- }
830
- const { defaultChartWidth: F, defaultChartHeight: o } = ae(r);
831
- u.value.tiles.forEach((f) => {
832
- f.widget.config.chartWidth == null && (f.widget.config.chartWidth = F.value), f.widget.config.chartHeight == null && (f.widget.config.chartHeight = o.value);
833
- });
834
- const t = c.value ? m("report.common.clone") : m("report.common.save");
835
- if (await T({
836
- title: `${m("report.messages.saveReport")}`,
837
- message: m("report.messages.confirmAction", { action: t, name: q.value })
838
- }))
839
- try {
840
- await w(async () => {
841
- if (c.value) {
842
- const f = JSON.parse(JSON.stringify(u.value));
843
- f.editable = !0, f.id = "", f.name = `${f.name} ${m("report.common.duplicate")}`, await r.createOrUpdateReport(f);
844
- } else
845
- u.value && await r.createOrUpdateReport(u.value);
846
- d.push({
847
- name: "reportView",
848
- query: n.query
849
- });
850
- });
851
- } catch (f) {
852
- console.log(f), I.open({
853
- message: m("report.messages.failedToAction", { action: t }),
854
- type: "error"
855
- });
856
- }
857
- }
858
- async function O() {
859
- var o;
860
- if (!u.value) return;
861
- await T({
862
- title: m("report.common.report", 1),
863
- message: m("report.editor.notSaved", { name: (o = u.value) == null ? void 0 : o.name })
864
- }) && (u.value = JSON.parse(JSON.stringify(_.value)), d.back());
865
- }
866
- Ue(() => {
867
- u.value || d.push({ name: "reports" });
868
- });
869
- const A = [
870
- {
871
- label: m("report.common.default"),
872
- width: void 0,
873
- height: void 0
874
- },
875
- {
876
- label: m("report.editor.devices.desktop"),
877
- width: 1920,
878
- height: 1080
879
- },
880
- {
881
- label: m("report.editor.devices.tablet"),
882
- width: 820,
883
- height: 1180
884
- },
885
- {
886
- label: m("report.editor.devices.phone"),
887
- width: 390,
888
- height: 859
889
- }
890
- ], $ = R(A[0]), p = R(!1), l = N(() => p.value ? Math.max($.value.width || 0, $.value.height || 0) : Math.min($.value.width || 0, $.value.height || 0)), C = N(() => p.value ? Math.min($.value.width || 0, $.value.height || 0) : Math.max($.value.width || 0, $.value.height || 0)), U = N(() => window.innerHeight - 72 - 56), W = N(() => {
891
- if (!l.value) return 1;
892
- let F = (U.value - 48) / l.value, o = C.value * F;
893
- return o > window.innerWidth && (F = window.innerWidth / C.value, o = C.value * F), F > 1 ? 1 : F;
894
- });
895
- function M(F) {
896
- $.value = F;
897
- }
898
- function P() {
899
- p.value = !p.value;
900
- }
901
- return (F, o) => {
902
- const t = v("FmTooltip"), D = v("FmButton"), f = v("FmPageHead");
903
- return i(), k(qe, null, {
904
- default: s(() => [
905
- a(f, {
906
- actions: [
907
- { label: e(m)("report.common.cancel"), value: "cancel", isPrimary: !1 },
908
- { label: "Save Report", value: "save", isPrimary: !0, prependIcon: "download" }
909
- ],
910
- "onClick:action": o[0] || (o[0] = (g) => {
911
- g === "cancel" && O(), g === "save" && b();
912
- })
913
- }, {
914
- title: s(() => [
915
- h("div", dl, [
916
- a(t, {
917
- content: q.value,
918
- placement: "bottom"
919
- }, {
920
- default: s(() => [
921
- h("p", {
922
- class: le(`${e(V).sm || e(V).xs ? "hidden" : ""} text-ellipsis overflow-hidden text-nowrap fm-typo-en-title-md-600 w-[250px]`)
923
- }, E(q.value), 3)
924
- ]),
925
- _: 1
926
- }, 8, ["content"]),
927
- h("div", ml, [
928
- h("div", cl, [
929
- (i(), S(L, null, Q(A, (g) => {
930
- var H;
931
- return a(D, {
932
- key: g.label,
933
- label: g.label,
934
- variant: ((H = $.value) == null ? void 0 : H.label) === g.label ? "primary" : "secondary",
935
- size: "md",
936
- onClick: (oe) => M(g)
937
- }, null, 8, ["label", "variant", "onClick"]);
938
- }), 64))
939
- ]),
940
- a(D, {
941
- icon: "screen_rotation",
942
- variant: "tertiary",
943
- size: "md",
944
- class: "text-fm-color-typo-primary",
945
- onClick: P
946
- })
947
- ])
948
- ])
949
- ]),
950
- _: 1
951
- }, 8, ["actions"]),
952
- e(u) ? (i(), k(ul, {
953
- key: 0,
954
- modelValue: e(u),
955
- "onUpdate:modelValue": o[1] || (o[1] = (g) => ke(u) ? u.value = g : null),
956
- style: ce({ height: U.value + "px" }),
957
- class: le(e(V).lg || e(V).md ? "flex" : ""),
958
- "hide-configuration": B.value,
959
- "preview-width": C.value,
960
- "preview-height": l.value,
961
- "preview-scale": W.value,
962
- onHideConfiguration: o[2] || (o[2] = (g) => B.value = g)
963
- }, null, 8, ["modelValue", "style", "class", "hide-configuration", "preview-width", "preview-height", "preview-scale"])) : Y("", !0)
964
- ]),
965
- _: 1
966
- });
967
- };
968
- }
969
- });
970
- export {
971
- kl as default
972
- };