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