@feedmepos/mf-report 5.23.9 → 5.24.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 (25) hide show
  1. package/dist/{App-BZrJScUy.js → App-DE1HZR2p.js} +4 -4
  2. package/dist/{BaseDialog.vue_vue_type_script_setup_true_lang-pYe2bX3S.js → BaseDialog.vue_vue_type_script_setup_true_lang-V5kBhZ3b.js} +543 -536
  3. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-XYtSMlzj.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-BBMrcJ6r.js} +1 -1
  4. package/dist/{Default.vue_vue_type_script_setup_true_lang-cdffEExQ.js → Default.vue_vue_type_script_setup_true_lang-B1M6sgjg.js} +1 -1
  5. package/dist/{FilterSelector.vue_vue_type_script_setup_true_lang-DclkRCoN.js → FilterSelector.vue_vue_type_script_setup_true_lang-ClD-2rss.js} +176 -176
  6. package/dist/{InsightView-Tv1zwcZH.js → InsightView-B7YGZf2b.js} +4 -4
  7. package/dist/{Integration-IU2PWqnn.js → Integration-vaNIXd_Y.js} +3 -3
  8. package/dist/{Integrations-BWvWAEZY.js → Integrations-9w-afl9s.js} +2 -2
  9. package/dist/{Layout-B1evYsv9.js → Layout-bAkAniZN.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-BQPCJYFc.js → MenuTab.vue_vue_type_script_setup_true_lang-BNiMWyMp.js} +5 -5
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-BLvQUAWn.js → NavigationTab.vue_vue_type_script_setup_true_lang-CR__9-D-.js} +3 -3
  12. package/dist/{OverviewView-Cz66yY79.js → OverviewView-DnHBixM2.js} +4 -4
  13. package/dist/{Report-I1TVhc_5.js → Report--N_OsGdS.js} +3 -3
  14. package/dist/ReportEditor-AptQ2ino.js +1442 -0
  15. package/dist/{ReportView-T2ThdsZQ.js → ReportView-C03DK4_-.js} +6 -6
  16. package/dist/{Setting-BjVIDt8e.js → Setting-C_JDRaQF.js} +3 -3
  17. package/dist/{TileEditor-VPautwYN.js → TileEditor-CdaP3Cc3.js} +5 -5
  18. package/dist/{TransitionFade-BCxLswdT.js → TransitionFade-C-7SV4bk.js} +4 -4
  19. package/dist/{app-AWxvVekP.js → app-DRiGqxTd.js} +31 -15
  20. package/dist/app.js +1 -1
  21. package/dist/assets/{processTableData.worker-CC1ehXtr.js → formatChartData.worker-C3U_CcDO.js} +29 -29
  22. package/dist/assets/{formatChartData.worker-DkfLOO1x.js → processTableData.worker-D_oiIvNW.js} +29 -29
  23. package/dist/{useRestaurantPermission-C0aF3n_j.js → useRestaurantPermission-CCLVHSVa.js} +1 -1
  24. package/package.json +1 -1
  25. package/dist/ReportEditor-CHns80TI.js +0 -1406
