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