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