@@ -1,1406 +0,0 @@
1
- import { defineComponent as he, mergeModels as be, useModel as ye, ref as R, computed as N, resolveComponent as h, createBlock as T, openBlock as r, withCtx as p, createElementVNode as y, createVNode as a, unref as t, normalizeClass as ke, createTextVNode as Le, toDisplayString as X, createElementBlock as C, Fragment as ee, renderSlot as Xe, createCommentVNode as A, watch as ge, renderList as ce, resolveDynamicComponent as sl, isRef as Ye, normalizeStyle as He, onMounted as ul } from "vue";
2
- import { W as ml, g as dl, _ as cl, a as pl, i as vl, S as Ae, d as Ge, T as fl, b as gl } from "./TransitionFade-BCxLswdT.js";
3
- import { C as fe, D as Q, b as Ve, u as Ze, a as bl, v as Oe } from "./BaseDialog.vue_vue_type_script_setup_true_lang-pYe2bX3S.js";
4
- import { storeToRefs as Re } from "pinia";
5
- import { useRouter as el, useRoute as ll } from "vue-router";
6
- import { useBreakpoints as Ie, useSnackbar as tl, FmButtonColorThemeVariant as xe } from "@feedmepos/ui-library";
7
- import { u as ol } from "./message-dialog-UoMWOnil.js";
8
- import { u as Ne, a as yl } from "./vue-i18n-DVWuTfed.js";
9
- import { r as $e } from "./i18n-CI_sQ5d_.js";
10
- import { g as hl, a as Ke, _ as ze } from "./FilterSelector.vue_vue_type_script_setup_true_lang-DclkRCoN.js";
11
- import { _ as Ee } from "./NoData.vue_vue_type_script_setup_true_lang-CDKHIlF2.js";
12
- import { a as Pe } from "./SelectComponent.vue_vue_type_script_setup_true_lang-Df40itH5.js";
13
- import { a as _l, i as Je } from "./app-AWxvVekP.js";
14
- import { useCoreStore as wl } from "@feedmepos/mf-common";
15
- const Fl = /* @__PURE__ */ he({
16
- __name: "WidgetDialog",
17
- props: /* @__PURE__ */ be({
18
- isOpen: { type: Boolean }
19
- }, {
20
- modelValue: {},
21
- modelModifiers: {}
22
- }),
23
- emits: /* @__PURE__ */ be(["update:isOpen"], ["update:modelValue"]),
24
- setup(M, { emit: n }) {
25
- const { t: i } = Ne(), { breakpoints: u } = Ie(), x = ye(M, "modelValue"), v = M, S = n;
26
- function z() {
27
- S("update:isOpen", !1);
28
- }
29
- function F() {
30
- s.value && (x.value = s.value, s.value = void 0, S("update:isOpen", !1));
31
- }
32
- const s = R(), B = N(() => !s.value);
33
- return (Y, D) => {
34
- const E = h("FmButton"), w = h("FmDialog");
35
- return r(), T(w, {
36
- "model-value": v.isOpen
37
- }, {
38
- "dialog-header": p(() => [
39
- Le(X(t(i)("report.widget.type")), 1)
40
- ]),
41
- default: p(() => [
42
- a(ml, {
43
- modelValue: s.value,
44
- "onUpdate:modelValue": D[0] || (D[0] = (V) => s.value = V),
45
- class: ke(`grid ${t(u).lg || t(u).md ? "grid-cols-3 gap-3" : "grid-cols-2 gap-3"}`),
46
- "child-class": "p-[8px] flex flex-col"
47
- }, null, 8, ["modelValue", "class"])
48
- ]),
49
- "dialog-footer": p(() => [
50
- D[1] || (D[1] = y("div", { class: "grow" }, null, -1)),
51
- a(E, {
52
- label: t(i)("report.common.cancel"),
53
- variant: "tertiary",
54
- onClick: z
55
- }, null, 8, ["label"]),
56
- a(E, {
57
- label: t(i)("report.common.confirm"),
58
- disabled: B.value,
59
- onClick: F
60
- }, null, 8, ["label", "disabled"])
61
- ]),
62
- _: 1
63
- }, 8, ["model-value"]);
64
- };
65
- }
66
- }), Vl = { class: "fm-typo-en-body-lg-600" }, je = /* @__PURE__ */ he({
67
- __name: "ReportEditorTabHeader",
68
- props: /* @__PURE__ */ be({
69
- icon: {
70
- type: String,
71
- required: !0
72
- }
73
- }, {
74
- modelValue: { type: Boolean, required: !0, default: !1 },
75
- modelModifiers: {}
76
- }),
77
- emits: ["update:modelValue"],
78
- setup(M) {
79
- const { t: n } = Ne(), i = ye(M, "modelValue"), u = M;
80
- return (x, v) => {
81
- const S = h("FmIcon");
82
- return r(), C("div", {
83
- class: "px-6 py-16 flex items-center gap-2 bg-fm-color-neutral-white border cursor-pointer",
84
- onClick: v[0] || (v[0] = (z) => i.value = !i.value)
85
- }, [
86
- y("p", Vl, X(t(n)("report.editor.customizeReport")), 1),
87
- v[1] || (v[1] = y("div", { class: "grow" }, null, -1)),
88
- a(S, {
89
- name: u.icon
90
- }, null, 8, ["name"])
91
- ]);
92
- };
93
- }
94
- }), xl = /* @__PURE__ */ he({
95
- __name: "ReportEditorTabDesktop",
96
- props: {
97
- modelValue: { required: !0, default: !1 },
98
- modelModifiers: {}
99
- },
100
- emits: ["update:modelValue"],
101
- setup(M) {
102
- const n = ye(M, "modelValue");
103
- return (i, u) => (r(), C(ee, null, [
104
- a(je, {
105
- modelValue: n.value,
106
- "onUpdate:modelValue": u[0] || (u[0] = (x) => n.value = x),
107
- icon: "keyboard_double_arrow_left"
108
- }, null, 8, ["modelValue"]),
109
- Xe(i.$slots, "default")
110
- ], 64));
111
- }
112
- }), kl = /* @__PURE__ */ he({
113
- __name: "ReportEditorTabMobile",
114
- props: {
115
- modelValue: { required: !0, default: !1 },
116
- modelModifiers: {}
117
- },
118
- emits: ["update:modelValue"],
119
- setup(M) {
120
- const n = ye(M, "modelValue");
121
- return (i, u) => {
122
- const x = h("FmTopSheet"), v = h("FmCard");
123
- return r(), T(v, { class: "fixed bottom-0 w-full" }, {
124
- default: p(() => [
125
- a(je, {
126
- modelValue: n.value,
127
- "onUpdate:modelValue": u[0] || (u[0] = (S) => n.value = S),
128
- icon: "keyboard_double_arrow_up"
129
- }, null, 8, ["modelValue"]),
130
- a(x, {
131
- modelValue: n.value,
132
- "onUpdate:modelValue": u[2] || (u[2] = (S) => n.value = S),
133
- "fullscreen-size": "sm"
134
- }, {
135
- default: p(() => [
136
- a(je, {
137
- modelValue: n.value,
138
- "onUpdate:modelValue": u[1] || (u[1] = (S) => n.value = S),
139
- icon: "keyboard_double_arrow_down"
140
- }, null, 8, ["modelValue"]),
141
- n.value ? Xe(i.$slots, "default", { key: 0 }) : A("", !0)
142
- ]),
143
- _: 3
144
- }, 8, ["modelValue"])
145
- ]),
146
- _: 3
147
- });
148
- };
149
- }
150
- }), Cl = {
151
- key: 2,
152
- class: "flex flex-col gap-3 mt-2 border border-neutral-300 p-3"
153
- }, Tl = { class: "grid grid-cols-1 gap-2 rounded-md border border-neutral-300 p-2 sm:grid-cols-[1.3fr_1fr_1fr_auto] sm:items-end" }, Sl = {
154
- key: 0,
155
- class: "flex justify-end sm:pb-[2px]"
156
- }, Ol = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, $l = { class: "pl-1" }, Nl = {
157
- key: 0,
158
- class: "flex justify-end sm:pb-[2px]"
159
- }, Ul = {
160
- key: 4,
161
- class: "flex flex-col gap-2"
162
- }, Ml = /* @__PURE__ */ he({
163
- __name: "GlobalFilterDialog",
164
- props: /* @__PURE__ */ be({
165
- schemas: {
166
- type: Array,
167
- default: () => []
168
- },
169
- tiles: {
170
- type: Array,
171
- required: !0
172
- }
173
- }, {
174
- globalFilter: {
175
- default: () => null
176
- },
177
- globalFilterModifiers: {},
178
- isOpen: { type: Boolean, default: () => !1, required: !0 },
179
- isOpenModifiers: {}
180
- }),
181
- emits: ["update:globalFilter", "update:isOpen"],
182
- setup(M) {
183
- const { t: n, te: i } = Ne(), u = ye(M, "globalFilter"), x = ye(M, "isOpen"), v = tl(), S = M, z = R(""), F = R(), s = R(), B = R(), Y = R([]), D = R([]), E = R(""), w = R(!1), V = R(!1), O = R([]), U = R([]), L = R(fe.Equal);
184
- function oe(l) {
185
- return JSON.parse(JSON.stringify(l));
186
- }
187
- function f(l, e) {
188
- return { hour: l, minute: e };
189
- }
190
- function le(l) {
191
- return l ? `${String(l.hour).padStart(2, "0")}:${String(l.minute).padStart(2, "0")}` : null;
192
- }
193
- function _e(l) {
194
- if (!l) return null;
195
- const [e, c] = l.split(":").map(Number);
196
- return Number.isNaN(e) || Number.isNaN(c) ? null : { hour: e, minute: c };
197
- }
198
- const Z = N(() => s.value ? !(s.value.type === Q.Timestamp && B.value === Ve.DateTime) : !1), G = N(
199
- () => {
200
- var l;
201
- return ((l = s.value) == null ? void 0 : l.type) === Q.Timestamp && B.value === Ve.TimeOfDay;
202
- }
203
- ), ie = N(() => {
204
- var l;
205
- return (((l = s.value) == null ? void 0 : l.filterOperators) ?? []).filter((e) => e !== fe.And && e !== fe.Or).map((e) => ({
206
- label: n(`report.section.comparisonOperator.${e}`),
207
- value: e
208
- }));
209
- });
210
- function se() {
211
- var e;
212
- const l = (e = ie.value[0]) == null ? void 0 : e.value;
213
- return l || (s.value ? ve(s.value.type, B.value ?? null) : fe.Equal);
214
- }
215
- function pe(l) {
216
- if (s.value)
217
- return hl({
218
- operator: l ?? se(),
219
- dataType: s.value.type,
220
- dimensionOption: s.value.type === Q.Timestamp ? B.value ?? null : null,
221
- t: n
222
- });
223
- }
224
- function $(l, e) {
225
- if (typeof (e == null ? void 0 : e.default) == "boolean" || l.length > 0 && l.every((b) => typeof b == "boolean")) {
226
- const b = l.reduce((k, W) => (typeof W == "boolean" && k.push(W), k), []);
227
- if (e)
228
- for (e.fixed && b.splice(e.count); b.length < e.count; )
229
- b.push(typeof e.default == "boolean" ? e.default : !1);
230
- return b;
231
- }
232
- const d = l.reduce((b, k) => (typeof k == "string" && b.push(k), b), []);
233
- if (e)
234
- for (e.fixed && d.splice(e.count); d.length < e.count; )
235
- d.push(typeof e.default == "string" ? e.default : "");
236
- return d;
237
- }
238
- function I(l = L.value) {
239
- const e = pe(l), c = $(
240
- e ? Array(e.count).fill(e.default) : [],
241
- e
242
- );
243
- return {
244
- label: "",
245
- operator: l,
246
- values: c
247
- };
248
- }
249
- function P() {
250
- return {
251
- name: "",
252
- startTime: f(0, 0),
253
- endTime: f(23, 59)
254
- };
255
- }
256
- function ae() {
257
- if (!(!Z.value || !V.value)) {
258
- if (G.value) {
259
- U.value.length === 0 && (U.value = [P()]);
260
- return;
261
- }
262
- O.value.length === 0 && (O.value = [I()]);
263
- }
264
- }
265
- function Ce() {
266
- var c, d, b;
267
- const l = oe(((c = u.value) == null ? void 0 : c.customOptions) ?? []), e = oe(((d = u.value) == null ? void 0 : d.customTimeRanges) ?? []);
268
- L.value = ((b = l[0]) == null ? void 0 : b.operator) ?? se(), V.value = l.length > 0 || e.length > 0, O.value = l, U.value = e, ae();
269
- }
270
- function J(l) {
271
- L.value = l, O.value = O.value.map((e, c) => {
272
- const d = O.value[c];
273
- if (!d)
274
- return I(l);
275
- const b = pe(l), k = $(
276
- Array.isArray(d.values) ? [...d.values] : [],
277
- b
278
- );
279
- return {
280
- ...d,
281
- operator: l,
282
- values: k
283
- };
284
- });
285
- }
286
- function m() {
287
- O.value = [...O.value, I()];
288
- }
289
- function o(l) {
290
- O.value.length <= 1 || (O.value = O.value.filter((e, c) => c !== l));
291
- }
292
- function K() {
293
- U.value = [...U.value, P()];
294
- }
295
- function q(l) {
296
- U.value.length <= 1 || (U.value = U.value.filter(
297
- (e, c) => c !== l
298
- ));
299
- }
300
- function H(l, e, c) {
301
- const d = U.value[l];
302
- d && (U.value[l] = {
303
- ...d,
304
- [e]: _e(c)
305
- });
306
- }
307
- function ne(l) {
308
- return l.length === 0 || l.some((e) => e == null || e === "");
309
- }
310
- function Fe() {
311
- if (!V.value) return !0;
312
- if (G.value) {
313
- const c = U.value.map((b) => b.name.trim()).filter(Boolean);
314
- return U.value.some(
315
- (b) => !b.name.trim() || !b.startTime || !b.endTime
316
- ) ? (v.open({
317
- message: n("report.section.filter.invalidCustomTimeRange"),
318
- type: "error"
319
- }), !1) : new Set(c).size !== c.length ? (v.open({
320
- message: n("report.section.filter.customTimeRangeNamesMustBeUnique"),
321
- type: "error"
322
- }), !1) : !0;
323
- }
324
- const l = O.value.map((c) => c.label.trim()).filter(Boolean);
325
- return O.value.some(
326
- (c) => !c.label.trim() || ne(c.values)
327
- ) ? (v.open({ message: n("report.section.filter.invalidCustomOption"), type: "error" }), !1) : new Set(l).size !== l.length ? (v.open({
328
- message: n("report.section.filter.customOptionLabelsMustBeUnique"),
329
- type: "error"
330
- }), !1) : !0;
331
- }
332
- ge(x, (l) => {
333
- var e, c, d, b, k, W, me;
334
- l && (z.value = ((e = u.value) == null ? void 0 : e.label) || "", F.value = S.schemas.find(
335
- (de) => {
336
- var j;
337
- return de.name === ((j = u.value) == null ? void 0 : j.schemaName);
338
- }
339
- ), s.value = (c = Te.value.find(
340
- (de) => {
341
- var j;
342
- return de.value.name === ((j = u.value) == null ? void 0 : j.name);
343
- }
344
- )) == null ? void 0 : c.value, B.value = (d = u.value) == null ? void 0 : d.option, Y.value = ((b = u.value) == null ? void 0 : b.tileIds) || [], D.value = ((k = u.value) == null ? void 0 : k.filters) || [], w.value = !!((W = u.value) != null && W.dataFormula), E.value = ((me = u.value) == null ? void 0 : me.dataFormula) || "", Ce());
345
- }), ge(V, (l) => {
346
- var e;
347
- l && (L.value = ((e = O.value[0]) == null ? void 0 : e.operator) ?? se(), ae());
348
- }), ge(Z, (l) => {
349
- if (!l) {
350
- V.value = !1, O.value = [], U.value = [];
351
- return;
352
- }
353
- ae();
354
- }), ge(G, () => {
355
- ae();
356
- }), ge(ie, (l) => {
357
- var c;
358
- const e = (c = l[0]) == null ? void 0 : c.value;
359
- e && (l.some((d) => d.value === L.value) || J(e));
360
- });
361
- const we = N(
362
- () => S.schemas.map((l) => ({
363
- label: l.label || l.name,
364
- value: l
365
- }))
366
- ), Te = N(() => {
367
- var l;
368
- return (((l = F.value) == null ? void 0 : l.fields) || []).filter((e) => e.type !== Q.Numeric).map((e) => ({
369
- label: e.label || e.name,
370
- value: e
371
- }));
372
- }), Ue = N(() => {
373
- var l;
374
- return ((l = s.value) == null ? void 0 : l.type) !== Q.Timestamp ? [] : dl(n);
375
- }), Me = N(() => S.tiles.reduce((l, e, c) => {
376
- var k, W;
377
- const d = e.widget.config.schemaNames ?? [], b = (e.widget.config.joinDatasources ?? []).flatMap(
378
- (me) => me.schemaNames ?? []
379
- );
380
- return [...d, ...b].includes(((k = F.value) == null ? void 0 : k.name) || "") && l.push({
381
- label: (W = e == null ? void 0 : e.widget.title) != null && W.trim() ? e.widget.title : `Widget ${c + 1}`,
382
- value: e.id
383
- }), l;
384
- }, [])), Be = N(
385
- () => S.schemas.flatMap(
386
- (l) => (l.fields ?? []).map((e) => ({
387
- ...e,
388
- labels: [
389
- $e(n, i, l.label, "schema"),
390
- $e(n, i, e.label || e.name, "other")
391
- ]
392
- }))
393
- )
394
- );
395
- function qe(l) {
396
- var e;
397
- l.name !== ((e = F.value) == null ? void 0 : e.name) && (F.value = l, s.value = void 0, L.value = fe.Equal, V.value = !1, O.value = [], U.value = []);
398
- }
399
- function _(l) {
400
- s.value = l, B.value = l.type === Q.Timestamp ? Ve.DateTime : void 0, L.value = se(), V.value = !1, O.value = [], U.value = [];
401
- }
402
- function ve(l, e) {
403
- switch (l) {
404
- case Q.Timestamp:
405
- return e === Ve.DateTime || e === Ve.TimeOfDay ? fe.Between : fe.Equal;
406
- case Q.Bool:
407
- case Q.String:
408
- case Q.Numeric:
409
- return fe.Equal;
410
- default:
411
- throw new Error(`Unsupported data type: ${l}`);
412
- }
413
- }
414
- function ue() {
415
- if (!F.value) {
416
- v.open({ message: n("report.section.filter.invalidSchema"), type: "error" });
417
- return;
418
- }
419
- if (!s.value) {
420
- v.open({ message: n("report.section.filter.invalidDimension"), type: "error" });
421
- return;
422
- }
423
- const l = D.value.filter((d) => d ? !we.value.some((k) => k.value.name === d.schemaName) : !0);
424
- if (l.length > 0) {
425
- const d = l.filter((k) => !!k).map((k) => k.schemaName), b = l.some((k) => !k) ? `, ${n("report.section.filter.unknownFilters")}` : "";
426
- v.open({
427
- message: n("report.section.filter.invalidFiltersSchemaNotFound", {
428
- schemas: d.join(", "),
429
- unknownFiltersSuffix: b
430
- }),
431
- type: "error"
432
- });
433
- return;
434
- }
435
- if (!Fe())
436
- return;
437
- const e = V.value && !G.value ? O.value.map((d) => ({
438
- label: d.label.trim(),
439
- operator: d.operator ?? se(),
440
- values: $(
441
- [...d.values],
442
- pe(d.operator)
443
- )
444
- })) : void 0, c = V.value && G.value ? U.value.map((d) => ({
445
- name: d.name.trim(),
446
- startTime: d.startTime,
447
- endTime: d.endTime
448
- })) : void 0;
449
- u.value = {
450
- schemaName: F.value.name,
451
- name: s.value.name,
452
- label: z.value,
453
- operator: ve(
454
- s.value.type,
455
- s.value.type === Q.Timestamp ? B.value ?? Ve.DateTime : null
456
- ),
457
- option: s.value.type === Q.Timestamp ? B.value : null,
458
- values: [],
459
- tileIds: [...Y.value],
460
- filters: oe(D.value),
461
- dataFormula: w.value ? E.value : void 0,
462
- customOptions: e,
463
- customTimeRanges: c
464
- }, x.value = !1;
465
- }
466
- function Se() {
467
- x.value = !1;
468
- }
469
- const We = N(() => {
470
- var l;
471
- return [
472
- (l = F.value) == null ? void 0 : l.name,
473
- ...D.value.map((e) => e.schemaName)
474
- ];
475
- });
476
- function al(l) {
477
- var k, W, me, de;
478
- const e = S.tiles.find((j) => j.id === l.value), c = ((W = (k = e == null ? void 0 : e.widget) == null ? void 0 : k.config) == null ? void 0 : W.schemaNames) ?? [], d = (((de = (me = e == null ? void 0 : e.widget) == null ? void 0 : me.config) == null ? void 0 : de.joinDatasources) ?? []).flatMap(
479
- (j) => j.schemaNames ?? []
480
- ), b = [...c, ...d];
481
- return We.value.filter((j) => !!j).some((j) => !b.includes(j));
482
- }
483
- return (l, e) => {
484
- const c = h("FmTextField"), d = h("FmSelect"), b = h("FmCheckbox"), k = h("FmTimePicker"), W = h("FmButton"), me = h("FmTextarea"), de = h("FmLabel"), j = h("FmIcon"), nl = h("FmTooltip"), rl = h("FmForm"), il = h("FmDialog");
485
- return r(), T(il, {
486
- modelValue: x.value,
487
- "onUpdate:modelValue": e[11] || (e[11] = (De) => x.value = De),
488
- overlay: !0,
489
- "z-index": 10
490
- }, {
491
- "dialog-header": p(() => [
492
- Le(X(t(n)("report.section.filter.globalFilter")), 1)
493
- ]),
494
- default: p(() => [
495
- a(rl, {
496
- ref: "form",
497
- class: "flex flex-col gap-2 w-[490px]"
498
- }, {
499
- default: p(() => {
500
- var De;
501
- return [
502
- a(c, {
503
- modelValue: z.value,
504
- "onUpdate:modelValue": e[0] || (e[0] = (g) => z.value = g),
505
- placeholder: t(n)("report.section.filter.displayName"),
506
- label: t(n)("report.section.filter.displayName"),
507
- class: "mb-2"
508
- }, null, 8, ["modelValue", "placeholder", "label"]),
509
- a(Pe, {
510
- "model-value": F.value,
511
- items: we.value,
512
- placeholder: t(n)("report.section.schema.title"),
513
- label: t(n)("report.section.schema.title"),
514
- "onUpdate:modelValue": e[1] || (e[1] = (g) => qe(g))
515
- }, null, 8, ["model-value", "items", "placeholder", "label"]),
516
- a(Pe, {
517
- "model-value": s.value,
518
- items: Te.value,
519
- placeholder: t(n)("report.section.dimension.title"),
520
- label: t(n)("report.section.dimension.title"),
521
- "onUpdate:modelValue": e[2] || (e[2] = (g) => _(g))
522
- }, null, 8, ["model-value", "items", "placeholder", "label"]),
523
- ((De = s.value) == null ? void 0 : De.type) === t(Q).Timestamp ? (r(), T(d, {
524
- key: 0,
525
- modelValue: B.value,
526
- "onUpdate:modelValue": e[3] || (e[3] = (g) => B.value = g),
527
- items: Ue.value,
528
- placeholder: t(n)("report.section.filter.timeFormatter"),
529
- label: t(n)("report.section.filter.timeFormatter")
530
- }, null, 8, ["modelValue", "items", "placeholder", "label"])) : A("", !0),
531
- Z.value ? (r(), T(b, {
532
- key: 1,
533
- modelValue: V.value,
534
- "onUpdate:modelValue": e[4] || (e[4] = (g) => V.value = g),
535
- label: t(n)("report.section.filter.customOptions"),
536
- value: !0
537
- }, null, 8, ["modelValue", "label"])) : A("", !0),
538
- Z.value && V.value ? (r(), C("div", Cl, [
539
- G.value ? (r(!0), C(ee, { key: 0 }, ce(U.value, (g, re) => (r(), C("div", {
540
- key: `custom-time-range-${re}`,
541
- class: "flex flex-col gap-2"
542
- }, [
543
- y("div", Tl, [
544
- a(c, {
545
- modelValue: g.name,
546
- "onUpdate:modelValue": (te) => g.name = te,
547
- label: t(n)("report.section.filter.label")
548
- }, null, 8, ["modelValue", "onUpdate:modelValue", "label"]),
549
- a(k, {
550
- "model-value": le(g.startTime),
551
- label: t(n)("report.date.startingTime"),
552
- "onUpdate:modelValue": (te) => H(re, "startTime", te)
553
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]),
554
- a(k, {
555
- "model-value": le(g.endTime),
556
- label: t(n)("report.date.endingTime"),
557
- "onUpdate:modelValue": (te) => H(re, "endTime", te)
558
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]),
559
- U.value.length > 1 ? (r(), C("div", Sl, [
560
- a(W, {
561
- icon: "delete",
562
- variant: "tertiary",
563
- onClick: (te) => q(re)
564
- }, null, 8, ["onClick"])
565
- ])) : A("", !0)
566
- ])
567
- ]))), 128)) : (r(), C(ee, { key: 1 }, [
568
- y("p", Ol, X(t(n)("report.section.filter.operator")), 1),
569
- ie.value.length > 0 ? (r(), T(Pe, {
570
- key: 0,
571
- "model-value": L.value,
572
- items: ie.value,
573
- placeholder: t(n)("report.section.filter.operator"),
574
- "onUpdate:modelValue": e[5] || (e[5] = (g) => J(g))
575
- }, null, 8, ["model-value", "items", "placeholder"])) : A("", !0),
576
- (r(!0), C(ee, null, ce(O.value, (g, re) => (r(), C("div", {
577
- key: `custom-option-${re}`,
578
- class: "flex flex-col gap-2"
579
- }, [
580
- y("div", {
581
- class: ke([
582
- "grid grid-cols-1 gap-2 p-2 sm:items-end text-fm-color-typo-primary fm-typo-en-body-lg-600 border-neutral-300 rounded-md border",
583
- "sm:grid-cols-[1fr_1.6fr_auto]"
584
- ])
585
- }, [
586
- y("span", $l, X(t(n)("report.section.filter.label")), 1),
587
- a(c, {
588
- modelValue: g.label,
589
- "onUpdate:modelValue": (te) => g.label = te
590
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
591
- (r(), T(cl, {
592
- key: `custom-option-value-${re}-${g.operator ?? ""}-${B.value ?? ""}`,
593
- modelValue: g.values,
594
- "onUpdate:modelValue": (te) => g.values = te,
595
- config: pe(g.operator),
596
- option: B.value
597
- }, null, 8, ["modelValue", "onUpdate:modelValue", "config", "option"])),
598
- O.value.length > 1 ? (r(), C("div", Nl, [
599
- a(W, {
600
- icon: "delete",
601
- variant: "tertiary",
602
- onClick: (te) => o(re)
603
- }, null, 8, ["onClick"])
604
- ])) : A("", !0)
605
- ])
606
- ]))), 128))
607
- ], 64)),
608
- a(W, {
609
- class: "w-full",
610
- variant: "primary",
611
- icon: "add",
612
- "icon-position": "prepend",
613
- onClick: e[6] || (e[6] = (g) => G.value ? K() : m())
614
- })
615
- ])) : A("", !0),
616
- a(b, {
617
- modelValue: w.value,
618
- "onUpdate:modelValue": e[7] || (e[7] = (g) => w.value = g),
619
- label: t(n)("report.section.filter.advance"),
620
- value: !0
621
- }, null, 8, ["modelValue", "label"]),
622
- w.value ? (r(), T(me, {
623
- key: 3,
624
- modelValue: E.value,
625
- "onUpdate:modelValue": e[8] || (e[8] = (g) => E.value = g),
626
- placeholder: t(n)("report.section.filter.dataFormula")
627
- }, null, 8, ["modelValue", "placeholder"])) : A("", !0),
628
- a(pl, {
629
- modelValue: D.value,
630
- "onUpdate:modelValue": e[9] || (e[9] = (g) => D.value = g),
631
- options: Be.value
632
- }, null, 8, ["modelValue", "options"]),
633
- a(de, { class: "mt-2 fm-typo-en-body-lg-600" }, {
634
- default: p(() => [
635
- Le(X(t(n)("report.section.filter.applyWidget")), 1)
636
- ]),
637
- _: 1
638
- }),
639
- M.tiles.length > 0 ? (r(), C("div", Ul, [
640
- (r(!0), C(ee, null, ce(Me.value, (g) => (r(), C("div", {
641
- key: g.value,
642
- class: "flex items-center"
643
- }, [
644
- a(b, {
645
- modelValue: Y.value,
646
- "onUpdate:modelValue": e[10] || (e[10] = (re) => Y.value = re),
647
- label: g.label,
648
- value: g.value
649
- }, null, 8, ["modelValue", "label", "value"]),
650
- al(g) ? (r(), T(nl, {
651
- key: 0,
652
- content: t(n)("report.section.filter.missingFilterSchema"),
653
- "z-index": 99,
654
- class: "ml-2"
655
- }, {
656
- default: p(() => [
657
- a(j, {
658
- name: "warning",
659
- class: "text-fm-color-system-error-300"
660
- })
661
- ]),
662
- _: 1
663
- }, 8, ["content"])) : A("", !0)
664
- ]))), 128))
665
- ])) : (r(), T(de, {
666
- key: 5,
667
- class: "fm-typo-en-body-lg-400",
668
- label: t(n)("report.section.filter.noWidget")
669
- }, null, 8, ["label"]))
670
- ];
671
- }),
672
- _: 1
673
- }, 512)
674
- ]),
675
- "dialog-footer": p(() => [
676
- e[12] || (e[12] = y("div", { class: "grow" }, null, -1)),
677
- a(W, {
678
- label: t(n)("report.common.cancel"),
679
- variant: "tertiary",
680
- onClick: Se
681
- }, null, 8, ["label"]),
682
- a(W, {
683
- label: t(n)("report.common.confirm"),
684
- onClick: ue
685
- }, null, 8, ["label"])
686
- ]),
687
- _: 1
688
- }, 8, ["modelValue"]);
689
- };
690
- }
691
- }), Bl = { class: "flex flex-col gap-24 top-0 bg-fm-color-neutral-white z-10" }, Dl = { class: "flex items-center gap-8" }, Rl = { class: "flex flex-col gap-24 top-0 bg-fm-color-neutral-white z-10" }, Il = { class: "flex items-center gap-1 max-w-[195px] w-[195px]" }, ql = { class: "line-clamp-2 overflow-hidden max-w-[195px] w-[195px]" }, Wl = { class: "flex flex-col gap-24" }, zl = { class: "line-clamp-2 overflow-hidden max-w-[195px] w-[195px]" }, Qe = /* @__PURE__ */ he({
692
- __name: "ReportEditorTab",
693
- props: /* @__PURE__ */ be({
694
- hideConfiguration: {
695
- type: Boolean,
696
- default: !1
697
- }
698
- }, {
699
- modelValue: { required: !0 },
700
- modelModifiers: {}
701
- }),
702
- emits: /* @__PURE__ */ be(["hideConfiguration"], ["update:modelValue"]),
703
- setup(M, { emit: n }) {
704
- const i = ye(M, "modelValue"), { breakpoints: u } = Ie(), x = M, v = n, S = el(), z = ll(), F = R(), {
705
- currentSelectWidgetType: s,
706
- categories: B,
707
- editingTile: Y,
708
- editingTileIndex: D,
709
- editingGlobalFilter: E,
710
- editingGlobalFilterIndex: w
711
- } = Re(Ze()), { schemas: V } = Re(bl()), { globalFilters: O } = Re(_l()), { promptMessage: U } = ol(), L = R(!1), oe = R(!1), { t: f, te: le, locale: _e } = Ne(), Z = R(void 0), G = N(() => {
712
- const m = i.value.tiles.flatMap((o) => {
713
- var H;
714
- const K = o.widget.config.schemaNames ?? [], q = ((H = o.widget.config.joinDatasources) == null ? void 0 : H.flatMap((ne) => ne.schemaNames ?? [])) ?? [];
715
- return [...K, ...q];
716
- });
717
- return [...new Set(m)].reduce((o, K) => {
718
- const q = V.value.find((H) => H.name === K);
719
- return q && o.push(q), o;
720
- }, []);
721
- });
722
- function ie(m) {
723
- if (!m) return "";
724
- const o = `report.widget.types.${m.toLowerCase()}`;
725
- return le(o) ? f(o) : $e(f, le, m, "other");
726
- }
727
- ge(
728
- () => s.value,
729
- () => {
730
- s.value !== void 0 && (Z.value = vl(s.value), Y.value = Z.value, D.value = -1, S.push({
731
- name: "tileEditor",
732
- query: z.query
733
- }));
734
- },
735
- { immediate: !0 }
736
- ), ge(
737
- () => i.value.tiles,
738
- (m) => {
739
- m.forEach((o) => {
740
- o.id || (o.id = Oe());
741
- });
742
- },
743
- { immediate: !0, deep: !0 }
744
- );
745
- const se = [
746
- {
747
- label: "report.common.edit",
748
- selected: !1,
749
- variant: "tertiary",
750
- onClick: (m) => {
751
- D.value = m, Y.value = JSON.parse(JSON.stringify(i.value.tiles[m])), S.push({
752
- name: "tileEditor",
753
- query: z.query
754
- });
755
- }
756
- },
757
- {
758
- label: "report.common.duplicate",
759
- selected: !1,
760
- variant: "tertiary",
761
- onClick: (m) => {
762
- const o = {
763
- ...JSON.parse(JSON.stringify(i.value.tiles[m])),
764
- id: Oe()
765
- };
766
- i.value.tiles.push(o);
767
- }
768
- },
769
- {
770
- label: "report.common.remove",
771
- selected: !1,
772
- variant: "destructive",
773
- onClick: async (m) => {
774
- if (await U({
775
- title: f("report.editor.deleteWidget"),
776
- message: f("report.editor.deleteWidgetConfirm", {
777
- title: i.value.tiles[m].widget.title
778
- })
779
- })) {
780
- const K = i.value.tiles[m].id;
781
- i.value.tiles.splice(m, 1), i.value.globalFilters && i.value.globalFilters.forEach((q) => {
782
- var H;
783
- q.tileIds = (H = q.tileIds) == null ? void 0 : H.filter((ne) => ne !== K);
784
- });
785
- }
786
- }
787
- }
788
- ], pe = [
789
- {
790
- label: "report.common.edit",
791
- selected: !1,
792
- variant: "tertiary",
793
- onClick: (m) => {
794
- var o;
795
- w.value = m, E.value = JSON.parse(JSON.stringify((o = i.value.globalFilters) == null ? void 0 : o[m])), L.value = !0;
796
- }
797
- },
798
- {
799
- label: "report.common.duplicate",
800
- selected: !1,
801
- variant: "tertiary",
802
- onClick: (m) => {
803
- var q;
804
- const o = (q = i.value.globalFilters) == null ? void 0 : q[m];
805
- if (!o) return;
806
- const K = JSON.parse(JSON.stringify(o));
807
- i.value.globalFilters || (i.value.globalFilters = []), i.value.globalFilters.push(K);
808
- }
809
- },
810
- {
811
- label: "report.common.remove",
812
- selected: !1,
813
- variant: "destructive",
814
- onClick: async (m) => {
815
- var q, H;
816
- const o = (q = i.value.globalFilters) == null ? void 0 : q[m];
817
- if (!o) return;
818
- await U({
819
- title: f("report.editor.deleteWidget"),
820
- message: f("report.editor.deleteWidgetConfirm", {
821
- title: Je(o)
822
- })
823
- }) && ((H = i.value.globalFilters) == null || H.splice(m, 1));
824
- }
825
- }
826
- ], $ = N(() => B.value.map((m) => ({
827
- label: f(`report.category.${m.name}`),
828
- value: m.id
829
- }))), { sessionUser: I } = wl(), P = N({
830
- get: () => i.value.queryVersion === "v2",
831
- set: (m) => {
832
- i.value.queryVersion = m ? "v2" : "v1";
833
- }
834
- }), ae = N({
835
- get: () => $e(f, le, i.value.name, "other"),
836
- set: (m) => {
837
- i.value.name = m;
838
- }
839
- });
840
- function Ce(m) {
841
- var o;
842
- return !((o = m.tileIds) != null && o.length);
843
- }
844
- function J(m) {
845
- return !G.value.find((o) => o.name === m.schemaName);
846
- }
847
- return ge(
848
- () => i.value.globalFilters,
849
- (m) => {
850
- O.value = JSON.parse(JSON.stringify(m || []));
851
- },
852
- { deep: !0, immediate: !0 }
853
- ), (m, o) => {
854
- const K = h("FmTextField"), q = h("FmSelect"), H = h("FmSwitch"), ne = h("FmButton"), Fe = h("FmIcon"), we = h("FmTooltip"), Te = h("FmMenuItem"), Ue = h("FmMenu"), Me = h("FmListItem"), Be = h("FmList"), qe = h("FmForm");
855
- return r(), T(sl(t(u).lg || t(u).md ? xl : kl), {
856
- "model-value": x.hideConfiguration,
857
- "onUpdate:modelValue": o[10] || (o[10] = (_) => v("hideConfiguration", _))
858
- }, {
859
- default: p(() => [
860
- a(Ml, {
861
- "is-open": L.value,
862
- "onUpdate:isOpen": o[0] || (o[0] = (_) => L.value = _),
863
- "global-filter": t(E),
864
- tiles: i.value.tiles,
865
- schemas: G.value,
866
- "onUpdate:globalFilter": o[1] || (o[1] = (_) => {
867
- _ && (i.value.globalFilters || (i.value.globalFilters = []), typeof t(w) == "number" && t(w) >= 0 ? i.value.globalFilters[t(w)] = _ : i.value.globalFilters.push(_));
868
- })
869
- }, null, 8, ["is-open", "global-filter", "tiles", "schemas"]),
870
- a(Fl, {
871
- modelValue: t(s),
872
- "onUpdate:modelValue": o[2] || (o[2] = (_) => Ye(s) ? s.value = _ : null),
873
- "is-open": oe.value,
874
- "onUpdate:isOpen": o[3] || (o[3] = (_) => oe.value = _)
875
- }, null, 8, ["modelValue", "is-open"]),
876
- a(qe, {
877
- ref_key: "form",
878
- ref: F,
879
- class: "px-6 py-16 flex flex-col gap-24 overflow-y-auto overflow-x-hidden"
880
- }, {
881
- default: p(() => [
882
- a(Ae, { class: "border-solid" }, {
883
- header: p(() => [
884
- y("p", null, X(t(f)("report.editor.reportInfo")), 1),
885
- o[11] || (o[11] = y("div", { class: "grow" }, null, -1))
886
- ]),
887
- content: p(() => [
888
- y("div", Bl, [
889
- a(K, {
890
- modelValue: ae.value,
891
- "onUpdate:modelValue": o[4] || (o[4] = (_) => ae.value = _),
892
- label: t(f)("report.common.name"),
893
- placeholder: t(f)("report.common.name")
894
- }, null, 8, ["modelValue", "label", "placeholder"]),
895
- (r(), T(q, {
896
- modelValue: i.value.category,
897
- "onUpdate:modelValue": o[5] || (o[5] = (_) => i.value.category = _),
898
- label: t(f)("report.common.category"),
899
- items: $.value,
900
- key: `category-${t(_e)}`
901
- }, null, 8, ["modelValue", "label", "items"])),
902
- a(K, {
903
- modelValue: i.value.description,
904
- "onUpdate:modelValue": o[6] || (o[6] = (_) => i.value.description = _),
905
- label: t(f)("report.common.description"),
906
- placeholder: t(f)("report.common.description")
907
- }, null, 8, ["modelValue", "label", "placeholder"]),
908
- y("div", Dl, [
909
- o[12] || (o[12] = y("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, "V2", -1)),
910
- a(H, {
911
- modelValue: P.value,
912
- "onUpdate:modelValue": o[7] || (o[7] = (_) => P.value = _)
913
- }, null, 8, ["modelValue"])
914
- ])
915
- ])
916
- ]),
917
- _: 1
918
- }),
919
- a(Ae, {
920
- class: "border-solid",
921
- "is-open": !1
922
- }, {
923
- header: p(() => [
924
- y("p", null, X(t(f)("report.section.filter.globalFilter")), 1),
925
- o[13] || (o[13] = y("div", { class: "grow" }, null, -1))
926
- ]),
927
- content: p(() => [
928
- y("div", Rl, [
929
- a(ne, {
930
- label: t(f)("report.section.filter.addGlobalFilter"),
931
- variant: "secondary",
932
- icon: "add",
933
- "icon-position": "prepend",
934
- "border-color": t(xe).ColorPrimary,
935
- "text-color": t(xe).ColorPrimary,
936
- onClick: o[8] || (o[8] = () => {
937
- w.value = null, E.value = null, L.value = !0;
938
- })
939
- }, null, 8, ["label", "border-color", "text-color"]),
940
- a(Be, null, {
941
- default: p(() => [
942
- a(t(Ge), {
943
- list: i.value.globalFilters,
944
- "item-key": "`${element.schemaName}-${element.name}`",
945
- class: "flex flex-col gap-2 cursor-grab",
946
- handle: ".handle"
947
- }, {
948
- item: p(({ element: _, index: ve }) => [
949
- a(Me, { class: "!cursor-grab border rounded-md border-neutral-300" }, {
950
- default: p(() => [
951
- a(Fe, {
952
- name: "drag_handle",
953
- class: "handle"
954
- }),
955
- y("div", Il, [
956
- a(we, {
957
- "z-index": 99,
958
- content: t(Je)(_),
959
- class: "handle"
960
- }, {
961
- default: p(() => [
962
- y("p", ql, X(t(Je)(_)), 1)
963
- ]),
964
- _: 2
965
- }, 1032, ["content"]),
966
- J(_) ? (r(), T(we, {
967
- key: 0,
968
- content: t(f)("report.section.filter.missingSchema"),
969
- "z-index": 99
970
- }, {
971
- default: p(() => [
972
- a(Fe, {
973
- name: "warning",
974
- class: "text-fm-color-system-error-300"
975
- })
976
- ]),
977
- _: 1
978
- }, 8, ["content"])) : Ce(_) ? (r(), T(we, {
979
- key: 1,
980
- content: t(f)("report.section.filter.missingTileIds"),
981
- "z-index": 99
982
- }, {
983
- default: p(() => [
984
- a(Fe, {
985
- name: "warning",
986
- class: "text-fm-color-system-warning-300"
987
- })
988
- ]),
989
- _: 1
990
- }, 8, ["content"])) : A("", !0)
991
- ]),
992
- o[14] || (o[14] = y("div", { class: "grow" }, null, -1)),
993
- a(Ue, {
994
- trigger: "click",
995
- shift: !0,
996
- "stop-click-propagation": !0
997
- }, {
998
- "menu-button": p(() => [
999
- a(ne, {
1000
- "append-icon": "more_vert",
1001
- variant: "tertiary"
1002
- })
1003
- ]),
1004
- default: p(() => [
1005
- (r(), C(ee, null, ce(pe, (ue, Se) => a(Te, {
1006
- key: Se,
1007
- onClick: (We) => ue.onClick(ve)
1008
- }, {
1009
- label: p(() => [
1010
- y("p", {
1011
- class: ke(
1012
- ue.variant === "destructive" ? " text-fm-color-system-error-300" : ""
1013
- )
1014
- }, X(t(f)(ue.label)), 3)
1015
- ]),
1016
- _: 2
1017
- }, 1032, ["onClick"])), 64))
1018
- ]),
1019
- _: 2
1020
- }, 1024)
1021
- ]),
1022
- _: 2
1023
- }, 1024)
1024
- ]),
1025
- _: 1
1026
- }, 8, ["list"])
1027
- ]),
1028
- _: 1
1029
- })
1030
- ])
1031
- ]),
1032
- _: 1
1033
- }),
1034
- y("div", Wl, [
1035
- a(ne, {
1036
- label: t(f)("report.editor.addWidget"),
1037
- variant: "secondary",
1038
- icon: "add",
1039
- "icon-position": "prepend",
1040
- "border-color": t(xe).ColorPrimary,
1041
- "text-color": t(xe).ColorPrimary,
1042
- onClick: o[9] || (o[9] = (_) => oe.value = !0)
1043
- }, null, 8, ["label", "border-color", "text-color"]),
1044
- a(Be, null, {
1045
- default: p(() => [
1046
- a(t(Ge), {
1047
- list: i.value.tiles,
1048
- "item-key": "id",
1049
- class: "flex flex-col gap-2 cursor-grab",
1050
- handle: ".handle"
1051
- }, {
1052
- item: p(({ element: _, index: ve }) => [
1053
- a(Me, { class: "!cursor-grab border rounded-md border-neutral-300" }, {
1054
- default: p(() => [
1055
- a(Fe, {
1056
- name: "drag_handle",
1057
- class: "handle"
1058
- }),
1059
- a(we, {
1060
- content: _.widget.title ? ie(_.widget.title) : t(f)("report.editor.widget", { index: ve + 1 }),
1061
- class: "handle"
1062
- }, {
1063
- default: p(() => [
1064
- y("p", zl, X(_.widget.title ? ie(_.widget.title) : t(f)("report.editor.widget", { index: ve + 1 })), 1)
1065
- ]),
1066
- _: 2
1067
- }, 1032, ["content"]),
1068
- o[15] || (o[15] = y("div", { class: "grow" }, null, -1)),
1069
- a(Ue, {
1070
- trigger: "click",
1071
- shift: !0,
1072
- "stop-click-propagation": !0
1073
- }, {
1074
- "menu-button": p(() => [
1075
- a(ne, {
1076
- "append-icon": "more_vert",
1077
- variant: "tertiary"
1078
- })
1079
- ]),
1080
- default: p(() => [
1081
- (r(), C(ee, null, ce(se, (ue, Se) => a(Te, {
1082
- key: Se,
1083
- onClick: (We) => ue.onClick(ve)
1084
- }, {
1085
- label: p(() => [
1086
- y("p", {
1087
- class: ke(
1088
- ue.variant === "destructive" ? " text-fm-color-system-error-300" : ""
1089
- )
1090
- }, X(t(f)(ue.label)), 3)
1091
- ]),
1092
- _: 2
1093
- }, 1032, ["onClick"])), 64))
1094
- ]),
1095
- _: 2
1096
- }, 1024)
1097
- ]),
1098
- _: 2
1099
- }, 1024)
1100
- ]),
1101
- _: 1
1102
- }, 8, ["list"])
1103
- ]),
1104
- _: 1
1105
- })
1106
- ])
1107
- ]),
1108
- _: 1
1109
- }, 512)
1110
- ]),
1111
- _: 1
1112
- }, 8, ["model-value"]);
1113
- };
1114
- }
1115
- }), El = { class: "h-full w-full overflow-x-hidden" }, Pl = { class: "flex flex-col bg-fm-color-neutral-white w-[400px]" }, Jl = { class: "flex bg-fm-color-neutral-white w-[88px]" }, Ll = {
1116
- key: 1,
1117
- class: "w-full overflow-y-auto"
1118
- }, Hl = {
1119
- key: 0,
1120
- class: "w-full grid grid-cols-12 gap-[24px] p-24"
1121
- }, jl = { class: "col-span-12 mb-4 flex flex-wrap gap-2 pb-2" }, Al = { key: 2 }, Gl = {
1122
- key: 0,
1123
- class: "grid grid-cols-12 gap-[16px]"
1124
- }, Kl = { class: "col-span-12 mb-4 flex flex-wrap gap-2 pb-2" }, Ql = {
1125
- key: 3,
1126
- class: "h-full w-full flex items-start justify-center bg-fm-color-neutral-white py-24",
1127
- style: { backgroundColor: "#F6F8FC" }
1128
- }, Xl = {
1129
- key: 0,
1130
- class: "w-full grid grid-cols-12 gap-[24px] p-24"
1131
- }, Yl = /* @__PURE__ */ he({
1132
- __name: "ReportEditorViewport",
1133
- props: /* @__PURE__ */ be({
1134
- hideConfiguration: { type: Boolean, required: !1, default: !1 },
1135
- previewWidth: { type: Number, required: !0 },
1136
- previewHeight: { type: Number, required: !0 },
1137
- previewScale: { type: Number, required: !0 }
1138
- }, {
1139
- modelValue: { required: !0, default: () => {
1140
- } },
1141
- modelModifiers: {}
1142
- }),
1143
- emits: /* @__PURE__ */ be(["hideConfiguration"], ["update:modelValue"]),
1144
- setup(M, { emit: n }) {
1145
- const { breakpoints: i } = Ie(), u = ye(M, "modelValue"), x = M, v = N(() => x.previewWidth > 0 && x.previewHeight > 0), S = N(() => i.value.sm || i.value.xs), z = n;
1146
- return (F, s) => {
1147
- const B = h("FmCircularProgress"), Y = h("FmButton"), D = h("FmMenuDivider"), E = h("FmCard");
1148
- return r(), C("div", El, [
1149
- u.value ? (r(), C(ee, { key: 1 }, [
1150
- v.value ? A("", !0) : (r(), T(fl, {
1151
- key: 0,
1152
- "model-value": !x.hideConfiguration
1153
- }, {
1154
- right: p(() => [
1155
- y("div", Pl, [
1156
- u.value ? (r(), T(Qe, {
1157
- key: 0,
1158
- modelValue: u.value,
1159
- "onUpdate:modelValue": s[0] || (s[0] = (w) => u.value = w),
1160
- "hide-configuration": x.hideConfiguration,
1161
- onHideConfiguration: s[1] || (s[1] = (w) => z("hideConfiguration", w))
1162
- }, null, 8, ["modelValue", "hide-configuration"])) : A("", !0)
1163
- ])
1164
- ]),
1165
- left: p(() => [
1166
- y("div", Jl, [
1167
- a(Y, {
1168
- variant: "secondary",
1169
- icon: "keyboard_double_arrow_right",
1170
- "border-color": t(xe).ColorPrimary,
1171
- "text-color": t(xe).ColorPrimary,
1172
- class: "m-24 my-16",
1173
- size: "md",
1174
- onClick: s[2] || (s[2] = (w) => z("hideConfiguration", !x.hideConfiguration))
1175
- }, null, 8, ["border-color", "text-color"])
1176
- ])
1177
- ]),
1178
- _: 1
1179
- }, 8, ["model-value"])),
1180
- a(D, {
1181
- vertical: "",
1182
- style: { margin: "0px" }
1183
- }),
1184
- !S.value && !v.value ? (r(), C("div", Ll, [
1185
- u.value.tiles.length > 0 ? (r(), C("div", Hl, [
1186
- y("div", jl, [
1187
- a(Ke)
1188
- ]),
1189
- (r(!0), C(ee, null, ce(u.value.tiles, (w, V) => (r(), T(ze, {
1190
- key: `${t(Oe)()}_${V}`,
1191
- "model-value": w,
1192
- index: V,
1193
- "hide-export": !0
1194
- }, null, 8, ["model-value", "index"]))), 128))
1195
- ])) : (r(), T(Ee, { key: 1 }))
1196
- ])) : S.value && !v.value ? (r(), C("div", Al, [
1197
- a(E, { class: "px-5 pb-28" }, {
1198
- default: p(() => [
1199
- u.value.tiles.length > 0 ? (r(), C("div", Gl, [
1200
- y("div", Kl, [
1201
- a(Ke)
1202
- ]),
1203
- (r(!0), C(ee, null, ce(u.value.tiles, (w, V) => (r(), T(ze, {
1204
- key: `${t(Oe)()}_${V}`,
1205
- "model-value": w,
1206
- index: V,
1207
- "hide-export": !0
1208
- }, null, 8, ["model-value", "index"]))), 128))
1209
- ])) : (r(), T(Ee, { key: 1 }))
1210
- ]),
1211
- _: 1
1212
- }),
1213
- u.value ? (r(), T(Qe, {
1214
- key: 0,
1215
- modelValue: u.value,
1216
- "onUpdate:modelValue": s[3] || (s[3] = (w) => u.value = w),
1217
- "hide-configuration": x.hideConfiguration,
1218
- onHideConfiguration: s[4] || (s[4] = (w) => {
1219
- z("hideConfiguration", w);
1220
- })
1221
- }, null, 8, ["modelValue", "hide-configuration"])) : A("", !0)
1222
- ])) : (r(), C("div", Ql, [
1223
- y("div", {
1224
- style: He({
1225
- transformOrigin: "top center",
1226
- transform: `scale(${x.previewScale})`
1227
- })
1228
- }, [
1229
- y("div", {
1230
- class: "overflow-y-auto bg-white rounded-lg",
1231
- style: He({
1232
- width: x.previewWidth + "px",
1233
- height: x.previewHeight + "px"
1234
- })
1235
- }, [
1236
- u.value.tiles.length > 0 ? (r(), C("div", Xl, [
1237
- (r(!0), C(ee, null, ce(u.value.tiles, (w, V) => (r(), T(ze, {
1238
- key: `${t(Oe)()}_${V}`,
1239
- "model-value": w,
1240
- index: V,
1241
- "hide-export": !0,
1242
- "custom-screen-width": x.previewWidth
1243
- }, null, 8, ["model-value", "index", "custom-screen-width"]))), 128))
1244
- ])) : (r(), T(Ee, { key: 1 }))
1245
- ], 4)
1246
- ], 4)
1247
- ]))
1248
- ], 64)) : (r(), T(B, { key: 0 }))
1249
- ]);
1250
- };
1251
- }
1252
- }), Zl = { class: "flex items-center gap-4" }, et = { class: "flex justify-center items-center gap-2 w-full" }, lt = { class: "flex gap-4" }, gt = /* @__PURE__ */ he({
1253
- __name: "ReportEditor",
1254
- setup(M) {
1255
- const n = el(), i = ll(), u = Ze(), { promptLoader: x } = yl(), { t: v, te: S } = Ne(), { currentReport: z, editingReport: F } = Re(u), { breakpoints: s } = Ie(), B = N(() => {
1256
- var $;
1257
- return !(($ = F.value) != null && $.editable);
1258
- }), Y = N(() => {
1259
- var $;
1260
- return (($ = F.value) == null ? void 0 : $.name) ?? v("report.editor.newReport");
1261
- }), D = N(() => $e(v, S, Y.value, "other")), E = tl(), { promptMessage: w } = ol(), V = R(!1), O = N(() => [
1262
- { label: v("report.common.cancel"), value: "cancel", isPrimary: !1 },
1263
- { label: v("report.common.save"), value: "save", isPrimary: !0, prependIcon: "download" }
1264
- ]);
1265
- async function U() {
1266
- if (!F.value || F.value.tiles.length === 0) {
1267
- E.open({ message: v("report.messages.noWidget"), type: "error" });
1268
- return;
1269
- }
1270
- const $ = B.value ? v("report.common.clone") : v("report.common.save");
1271
- if (await w({
1272
- title: `${v("report.messages.saveReport")}`,
1273
- message: v("report.messages.confirmAction", { action: $, name: D.value })
1274
- }))
1275
- try {
1276
- await x(async () => {
1277
- if (B.value) {
1278
- const P = JSON.parse(JSON.stringify(F.value));
1279
- P.editable = !0, P.id = "", P.name = `${P.name} ${v("report.common.duplicate")}`, P.isDefault = !1, await u.createOrUpdateReport(P);
1280
- } else
1281
- F.value && await u.createOrUpdateReport(F.value);
1282
- n.push({
1283
- name: "reportView",
1284
- query: i.query
1285
- });
1286
- });
1287
- } catch (P) {
1288
- console.log(P), E.open({
1289
- message: v("report.messages.failedToAction", { action: $ }),
1290
- type: "error"
1291
- });
1292
- }
1293
- }
1294
- async function L() {
1295
- var I;
1296
- if (!F.value) return;
1297
- await w({
1298
- title: v("report.common.report", 1),
1299
- message: v("report.editor.notSaved", { name: (I = F.value) == null ? void 0 : I.name })
1300
- }) && (F.value = JSON.parse(JSON.stringify(z.value)), n.back());
1301
- }
1302
- ul(() => {
1303
- F.value || n.push({ name: "reports" });
1304
- });
1305
- const oe = [
1306
- {
1307
- labelKey: "report.common.default",
1308
- width: void 0,
1309
- height: void 0
1310
- },
1311
- {
1312
- labelKey: "report.editor.devices.desktop",
1313
- width: 1920,
1314
- height: 1080
1315
- },
1316
- {
1317
- labelKey: "report.editor.devices.tablet",
1318
- width: 820,
1319
- height: 1180
1320
- },
1321
- {
1322
- labelKey: "report.editor.devices.phone",
1323
- width: 390,
1324
- height: 859
1325
- }
1326
- ], f = R(oe[0]), le = R(!1), _e = N(() => le.value ? Math.max(f.value.width || 0, f.value.height || 0) : Math.min(f.value.width || 0, f.value.height || 0)), Z = N(() => le.value ? Math.min(f.value.width || 0, f.value.height || 0) : Math.max(f.value.width || 0, f.value.height || 0)), G = N(() => window.innerHeight - 72 - 56), ie = N(() => {
1327
- if (!_e.value) return 1;
1328
- let $ = (G.value - 48) / _e.value, I = Z.value * $;
1329
- return I > window.innerWidth && ($ = window.innerWidth / Z.value, I = Z.value * $), $ > 1 ? 1 : $;
1330
- });
1331
- function se($) {
1332
- f.value = $;
1333
- }
1334
- function pe() {
1335
- le.value = !le.value;
1336
- }
1337
- return ($, I) => {
1338
- const P = h("FmTooltip"), ae = h("FmButton"), Ce = h("FmPageHead");
1339
- return r(), T(gl, null, {
1340
- default: p(() => [
1341
- a(Ce, {
1342
- "data-editor-header": "true",
1343
- actions: O.value,
1344
- "onClick:action": I[0] || (I[0] = (J) => {
1345
- J === "cancel" && L(), J === "save" && U();
1346
- })
1347
- }, {
1348
- title: p(() => [
1349
- y("div", Zl, [
1350
- a(P, {
1351
- content: D.value,
1352
- placement: "bottom"
1353
- }, {
1354
- default: p(() => [
1355
- y("p", {
1356
- class: ke(`${t(s).sm || t(s).xs ? "hidden" : ""} text-ellipsis overflow-hidden text-nowrap fm-typo-en-title-md-600 w-[250px]`)
1357
- }, X(D.value), 3)
1358
- ]),
1359
- _: 1
1360
- }, 8, ["content"]),
1361
- y("div", et, [
1362
- y("div", lt, [
1363
- (r(), C(ee, null, ce(oe, (J) => {
1364
- var m;
1365
- return a(ae, {
1366
- key: J.labelKey,
1367
- label: t(v)(J.labelKey),
1368
- variant: ((m = f.value) == null ? void 0 : m.labelKey) === J.labelKey ? "primary" : "secondary",
1369
- size: "md",
1370
- onClick: (o) => se(J)
1371
- }, null, 8, ["label", "variant", "onClick"]);
1372
- }), 64))
1373
- ]),
1374
- a(ae, {
1375
- icon: "screen_rotation",
1376
- variant: "tertiary",
1377
- size: "md",
1378
- class: "text-fm-color-typo-primary",
1379
- onClick: pe
1380
- })
1381
- ])
1382
- ])
1383
- ]),
1384
- _: 1
1385
- }, 8, ["actions"]),
1386
- t(F) ? (r(), T(Yl, {
1387
- key: 0,
1388
- modelValue: t(F),
1389
- "onUpdate:modelValue": I[1] || (I[1] = (J) => Ye(F) ? F.value = J : null),
1390
- style: He({ height: G.value + "px" }),
1391
- class: ke(t(s).lg || t(s).md ? "flex" : ""),
1392
- "hide-configuration": V.value,
1393
- "preview-width": Z.value,
1394
- "preview-height": _e.value,
1395
- "preview-scale": ie.value,
1396
- onHideConfiguration: I[2] || (I[2] = (J) => V.value = J)
1397
- }, null, 8, ["modelValue", "style", "class", "hide-configuration", "preview-width", "preview-height", "preview-scale"])) : A("", !0)
1398
- ]),
1399
- _: 1
1400
- });
1401
- };
1402
- }
1403
- });
1404
- export {
1405
- gt as default
1406
- };