@feedmepos/mf-report 5.33.0 → 5.33.1

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