@feedmepos/mf-report 5.27.35 → 5.27.36
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-4_GHdc0c.js → App-CHT3iF-7.js} +4 -4
- package/dist/{DateRangeSelect-Cvxqh6KE.js → DateRangeSelect-D2772bgT.js} +1 -1
- package/dist/{Default.vue_vue_type_script_setup_true_lang-FvTBswXI.js → Default.vue_vue_type_script_setup_true_lang-CArSG8Z_.js} +1 -1
- package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-PhthswCX.js → DynamicWidget.vue_vue_type_script_setup_true_lang-RABMoQ3F.js} +949 -879
- package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CoI3PFYF.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-DzZP-ANz.js} +3886 -3841
- package/dist/InsightView-KYbGpFKj.js +689 -0
- package/dist/{Integration-BmtzVBU8.js → Integration-CocbSCYz.js} +3 -3
- package/dist/{Integrations-FKTHYjkY.js → Integrations-DaKi0pnt.js} +2 -2
- package/dist/{Layout-Dn9c-gMi.js → Layout-p1hYeFa3.js} +1 -1
- package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-H1iroFEV.js → MenuTab.vue_vue_type_script_setup_true_lang-DG-9RjS_.js} +49 -46
- package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-cPTLcF06.js → NavigationTab.vue_vue_type_script_setup_true_lang-By2GxyK2.js} +3 -3
- package/dist/{OverviewView-DQs-PWBo.js → OverviewView-CfmhSHLj.js} +4 -4
- package/dist/{Report-gLUTNmHm.js → Report-tUyaWEtI.js} +3 -3
- package/dist/ReportEditor-BUXYZXMs.js +2032 -0
- package/dist/ReportView-BwrLb4jX.js +331 -0
- package/dist/{Setting-zldr38s7.js → Setting-DApgIt2e.js} +11 -11
- package/dist/{Template-nAGq9Il6.js → Template-Cte2kk4J.js} +3 -3
- package/dist/TileEditor-DPUludYa.js +4154 -0
- package/dist/TileGrid.vue_vue_type_script_setup_true_lang-CC-xGpBd.js +257 -0
- package/dist/{TransitionFade-Cq7jxuTO.js → TransitionFade-DszPGM-J.js} +4 -4
- package/dist/{app-L5Gs2RN0.js → app-CwM9HM2R.js} +3577 -3371
- package/dist/app.js +1 -1
- package/dist/assets/{formatChartData.worker-GhwszhPe.js → formatChartData.worker-Ci7ZpIYk.js} +6 -6
- package/dist/assets/{processTableData.worker-C4hgpe0l.js → processTableData.worker-C2Ubh_e0.js} +6 -6
- package/dist/style.css +1 -1
- package/dist/{useRestaurantPermission-D9GFgNLW.js → useRestaurantPermission-BQ0MKNOz.js} +1 -1
- package/package.json +2 -2
- package/dist/InsightView-D8Jpwge7.js +0 -664
- package/dist/ReportEditor-kp63cCQT.js +0 -1831
- package/dist/ReportView-0m23WbFa.js +0 -311
- package/dist/TileEditor-CcwBUuaS.js +0 -4093
- package/dist/TileGrid.vue_vue_type_script_setup_true_lang-707n8i-y.js +0 -154
|
@@ -0,0 +1,2032 @@
|
|
|
1
|
+
import { defineComponent as we, mergeModels as ke, useModel as Te, ref as L, computed as b, resolveComponent as C, createBlock as T, openBlock as c, withCtx as _, createElementVNode as v, createVNode as i, unref as o, normalizeClass as Pe, createTextVNode as Ge, toDisplayString as B, createElementBlock as R, Fragment as he, renderSlot as vt, createCommentVNode as M, watch as ge, renderList as qe, onMounted as ft, onUnmounted as St, resolveDynamicComponent as $t, isRef as gt, normalizeStyle as lt } from "vue";
|
|
2
|
+
import { W as Dt, g as Ot, _ as It, a as Ut, e as Oe, S as Le, d as bt, b as yt, T as Bt, c as Nt } from "./TransitionFade-DszPGM-J.js";
|
|
3
|
+
import { C as Ve, D as te, d as Re, g as Mt, F as He, e as Ie, u as at, M as ht, r as Rt, f as st, n as zt, h as qt, i as Pt, j as Et, k as Lt, a as Gt, b as ut, m as Xe, o as Wt, Q as je, p as At, l as Ht, c as dt, q as jt } from "./GlobalFilterSelect.vue_vue_type_script_setup_true_lang-DzZP-ANz.js";
|
|
4
|
+
import { storeToRefs as ze } from "pinia";
|
|
5
|
+
import { useRouter as rt, useRoute as nt } from "vue-router";
|
|
6
|
+
import { useBreakpoints as Je, useSnackbar as wt, FmButtonColorThemeVariant as Ce } from "@feedmepos/ui-library";
|
|
7
|
+
import { u as it } from "./message-dialog-UoMWOnil.js";
|
|
8
|
+
import { u as Ee, a as Jt } from "./_plugin-vue_export-helper-onplcgja.js";
|
|
9
|
+
import { r as We } from "./i18n-CI_sQ5d_.js";
|
|
10
|
+
import { _ as Ze } from "./TileGrid.vue_vue_type_script_setup_true_lang-CC-xGpBd.js";
|
|
11
|
+
import { a as et, _ as tt } from "./SelectComponent.vue_vue_type_script_setup_true_lang-CGbb3b5G.js";
|
|
12
|
+
import { d as Kt, e as Qt, i as Yt } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-RABMoQ3F.js";
|
|
13
|
+
import { useCoreStore as Xt } from "@feedmepos/mf-common";
|
|
14
|
+
import { u as Zt, a as el } from "./app-CwM9HM2R.js";
|
|
15
|
+
import { d as tl } from "./DateRangeSelect-D2772bgT.js";
|
|
16
|
+
const ll = /* @__PURE__ */ we({
|
|
17
|
+
__name: "WidgetDialog",
|
|
18
|
+
props: /* @__PURE__ */ ke({
|
|
19
|
+
isOpen: { type: Boolean }
|
|
20
|
+
}, {
|
|
21
|
+
modelValue: {},
|
|
22
|
+
modelModifiers: {}
|
|
23
|
+
}),
|
|
24
|
+
emits: /* @__PURE__ */ ke(["update:isOpen"], ["update:modelValue"]),
|
|
25
|
+
setup(z, { emit: p }) {
|
|
26
|
+
const { t: d } = Ee(), { breakpoints: y } = Je(), s = Te(z, "modelValue"), h = z, P = p;
|
|
27
|
+
function Q() {
|
|
28
|
+
P("update:isOpen", !1);
|
|
29
|
+
}
|
|
30
|
+
function S() {
|
|
31
|
+
F.value && (s.value = F.value, F.value = void 0, P("update:isOpen", !1));
|
|
32
|
+
}
|
|
33
|
+
const F = L(), U = b(() => !F.value);
|
|
34
|
+
return (ee, q) => {
|
|
35
|
+
const r = C("FmButton"), O = C("FmDialog");
|
|
36
|
+
return c(), T(O, {
|
|
37
|
+
"model-value": h.isOpen
|
|
38
|
+
}, {
|
|
39
|
+
"dialog-header": _(() => [
|
|
40
|
+
Ge(B(o(d)("report.widget.type")), 1)
|
|
41
|
+
]),
|
|
42
|
+
default: _(() => [
|
|
43
|
+
i(Dt, {
|
|
44
|
+
modelValue: F.value,
|
|
45
|
+
"onUpdate:modelValue": q[0] || (q[0] = (k) => F.value = k),
|
|
46
|
+
class: Pe(`grid ${o(y).lg || o(y).md ? "grid-cols-3 gap-3" : "grid-cols-2 gap-3"}`),
|
|
47
|
+
"child-class": "p-[8px] flex flex-col"
|
|
48
|
+
}, null, 8, ["modelValue", "class"])
|
|
49
|
+
]),
|
|
50
|
+
"dialog-footer": _(() => [
|
|
51
|
+
q[1] || (q[1] = v("div", { class: "grow" }, null, -1)),
|
|
52
|
+
i(r, {
|
|
53
|
+
label: o(d)("report.common.cancel"),
|
|
54
|
+
variant: "tertiary",
|
|
55
|
+
onClick: Q
|
|
56
|
+
}, null, 8, ["label"]),
|
|
57
|
+
i(r, {
|
|
58
|
+
label: o(d)("report.common.confirm"),
|
|
59
|
+
disabled: U.value,
|
|
60
|
+
onClick: S
|
|
61
|
+
}, null, 8, ["label", "disabled"])
|
|
62
|
+
]),
|
|
63
|
+
_: 1
|
|
64
|
+
}, 8, ["model-value"]);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}), ol = { class: "fm-typo-en-body-lg-600" }, ot = /* @__PURE__ */ we({
|
|
68
|
+
__name: "ReportEditorTabHeader",
|
|
69
|
+
props: /* @__PURE__ */ ke({
|
|
70
|
+
icon: {
|
|
71
|
+
type: String,
|
|
72
|
+
required: !0
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
modelValue: { type: Boolean, required: !0, default: !1 },
|
|
76
|
+
modelModifiers: {}
|
|
77
|
+
}),
|
|
78
|
+
emits: ["update:modelValue"],
|
|
79
|
+
setup(z) {
|
|
80
|
+
const { t: p } = Ee(), d = Te(z, "modelValue"), y = z;
|
|
81
|
+
return (s, h) => {
|
|
82
|
+
const P = C("FmIcon");
|
|
83
|
+
return c(), R("div", {
|
|
84
|
+
class: "px-6 py-16 flex items-center gap-2 bg-fm-color-neutral-white border cursor-pointer",
|
|
85
|
+
onClick: h[0] || (h[0] = (Q) => d.value = !d.value)
|
|
86
|
+
}, [
|
|
87
|
+
v("p", ol, B(o(p)("report.editor.customizeReport")), 1),
|
|
88
|
+
h[1] || (h[1] = v("div", { class: "grow" }, null, -1)),
|
|
89
|
+
i(P, {
|
|
90
|
+
name: y.icon
|
|
91
|
+
}, null, 8, ["name"])
|
|
92
|
+
]);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}), al = /* @__PURE__ */ we({
|
|
96
|
+
__name: "ReportEditorTabDesktop",
|
|
97
|
+
props: {
|
|
98
|
+
modelValue: { required: !0, default: !1 },
|
|
99
|
+
modelModifiers: {}
|
|
100
|
+
},
|
|
101
|
+
emits: ["update:modelValue"],
|
|
102
|
+
setup(z) {
|
|
103
|
+
const p = Te(z, "modelValue");
|
|
104
|
+
return (d, y) => (c(), R(he, null, [
|
|
105
|
+
i(ot, {
|
|
106
|
+
modelValue: p.value,
|
|
107
|
+
"onUpdate:modelValue": y[0] || (y[0] = (s) => p.value = s),
|
|
108
|
+
icon: "keyboard_double_arrow_left"
|
|
109
|
+
}, null, 8, ["modelValue"]),
|
|
110
|
+
vt(d.$slots, "default")
|
|
111
|
+
], 64));
|
|
112
|
+
}
|
|
113
|
+
}), rl = /* @__PURE__ */ we({
|
|
114
|
+
__name: "ReportEditorTabMobile",
|
|
115
|
+
props: {
|
|
116
|
+
modelValue: { required: !0, default: !1 },
|
|
117
|
+
modelModifiers: {}
|
|
118
|
+
},
|
|
119
|
+
emits: ["update:modelValue"],
|
|
120
|
+
setup(z) {
|
|
121
|
+
const p = Te(z, "modelValue");
|
|
122
|
+
return (d, y) => {
|
|
123
|
+
const s = C("FmTopSheet"), h = C("FmCard");
|
|
124
|
+
return c(), T(h, { class: "fixed bottom-0 w-full" }, {
|
|
125
|
+
default: _(() => [
|
|
126
|
+
i(ot, {
|
|
127
|
+
modelValue: p.value,
|
|
128
|
+
"onUpdate:modelValue": y[0] || (y[0] = (P) => p.value = P),
|
|
129
|
+
icon: "keyboard_double_arrow_up"
|
|
130
|
+
}, null, 8, ["modelValue"]),
|
|
131
|
+
i(s, {
|
|
132
|
+
modelValue: p.value,
|
|
133
|
+
"onUpdate:modelValue": y[2] || (y[2] = (P) => p.value = P),
|
|
134
|
+
"fullscreen-size": "sm"
|
|
135
|
+
}, {
|
|
136
|
+
default: _(() => [
|
|
137
|
+
i(ot, {
|
|
138
|
+
modelValue: p.value,
|
|
139
|
+
"onUpdate:modelValue": y[1] || (y[1] = (P) => p.value = P),
|
|
140
|
+
icon: "keyboard_double_arrow_down"
|
|
141
|
+
}, null, 8, ["modelValue"]),
|
|
142
|
+
p.value ? vt(d.$slots, "default", { key: 0 }) : M("", !0)
|
|
143
|
+
]),
|
|
144
|
+
_: 3
|
|
145
|
+
}, 8, ["modelValue"])
|
|
146
|
+
]),
|
|
147
|
+
_: 3
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}), nl = {
|
|
152
|
+
key: 2,
|
|
153
|
+
class: "flex flex-col gap-3 mt-2 border border-neutral-300 p-3"
|
|
154
|
+
}, il = { class: "grid grid-cols-1 gap-2 rounded-md border border-neutral-300 p-2 sm:grid-cols-[1.3fr_1fr_1fr_auto] sm:items-end" }, sl = {
|
|
155
|
+
key: 0,
|
|
156
|
+
class: "flex justify-end sm:pb-[2px]"
|
|
157
|
+
}, ul = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, dl = { class: "pl-1" }, ml = {
|
|
158
|
+
key: 0,
|
|
159
|
+
class: "flex justify-end sm:pb-[2px]"
|
|
160
|
+
}, cl = {
|
|
161
|
+
key: 3,
|
|
162
|
+
class: "flex flex-col gap-2"
|
|
163
|
+
}, pl = /* @__PURE__ */ we({
|
|
164
|
+
__name: "GlobalFilterDialog",
|
|
165
|
+
props: /* @__PURE__ */ ke({
|
|
166
|
+
schemas: {
|
|
167
|
+
type: Array,
|
|
168
|
+
default: () => []
|
|
169
|
+
},
|
|
170
|
+
tiles: {
|
|
171
|
+
type: Array,
|
|
172
|
+
required: !0
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
globalFilter: {
|
|
176
|
+
default: () => null
|
|
177
|
+
},
|
|
178
|
+
globalFilterModifiers: {},
|
|
179
|
+
isOpen: { type: Boolean, default: () => !1, required: !0 },
|
|
180
|
+
isOpenModifiers: {}
|
|
181
|
+
}),
|
|
182
|
+
emits: ["update:globalFilter", "update:isOpen"],
|
|
183
|
+
setup(z) {
|
|
184
|
+
const { t: p, te: d } = Ee(), y = Te(z, "globalFilter"), s = Te(z, "isOpen"), h = wt(), P = z, Q = L(""), S = L(), F = L(), U = L(), ee = L([]), q = L([]), r = L(!1), O = L([]), k = L([]), Y = L(Ve.Equal);
|
|
185
|
+
function ne(e) {
|
|
186
|
+
return JSON.parse(JSON.stringify(e));
|
|
187
|
+
}
|
|
188
|
+
function ce(e, t) {
|
|
189
|
+
return { hour: e, minute: t };
|
|
190
|
+
}
|
|
191
|
+
function A(e) {
|
|
192
|
+
return e ? `${String(e.hour).padStart(2, "0")}:${String(e.minute).padStart(2, "0")}` : null;
|
|
193
|
+
}
|
|
194
|
+
function j(e) {
|
|
195
|
+
if (!e) return null;
|
|
196
|
+
const [t, m] = e.split(":").map(Number);
|
|
197
|
+
return Number.isNaN(t) || Number.isNaN(m) ? null : { hour: t, minute: m };
|
|
198
|
+
}
|
|
199
|
+
const x = b(() => F.value ? !(F.value.type === te.Timestamp && U.value === Re.DateTime) : !1), X = b(
|
|
200
|
+
() => {
|
|
201
|
+
var e;
|
|
202
|
+
return ((e = F.value) == null ? void 0 : e.type) === te.Timestamp && U.value === Re.TimeOfDay;
|
|
203
|
+
}
|
|
204
|
+
), le = b(() => {
|
|
205
|
+
var e;
|
|
206
|
+
return (((e = F.value) == null ? void 0 : e.filterOperators) ?? []).filter((t) => t !== Ve.And && t !== Ve.Or).map((t) => ({
|
|
207
|
+
label: p(`report.section.comparisonOperator.${t}`),
|
|
208
|
+
value: t
|
|
209
|
+
}));
|
|
210
|
+
});
|
|
211
|
+
function oe() {
|
|
212
|
+
var t;
|
|
213
|
+
const e = (t = le.value[0]) == null ? void 0 : t.value;
|
|
214
|
+
return e || (F.value ? Ne(
|
|
215
|
+
F.value.type,
|
|
216
|
+
U.value ?? null
|
|
217
|
+
) : Ve.Equal);
|
|
218
|
+
}
|
|
219
|
+
function se(e) {
|
|
220
|
+
if (F.value)
|
|
221
|
+
return Mt({
|
|
222
|
+
operator: e ?? oe(),
|
|
223
|
+
dataType: F.value.type,
|
|
224
|
+
dimensionOption: F.value.type === te.Timestamp ? U.value ?? null : null,
|
|
225
|
+
t: p
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
function ue(e, t) {
|
|
229
|
+
if (typeof (t == null ? void 0 : t.default) == "boolean" || e.length > 0 && e.every((V) => typeof V == "boolean")) {
|
|
230
|
+
const V = e.reduce((D, I) => (typeof I == "boolean" && D.push(I), D), []);
|
|
231
|
+
if (t)
|
|
232
|
+
for (t.fixed && V.splice(t.count); V.length < t.count; )
|
|
233
|
+
V.push(typeof t.default == "boolean" ? t.default : !1);
|
|
234
|
+
return V;
|
|
235
|
+
}
|
|
236
|
+
const g = e.reduce((V, D) => (typeof D == "string" && V.push(D), V), []);
|
|
237
|
+
if (t)
|
|
238
|
+
for (t.fixed && g.splice(t.count); g.length < t.count; )
|
|
239
|
+
g.push(typeof t.default == "string" ? t.default : "");
|
|
240
|
+
return g;
|
|
241
|
+
}
|
|
242
|
+
function de(e = Y.value) {
|
|
243
|
+
const t = se(e), m = ue(
|
|
244
|
+
t ? Array(t.count).fill(t.default) : [],
|
|
245
|
+
t
|
|
246
|
+
);
|
|
247
|
+
return {
|
|
248
|
+
label: "",
|
|
249
|
+
operator: e,
|
|
250
|
+
values: m
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function E() {
|
|
254
|
+
return {
|
|
255
|
+
name: "",
|
|
256
|
+
startTime: ce(0, 0),
|
|
257
|
+
endTime: ce(23, 59)
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function G() {
|
|
261
|
+
if (!(!x.value || !r.value)) {
|
|
262
|
+
if (X.value) {
|
|
263
|
+
k.value.length === 0 && (k.value = [E()]);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
O.value.length === 0 && (O.value = [de()]);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function J() {
|
|
270
|
+
var m, g, V;
|
|
271
|
+
const e = ne(((m = y.value) == null ? void 0 : m.customOptions) ?? []), t = ne(((g = y.value) == null ? void 0 : g.customTimeRanges) ?? []);
|
|
272
|
+
Y.value = ((V = e[0]) == null ? void 0 : V.operator) ?? oe(), r.value = e.length > 0 || t.length > 0, O.value = e, k.value = t, G();
|
|
273
|
+
}
|
|
274
|
+
function pe(e) {
|
|
275
|
+
Y.value = e, O.value = O.value.map((t, m) => {
|
|
276
|
+
const g = O.value[m];
|
|
277
|
+
if (!g)
|
|
278
|
+
return de(e);
|
|
279
|
+
const V = se(e), D = ue(
|
|
280
|
+
Array.isArray(g.values) ? [...g.values] : [],
|
|
281
|
+
V
|
|
282
|
+
);
|
|
283
|
+
return {
|
|
284
|
+
...g,
|
|
285
|
+
operator: e,
|
|
286
|
+
values: D
|
|
287
|
+
};
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function be() {
|
|
291
|
+
O.value = [...O.value, de()];
|
|
292
|
+
}
|
|
293
|
+
function K(e) {
|
|
294
|
+
O.value.length <= 1 || (O.value = O.value.filter((t, m) => m !== e));
|
|
295
|
+
}
|
|
296
|
+
function _e() {
|
|
297
|
+
k.value = [...k.value, E()];
|
|
298
|
+
}
|
|
299
|
+
function ae(e) {
|
|
300
|
+
k.value.length <= 1 || (k.value = k.value.filter(
|
|
301
|
+
(t, m) => m !== e
|
|
302
|
+
));
|
|
303
|
+
}
|
|
304
|
+
function Se(e, t, m) {
|
|
305
|
+
const g = k.value[e];
|
|
306
|
+
g && (k.value[e] = {
|
|
307
|
+
...g,
|
|
308
|
+
[t]: j(m)
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function Ue(e) {
|
|
312
|
+
return e.length === 0 || e.some((t) => t === "");
|
|
313
|
+
}
|
|
314
|
+
function $e() {
|
|
315
|
+
if (!r.value) return !0;
|
|
316
|
+
if (X.value) {
|
|
317
|
+
const m = k.value.map((V) => V.name.trim()).filter(Boolean);
|
|
318
|
+
return k.value.some(
|
|
319
|
+
(V) => !V.name.trim() || !V.startTime || !V.endTime
|
|
320
|
+
) ? (h.open({
|
|
321
|
+
message: p("report.section.filter.invalidCustomTimeRange"),
|
|
322
|
+
type: "error"
|
|
323
|
+
}), !1) : new Set(m).size !== m.length ? (h.open({
|
|
324
|
+
message: p("report.section.filter.customTimeRangeNamesMustBeUnique"),
|
|
325
|
+
type: "error"
|
|
326
|
+
}), !1) : !0;
|
|
327
|
+
}
|
|
328
|
+
const e = O.value.map((m) => m.label.trim()).filter(Boolean);
|
|
329
|
+
return O.value.some(
|
|
330
|
+
(m) => !m.label.trim() || Ue(m.values)
|
|
331
|
+
) ? (h.open({ message: p("report.section.filter.invalidCustomOption"), type: "error" }), !1) : new Set(e).size !== e.length ? (h.open({
|
|
332
|
+
message: p("report.section.filter.customOptionLabelsMustBeUnique"),
|
|
333
|
+
type: "error"
|
|
334
|
+
}), !1) : !0;
|
|
335
|
+
}
|
|
336
|
+
ge(s, (e) => {
|
|
337
|
+
var t, m, g, V, D;
|
|
338
|
+
e && (Q.value = ((t = y.value) == null ? void 0 : t.label) || "", S.value = P.schemas.find(
|
|
339
|
+
(I) => {
|
|
340
|
+
var W;
|
|
341
|
+
return I.name === ((W = y.value) == null ? void 0 : W.schemaName);
|
|
342
|
+
}
|
|
343
|
+
), F.value = (m = fe.value.find(
|
|
344
|
+
(I) => {
|
|
345
|
+
var W;
|
|
346
|
+
return I.value.name === ((W = y.value) == null ? void 0 : W.name);
|
|
347
|
+
}
|
|
348
|
+
)) == null ? void 0 : m.value, U.value = (g = y.value) == null ? void 0 : g.option, ee.value = ((V = y.value) == null ? void 0 : V.tileIds) || [], q.value = ((D = y.value) == null ? void 0 : D.filters) || [], J());
|
|
349
|
+
}), ge(r, (e) => {
|
|
350
|
+
var t;
|
|
351
|
+
e && (Y.value = ((t = O.value[0]) == null ? void 0 : t.operator) ?? oe(), G());
|
|
352
|
+
}), ge(x, (e) => {
|
|
353
|
+
if (!e) {
|
|
354
|
+
r.value = !1, O.value = [], k.value = [];
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
G();
|
|
358
|
+
}), ge(X, () => {
|
|
359
|
+
G();
|
|
360
|
+
}), ge(le, (e) => {
|
|
361
|
+
var m;
|
|
362
|
+
const t = (m = e[0]) == null ? void 0 : m.value;
|
|
363
|
+
t && (e.some((g) => g.value === Y.value) || pe(t));
|
|
364
|
+
});
|
|
365
|
+
const ve = b(
|
|
366
|
+
() => P.schemas.map((e) => ({
|
|
367
|
+
label: e.label || e.name,
|
|
368
|
+
value: e
|
|
369
|
+
}))
|
|
370
|
+
), fe = b(() => {
|
|
371
|
+
var e;
|
|
372
|
+
return (((e = S.value) == null ? void 0 : e.fields) || []).filter((t) => t.type !== te.Numeric).map((t) => ({
|
|
373
|
+
label: t.label || t.name,
|
|
374
|
+
value: t
|
|
375
|
+
}));
|
|
376
|
+
}), ye = b(() => {
|
|
377
|
+
var e;
|
|
378
|
+
return ((e = F.value) == null ? void 0 : e.type) !== te.Timestamp ? [] : Ot(p);
|
|
379
|
+
}), Fe = b(() => P.tiles.reduce((e, t, m) => {
|
|
380
|
+
var D, I, W, H, Z;
|
|
381
|
+
const g = ((D = t.widget) == null ? void 0 : D.config.schemaNames) ?? [], V = (((I = t.widget) == null ? void 0 : I.config.joinDatasources) ?? []).flatMap(
|
|
382
|
+
(me) => me.schemaNames ?? []
|
|
383
|
+
);
|
|
384
|
+
return [...g, ...V].includes(((W = S.value) == null ? void 0 : W.name) || "") && e.push({
|
|
385
|
+
label: (Z = (H = t.widget) == null ? void 0 : H.title) != null && Z.trim() ? t.widget.title : `Widget ${m + 1}`,
|
|
386
|
+
value: t.id
|
|
387
|
+
}), e;
|
|
388
|
+
}, [])), xe = b(
|
|
389
|
+
() => P.schemas.flatMap(
|
|
390
|
+
(e) => (e.fields ?? []).map((t) => ({
|
|
391
|
+
...t,
|
|
392
|
+
labels: [
|
|
393
|
+
We(p, d, e.label, "schema"),
|
|
394
|
+
We(p, d, t.label || t.name, "other")
|
|
395
|
+
]
|
|
396
|
+
}))
|
|
397
|
+
)
|
|
398
|
+
);
|
|
399
|
+
function De(e) {
|
|
400
|
+
var t;
|
|
401
|
+
e.name !== ((t = S.value) == null ? void 0 : t.name) && (S.value = e, F.value = void 0, Y.value = Ve.Equal, r.value = !1, O.value = [], k.value = []);
|
|
402
|
+
}
|
|
403
|
+
function Be(e) {
|
|
404
|
+
F.value = e, U.value = e.type === te.Timestamp ? Re.DateTime : void 0, Y.value = oe(), r.value = !1, O.value = [], k.value = [];
|
|
405
|
+
}
|
|
406
|
+
function Ne(e, t) {
|
|
407
|
+
switch (e) {
|
|
408
|
+
case te.Timestamp:
|
|
409
|
+
return t === Re.DateTime || t === Re.TimeOfDay ? Ve.Between : Ve.Equal;
|
|
410
|
+
case te.Bool:
|
|
411
|
+
case te.String:
|
|
412
|
+
case te.Numeric:
|
|
413
|
+
return Ve.Equal;
|
|
414
|
+
default:
|
|
415
|
+
throw new Error(`Unsupported data type: ${e}`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function Me() {
|
|
419
|
+
if (!S.value) {
|
|
420
|
+
h.open({ message: p("report.section.filter.invalidSchema"), type: "error" });
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (!F.value) {
|
|
424
|
+
h.open({ message: p("report.section.filter.invalidDimension"), type: "error" });
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
const e = q.value.filter((g) => g ? !ve.value.some((D) => D.value.name === g.schemaName) : !0);
|
|
428
|
+
if (e.length > 0) {
|
|
429
|
+
const g = e.filter((D) => !!D).map((D) => D.schemaName), V = e.some((D) => !D) ? `, ${p("report.section.filter.unknownFilters")}` : "";
|
|
430
|
+
h.open({
|
|
431
|
+
message: p("report.section.filter.invalidFiltersSchemaNotFound", {
|
|
432
|
+
schemas: g.join(", "),
|
|
433
|
+
unknownFiltersSuffix: V
|
|
434
|
+
}),
|
|
435
|
+
type: "error"
|
|
436
|
+
});
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (!$e())
|
|
440
|
+
return;
|
|
441
|
+
const t = r.value && !X.value ? O.value.map((g) => ({
|
|
442
|
+
label: g.label.trim(),
|
|
443
|
+
operator: g.operator ?? oe(),
|
|
444
|
+
values: ue(
|
|
445
|
+
[...g.values],
|
|
446
|
+
se(g.operator)
|
|
447
|
+
)
|
|
448
|
+
})) : void 0, m = r.value && X.value ? k.value.map((g) => ({
|
|
449
|
+
name: g.name.trim(),
|
|
450
|
+
startTime: g.startTime,
|
|
451
|
+
endTime: g.endTime
|
|
452
|
+
})) : void 0;
|
|
453
|
+
y.value = {
|
|
454
|
+
schemaName: S.value.name,
|
|
455
|
+
name: F.value.name,
|
|
456
|
+
label: Q.value,
|
|
457
|
+
operator: Ne(
|
|
458
|
+
F.value.type,
|
|
459
|
+
F.value.type === te.Timestamp ? U.value ?? Re.DateTime : null
|
|
460
|
+
),
|
|
461
|
+
option: F.value.type === te.Timestamp ? U.value : null,
|
|
462
|
+
values: [],
|
|
463
|
+
tileIds: [...ee.value],
|
|
464
|
+
filters: ne(q.value),
|
|
465
|
+
customOptions: t,
|
|
466
|
+
customTimeRanges: m
|
|
467
|
+
}, s.value = !1;
|
|
468
|
+
}
|
|
469
|
+
function re() {
|
|
470
|
+
s.value = !1;
|
|
471
|
+
}
|
|
472
|
+
const n = b(() => {
|
|
473
|
+
var e;
|
|
474
|
+
return [
|
|
475
|
+
(e = S.value) == null ? void 0 : e.name,
|
|
476
|
+
...q.value.map((t) => t.schemaName)
|
|
477
|
+
];
|
|
478
|
+
});
|
|
479
|
+
function a(e) {
|
|
480
|
+
var $;
|
|
481
|
+
const t = P.tiles.find((w) => w.id === e.value);
|
|
482
|
+
if (!t || !S.value || !F.value) return null;
|
|
483
|
+
const m = ($ = t == null ? void 0 : t.widget) == null ? void 0 : $.config, g = (m == null ? void 0 : m.schemaNames) ?? [], V = ((m == null ? void 0 : m.joinDatasources) ?? []).flatMap(
|
|
484
|
+
(w) => w.schemaNames ?? []
|
|
485
|
+
), D = [...g, ...V], I = n.value.filter((w) => !!w).some((w) => !D.includes(w)), W = F.value.type === te.Timestamp;
|
|
486
|
+
if (I)
|
|
487
|
+
return p(
|
|
488
|
+
W ? "report.section.filter.missingFilterSchema" : "report.section.filter.missingFilterSchemaOrDimension"
|
|
489
|
+
);
|
|
490
|
+
if (W) return null;
|
|
491
|
+
const H = ((m == null ? void 0 : m.dimensions) ?? []).map((w) => ({
|
|
492
|
+
schemaName: w.schemaName,
|
|
493
|
+
name: w.name
|
|
494
|
+
})), Z = ((m == null ? void 0 : m.joinDatasources) ?? []).flatMap(
|
|
495
|
+
(w) => (w.dimensions ?? []).map((ie) => ({
|
|
496
|
+
schemaName: ie.schemaName,
|
|
497
|
+
name: ie.name
|
|
498
|
+
}))
|
|
499
|
+
), me = [...H, ...Z], f = S.value.name, u = F.value.name;
|
|
500
|
+
return me.some(
|
|
501
|
+
(w) => w.schemaName === f && w.name === u
|
|
502
|
+
) ? null : p("report.section.filter.missingFilterSchemaOrDimension");
|
|
503
|
+
}
|
|
504
|
+
return (e, t) => {
|
|
505
|
+
const m = C("FmTextField"), g = C("FmSelect"), V = C("FmCheckbox"), D = C("FmTimePicker"), I = C("FmButton"), W = C("FmLabel"), H = C("FmIcon"), Z = C("FmTooltip"), me = C("FmForm"), f = C("FmDialog");
|
|
506
|
+
return c(), T(f, {
|
|
507
|
+
modelValue: s.value,
|
|
508
|
+
"onUpdate:modelValue": t[9] || (t[9] = (u) => s.value = u),
|
|
509
|
+
overlay: !0,
|
|
510
|
+
"z-index": 10
|
|
511
|
+
}, {
|
|
512
|
+
"dialog-header": _(() => [
|
|
513
|
+
Ge(B(o(p)("report.section.filter.globalFilter")), 1)
|
|
514
|
+
]),
|
|
515
|
+
default: _(() => [
|
|
516
|
+
i(me, {
|
|
517
|
+
ref: "form",
|
|
518
|
+
class: "flex flex-col gap-2 w-[490px]"
|
|
519
|
+
}, {
|
|
520
|
+
default: _(() => {
|
|
521
|
+
var u;
|
|
522
|
+
return [
|
|
523
|
+
i(m, {
|
|
524
|
+
modelValue: Q.value,
|
|
525
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => Q.value = l),
|
|
526
|
+
placeholder: o(p)("report.section.filter.displayName"),
|
|
527
|
+
label: o(p)("report.section.filter.displayName"),
|
|
528
|
+
class: "mb-2"
|
|
529
|
+
}, null, 8, ["modelValue", "placeholder", "label"]),
|
|
530
|
+
i(et, {
|
|
531
|
+
"model-value": S.value,
|
|
532
|
+
items: ve.value,
|
|
533
|
+
placeholder: o(p)("report.section.schema.title"),
|
|
534
|
+
label: o(p)("report.section.schema.title"),
|
|
535
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => De(l))
|
|
536
|
+
}, null, 8, ["model-value", "items", "placeholder", "label"]),
|
|
537
|
+
i(et, {
|
|
538
|
+
"model-value": F.value,
|
|
539
|
+
items: fe.value,
|
|
540
|
+
placeholder: o(p)("report.section.dimension.title"),
|
|
541
|
+
label: o(p)("report.section.dimension.title"),
|
|
542
|
+
"onUpdate:modelValue": t[2] || (t[2] = (l) => Be(l))
|
|
543
|
+
}, null, 8, ["model-value", "items", "placeholder", "label"]),
|
|
544
|
+
((u = F.value) == null ? void 0 : u.type) === o(te).Timestamp ? (c(), T(g, {
|
|
545
|
+
key: 0,
|
|
546
|
+
modelValue: U.value,
|
|
547
|
+
"onUpdate:modelValue": t[3] || (t[3] = (l) => U.value = l),
|
|
548
|
+
items: ye.value,
|
|
549
|
+
placeholder: o(p)("report.section.filter.timeFormatter"),
|
|
550
|
+
label: o(p)("report.section.filter.timeFormatter")
|
|
551
|
+
}, null, 8, ["modelValue", "items", "placeholder", "label"])) : M("", !0),
|
|
552
|
+
x.value ? (c(), T(V, {
|
|
553
|
+
key: 1,
|
|
554
|
+
modelValue: r.value,
|
|
555
|
+
"onUpdate:modelValue": t[4] || (t[4] = (l) => r.value = l),
|
|
556
|
+
label: o(p)("report.section.filter.customOptions"),
|
|
557
|
+
value: !0
|
|
558
|
+
}, null, 8, ["modelValue", "label"])) : M("", !0),
|
|
559
|
+
x.value && r.value ? (c(), R("div", nl, [
|
|
560
|
+
X.value ? (c(!0), R(he, { key: 0 }, qe(k.value, (l, $) => (c(), R("div", {
|
|
561
|
+
key: `custom-time-range-${$}`,
|
|
562
|
+
class: "flex flex-col gap-2"
|
|
563
|
+
}, [
|
|
564
|
+
v("div", il, [
|
|
565
|
+
i(m, {
|
|
566
|
+
modelValue: l.name,
|
|
567
|
+
"onUpdate:modelValue": (w) => l.name = w,
|
|
568
|
+
label: o(p)("report.section.filter.label")
|
|
569
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "label"]),
|
|
570
|
+
i(D, {
|
|
571
|
+
"model-value": A(l.startTime),
|
|
572
|
+
label: o(p)("report.date.startingTime"),
|
|
573
|
+
"onUpdate:modelValue": (w) => Se($, "startTime", w)
|
|
574
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"]),
|
|
575
|
+
i(D, {
|
|
576
|
+
"model-value": A(l.endTime),
|
|
577
|
+
label: o(p)("report.date.endingTime"),
|
|
578
|
+
"onUpdate:modelValue": (w) => Se($, "endTime", w)
|
|
579
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"]),
|
|
580
|
+
k.value.length > 1 ? (c(), R("div", sl, [
|
|
581
|
+
i(I, {
|
|
582
|
+
icon: "delete",
|
|
583
|
+
variant: "tertiary",
|
|
584
|
+
onClick: (w) => ae($)
|
|
585
|
+
}, null, 8, ["onClick"])
|
|
586
|
+
])) : M("", !0)
|
|
587
|
+
])
|
|
588
|
+
]))), 128)) : (c(), R(he, { key: 1 }, [
|
|
589
|
+
v("p", ul, B(o(p)("report.section.filter.operator")), 1),
|
|
590
|
+
le.value.length > 0 ? (c(), T(et, {
|
|
591
|
+
key: 0,
|
|
592
|
+
"model-value": Y.value,
|
|
593
|
+
items: le.value,
|
|
594
|
+
placeholder: o(p)("report.section.filter.operator"),
|
|
595
|
+
"onUpdate:modelValue": t[5] || (t[5] = (l) => pe(l))
|
|
596
|
+
}, null, 8, ["model-value", "items", "placeholder"])) : M("", !0),
|
|
597
|
+
(c(!0), R(he, null, qe(O.value, (l, $) => (c(), R("div", {
|
|
598
|
+
key: `custom-option-${$}`,
|
|
599
|
+
class: "flex flex-col gap-2"
|
|
600
|
+
}, [
|
|
601
|
+
v("div", {
|
|
602
|
+
class: Pe(["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", "sm:grid-cols-[1fr_1.6fr_auto]"])
|
|
603
|
+
}, [
|
|
604
|
+
v("span", dl, B(o(p)("report.section.filter.label")), 1),
|
|
605
|
+
i(m, {
|
|
606
|
+
modelValue: l.label,
|
|
607
|
+
"onUpdate:modelValue": (w) => l.label = w
|
|
608
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
609
|
+
(c(), T(It, {
|
|
610
|
+
key: `custom-option-value-${$}-${l.operator ?? ""}-${U.value ?? ""}`,
|
|
611
|
+
modelValue: l.values,
|
|
612
|
+
"onUpdate:modelValue": (w) => l.values = w,
|
|
613
|
+
config: se(l.operator),
|
|
614
|
+
option: U.value
|
|
615
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "config", "option"])),
|
|
616
|
+
O.value.length > 1 ? (c(), R("div", ml, [
|
|
617
|
+
i(I, {
|
|
618
|
+
icon: "delete",
|
|
619
|
+
variant: "tertiary",
|
|
620
|
+
onClick: (w) => K($)
|
|
621
|
+
}, null, 8, ["onClick"])
|
|
622
|
+
])) : M("", !0)
|
|
623
|
+
])
|
|
624
|
+
]))), 128))
|
|
625
|
+
], 64)),
|
|
626
|
+
i(I, {
|
|
627
|
+
class: "w-full",
|
|
628
|
+
variant: "primary",
|
|
629
|
+
icon: "add",
|
|
630
|
+
"icon-position": "prepend",
|
|
631
|
+
onClick: t[6] || (t[6] = (l) => X.value ? _e() : be())
|
|
632
|
+
})
|
|
633
|
+
])) : M("", !0),
|
|
634
|
+
i(Ut, {
|
|
635
|
+
modelValue: q.value,
|
|
636
|
+
"onUpdate:modelValue": t[7] || (t[7] = (l) => q.value = l),
|
|
637
|
+
options: xe.value
|
|
638
|
+
}, null, 8, ["modelValue", "options"]),
|
|
639
|
+
i(W, { class: "mt-2 fm-typo-en-body-lg-600" }, {
|
|
640
|
+
default: _(() => [
|
|
641
|
+
Ge(B(o(p)("report.section.filter.applyWidget")), 1)
|
|
642
|
+
]),
|
|
643
|
+
_: 1
|
|
644
|
+
}),
|
|
645
|
+
z.tiles.length > 0 ? (c(), R("div", cl, [
|
|
646
|
+
(c(!0), R(he, null, qe(Fe.value, (l) => (c(), R("div", {
|
|
647
|
+
key: l.value,
|
|
648
|
+
class: "flex items-center"
|
|
649
|
+
}, [
|
|
650
|
+
i(V, {
|
|
651
|
+
modelValue: ee.value,
|
|
652
|
+
"onUpdate:modelValue": t[8] || (t[8] = ($) => ee.value = $),
|
|
653
|
+
label: l.label,
|
|
654
|
+
value: l.value
|
|
655
|
+
}, null, 8, ["modelValue", "label", "value"]),
|
|
656
|
+
a(l) ? (c(), T(Z, {
|
|
657
|
+
key: 0,
|
|
658
|
+
content: a(l) ?? void 0,
|
|
659
|
+
"z-index": 99,
|
|
660
|
+
class: "ml-2"
|
|
661
|
+
}, {
|
|
662
|
+
default: _(() => [
|
|
663
|
+
i(H, {
|
|
664
|
+
name: "warning",
|
|
665
|
+
class: "text-fm-color-system-error-300"
|
|
666
|
+
})
|
|
667
|
+
]),
|
|
668
|
+
_: 2
|
|
669
|
+
}, 1032, ["content"])) : M("", !0)
|
|
670
|
+
]))), 128))
|
|
671
|
+
])) : (c(), T(W, {
|
|
672
|
+
key: 4,
|
|
673
|
+
class: "fm-typo-en-body-lg-400",
|
|
674
|
+
label: o(p)("report.section.filter.noWidget")
|
|
675
|
+
}, null, 8, ["label"]))
|
|
676
|
+
];
|
|
677
|
+
}),
|
|
678
|
+
_: 1
|
|
679
|
+
}, 512)
|
|
680
|
+
]),
|
|
681
|
+
"dialog-footer": _(() => [
|
|
682
|
+
t[10] || (t[10] = v("div", { class: "grow" }, null, -1)),
|
|
683
|
+
i(I, {
|
|
684
|
+
label: o(p)("report.common.cancel"),
|
|
685
|
+
variant: "tertiary",
|
|
686
|
+
onClick: re
|
|
687
|
+
}, null, 8, ["label"]),
|
|
688
|
+
i(I, {
|
|
689
|
+
label: o(p)("report.common.confirm"),
|
|
690
|
+
onClick: Me
|
|
691
|
+
}, null, 8, ["label"])
|
|
692
|
+
]),
|
|
693
|
+
_: 1
|
|
694
|
+
}, 8, ["modelValue"]);
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
}), vl = 8.4375, fl = 1024 ** 4, gl = {
|
|
698
|
+
MY: { rate: 4, currency: "MYR", symbol: "RM" },
|
|
699
|
+
TH: { rate: 33, currency: "THB", symbol: "฿" },
|
|
700
|
+
SG: { rate: 1.29, currency: "SGD", symbol: "S$" },
|
|
701
|
+
ID: { rate: 17900, currency: "IDR", symbol: "Rp" }
|
|
702
|
+
}, bl = { rate: 1, currency: "USD", symbol: "$" };
|
|
703
|
+
function mt(z, p) {
|
|
704
|
+
const d = z / fl * vl, { rate: y, currency: s, symbol: h } = gl[p] ?? bl;
|
|
705
|
+
return {
|
|
706
|
+
amount: d * y,
|
|
707
|
+
currency: s,
|
|
708
|
+
symbol: h,
|
|
709
|
+
costUsd: d
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function ct(z, p) {
|
|
713
|
+
return z < 0.01 ? `< ${p}0.01` : `${p}${z.toFixed(2)}`;
|
|
714
|
+
}
|
|
715
|
+
const yl = { class: "flex flex-col gap-16" }, hl = {
|
|
716
|
+
key: 0,
|
|
717
|
+
class: "flex flex-col gap-8"
|
|
718
|
+
}, wl = { class: "flex items-center gap-4 pb-8 border-b border-neutral-300" }, _l = ["title"], Fl = { class: "fm-typo-en-title-sm-600 pt-8" }, xl = { class: "mx-16 flex flex-col gap-12 py-4" }, Vl = { class: "fm-typo-en-body-lg-600" }, Cl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary" }, kl = { class: "flex flex-col gap-12 border-t border-neutral-200 pt-12" }, Tl = { class: "fm-typo-en-body-lg-600" }, Sl = { class: "grid grid-cols-2 items-end gap-12" }, $l = { class: "flex flex-col gap-8 min-w-0" }, Dl = { class: "fm-typo-en-body-sm-600 whitespace-nowrap" }, Ol = { class: "flex gap-8" }, Il = { class: "grid grid-cols-2 items-end gap-12" }, Ul = { class: "flex flex-col gap-8 min-w-0" }, Bl = { class: "fm-typo-en-body-sm-600 whitespace-nowrap" }, Nl = { class: "flex gap-8" }, Ml = {
|
|
719
|
+
key: 1,
|
|
720
|
+
class: "rounded-md border border-dashed border-neutral-300 p-12 text-center fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
721
|
+
}, Rl = ["onClick"], zl = ["title"], ql = {
|
|
722
|
+
key: 0,
|
|
723
|
+
class: "text-fm-color-typo-secondary"
|
|
724
|
+
}, Pl = { class: "text-fm-color-system-error-300" }, El = { class: "w-full text-left" }, Ll = /* @__PURE__ */ we({
|
|
725
|
+
__name: "TileDrillPanel",
|
|
726
|
+
props: {
|
|
727
|
+
report: {}
|
|
728
|
+
},
|
|
729
|
+
emits: ["add-widget"],
|
|
730
|
+
setup(z, { emit: p }) {
|
|
731
|
+
const d = z, y = p, { t: s, te: h } = Ee(), P = [
|
|
732
|
+
{ label: s("report.tile.widget.icon.small"), value: He.Small },
|
|
733
|
+
{ label: s("report.tile.widget.icon.medium"), value: He.Medium },
|
|
734
|
+
{ label: s("report.tile.widget.icon.large"), value: He.Large },
|
|
735
|
+
{ label: s("report.tile.widget.icon.extraLarge"), value: He.ExtraLarge }
|
|
736
|
+
], Q = [
|
|
737
|
+
{ label: s("report.tile.widget.icon.material"), value: Ie.Material },
|
|
738
|
+
{ label: s("report.tile.widget.icon.customSvg"), value: Ie.Custom }
|
|
739
|
+
], S = rt(), F = nt(), { promptMessage: U } = it(), ee = at(), q = b(() => {
|
|
740
|
+
const n = [];
|
|
741
|
+
let a = d.report.tiles;
|
|
742
|
+
for (const e of Oe.value) {
|
|
743
|
+
const t = a.find((m) => m.id === e);
|
|
744
|
+
if (!t) break;
|
|
745
|
+
n.push(t), a = t.tiles ?? [];
|
|
746
|
+
}
|
|
747
|
+
return n;
|
|
748
|
+
});
|
|
749
|
+
ge(q, (n) => {
|
|
750
|
+
n.length !== Oe.value.length && (Oe.value = n.map((a) => a.id));
|
|
751
|
+
});
|
|
752
|
+
const r = b(() => q.value[q.value.length - 1] ?? null), O = b(() => q.value[q.value.length - 2] ?? null), k = b(
|
|
753
|
+
() => r.value ? r.value.tiles ?? [] : d.report.tiles
|
|
754
|
+
), Y = b(() => {
|
|
755
|
+
var n;
|
|
756
|
+
return ((n = r.value) == null ? void 0 : n.id) ?? null;
|
|
757
|
+
}), ne = b(() => q.value.length === 0), ce = b(() => {
|
|
758
|
+
var n;
|
|
759
|
+
return ((n = r.value) == null ? void 0 : n.tab) === !0;
|
|
760
|
+
}), A = b(() => {
|
|
761
|
+
var n;
|
|
762
|
+
return ((n = O.value) == null ? void 0 : n.tab) === !0;
|
|
763
|
+
}), j = b(
|
|
764
|
+
() => q.value.reduce((n, a) => a.tab ? n : n + 1, 1)
|
|
765
|
+
), x = b(() => !ce.value && j.value < ht), X = b(() => ne.value);
|
|
766
|
+
function le(n) {
|
|
767
|
+
n.widget || (Oe.value = [...Oe.value, n.id]);
|
|
768
|
+
}
|
|
769
|
+
function oe() {
|
|
770
|
+
Oe.value = Oe.value.slice(0, -1);
|
|
771
|
+
}
|
|
772
|
+
function se(n) {
|
|
773
|
+
if (!n) return "";
|
|
774
|
+
const a = `report.widget.types.${n.toLowerCase()}`;
|
|
775
|
+
return h(a) ? s(a) : We(s, h, n, "other");
|
|
776
|
+
}
|
|
777
|
+
function ue(n, a) {
|
|
778
|
+
return n.widget ? n.widget.title ? se(n.widget.title) : s("report.editor.widget", { index: a + 1 }) : n.tabTitle !== void 0 ? n.tabTitle || s("report.editor.tab", { index: a + 1 }) : n.title ? n.title : n.tab ? s("report.editor.tabGroup") : s("report.editor.group");
|
|
779
|
+
}
|
|
780
|
+
function de(n, a) {
|
|
781
|
+
return !n.widget && ce.value ? n.tabTitle || s("report.editor.tab", { index: a + 1 }) : ue(n, a);
|
|
782
|
+
}
|
|
783
|
+
function E(n) {
|
|
784
|
+
var a;
|
|
785
|
+
return ((a = n.tiles) == null ? void 0 : a.length) ?? 0;
|
|
786
|
+
}
|
|
787
|
+
const G = b(
|
|
788
|
+
() => q.value.map((n, a) => ue(n, a)).join(" › ")
|
|
789
|
+
);
|
|
790
|
+
function J(n, a) {
|
|
791
|
+
yt.value = Y.value, ee.editingTileIndex = a, ee.editingTile = JSON.parse(JSON.stringify(n)), S.push({ name: "tileEditor", query: F.query });
|
|
792
|
+
}
|
|
793
|
+
function pe(n, a) {
|
|
794
|
+
k.value.splice(a + 1, 0, Rt(n));
|
|
795
|
+
}
|
|
796
|
+
async function be(n, a) {
|
|
797
|
+
var m;
|
|
798
|
+
if (!await U({
|
|
799
|
+
title: s("report.editor.deleteWidget"),
|
|
800
|
+
message: s("report.editor.deleteWidgetConfirm", { title: de(n, a) })
|
|
801
|
+
})) return;
|
|
802
|
+
const t = st(n);
|
|
803
|
+
k.value.splice(a, 1), (m = d.report.globalFilters) == null || m.forEach((g) => {
|
|
804
|
+
var V;
|
|
805
|
+
g.tileIds = (V = g.tileIds) == null ? void 0 : V.filter((D) => !t.includes(D));
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
function K() {
|
|
809
|
+
r.value && (r.value.tiles || (r.value.tiles = []), r.value.tiles.push(zt(r.value.tiles.length + 1)));
|
|
810
|
+
}
|
|
811
|
+
function _e() {
|
|
812
|
+
k.value.push(qt());
|
|
813
|
+
}
|
|
814
|
+
function ae() {
|
|
815
|
+
k.value.push(Pt());
|
|
816
|
+
}
|
|
817
|
+
function Se(n) {
|
|
818
|
+
var e;
|
|
819
|
+
const a = Number((e = n.size) == null ? void 0 : e.width);
|
|
820
|
+
n.size || (n.size = { width: 12, height: 12 }), !Number.isFinite(a) || a < 1 ? n.size.width = 1 : a > 12 && (n.size.width = 12);
|
|
821
|
+
}
|
|
822
|
+
function Ue(n) {
|
|
823
|
+
var e;
|
|
824
|
+
const a = Number((e = n.size) == null ? void 0 : e.height);
|
|
825
|
+
n.size || (n.size = { width: 12, height: 12 }), !Number.isFinite(a) || a < 1 ? n.size.height = 1 : a > 12 && (n.size.height = 12);
|
|
826
|
+
}
|
|
827
|
+
function $e(n, a) {
|
|
828
|
+
const e = Number(n[a]);
|
|
829
|
+
!Number.isFinite(e) || e < 1 ? n[a] = 1 : e > 24 && (n[a] = 24);
|
|
830
|
+
}
|
|
831
|
+
const ve = b({
|
|
832
|
+
get: () => {
|
|
833
|
+
var n;
|
|
834
|
+
return ((n = r.value) == null ? void 0 : n.titleFontSize) ?? 16;
|
|
835
|
+
},
|
|
836
|
+
set: (n) => {
|
|
837
|
+
r.value && (r.value.titleFontSize = n ?? void 0);
|
|
838
|
+
}
|
|
839
|
+
}), fe = b({
|
|
840
|
+
get: () => {
|
|
841
|
+
var n;
|
|
842
|
+
return ((n = r.value) == null ? void 0 : n.descriptionFontSize) ?? 14;
|
|
843
|
+
},
|
|
844
|
+
set: (n) => {
|
|
845
|
+
r.value && (r.value.descriptionFontSize = n ?? void 0);
|
|
846
|
+
}
|
|
847
|
+
}), ye = b({
|
|
848
|
+
get: () => {
|
|
849
|
+
var n, a, e;
|
|
850
|
+
return ((n = r.value) == null ? void 0 : n.tabIconType) ?? ((e = (a = r.value) == null ? void 0 : a.tabIcon) != null && e.trim().startsWith("<svg") ? Ie.Custom : Ie.Material);
|
|
851
|
+
},
|
|
852
|
+
set: (n) => {
|
|
853
|
+
r.value && (r.value.tabIconType = n);
|
|
854
|
+
}
|
|
855
|
+
}), Fe = b({
|
|
856
|
+
get: () => {
|
|
857
|
+
var n, a;
|
|
858
|
+
return ye.value === Ie.Custom ? Kt(((n = r.value) == null ? void 0 : n.tabIcon) ?? "") : ((a = r.value) == null ? void 0 : a.tabIcon) ?? "";
|
|
859
|
+
},
|
|
860
|
+
set: (n) => {
|
|
861
|
+
r.value && (r.value.tabIcon = ye.value === Ie.Custom ? Qt(n) : n.trim());
|
|
862
|
+
}
|
|
863
|
+
}), xe = L(!1), De = L(null), Be = L([]);
|
|
864
|
+
function Ne(n) {
|
|
865
|
+
const a = [
|
|
866
|
+
{ parentId: null, label: s("report.editor.topLevel"), level: 1 }
|
|
867
|
+
], e = (m, g, V) => {
|
|
868
|
+
let D = 0;
|
|
869
|
+
m.forEach((I) => {
|
|
870
|
+
var W;
|
|
871
|
+
if (!I.widget)
|
|
872
|
+
if (I.tab) {
|
|
873
|
+
const H = `${V}${s("report.editor.tabGroup")}`;
|
|
874
|
+
(W = I.tiles) == null || W.forEach((Z, me) => {
|
|
875
|
+
const f = `${H} › ${Z.tabTitle || s("report.editor.tab", { index: me + 1 })}`;
|
|
876
|
+
a.push({ parentId: Z.id, label: f, level: g + 1 }), e(Z.tiles ?? [], g + 1, `${f} › `);
|
|
877
|
+
});
|
|
878
|
+
} else {
|
|
879
|
+
D += 1;
|
|
880
|
+
const H = `${V}${I.title || `${s("report.editor.group")} ${D}`}`;
|
|
881
|
+
a.push({ parentId: I.id, label: H, level: g + 1 }), e(I.tiles ?? [], g + 1, `${H} › `);
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
};
|
|
885
|
+
e(d.report.tiles, 1, "");
|
|
886
|
+
const t = new Set(st(n));
|
|
887
|
+
return a.filter(
|
|
888
|
+
(m) => m.parentId !== Y.value && !(m.parentId && t.has(m.parentId)) && Lt(n, m.level)
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
function Me(n) {
|
|
892
|
+
De.value = n, Be.value = Ne(n), xe.value = !0;
|
|
893
|
+
}
|
|
894
|
+
function re(n) {
|
|
895
|
+
const a = De.value;
|
|
896
|
+
if (!a) return;
|
|
897
|
+
const e = k.value.indexOf(a);
|
|
898
|
+
e >= 0 && k.value.splice(e, 1), Et(d.report.tiles, n.parentId).push(a), xe.value = !1, De.value = null;
|
|
899
|
+
}
|
|
900
|
+
return (n, a) => {
|
|
901
|
+
const e = C("FmButton"), t = C("FmTextField"), m = C("FmSelect"), g = C("FmTextarea"), V = C("FmStepperField"), D = C("FmIcon"), I = C("FmMenuItem"), W = C("FmMenu"), H = C("FmList"), Z = C("FmListItem"), me = C("FmDialog");
|
|
902
|
+
return c(), R("div", yl, [
|
|
903
|
+
ne.value ? M("", !0) : (c(), R("div", hl, [
|
|
904
|
+
v("div", wl, [
|
|
905
|
+
i(e, {
|
|
906
|
+
icon: "arrow_back",
|
|
907
|
+
variant: "tertiary",
|
|
908
|
+
class: "-ml-8",
|
|
909
|
+
onClick: oe
|
|
910
|
+
}),
|
|
911
|
+
v("p", {
|
|
912
|
+
class: "fm-typo-en-body-md-600 line-clamp-1 overflow-hidden break-all min-w-0 grow text-left",
|
|
913
|
+
title: G.value
|
|
914
|
+
}, B(G.value), 9, _l)
|
|
915
|
+
]),
|
|
916
|
+
A.value && r.value ? (c(), T(t, {
|
|
917
|
+
key: 0,
|
|
918
|
+
modelValue: r.value.tabTitle,
|
|
919
|
+
"onUpdate:modelValue": a[0] || (a[0] = (f) => r.value.tabTitle = f),
|
|
920
|
+
label: o(s)("report.editor.tabName"),
|
|
921
|
+
placeholder: o(s)("report.editor.tabName")
|
|
922
|
+
}, null, 8, ["modelValue", "label", "placeholder"])) : M("", !0),
|
|
923
|
+
A.value && r.value ? (c(), T(m, {
|
|
924
|
+
key: 1,
|
|
925
|
+
modelValue: ye.value,
|
|
926
|
+
"onUpdate:modelValue": a[1] || (a[1] = (f) => ye.value = f),
|
|
927
|
+
label: o(s)("report.tile.widget.icon.type"),
|
|
928
|
+
items: Q
|
|
929
|
+
}, null, 8, ["modelValue", "label"])) : M("", !0),
|
|
930
|
+
A.value && r.value && ye.value === o(Ie).Material ? (c(), T(t, {
|
|
931
|
+
key: 2,
|
|
932
|
+
modelValue: Fe.value,
|
|
933
|
+
"onUpdate:modelValue": a[2] || (a[2] = (f) => Fe.value = f),
|
|
934
|
+
label: o(s)("report.tile.widget.icon.materialName"),
|
|
935
|
+
placeholder: o(s)("report.tile.widget.icon.materialPlaceholder")
|
|
936
|
+
}, null, 8, ["modelValue", "label", "placeholder"])) : A.value && r.value ? (c(), T(g, {
|
|
937
|
+
key: 3,
|
|
938
|
+
modelValue: Fe.value,
|
|
939
|
+
"onUpdate:modelValue": a[3] || (a[3] = (f) => Fe.value = f),
|
|
940
|
+
label: o(s)("report.tile.widget.icon.customSvg"),
|
|
941
|
+
placeholder: o(s)("report.tile.widget.icon.customPlaceholder")
|
|
942
|
+
}, null, 8, ["modelValue", "label", "placeholder"])) : M("", !0),
|
|
943
|
+
A.value && r.value ? (c(), T(m, {
|
|
944
|
+
key: 4,
|
|
945
|
+
modelValue: r.value.tabIconSize,
|
|
946
|
+
"onUpdate:modelValue": a[4] || (a[4] = (f) => r.value.tabIconSize = f),
|
|
947
|
+
label: o(s)("report.tile.widget.icon.size"),
|
|
948
|
+
items: P
|
|
949
|
+
}, null, 8, ["modelValue", "label"])) : M("", !0),
|
|
950
|
+
!A.value && r.value ? (c(), T(Le, {
|
|
951
|
+
key: 5,
|
|
952
|
+
"is-open": !1
|
|
953
|
+
}, {
|
|
954
|
+
header: _(() => [
|
|
955
|
+
v("p", Fl, B(o(s)("report.editor.groupDetails")), 1),
|
|
956
|
+
a[23] || (a[23] = v("div", { class: "grow" }, null, -1))
|
|
957
|
+
]),
|
|
958
|
+
content: _(() => [
|
|
959
|
+
v("div", xl, [
|
|
960
|
+
i(t, {
|
|
961
|
+
modelValue: r.value.title,
|
|
962
|
+
"onUpdate:modelValue": a[5] || (a[5] = (f) => r.value.title = f),
|
|
963
|
+
label: o(s)("report.editor.groupTitle"),
|
|
964
|
+
placeholder: o(s)("report.editor.groupTitlePlaceholder")
|
|
965
|
+
}, null, 8, ["modelValue", "label", "placeholder"]),
|
|
966
|
+
i(g, {
|
|
967
|
+
modelValue: r.value.description,
|
|
968
|
+
"onUpdate:modelValue": a[6] || (a[6] = (f) => r.value.description = f),
|
|
969
|
+
placeholder: o(s)("report.editor.groupDescriptionPlaceholder")
|
|
970
|
+
}, {
|
|
971
|
+
label: _(() => [
|
|
972
|
+
v("p", Vl, B(o(s)("report.editor.groupDescription")), 1),
|
|
973
|
+
v("p", Cl, " (" + B(o(s)("report.editor.optional")) + ") ", 1)
|
|
974
|
+
]),
|
|
975
|
+
_: 1
|
|
976
|
+
}, 8, ["modelValue", "placeholder"]),
|
|
977
|
+
v("div", kl, [
|
|
978
|
+
v("p", Tl, B(o(s)("report.editor.typography")), 1),
|
|
979
|
+
v("div", Sl, [
|
|
980
|
+
i(V, {
|
|
981
|
+
modelValue: ve.value,
|
|
982
|
+
"onUpdate:modelValue": a[7] || (a[7] = (f) => ve.value = f),
|
|
983
|
+
modelModifiers: { number: !0 },
|
|
984
|
+
class: "w-full",
|
|
985
|
+
label: o(s)("report.editor.titleSize"),
|
|
986
|
+
max: 24,
|
|
987
|
+
min: 1,
|
|
988
|
+
type: "number",
|
|
989
|
+
onBlur: a[8] || (a[8] = (f) => $e(r.value, "titleFontSize"))
|
|
990
|
+
}, null, 8, ["modelValue", "label"]),
|
|
991
|
+
v("div", $l, [
|
|
992
|
+
v("p", Dl, B(o(s)("report.editor.titleFormatting")), 1),
|
|
993
|
+
v("div", Ol, [
|
|
994
|
+
i(e, {
|
|
995
|
+
"append-icon": "format_bold",
|
|
996
|
+
"model-value": r.value.titleBold ?? !0,
|
|
997
|
+
variant: "tertiary",
|
|
998
|
+
"icon-color": r.value.titleBold ?? !0 ? "neutral-gray-400" : "neutral-gray-300",
|
|
999
|
+
"bg-color": r.value.titleBold ?? !0 ? "neutral-gray-100" : "neutral-white",
|
|
1000
|
+
class: "rounded-sm",
|
|
1001
|
+
title: o(s)("report.editor.bold"),
|
|
1002
|
+
onClick: a[9] || (a[9] = (f) => r.value.titleBold = !(r.value.titleBold ?? !0))
|
|
1003
|
+
}, null, 8, ["model-value", "icon-color", "bg-color", "title"]),
|
|
1004
|
+
i(e, {
|
|
1005
|
+
"append-icon": "format_italic",
|
|
1006
|
+
"model-value": r.value.titleItalic ?? !1,
|
|
1007
|
+
variant: "tertiary",
|
|
1008
|
+
"icon-color": r.value.titleItalic ? "neutral-gray-400" : "neutral-gray-300",
|
|
1009
|
+
"bg-color": r.value.titleItalic ? "neutral-gray-100" : "neutral-white",
|
|
1010
|
+
class: "rounded-sm",
|
|
1011
|
+
title: o(s)("report.editor.italic"),
|
|
1012
|
+
onClick: a[10] || (a[10] = (f) => r.value.titleItalic = !r.value.titleItalic)
|
|
1013
|
+
}, null, 8, ["model-value", "icon-color", "bg-color", "title"]),
|
|
1014
|
+
i(e, {
|
|
1015
|
+
"append-icon": "format_underlined",
|
|
1016
|
+
"model-value": r.value.titleUnderline ?? !1,
|
|
1017
|
+
variant: "tertiary",
|
|
1018
|
+
"icon-color": r.value.titleUnderline ? "neutral-gray-400" : "neutral-gray-300",
|
|
1019
|
+
"bg-color": r.value.titleUnderline ? "neutral-gray-100" : "neutral-white",
|
|
1020
|
+
class: "rounded-sm",
|
|
1021
|
+
title: o(s)("report.editor.underline"),
|
|
1022
|
+
onClick: a[11] || (a[11] = (f) => r.value.titleUnderline = !r.value.titleUnderline)
|
|
1023
|
+
}, null, 8, ["model-value", "icon-color", "bg-color", "title"])
|
|
1024
|
+
])
|
|
1025
|
+
])
|
|
1026
|
+
]),
|
|
1027
|
+
v("div", Il, [
|
|
1028
|
+
i(V, {
|
|
1029
|
+
modelValue: fe.value,
|
|
1030
|
+
"onUpdate:modelValue": a[12] || (a[12] = (f) => fe.value = f),
|
|
1031
|
+
modelModifiers: { number: !0 },
|
|
1032
|
+
class: "w-full",
|
|
1033
|
+
label: o(s)("report.editor.descriptionSize"),
|
|
1034
|
+
max: 24,
|
|
1035
|
+
min: 1,
|
|
1036
|
+
type: "number",
|
|
1037
|
+
onBlur: a[13] || (a[13] = (f) => $e(r.value, "descriptionFontSize"))
|
|
1038
|
+
}, null, 8, ["modelValue", "label"]),
|
|
1039
|
+
v("div", Ul, [
|
|
1040
|
+
v("p", Bl, B(o(s)("report.editor.descriptionFormatting")), 1),
|
|
1041
|
+
v("div", Nl, [
|
|
1042
|
+
i(e, {
|
|
1043
|
+
"append-icon": "format_bold",
|
|
1044
|
+
"model-value": r.value.descriptionBold ?? !1,
|
|
1045
|
+
variant: "tertiary",
|
|
1046
|
+
"icon-color": r.value.descriptionBold ? "neutral-gray-400" : "neutral-gray-300",
|
|
1047
|
+
"bg-color": r.value.descriptionBold ? "neutral-gray-100" : "neutral-white",
|
|
1048
|
+
class: "rounded-sm",
|
|
1049
|
+
title: o(s)("report.editor.bold"),
|
|
1050
|
+
onClick: a[14] || (a[14] = (f) => r.value.descriptionBold = !r.value.descriptionBold)
|
|
1051
|
+
}, null, 8, ["model-value", "icon-color", "bg-color", "title"]),
|
|
1052
|
+
i(e, {
|
|
1053
|
+
"append-icon": "format_italic",
|
|
1054
|
+
"model-value": r.value.descriptionItalic ?? !1,
|
|
1055
|
+
variant: "tertiary",
|
|
1056
|
+
"icon-color": r.value.descriptionItalic ? "neutral-gray-400" : "neutral-gray-300",
|
|
1057
|
+
"bg-color": r.value.descriptionItalic ? "neutral-gray-100" : "neutral-white",
|
|
1058
|
+
class: "rounded-sm",
|
|
1059
|
+
title: o(s)("report.editor.italic"),
|
|
1060
|
+
onClick: a[15] || (a[15] = (f) => r.value.descriptionItalic = !r.value.descriptionItalic)
|
|
1061
|
+
}, null, 8, ["model-value", "icon-color", "bg-color", "title"]),
|
|
1062
|
+
i(e, {
|
|
1063
|
+
"append-icon": "format_underlined",
|
|
1064
|
+
"model-value": r.value.descriptionUnderline ?? !1,
|
|
1065
|
+
variant: "tertiary",
|
|
1066
|
+
"icon-color": r.value.descriptionUnderline ? "neutral-gray-400" : "neutral-gray-300",
|
|
1067
|
+
"bg-color": r.value.descriptionUnderline ? "neutral-gray-100" : "neutral-white",
|
|
1068
|
+
class: "rounded-sm",
|
|
1069
|
+
title: o(s)("report.editor.underline"),
|
|
1070
|
+
onClick: a[16] || (a[16] = (f) => r.value.descriptionUnderline = !r.value.descriptionUnderline)
|
|
1071
|
+
}, null, 8, ["model-value", "icon-color", "bg-color", "title"])
|
|
1072
|
+
])
|
|
1073
|
+
])
|
|
1074
|
+
])
|
|
1075
|
+
])
|
|
1076
|
+
])
|
|
1077
|
+
]),
|
|
1078
|
+
_: 1
|
|
1079
|
+
})) : M("", !0),
|
|
1080
|
+
!A.value && r.value ? (c(), T(t, {
|
|
1081
|
+
key: 6,
|
|
1082
|
+
modelValue: r.value.size.width,
|
|
1083
|
+
"onUpdate:modelValue": a[17] || (a[17] = (f) => r.value.size.width = f),
|
|
1084
|
+
modelModifiers: { number: !0 },
|
|
1085
|
+
type: "number",
|
|
1086
|
+
label: o(s)("report.editor.width"),
|
|
1087
|
+
onBlur: a[18] || (a[18] = (f) => Se(r.value))
|
|
1088
|
+
}, null, 8, ["modelValue", "label"])) : M("", !0),
|
|
1089
|
+
!A.value && r.value ? (c(), T(t, {
|
|
1090
|
+
key: 7,
|
|
1091
|
+
modelValue: r.value.size.height,
|
|
1092
|
+
"onUpdate:modelValue": a[19] || (a[19] = (f) => r.value.size.height = f),
|
|
1093
|
+
modelModifiers: { number: !0 },
|
|
1094
|
+
type: "number",
|
|
1095
|
+
label: o(s)("report.editor.height"),
|
|
1096
|
+
onBlur: a[20] || (a[20] = (f) => Ue(r.value))
|
|
1097
|
+
}, null, 8, ["modelValue", "label"])) : M("", !0)
|
|
1098
|
+
])),
|
|
1099
|
+
k.value.length === 0 ? (c(), R("div", Ml, B(o(s)("report.editor.emptyLevel")), 1)) : (c(), T(H, { key: 2 }, {
|
|
1100
|
+
default: _(() => [
|
|
1101
|
+
i(o(bt), {
|
|
1102
|
+
list: k.value,
|
|
1103
|
+
"item-key": "id",
|
|
1104
|
+
class: "flex flex-col gap-2 cursor-grab",
|
|
1105
|
+
handle: ".handle"
|
|
1106
|
+
}, {
|
|
1107
|
+
item: _(({ element: f, index: u }) => [
|
|
1108
|
+
v("div", {
|
|
1109
|
+
class: Pe(["flex items-center gap-8 px-12 py-8 border rounded-md border-neutral-300 hover:bg-fm-color-opacity-sm", f.widget ? "cursor-grab" : "cursor-pointer"]),
|
|
1110
|
+
onClick: (l) => le(f)
|
|
1111
|
+
}, [
|
|
1112
|
+
i(D, {
|
|
1113
|
+
name: "drag_handle",
|
|
1114
|
+
class: "handle shrink-0 !cursor-grab"
|
|
1115
|
+
}),
|
|
1116
|
+
v("p", {
|
|
1117
|
+
class: "flex-1 min-w-0 truncate text-left fm-typo-en-body-lg-400",
|
|
1118
|
+
title: de(f, u)
|
|
1119
|
+
}, [
|
|
1120
|
+
Ge(B(de(f, u)) + " ", 1),
|
|
1121
|
+
f.widget ? M("", !0) : (c(), R("span", ql, " · " + B(E(f)), 1))
|
|
1122
|
+
], 8, zl),
|
|
1123
|
+
f.widget ? M("", !0) : (c(), T(D, {
|
|
1124
|
+
key: 0,
|
|
1125
|
+
name: "chevron_right",
|
|
1126
|
+
class: "shrink-0"
|
|
1127
|
+
})),
|
|
1128
|
+
i(W, {
|
|
1129
|
+
trigger: "click",
|
|
1130
|
+
shift: !0,
|
|
1131
|
+
"stop-click-propagation": !0,
|
|
1132
|
+
class: "shrink-0"
|
|
1133
|
+
}, {
|
|
1134
|
+
"menu-button": _(() => [
|
|
1135
|
+
i(e, {
|
|
1136
|
+
"append-icon": "more_vert",
|
|
1137
|
+
variant: "tertiary"
|
|
1138
|
+
})
|
|
1139
|
+
]),
|
|
1140
|
+
default: _(() => [
|
|
1141
|
+
f.widget ? (c(), T(I, {
|
|
1142
|
+
key: 0,
|
|
1143
|
+
label: o(s)("report.common.edit"),
|
|
1144
|
+
onClick: (l) => J(f, u)
|
|
1145
|
+
}, null, 8, ["label", "onClick"])) : M("", !0),
|
|
1146
|
+
f.tab ? M("", !0) : (c(), T(I, {
|
|
1147
|
+
key: 1,
|
|
1148
|
+
label: o(s)("report.editor.moveTo"),
|
|
1149
|
+
onClick: (l) => Me(f)
|
|
1150
|
+
}, null, 8, ["label", "onClick"])),
|
|
1151
|
+
i(I, {
|
|
1152
|
+
label: o(s)("report.common.duplicate"),
|
|
1153
|
+
onClick: (l) => pe(f, u)
|
|
1154
|
+
}, null, 8, ["label", "onClick"]),
|
|
1155
|
+
i(I, {
|
|
1156
|
+
onClick: (l) => be(f, u)
|
|
1157
|
+
}, {
|
|
1158
|
+
label: _(() => [
|
|
1159
|
+
v("p", Pl, B(o(s)("report.common.remove")), 1)
|
|
1160
|
+
]),
|
|
1161
|
+
_: 2
|
|
1162
|
+
}, 1032, ["onClick"])
|
|
1163
|
+
]),
|
|
1164
|
+
_: 2
|
|
1165
|
+
}, 1024)
|
|
1166
|
+
], 10, Rl)
|
|
1167
|
+
]),
|
|
1168
|
+
_: 1
|
|
1169
|
+
}, 8, ["list"])
|
|
1170
|
+
]),
|
|
1171
|
+
_: 1
|
|
1172
|
+
})),
|
|
1173
|
+
ce.value ? (c(), T(e, {
|
|
1174
|
+
key: 3,
|
|
1175
|
+
label: o(s)("report.editor.addTab"),
|
|
1176
|
+
variant: "secondary",
|
|
1177
|
+
icon: "add",
|
|
1178
|
+
"icon-position": "prepend",
|
|
1179
|
+
"border-color": o(Ce).ColorPrimary,
|
|
1180
|
+
"text-color": o(Ce).ColorPrimary,
|
|
1181
|
+
onClick: K
|
|
1182
|
+
}, null, 8, ["label", "border-color", "text-color"])) : (c(), T(W, {
|
|
1183
|
+
key: 4,
|
|
1184
|
+
trigger: "click",
|
|
1185
|
+
shift: !0
|
|
1186
|
+
}, {
|
|
1187
|
+
"menu-button": _(() => [
|
|
1188
|
+
i(e, {
|
|
1189
|
+
label: o(s)("report.common.add"),
|
|
1190
|
+
variant: "secondary",
|
|
1191
|
+
icon: "add",
|
|
1192
|
+
"icon-position": "prepend",
|
|
1193
|
+
class: "w-full",
|
|
1194
|
+
"border-color": o(Ce).ColorPrimary,
|
|
1195
|
+
"text-color": o(Ce).ColorPrimary
|
|
1196
|
+
}, null, 8, ["label", "border-color", "text-color"])
|
|
1197
|
+
]),
|
|
1198
|
+
default: _(() => [
|
|
1199
|
+
i(I, {
|
|
1200
|
+
label: o(s)("report.editor.addWidget"),
|
|
1201
|
+
onClick: a[21] || (a[21] = (f) => y("add-widget", Y.value))
|
|
1202
|
+
}, null, 8, ["label"]),
|
|
1203
|
+
x.value ? (c(), T(I, {
|
|
1204
|
+
key: 0,
|
|
1205
|
+
label: o(s)("report.editor.addGroup"),
|
|
1206
|
+
onClick: _e
|
|
1207
|
+
}, null, 8, ["label"])) : M("", !0),
|
|
1208
|
+
X.value ? (c(), T(I, {
|
|
1209
|
+
key: 1,
|
|
1210
|
+
label: o(s)("report.editor.addTabGroup"),
|
|
1211
|
+
onClick: ae
|
|
1212
|
+
}, null, 8, ["label"])) : M("", !0)
|
|
1213
|
+
]),
|
|
1214
|
+
_: 1
|
|
1215
|
+
})),
|
|
1216
|
+
i(me, {
|
|
1217
|
+
modelValue: xe.value,
|
|
1218
|
+
"onUpdate:modelValue": a[22] || (a[22] = (f) => xe.value = f),
|
|
1219
|
+
overlay: !0,
|
|
1220
|
+
"z-index": 10
|
|
1221
|
+
}, {
|
|
1222
|
+
"dialog-header": _(() => [
|
|
1223
|
+
Ge(B(o(s)("report.editor.moveTo")), 1)
|
|
1224
|
+
]),
|
|
1225
|
+
default: _(() => [
|
|
1226
|
+
i(H, null, {
|
|
1227
|
+
default: _(() => [
|
|
1228
|
+
(c(!0), R(he, null, qe(Be.value, (f) => (c(), T(Z, {
|
|
1229
|
+
key: f.parentId ?? "root",
|
|
1230
|
+
onClick: (u) => re(f)
|
|
1231
|
+
}, {
|
|
1232
|
+
default: _(() => [
|
|
1233
|
+
v("p", El, B(f.label), 1)
|
|
1234
|
+
]),
|
|
1235
|
+
_: 2
|
|
1236
|
+
}, 1032, ["onClick"]))), 128))
|
|
1237
|
+
]),
|
|
1238
|
+
_: 1
|
|
1239
|
+
})
|
|
1240
|
+
]),
|
|
1241
|
+
_: 1
|
|
1242
|
+
}, 8, ["modelValue"])
|
|
1243
|
+
]);
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
}), Gl = { class: "flex flex-col gap-24 top-0 bg-fm-color-neutral-white z-10" }, Wl = { class: "flex flex-col gap-24 top-0 bg-fm-color-neutral-white z-10" }, Al = { class: "flex items-center gap-8" }, Hl = {
|
|
1247
|
+
key: 2,
|
|
1248
|
+
class: "flex flex-col gap-8 rounded-md border border-fm-color-border px-16 py-12"
|
|
1249
|
+
}, jl = { class: "fm-typo-en-body-sm-400" }, Jl = { class: "fm-typo-en-body-sm-400 font-bold" }, Kl = { class: "space-y-1 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ql = { class: "flex flex-col gap-24 top-0 bg-fm-color-neutral-white z-10" }, Yl = { class: "flex items-center gap-1 max-w-[195px] w-[195px]" }, Xl = { class: "line-clamp-2 overflow-hidden max-w-[195px] w-[195px]" }, pt = /* @__PURE__ */ we({
|
|
1250
|
+
__name: "ReportEditorTab",
|
|
1251
|
+
props: /* @__PURE__ */ ke({
|
|
1252
|
+
hideConfiguration: {
|
|
1253
|
+
type: Boolean,
|
|
1254
|
+
default: !1
|
|
1255
|
+
}
|
|
1256
|
+
}, {
|
|
1257
|
+
modelValue: { required: !0 },
|
|
1258
|
+
modelModifiers: {}
|
|
1259
|
+
}),
|
|
1260
|
+
emits: /* @__PURE__ */ ke(["hideConfiguration"], ["update:modelValue"]),
|
|
1261
|
+
setup(z, { emit: p }) {
|
|
1262
|
+
const d = Te(z, "modelValue"), { breakpoints: y } = Je(), s = z, h = p, P = rt(), Q = nt(), S = L(), {
|
|
1263
|
+
currentSelectWidgetType: F,
|
|
1264
|
+
categories: U,
|
|
1265
|
+
editingTile: ee,
|
|
1266
|
+
editingTileIndex: q,
|
|
1267
|
+
editingGlobalFilter: r,
|
|
1268
|
+
editingGlobalFilterIndex: O
|
|
1269
|
+
} = ze(at()), { schemas: k } = ze(Gt()), { globalFilters: Y } = ze(ut()), { getGlobalFilterLabel: ne } = ut(), { promptMessage: ce } = it(), A = L(!1), j = L(!1), { t: x, te: X, locale: le } = Ee(), oe = L(void 0), se = b(() => {
|
|
1270
|
+
const u = Xe(d.value.tiles).flatMap((l) => {
|
|
1271
|
+
var ie;
|
|
1272
|
+
const $ = l.widget.config.schemaNames ?? [], w = ((ie = l.widget.config.joinDatasources) == null ? void 0 : ie.flatMap((Ae) => Ae.schemaNames ?? [])) ?? [];
|
|
1273
|
+
return [...$, ...w];
|
|
1274
|
+
});
|
|
1275
|
+
return [...new Set(u)].reduce((l, $) => {
|
|
1276
|
+
const w = k.value.find((ie) => ie.name === $);
|
|
1277
|
+
return w && l.push(w), l;
|
|
1278
|
+
}, []);
|
|
1279
|
+
}), ue = L(null);
|
|
1280
|
+
function de(u) {
|
|
1281
|
+
ue.value = u, j.value = !0;
|
|
1282
|
+
}
|
|
1283
|
+
ge(
|
|
1284
|
+
() => F.value,
|
|
1285
|
+
() => {
|
|
1286
|
+
F.value !== void 0 && (oe.value = Yt(F.value), ee.value = oe.value, q.value = -1, yt.value = ue.value, P.push({
|
|
1287
|
+
name: "tileEditor",
|
|
1288
|
+
query: Q.query
|
|
1289
|
+
}));
|
|
1290
|
+
},
|
|
1291
|
+
{ immediate: !0 }
|
|
1292
|
+
), ge(
|
|
1293
|
+
() => d.value.tiles,
|
|
1294
|
+
(u) => {
|
|
1295
|
+
Wt(u);
|
|
1296
|
+
},
|
|
1297
|
+
{ immediate: !0, deep: !0 }
|
|
1298
|
+
);
|
|
1299
|
+
const E = [
|
|
1300
|
+
{
|
|
1301
|
+
label: "report.common.edit",
|
|
1302
|
+
selected: !1,
|
|
1303
|
+
variant: "tertiary",
|
|
1304
|
+
onClick: (u) => {
|
|
1305
|
+
var l;
|
|
1306
|
+
O.value = u, r.value = JSON.parse(JSON.stringify((l = d.value.globalFilters) == null ? void 0 : l[u])), A.value = !0;
|
|
1307
|
+
}
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
label: "report.common.duplicate",
|
|
1311
|
+
selected: !1,
|
|
1312
|
+
variant: "tertiary",
|
|
1313
|
+
onClick: (u) => {
|
|
1314
|
+
var w;
|
|
1315
|
+
const l = (w = d.value.globalFilters) == null ? void 0 : w[u];
|
|
1316
|
+
if (!l) return;
|
|
1317
|
+
const $ = JSON.parse(JSON.stringify(l));
|
|
1318
|
+
d.value.globalFilters || (d.value.globalFilters = []), d.value.globalFilters.push($);
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
label: "report.common.remove",
|
|
1323
|
+
selected: !1,
|
|
1324
|
+
variant: "destructive",
|
|
1325
|
+
onClick: async (u) => {
|
|
1326
|
+
var w, ie;
|
|
1327
|
+
const l = (w = d.value.globalFilters) == null ? void 0 : w[u];
|
|
1328
|
+
if (!l) return;
|
|
1329
|
+
await ce({
|
|
1330
|
+
title: x("report.editor.deleteWidget"),
|
|
1331
|
+
message: x("report.editor.deleteWidgetConfirm", {
|
|
1332
|
+
title: ne(l)
|
|
1333
|
+
})
|
|
1334
|
+
}) && ((ie = d.value.globalFilters) == null || ie.splice(u, 1));
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
], G = b(() => U.value.map((u) => ({
|
|
1338
|
+
label: x(`report.category.${u.name}`),
|
|
1339
|
+
value: u.id
|
|
1340
|
+
}))), { sessionUser: J } = Xt(), pe = b(
|
|
1341
|
+
() => {
|
|
1342
|
+
var u, l, $, w;
|
|
1343
|
+
return ((l = (u = J.value) == null ? void 0 : u.role) == null ? void 0 : l.isAdmin) === !0 || ((w = ($ = J.value) == null ? void 0 : $.role) == null ? void 0 : w.isStaff) === !0;
|
|
1344
|
+
}
|
|
1345
|
+
), be = b({
|
|
1346
|
+
get: () => d.value.queryVersion === "v2",
|
|
1347
|
+
set: (u) => {
|
|
1348
|
+
d.value.queryVersion = u ? "v2" : "v1", u ? d.value.queryDatasource = d.value.queryDatasource ?? je.Postgres : d.value.queryDatasource = void 0;
|
|
1349
|
+
}
|
|
1350
|
+
}), K = [
|
|
1351
|
+
{ label: x("report.common.postgresql"), value: je.Postgres },
|
|
1352
|
+
{ label: x("report.common.bigquery"), value: je.BigQuery }
|
|
1353
|
+
], _e = [
|
|
1354
|
+
{ label: x("report.common.noBatch"), value: "none" },
|
|
1355
|
+
{ label: x("report.common.days"), value: "days" },
|
|
1356
|
+
{ label: x("report.common.locations"), value: "locations" }
|
|
1357
|
+
], ae = b({
|
|
1358
|
+
get: () => {
|
|
1359
|
+
var u, l;
|
|
1360
|
+
return (u = d.value.batch) != null && u.days ? "days" : (l = d.value.batch) != null && l.locations ? "locations" : "none";
|
|
1361
|
+
},
|
|
1362
|
+
set: (u) => {
|
|
1363
|
+
var l, $;
|
|
1364
|
+
u === "none" ? d.value.batch = void 0 : u === "days" ? d.value.batch = { days: ((l = d.value.batch) == null ? void 0 : l.days) || 1 } : u === "locations" && (d.value.batch = { locations: (($ = d.value.batch) == null ? void 0 : $.locations) || 10 });
|
|
1365
|
+
}
|
|
1366
|
+
}), Se = b({
|
|
1367
|
+
get: () => {
|
|
1368
|
+
var u, l;
|
|
1369
|
+
if (ae.value === "days") return ((u = d.value.batch) == null ? void 0 : u.days) ?? 1;
|
|
1370
|
+
if (ae.value === "locations") return ((l = d.value.batch) == null ? void 0 : l.locations) ?? 1;
|
|
1371
|
+
},
|
|
1372
|
+
set: (u) => {
|
|
1373
|
+
u && (ae.value === "days" ? d.value.batch = { days: u } : ae.value === "locations" && (d.value.batch = { locations: u }));
|
|
1374
|
+
}
|
|
1375
|
+
}), Ue = b({
|
|
1376
|
+
get: () => We(x, X, d.value.name, "other"),
|
|
1377
|
+
set: (u) => {
|
|
1378
|
+
d.value.name = u;
|
|
1379
|
+
}
|
|
1380
|
+
}), { country: $e } = ze(Zt()), {
|
|
1381
|
+
dateRange: ve,
|
|
1382
|
+
compareDateRange: fe,
|
|
1383
|
+
timeRange: ye,
|
|
1384
|
+
selectedLocationIds: Fe,
|
|
1385
|
+
businessDataVersion: xe,
|
|
1386
|
+
restaurants: De,
|
|
1387
|
+
warehouses: Be
|
|
1388
|
+
} = ze(el()), Ne = b(
|
|
1389
|
+
() => d.value.queryVersion === "v2" && d.value.queryDatasource === je.BigQuery
|
|
1390
|
+
), Me = b(() => Ne.value && pe.value), re = L(null), n = L(!1), a = b(() => {
|
|
1391
|
+
const u = ve.value.startDate ?? ve.value.endDate;
|
|
1392
|
+
return u ? {
|
|
1393
|
+
startDate: u,
|
|
1394
|
+
endDate: u
|
|
1395
|
+
} : ve.value;
|
|
1396
|
+
}), e = b(() => {
|
|
1397
|
+
const u = fe.value.startDate ?? fe.value.endDate;
|
|
1398
|
+
return u ? {
|
|
1399
|
+
startDate: u,
|
|
1400
|
+
endDate: u
|
|
1401
|
+
} : fe.value;
|
|
1402
|
+
}), t = b(() => {
|
|
1403
|
+
const u = d.value.batch;
|
|
1404
|
+
if (!u) return 1;
|
|
1405
|
+
if (u.locations) {
|
|
1406
|
+
const l = De.value.length + Be.value.length;
|
|
1407
|
+
return Math.max(1, Math.ceil(l / u.locations));
|
|
1408
|
+
}
|
|
1409
|
+
return 1;
|
|
1410
|
+
}), m = b(() => {
|
|
1411
|
+
if (re.value == null || re.value === 0) return null;
|
|
1412
|
+
const u = re.value * t.value;
|
|
1413
|
+
return mt(u, $e.value);
|
|
1414
|
+
}), g = b(() => re.value == null || re.value === 0 ? null : mt(re.value, $e.value)), V = b(() => m.value ? ct(m.value.amount, m.value.symbol) : ""), D = b(() => g.value ? ct(g.value.amount, g.value.symbol) : ""), I = b(() => t.value === 1 ? x("report.common.estimatedCostBatchSingular") : x("report.common.estimatedCostBatchPlural")), W = b(() => n.value ? "..." : !V.value || !D.value ? "--" : x("report.common.estimatedCostFormula", {
|
|
1415
|
+
batchCount: t.value,
|
|
1416
|
+
batchLabel: I.value,
|
|
1417
|
+
baseCost: D.value,
|
|
1418
|
+
totalCost: V.value
|
|
1419
|
+
}));
|
|
1420
|
+
let H = [];
|
|
1421
|
+
const Z = tl(async () => {
|
|
1422
|
+
if (!Me.value) return;
|
|
1423
|
+
const u = Xe(d.value.tiles).filter(
|
|
1424
|
+
(l) => {
|
|
1425
|
+
var $;
|
|
1426
|
+
return (($ = l.widget.config.schemaNames) == null ? void 0 : $.length) > 0;
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1429
|
+
if (u.length === 0) {
|
|
1430
|
+
re.value = null;
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
n.value = !0, H.forEach((l) => l.abort()), H = [];
|
|
1434
|
+
try {
|
|
1435
|
+
const l = await Promise.all(
|
|
1436
|
+
u.map(($) => {
|
|
1437
|
+
const w = new AbortController();
|
|
1438
|
+
return H.push(w), At({
|
|
1439
|
+
widget: $.widget,
|
|
1440
|
+
signal: w.signal,
|
|
1441
|
+
tileId: $.id,
|
|
1442
|
+
scopedDateRange: a.value,
|
|
1443
|
+
scopedCompareDateRange: e.value
|
|
1444
|
+
});
|
|
1445
|
+
})
|
|
1446
|
+
);
|
|
1447
|
+
re.value = l.reduce(($, w) => $ + (w.totalBytesProcessed ?? 0), 0);
|
|
1448
|
+
} catch (l) {
|
|
1449
|
+
l.code !== "ERR_CANCELED" && (re.value = null);
|
|
1450
|
+
} finally {
|
|
1451
|
+
n.value = !1;
|
|
1452
|
+
}
|
|
1453
|
+
}, 1e3);
|
|
1454
|
+
ge(
|
|
1455
|
+
[
|
|
1456
|
+
() => d.value.tiles,
|
|
1457
|
+
() => d.value.queryVersion,
|
|
1458
|
+
() => d.value.queryDatasource,
|
|
1459
|
+
() => d.value.batch,
|
|
1460
|
+
() => ve.value,
|
|
1461
|
+
() => ye.value,
|
|
1462
|
+
() => fe.value,
|
|
1463
|
+
() => Fe.value,
|
|
1464
|
+
() => xe.value
|
|
1465
|
+
],
|
|
1466
|
+
() => {
|
|
1467
|
+
Z();
|
|
1468
|
+
},
|
|
1469
|
+
{ deep: !0 }
|
|
1470
|
+
), ft(() => {
|
|
1471
|
+
Z();
|
|
1472
|
+
}), St(() => {
|
|
1473
|
+
H.forEach((u) => u.abort());
|
|
1474
|
+
});
|
|
1475
|
+
function me(u) {
|
|
1476
|
+
var l;
|
|
1477
|
+
return !((l = u.tileIds) != null && l.length);
|
|
1478
|
+
}
|
|
1479
|
+
function f(u) {
|
|
1480
|
+
return !se.value.find((l) => l.name === u.schemaName);
|
|
1481
|
+
}
|
|
1482
|
+
return ge(
|
|
1483
|
+
() => d.value.globalFilters,
|
|
1484
|
+
(u) => {
|
|
1485
|
+
Y.value = JSON.parse(JSON.stringify(u || []));
|
|
1486
|
+
},
|
|
1487
|
+
{ deep: !0, immediate: !0 }
|
|
1488
|
+
), (u, l) => {
|
|
1489
|
+
const $ = C("FmTextField"), w = C("FmSelect"), ie = C("FmSwitch"), Ae = C("FmButton"), Ke = C("FmIcon"), Qe = C("FmTooltip"), _t = C("FmMenuItem"), Ft = C("FmMenu"), xt = C("FmListItem"), Vt = C("FmList"), Ct = C("FmForm");
|
|
1490
|
+
return c(), T($t(o(y).lg || o(y).md ? al : rl), {
|
|
1491
|
+
"model-value": s.hideConfiguration,
|
|
1492
|
+
"onUpdate:modelValue": l[12] || (l[12] = (N) => h("hideConfiguration", N))
|
|
1493
|
+
}, {
|
|
1494
|
+
default: _(() => [
|
|
1495
|
+
i(pl, {
|
|
1496
|
+
"is-open": A.value,
|
|
1497
|
+
"onUpdate:isOpen": l[0] || (l[0] = (N) => A.value = N),
|
|
1498
|
+
"global-filter": o(r),
|
|
1499
|
+
tiles: o(Xe)(d.value.tiles),
|
|
1500
|
+
schemas: se.value,
|
|
1501
|
+
"onUpdate:globalFilter": l[1] || (l[1] = (N) => {
|
|
1502
|
+
N && (d.value.globalFilters || (d.value.globalFilters = []), typeof o(O) == "number" && o(O) >= 0 ? d.value.globalFilters[o(O)] = N : d.value.globalFilters.push(N));
|
|
1503
|
+
})
|
|
1504
|
+
}, null, 8, ["is-open", "global-filter", "tiles", "schemas"]),
|
|
1505
|
+
i(ll, {
|
|
1506
|
+
modelValue: o(F),
|
|
1507
|
+
"onUpdate:modelValue": l[2] || (l[2] = (N) => gt(F) ? F.value = N : null),
|
|
1508
|
+
"is-open": j.value,
|
|
1509
|
+
"onUpdate:isOpen": l[3] || (l[3] = (N) => j.value = N)
|
|
1510
|
+
}, null, 8, ["modelValue", "is-open"]),
|
|
1511
|
+
i(Ct, {
|
|
1512
|
+
ref_key: "form",
|
|
1513
|
+
ref: S,
|
|
1514
|
+
class: "px-6 py-16 flex flex-col gap-24 overflow-y-auto overflow-x-hidden"
|
|
1515
|
+
}, {
|
|
1516
|
+
default: _(() => [
|
|
1517
|
+
i(Le, { class: "border-solid" }, {
|
|
1518
|
+
header: _(() => [
|
|
1519
|
+
v("p", null, B(o(x)("report.editor.reportInfo")), 1),
|
|
1520
|
+
l[13] || (l[13] = v("div", { class: "grow" }, null, -1))
|
|
1521
|
+
]),
|
|
1522
|
+
content: _(() => [
|
|
1523
|
+
v("div", Gl, [
|
|
1524
|
+
i($, {
|
|
1525
|
+
modelValue: Ue.value,
|
|
1526
|
+
"onUpdate:modelValue": l[4] || (l[4] = (N) => Ue.value = N),
|
|
1527
|
+
label: o(x)("report.common.name"),
|
|
1528
|
+
placeholder: o(x)("report.common.name")
|
|
1529
|
+
}, null, 8, ["modelValue", "label", "placeholder"]),
|
|
1530
|
+
(c(), T(w, {
|
|
1531
|
+
key: `category-${o(le)}`,
|
|
1532
|
+
modelValue: d.value.category,
|
|
1533
|
+
"onUpdate:modelValue": l[5] || (l[5] = (N) => d.value.category = N),
|
|
1534
|
+
label: o(x)("report.common.category"),
|
|
1535
|
+
items: G.value
|
|
1536
|
+
}, null, 8, ["modelValue", "label", "items"])),
|
|
1537
|
+
i($, {
|
|
1538
|
+
modelValue: d.value.description,
|
|
1539
|
+
"onUpdate:modelValue": l[6] || (l[6] = (N) => d.value.description = N),
|
|
1540
|
+
label: o(x)("report.common.description"),
|
|
1541
|
+
placeholder: o(x)("report.common.description")
|
|
1542
|
+
}, null, 8, ["modelValue", "label", "placeholder"])
|
|
1543
|
+
])
|
|
1544
|
+
]),
|
|
1545
|
+
_: 1
|
|
1546
|
+
}),
|
|
1547
|
+
i(Le, {
|
|
1548
|
+
class: "border-solid",
|
|
1549
|
+
"is-open": !1
|
|
1550
|
+
}, {
|
|
1551
|
+
header: _(() => [
|
|
1552
|
+
v("p", null, B(o(x)("report.editor.advancedUsage")), 1),
|
|
1553
|
+
l[14] || (l[14] = v("div", { class: "grow" }, null, -1))
|
|
1554
|
+
]),
|
|
1555
|
+
content: _(() => [
|
|
1556
|
+
v("div", Wl, [
|
|
1557
|
+
v("div", Al, [
|
|
1558
|
+
l[15] || (l[15] = v("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, "V2", -1)),
|
|
1559
|
+
i(ie, {
|
|
1560
|
+
modelValue: be.value,
|
|
1561
|
+
"onUpdate:modelValue": l[7] || (l[7] = (N) => be.value = N)
|
|
1562
|
+
}, null, 8, ["modelValue"])
|
|
1563
|
+
]),
|
|
1564
|
+
be.value && pe.value ? (c(), T(w, {
|
|
1565
|
+
key: 0,
|
|
1566
|
+
modelValue: d.value.queryDatasource,
|
|
1567
|
+
"onUpdate:modelValue": l[8] || (l[8] = (N) => d.value.queryDatasource = N),
|
|
1568
|
+
label: o(x)("report.common.queryDatasource"),
|
|
1569
|
+
items: K
|
|
1570
|
+
}, null, 8, ["modelValue", "label"])) : M("", !0),
|
|
1571
|
+
i(w, {
|
|
1572
|
+
modelValue: ae.value,
|
|
1573
|
+
"onUpdate:modelValue": l[9] || (l[9] = (N) => ae.value = N),
|
|
1574
|
+
label: o(x)("report.common.batch"),
|
|
1575
|
+
items: _e
|
|
1576
|
+
}, null, 8, ["modelValue", "label"]),
|
|
1577
|
+
ae.value !== "none" ? (c(), T($, {
|
|
1578
|
+
key: 1,
|
|
1579
|
+
modelValue: Se.value,
|
|
1580
|
+
"onUpdate:modelValue": l[10] || (l[10] = (N) => Se.value = N),
|
|
1581
|
+
modelModifiers: { number: !0 },
|
|
1582
|
+
label: ae.value === "days" ? o(x)("report.common.days") : o(x)("report.common.locations"),
|
|
1583
|
+
type: "number"
|
|
1584
|
+
}, null, 8, ["modelValue", "label"])) : M("", !0),
|
|
1585
|
+
Me.value ? (c(), R("div", Hl, [
|
|
1586
|
+
v("span", jl, B(o(x)("report.common.estimatedBqCost")), 1),
|
|
1587
|
+
v("p", Jl, B(W.value), 1),
|
|
1588
|
+
v("div", Kl, [
|
|
1589
|
+
v("div", null, "* " + B(o(x)("report.common.estimatedCostGuidelineBigQuery")), 1),
|
|
1590
|
+
v("div", null, "* " + B(o(x)("report.common.estimatedCostGuidelineDateRange")), 1),
|
|
1591
|
+
v("div", null, "* " + B(o(x)("report.common.estimatedCostGuidelineLocationBatch")), 1)
|
|
1592
|
+
])
|
|
1593
|
+
])) : M("", !0)
|
|
1594
|
+
])
|
|
1595
|
+
]),
|
|
1596
|
+
_: 1
|
|
1597
|
+
}),
|
|
1598
|
+
i(Le, {
|
|
1599
|
+
class: "border-solid",
|
|
1600
|
+
"is-open": !1
|
|
1601
|
+
}, {
|
|
1602
|
+
header: _(() => [
|
|
1603
|
+
v("p", null, B(o(x)("report.section.filter.globalFilter")), 1),
|
|
1604
|
+
l[16] || (l[16] = v("div", { class: "grow" }, null, -1))
|
|
1605
|
+
]),
|
|
1606
|
+
content: _(() => [
|
|
1607
|
+
v("div", Ql, [
|
|
1608
|
+
i(Ae, {
|
|
1609
|
+
label: o(x)("report.section.filter.addGlobalFilter"),
|
|
1610
|
+
variant: "secondary",
|
|
1611
|
+
icon: "add",
|
|
1612
|
+
"icon-position": "prepend",
|
|
1613
|
+
"border-color": o(Ce).ColorPrimary,
|
|
1614
|
+
"text-color": o(Ce).ColorPrimary,
|
|
1615
|
+
onClick: l[11] || (l[11] = () => {
|
|
1616
|
+
O.value = null, r.value = null, A.value = !0;
|
|
1617
|
+
})
|
|
1618
|
+
}, null, 8, ["label", "border-color", "text-color"]),
|
|
1619
|
+
i(Vt, null, {
|
|
1620
|
+
default: _(() => [
|
|
1621
|
+
i(o(bt), {
|
|
1622
|
+
list: d.value.globalFilters,
|
|
1623
|
+
"item-key": "`${element.schemaName}-${element.name}`",
|
|
1624
|
+
class: "flex flex-col gap-2 cursor-grab",
|
|
1625
|
+
handle: ".handle"
|
|
1626
|
+
}, {
|
|
1627
|
+
item: _(({ element: N, index: kt }) => [
|
|
1628
|
+
i(xt, { class: "!cursor-grab border rounded-md border-neutral-300" }, {
|
|
1629
|
+
default: _(() => [
|
|
1630
|
+
i(Ke, {
|
|
1631
|
+
name: "drag_handle",
|
|
1632
|
+
class: "handle"
|
|
1633
|
+
}),
|
|
1634
|
+
v("div", Yl, [
|
|
1635
|
+
i(Qe, {
|
|
1636
|
+
"z-index": 99,
|
|
1637
|
+
content: o(ne)(N),
|
|
1638
|
+
class: "handle"
|
|
1639
|
+
}, {
|
|
1640
|
+
default: _(() => [
|
|
1641
|
+
v("p", Xl, B(o(ne)(N)), 1)
|
|
1642
|
+
]),
|
|
1643
|
+
_: 2
|
|
1644
|
+
}, 1032, ["content"]),
|
|
1645
|
+
f(N) ? (c(), T(Qe, {
|
|
1646
|
+
key: 0,
|
|
1647
|
+
content: o(x)("report.section.filter.missingSchema"),
|
|
1648
|
+
"z-index": 99
|
|
1649
|
+
}, {
|
|
1650
|
+
default: _(() => [
|
|
1651
|
+
i(Ke, {
|
|
1652
|
+
name: "warning",
|
|
1653
|
+
class: "text-fm-color-system-error-300"
|
|
1654
|
+
})
|
|
1655
|
+
]),
|
|
1656
|
+
_: 1
|
|
1657
|
+
}, 8, ["content"])) : me(N) ? (c(), T(Qe, {
|
|
1658
|
+
key: 1,
|
|
1659
|
+
content: o(x)("report.section.filter.missingTileIds"),
|
|
1660
|
+
"z-index": 99
|
|
1661
|
+
}, {
|
|
1662
|
+
default: _(() => [
|
|
1663
|
+
i(Ke, {
|
|
1664
|
+
name: "warning",
|
|
1665
|
+
class: "text-fm-color-system-warning-300"
|
|
1666
|
+
})
|
|
1667
|
+
]),
|
|
1668
|
+
_: 1
|
|
1669
|
+
}, 8, ["content"])) : M("", !0)
|
|
1670
|
+
]),
|
|
1671
|
+
l[17] || (l[17] = v("div", { class: "grow" }, null, -1)),
|
|
1672
|
+
i(Ft, {
|
|
1673
|
+
trigger: "click",
|
|
1674
|
+
shift: !0,
|
|
1675
|
+
"stop-click-propagation": !0
|
|
1676
|
+
}, {
|
|
1677
|
+
"menu-button": _(() => [
|
|
1678
|
+
i(Ae, {
|
|
1679
|
+
"append-icon": "more_vert",
|
|
1680
|
+
variant: "tertiary"
|
|
1681
|
+
})
|
|
1682
|
+
]),
|
|
1683
|
+
default: _(() => [
|
|
1684
|
+
(c(), R(he, null, qe(E, (Ye, Tt) => i(_t, {
|
|
1685
|
+
key: Tt,
|
|
1686
|
+
onClick: (fo) => Ye.onClick(kt)
|
|
1687
|
+
}, {
|
|
1688
|
+
label: _(() => [
|
|
1689
|
+
v("p", {
|
|
1690
|
+
class: Pe(
|
|
1691
|
+
Ye.variant === "destructive" ? " text-fm-color-system-error-300" : ""
|
|
1692
|
+
)
|
|
1693
|
+
}, B(o(x)(Ye.label)), 3)
|
|
1694
|
+
]),
|
|
1695
|
+
_: 2
|
|
1696
|
+
}, 1032, ["onClick"])), 64))
|
|
1697
|
+
]),
|
|
1698
|
+
_: 2
|
|
1699
|
+
}, 1024)
|
|
1700
|
+
]),
|
|
1701
|
+
_: 2
|
|
1702
|
+
}, 1024)
|
|
1703
|
+
]),
|
|
1704
|
+
_: 1
|
|
1705
|
+
}, 8, ["list"])
|
|
1706
|
+
]),
|
|
1707
|
+
_: 1
|
|
1708
|
+
})
|
|
1709
|
+
])
|
|
1710
|
+
]),
|
|
1711
|
+
_: 1
|
|
1712
|
+
}),
|
|
1713
|
+
i(Le, { class: "border-solid" }, {
|
|
1714
|
+
header: _(() => [
|
|
1715
|
+
v("p", null, B(o(x)("report.editor.widgets")), 1),
|
|
1716
|
+
l[18] || (l[18] = v("div", { class: "grow" }, null, -1))
|
|
1717
|
+
]),
|
|
1718
|
+
content: _(() => [
|
|
1719
|
+
i(Ll, {
|
|
1720
|
+
report: d.value,
|
|
1721
|
+
onAddWidget: de
|
|
1722
|
+
}, null, 8, ["report"])
|
|
1723
|
+
]),
|
|
1724
|
+
_: 1
|
|
1725
|
+
})
|
|
1726
|
+
]),
|
|
1727
|
+
_: 1
|
|
1728
|
+
}, 512)
|
|
1729
|
+
]),
|
|
1730
|
+
_: 1
|
|
1731
|
+
}, 8, ["model-value"]);
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
}), Zl = { class: "h-full w-full overflow-x-hidden" }, eo = { class: "flex flex-col bg-fm-color-neutral-white w-[400px]" }, to = { class: "flex bg-fm-color-neutral-white w-[88px]" }, lo = {
|
|
1735
|
+
key: 1,
|
|
1736
|
+
class: "w-full overflow-y-auto"
|
|
1737
|
+
}, oo = {
|
|
1738
|
+
key: 0,
|
|
1739
|
+
class: "w-full grid grid-cols-12 gap-[24px] p-24"
|
|
1740
|
+
}, ao = { class: "col-span-12 mb-4 flex flex-wrap gap-2 pb-2" }, ro = { key: 2 }, no = {
|
|
1741
|
+
key: 0,
|
|
1742
|
+
class: "grid grid-cols-12 gap-[16px]"
|
|
1743
|
+
}, io = { class: "col-span-12 mb-4 flex flex-wrap gap-2 pb-2" }, so = {
|
|
1744
|
+
key: 3,
|
|
1745
|
+
class: "h-full w-full flex items-start justify-center bg-fm-color-neutral-white py-24",
|
|
1746
|
+
style: { backgroundColor: "#F6F8FC" }
|
|
1747
|
+
}, uo = {
|
|
1748
|
+
key: 0,
|
|
1749
|
+
class: "w-full grid grid-cols-12 gap-[24px] p-24"
|
|
1750
|
+
}, mo = /* @__PURE__ */ we({
|
|
1751
|
+
__name: "ReportEditorViewport",
|
|
1752
|
+
props: /* @__PURE__ */ ke({
|
|
1753
|
+
hideConfiguration: { type: Boolean, required: !1, default: !1 },
|
|
1754
|
+
previewWidth: { type: Number, required: !0 },
|
|
1755
|
+
previewHeight: { type: Number, required: !0 },
|
|
1756
|
+
previewScale: { type: Number, required: !0 }
|
|
1757
|
+
}, {
|
|
1758
|
+
modelValue: { required: !0, default: () => {
|
|
1759
|
+
} },
|
|
1760
|
+
modelModifiers: {}
|
|
1761
|
+
}),
|
|
1762
|
+
emits: /* @__PURE__ */ ke(["hideConfiguration"], ["update:modelValue"]),
|
|
1763
|
+
setup(z, { emit: p }) {
|
|
1764
|
+
const { breakpoints: d } = Je(), y = Te(z, "modelValue"), s = b(() => {
|
|
1765
|
+
var F;
|
|
1766
|
+
return Ht((F = y.value) == null ? void 0 : F.tiles);
|
|
1767
|
+
}), h = z, P = b(() => h.previewWidth > 0 && h.previewHeight > 0), Q = b(() => d.value.sm || d.value.xs), S = p;
|
|
1768
|
+
return (F, U) => {
|
|
1769
|
+
const ee = C("FmCircularProgress"), q = C("FmButton"), r = C("FmMenuDivider"), O = C("FmCard");
|
|
1770
|
+
return c(), R("div", Zl, [
|
|
1771
|
+
y.value ? (c(), R(he, { key: 1 }, [
|
|
1772
|
+
P.value ? M("", !0) : (c(), T(Bt, {
|
|
1773
|
+
key: 0,
|
|
1774
|
+
"model-value": !h.hideConfiguration
|
|
1775
|
+
}, {
|
|
1776
|
+
right: _(() => [
|
|
1777
|
+
v("div", eo, [
|
|
1778
|
+
y.value ? (c(), T(pt, {
|
|
1779
|
+
key: 0,
|
|
1780
|
+
modelValue: y.value,
|
|
1781
|
+
"onUpdate:modelValue": U[0] || (U[0] = (k) => y.value = k),
|
|
1782
|
+
"hide-configuration": h.hideConfiguration,
|
|
1783
|
+
onHideConfiguration: U[1] || (U[1] = (k) => S("hideConfiguration", k))
|
|
1784
|
+
}, null, 8, ["modelValue", "hide-configuration"])) : M("", !0)
|
|
1785
|
+
])
|
|
1786
|
+
]),
|
|
1787
|
+
left: _(() => [
|
|
1788
|
+
v("div", to, [
|
|
1789
|
+
i(q, {
|
|
1790
|
+
variant: "secondary",
|
|
1791
|
+
icon: "keyboard_double_arrow_right",
|
|
1792
|
+
"border-color": o(Ce).ColorPrimary,
|
|
1793
|
+
"text-color": o(Ce).ColorPrimary,
|
|
1794
|
+
class: "m-24 my-16",
|
|
1795
|
+
size: "md",
|
|
1796
|
+
onClick: U[2] || (U[2] = (k) => S("hideConfiguration", !h.hideConfiguration))
|
|
1797
|
+
}, null, 8, ["border-color", "text-color"])
|
|
1798
|
+
])
|
|
1799
|
+
]),
|
|
1800
|
+
_: 1
|
|
1801
|
+
}, 8, ["model-value"])),
|
|
1802
|
+
i(r, {
|
|
1803
|
+
vertical: "",
|
|
1804
|
+
style: { margin: "0px" }
|
|
1805
|
+
}),
|
|
1806
|
+
!Q.value && !P.value ? (c(), R("div", lo, [
|
|
1807
|
+
y.value.tiles.length > 0 ? (c(), R("div", oo, [
|
|
1808
|
+
v("div", ao, [
|
|
1809
|
+
i(dt)
|
|
1810
|
+
]),
|
|
1811
|
+
i(Ze, {
|
|
1812
|
+
tiles: y.value.tiles,
|
|
1813
|
+
"report-id": y.value.id || "editing",
|
|
1814
|
+
"leaf-index-by-id": s.value,
|
|
1815
|
+
"hide-export": !0
|
|
1816
|
+
}, null, 8, ["tiles", "report-id", "leaf-index-by-id"])
|
|
1817
|
+
])) : (c(), T(tt, { key: 1 }))
|
|
1818
|
+
])) : Q.value && !P.value ? (c(), R("div", ro, [
|
|
1819
|
+
i(O, { class: "px-5 pb-28" }, {
|
|
1820
|
+
default: _(() => [
|
|
1821
|
+
y.value.tiles.length > 0 ? (c(), R("div", no, [
|
|
1822
|
+
v("div", io, [
|
|
1823
|
+
i(dt)
|
|
1824
|
+
]),
|
|
1825
|
+
i(Ze, {
|
|
1826
|
+
tiles: y.value.tiles,
|
|
1827
|
+
"report-id": y.value.id || "editing",
|
|
1828
|
+
"leaf-index-by-id": s.value,
|
|
1829
|
+
"hide-export": !0
|
|
1830
|
+
}, null, 8, ["tiles", "report-id", "leaf-index-by-id"])
|
|
1831
|
+
])) : (c(), T(tt, { key: 1 }))
|
|
1832
|
+
]),
|
|
1833
|
+
_: 1
|
|
1834
|
+
}),
|
|
1835
|
+
y.value ? (c(), T(pt, {
|
|
1836
|
+
key: 0,
|
|
1837
|
+
modelValue: y.value,
|
|
1838
|
+
"onUpdate:modelValue": U[3] || (U[3] = (k) => y.value = k),
|
|
1839
|
+
"hide-configuration": h.hideConfiguration,
|
|
1840
|
+
onHideConfiguration: U[4] || (U[4] = (k) => {
|
|
1841
|
+
S("hideConfiguration", k);
|
|
1842
|
+
})
|
|
1843
|
+
}, null, 8, ["modelValue", "hide-configuration"])) : M("", !0)
|
|
1844
|
+
])) : (c(), R("div", so, [
|
|
1845
|
+
v("div", {
|
|
1846
|
+
style: lt({
|
|
1847
|
+
transformOrigin: "top center",
|
|
1848
|
+
transform: `scale(${h.previewScale})`
|
|
1849
|
+
})
|
|
1850
|
+
}, [
|
|
1851
|
+
v("div", {
|
|
1852
|
+
class: "overflow-y-auto bg-white rounded-lg",
|
|
1853
|
+
style: lt({
|
|
1854
|
+
width: h.previewWidth + "px",
|
|
1855
|
+
height: h.previewHeight + "px"
|
|
1856
|
+
})
|
|
1857
|
+
}, [
|
|
1858
|
+
y.value.tiles.length > 0 ? (c(), R("div", uo, [
|
|
1859
|
+
i(Ze, {
|
|
1860
|
+
tiles: y.value.tiles,
|
|
1861
|
+
"report-id": y.value.id || "editing",
|
|
1862
|
+
"leaf-index-by-id": s.value,
|
|
1863
|
+
"hide-export": !0,
|
|
1864
|
+
"custom-screen-width": h.previewWidth
|
|
1865
|
+
}, null, 8, ["tiles", "report-id", "leaf-index-by-id", "custom-screen-width"])
|
|
1866
|
+
])) : (c(), T(tt, { key: 1 }))
|
|
1867
|
+
], 4)
|
|
1868
|
+
], 4)
|
|
1869
|
+
]))
|
|
1870
|
+
], 64)) : (c(), T(ee, { key: 0 }))
|
|
1871
|
+
]);
|
|
1872
|
+
};
|
|
1873
|
+
}
|
|
1874
|
+
}), co = { class: "flex items-center gap-4" }, po = { class: "flex justify-center items-center gap-2 w-full" }, vo = { class: "flex gap-4" }, Oo = /* @__PURE__ */ we({
|
|
1875
|
+
__name: "ReportEditor",
|
|
1876
|
+
setup(z) {
|
|
1877
|
+
const p = rt(), d = nt(), y = at(), { promptLoader: s } = Jt(), { t: h, te: P } = Ee(), { currentReport: Q, editingReport: S } = ze(y), { breakpoints: F } = Je(), U = b(() => {
|
|
1878
|
+
var E;
|
|
1879
|
+
return !((E = S.value) != null && E.editable);
|
|
1880
|
+
}), ee = b(() => {
|
|
1881
|
+
var E;
|
|
1882
|
+
return ((E = S.value) == null ? void 0 : E.name) ?? h("report.editor.newReport");
|
|
1883
|
+
}), q = b(() => We(h, P, ee.value, "other")), r = wt(), { promptMessage: O } = it(), k = L(!1), Y = b(() => [
|
|
1884
|
+
{ label: h("report.common.cancel"), value: "cancel", isPrimary: !1 },
|
|
1885
|
+
{ label: h("report.common.save"), value: "save", isPrimary: !0, prependIcon: "download" }
|
|
1886
|
+
]);
|
|
1887
|
+
async function ne() {
|
|
1888
|
+
if (!S.value || S.value.tiles.length === 0) {
|
|
1889
|
+
r.open({ message: h("report.messages.noWidget"), type: "error" });
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
if (jt(S.value.tiles) > ht) {
|
|
1893
|
+
r.open({ message: h("report.messages.tooDeepNesting"), type: "error" });
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
const E = U.value ? h("report.common.clone") : h("report.common.save");
|
|
1897
|
+
if (await O({
|
|
1898
|
+
title: `${h("report.messages.saveReport")}`,
|
|
1899
|
+
message: h("report.messages.confirmAction", { action: E, name: q.value })
|
|
1900
|
+
}))
|
|
1901
|
+
try {
|
|
1902
|
+
await s(async () => {
|
|
1903
|
+
if (U.value) {
|
|
1904
|
+
const J = JSON.parse(JSON.stringify(S.value));
|
|
1905
|
+
J.editable = !0, J.id = "", J.name = `${J.name} ${h("report.common.duplicate")}`, J.isDefault = !1, await y.createOrUpdateReport(J);
|
|
1906
|
+
} else
|
|
1907
|
+
S.value && await y.createOrUpdateReport(S.value);
|
|
1908
|
+
p.push({
|
|
1909
|
+
name: "reportView",
|
|
1910
|
+
query: d.query
|
|
1911
|
+
});
|
|
1912
|
+
});
|
|
1913
|
+
} catch (J) {
|
|
1914
|
+
console.log(J), r.open({
|
|
1915
|
+
message: h("report.messages.failedToAction", { action: E }),
|
|
1916
|
+
type: "error"
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
async function ce() {
|
|
1921
|
+
var G;
|
|
1922
|
+
if (!S.value) return;
|
|
1923
|
+
await O({
|
|
1924
|
+
title: h("report.common.report", 1),
|
|
1925
|
+
message: h("report.editor.notSaved", { name: (G = S.value) == null ? void 0 : G.name })
|
|
1926
|
+
}) && (S.value = JSON.parse(JSON.stringify(Q.value)), p.back());
|
|
1927
|
+
}
|
|
1928
|
+
ft(() => {
|
|
1929
|
+
S.value || p.push({ name: "reports" });
|
|
1930
|
+
});
|
|
1931
|
+
const A = [
|
|
1932
|
+
{
|
|
1933
|
+
labelKey: "report.common.default",
|
|
1934
|
+
width: void 0,
|
|
1935
|
+
height: void 0
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
labelKey: "report.editor.devices.desktop",
|
|
1939
|
+
width: 1920,
|
|
1940
|
+
height: 1080
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
labelKey: "report.editor.devices.tablet",
|
|
1944
|
+
width: 820,
|
|
1945
|
+
height: 1180
|
|
1946
|
+
},
|
|
1947
|
+
{
|
|
1948
|
+
labelKey: "report.editor.devices.phone",
|
|
1949
|
+
width: 390,
|
|
1950
|
+
height: 859
|
|
1951
|
+
}
|
|
1952
|
+
], j = L(A[0]), x = L(!1), X = b(() => x.value ? Math.max(j.value.width || 0, j.value.height || 0) : Math.min(j.value.width || 0, j.value.height || 0)), le = b(() => x.value ? Math.min(j.value.width || 0, j.value.height || 0) : Math.max(j.value.width || 0, j.value.height || 0)), oe = b(() => window.innerHeight - 72 - 56), se = b(() => {
|
|
1953
|
+
if (!X.value) return 1;
|
|
1954
|
+
let E = (oe.value - 48) / X.value, G = le.value * E;
|
|
1955
|
+
return G > window.innerWidth && (E = window.innerWidth / le.value, G = le.value * E), E > 1 ? 1 : E;
|
|
1956
|
+
});
|
|
1957
|
+
function ue(E) {
|
|
1958
|
+
j.value = E;
|
|
1959
|
+
}
|
|
1960
|
+
function de() {
|
|
1961
|
+
x.value = !x.value;
|
|
1962
|
+
}
|
|
1963
|
+
return (E, G) => {
|
|
1964
|
+
const J = C("FmTooltip"), pe = C("FmButton"), be = C("FmPageHead");
|
|
1965
|
+
return c(), T(Nt, null, {
|
|
1966
|
+
default: _(() => [
|
|
1967
|
+
i(be, {
|
|
1968
|
+
"data-editor-header": "true",
|
|
1969
|
+
actions: Y.value,
|
|
1970
|
+
"onClick:action": G[0] || (G[0] = (K) => {
|
|
1971
|
+
K === "cancel" && ce(), K === "save" && ne();
|
|
1972
|
+
})
|
|
1973
|
+
}, {
|
|
1974
|
+
title: _(() => [
|
|
1975
|
+
v("div", co, [
|
|
1976
|
+
i(J, {
|
|
1977
|
+
content: q.value,
|
|
1978
|
+
placement: "bottom"
|
|
1979
|
+
}, {
|
|
1980
|
+
default: _(() => [
|
|
1981
|
+
v("p", {
|
|
1982
|
+
class: Pe(`${o(F).sm || o(F).xs ? "hidden" : ""} text-ellipsis overflow-hidden text-nowrap fm-typo-en-title-md-600 w-[250px]`)
|
|
1983
|
+
}, B(q.value), 3)
|
|
1984
|
+
]),
|
|
1985
|
+
_: 1
|
|
1986
|
+
}, 8, ["content"]),
|
|
1987
|
+
v("div", po, [
|
|
1988
|
+
v("div", vo, [
|
|
1989
|
+
(c(), R(he, null, qe(A, (K) => {
|
|
1990
|
+
var _e;
|
|
1991
|
+
return i(pe, {
|
|
1992
|
+
key: K.labelKey,
|
|
1993
|
+
label: o(h)(K.labelKey),
|
|
1994
|
+
variant: ((_e = j.value) == null ? void 0 : _e.labelKey) === K.labelKey ? "primary" : "secondary",
|
|
1995
|
+
size: "md",
|
|
1996
|
+
onClick: (ae) => ue(K)
|
|
1997
|
+
}, null, 8, ["label", "variant", "onClick"]);
|
|
1998
|
+
}), 64))
|
|
1999
|
+
]),
|
|
2000
|
+
i(pe, {
|
|
2001
|
+
icon: "screen_rotation",
|
|
2002
|
+
variant: "tertiary",
|
|
2003
|
+
size: "md",
|
|
2004
|
+
class: "text-fm-color-typo-primary",
|
|
2005
|
+
onClick: de
|
|
2006
|
+
})
|
|
2007
|
+
])
|
|
2008
|
+
])
|
|
2009
|
+
]),
|
|
2010
|
+
_: 1
|
|
2011
|
+
}, 8, ["actions"]),
|
|
2012
|
+
o(S) ? (c(), T(mo, {
|
|
2013
|
+
key: 0,
|
|
2014
|
+
modelValue: o(S),
|
|
2015
|
+
"onUpdate:modelValue": G[1] || (G[1] = (K) => gt(S) ? S.value = K : null),
|
|
2016
|
+
style: lt({ height: oe.value + "px" }),
|
|
2017
|
+
class: Pe(o(F).lg || o(F).md ? "flex" : ""),
|
|
2018
|
+
"hide-configuration": k.value,
|
|
2019
|
+
"preview-width": le.value,
|
|
2020
|
+
"preview-height": X.value,
|
|
2021
|
+
"preview-scale": se.value,
|
|
2022
|
+
onHideConfiguration: G[2] || (G[2] = (K) => k.value = K)
|
|
2023
|
+
}, null, 8, ["modelValue", "style", "class", "hide-configuration", "preview-width", "preview-height", "preview-scale"])) : M("", !0)
|
|
2024
|
+
]),
|
|
2025
|
+
_: 1
|
|
2026
|
+
});
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
});
|
|
2030
|
+
export {
|
|
2031
|
+
Oo as default
|
|
2032
|
+
};
|