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