@feedmepos/mf-report 5.19.19-beta.0 → 5.19.20

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