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