@feedmepos/mf-report 5.5.7-beta.0 → 5.5.8-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2514 @@
1
+ import { defineComponent as Y, mergeModels as X, useModel as W, computed as D, ref as A, resolveComponent as y, createElementBlock as L, openBlock as f, createVNode as d, createElementVNode as x, unref as n, withCtx as S, toDisplayString as B, Fragment as H, renderList as re, withModifiers as le, createTextVNode as ue, watch as me, createCommentVNode as _, createBlock as C, renderSlot as Te, resolveDynamicComponent as Se, normalizeClass as Ue, onMounted as Re, normalizeStyle as Me, isRef as je } from "vue";
2
+ import { useRoute as Ee, useRouter as Ae } from "vue-router";
3
+ import { h as Pe, d as ve, S as ge, W as qe, a as ze, T as He, _ as Ye } from "./TransitionFade-BP5asrDn.js";
4
+ import { W as N, a as Ge } from "./v4-Dzkr7vpG.js";
5
+ import { storeToRefs as we } from "pinia";
6
+ import { u as Ne } from "./message-dialog-UoMWOnil.js";
7
+ import { c as ke, d as De, p as Xe } from "./index-DqqTHE7n.js";
8
+ import { useSnackbar as Je, useBreakpoints as Oe, FmButtonColorThemeVariant as ce } from "@feedmepos/ui-library";
9
+ import { u as $e } from "./report-schema-OJAFh4P6.js";
10
+ import { _ as ie } from "./BaseDialog.vue_vue_type_script_setup_true_lang-DTNiGKgd.js";
11
+ import { _ as z } from "./SelectComponent.vue_vue_type_script_setup_true_lang-BVs1C4af.js";
12
+ import { u as Q, d as fe } from "./global-loader-BqFQzk46.js";
13
+ import { g as pe, l as oe, a as de, _ as Ie } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-B2WDEV5d.js";
14
+ import { _ as Le } from "./NoData.vue_vue_type_script_setup_true_lang-DI4X_DSc.js";
15
+ var te = /* @__PURE__ */ ((r) => (r.DateTime = "DATE_TIME", r.Hour = "HOUR", r.Day = "DAY", r.Week = "WEEK", r.Month = "MONTH", r.TimeOfDay = "TIME_OF_DAY", r.HourOfDay = "HOUR_OF_DAY", r.DayOfWeek = "DAY_OF_WEEK", r.DayOfMonth = "DAY_OF_MONTH", r.MonthOfYear = "MONTH_OF_YEAR", r.Year = "YEAR", r))(te || {}), ye = /* @__PURE__ */ ((r) => (r.Asc = "ASC", r.Desc = "DESC", r))(ye || {}), ee = /* @__PURE__ */ ((r) => (r.Equal = "EQUAL", r.NotEqual = "NOT_EQUAL", r.GreaterThan = "GREATER_THAN", r.LessThan = "LESS_THAN", r.GreaterThanOrEqual = "GREATER_THAN_OR_EQUAL", r.LessThanOrEqual = "LESS_THAN_OR_EQUAL", r.Between = "BETWEEN", r.Like = "LIKE", r.NotLike = "NOT_LIKE", r.And = "AND", r.Or = "OR", r))(ee || {}), ne = /* @__PURE__ */ ((r) => (r.String = "STRING", r.Timestamp = "TIMESTAMP", r.Bool = "BOOL", r.Numeric = "NUMERIC", r))(ne || {});
16
+ const xe = [
17
+ {
18
+ type: N.Circular,
19
+ maxDimension: null,
20
+ maxMetric: 1,
21
+ hasBreakdownDimension: !1,
22
+ canTranspose: !1,
23
+ isDrillConfigurable: !1,
24
+ hasLabel: !0,
25
+ hasXy: !1,
26
+ canRollup: !1,
27
+ showRollupPosition: !1,
28
+ canSearch: !1
29
+ },
30
+ {
31
+ type: N.Table,
32
+ maxDimension: null,
33
+ maxMetric: null,
34
+ hasBreakdownDimension: !1,
35
+ canTranspose: !1,
36
+ isDrillConfigurable: !0,
37
+ hasLabel: !1,
38
+ hasXy: !1,
39
+ canRollup: !0,
40
+ showRollupPosition: !0,
41
+ canSearch: !0
42
+ },
43
+ {
44
+ type: N.BarChart,
45
+ maxDimension: null,
46
+ maxMetric: 1,
47
+ hasBreakdownDimension: !0,
48
+ canTranspose: !0,
49
+ isDrillConfigurable: !1,
50
+ hasLabel: !0,
51
+ hasXy: !0,
52
+ canRollup: !1,
53
+ showRollupPosition: !1,
54
+ canSearch: !1
55
+ },
56
+ {
57
+ type: N.LineChart,
58
+ maxDimension: null,
59
+ maxMetric: 1,
60
+ hasBreakdownDimension: !0,
61
+ canTranspose: !0,
62
+ isDrillConfigurable: !1,
63
+ hasLabel: !0,
64
+ hasXy: !0,
65
+ canRollup: !1,
66
+ showRollupPosition: !1,
67
+ canSearch: !1
68
+ },
69
+ {
70
+ type: N.StackBarChart,
71
+ maxDimension: null,
72
+ maxMetric: 1,
73
+ hasBreakdownDimension: !0,
74
+ canTranspose: !0,
75
+ isDrillConfigurable: !1,
76
+ hasLabel: !0,
77
+ hasXy: !0,
78
+ canRollup: !1,
79
+ showRollupPosition: !1,
80
+ canSearch: !1
81
+ },
82
+ {
83
+ type: N.StackLineChart,
84
+ maxDimension: null,
85
+ maxMetric: 1,
86
+ hasBreakdownDimension: !0,
87
+ canTranspose: !0,
88
+ isDrillConfigurable: !1,
89
+ hasLabel: !0,
90
+ hasXy: !0,
91
+ canRollup: !1,
92
+ showRollupPosition: !1,
93
+ canSearch: !1
94
+ },
95
+ {
96
+ type: N.Scorecard,
97
+ maxDimension: null,
98
+ maxMetric: 1,
99
+ hasBreakdownDimension: !1,
100
+ canTranspose: !1,
101
+ isDrillConfigurable: !1,
102
+ hasLabel: !1,
103
+ hasXy: !1,
104
+ canRollup: !1,
105
+ showRollupPosition: !1,
106
+ canSearch: !1
107
+ },
108
+ {
109
+ type: N.Spacer,
110
+ maxDimension: 0,
111
+ maxMetric: 0,
112
+ hasBreakdownDimension: !1,
113
+ canTranspose: !1,
114
+ isDrillConfigurable: !1,
115
+ hasLabel: !1,
116
+ hasXy: !1,
117
+ canRollup: !1,
118
+ showRollupPosition: !1,
119
+ canSearch: !1
120
+ }
121
+ ], We = { class: "flex flex-col my-2 gap-8" }, Ke = { class: "fm-typo-en-body-lg-600" }, Qe = { class: "text-sm text-fm-color-neutral-gray-400" }, Ze = ["onClick"], el = { class: "fm-typo-en-body-lg-400 overflow-hidden text-ellipsis line-clamp-1" }, ll = /* @__PURE__ */ Y({
122
+ __name: "SchemaSection",
123
+ props: /* @__PURE__ */ X({
124
+ options: {
125
+ type: Array,
126
+ default: () => []
127
+ },
128
+ label: {
129
+ type: String,
130
+ default: "Schema"
131
+ }
132
+ }, {
133
+ modelValue: { required: !0 },
134
+ modelModifiers: {}
135
+ }),
136
+ emits: ["update:modelValue"],
137
+ setup(r) {
138
+ const { t: i } = Q(), l = W(r, "modelValue"), v = r, { schemas: c } = we($e()), s = D(
139
+ () => c.value.map((w) => ({
140
+ labels: [w.label],
141
+ value: w.name,
142
+ raw: w
143
+ }))
144
+ ), b = D(() => {
145
+ if (l.value.schemaNames.length === 0 || o.value === 0)
146
+ return s.value.filter((w) => !w.raw.isJoinOnly);
147
+ {
148
+ const w = l.value.schemaNames[0], p = c.value.find((t) => t.name === w), F = ((p == null ? void 0 : p.joins) || []).map((t) => t);
149
+ return s.value.filter((t) => F.includes(t.raw.name));
150
+ }
151
+ }), g = A(!1), u = A(""), o = A(), V = Je();
152
+ function T(w) {
153
+ var p;
154
+ return (p = c.value.find((F) => F.name === w)) == null ? void 0 : p.label;
155
+ }
156
+ function O(w) {
157
+ o.value = w, g.value = !0, w !== void 0 ? u.value = l.value.schemaNames[w] : u.value = "";
158
+ }
159
+ function h() {
160
+ u.value !== "" ? (o.value !== void 0 ? l.value.schemaNames[o.value] = u.value : l.value.schemaNames.push(u.value), g.value = !1) : V.open({ message: i("report.section.schema.nothingSelected"), type: "error" });
161
+ }
162
+ return (w, p) => {
163
+ const F = y("FmForm"), t = y("FmIcon"), a = y("FmField");
164
+ return f(), L("div", We, [
165
+ d(ie, {
166
+ modelValue: g.value,
167
+ "onUpdate:modelValue": p[1] || (p[1] = (e) => g.value = e),
168
+ title: v.label,
169
+ "primary-button-label": n(i)("report.common.confirm"),
170
+ "secondary-button-label": n(i)("report.common.cancel"),
171
+ onConfirm: h
172
+ }, {
173
+ content: S(() => [
174
+ d(F, { ref: "form" }, {
175
+ default: S(() => [
176
+ d(z, {
177
+ modelValue: u.value,
178
+ "onUpdate:modelValue": p[0] || (p[0] = (e) => u.value = e),
179
+ label: n(i)("report.section.schema.title"),
180
+ items: o.value === 0 ? s.value.map((e) => ({ label: e.labels[0], value: e.value })) : b.value.map((e) => ({
181
+ label: e.labels[0],
182
+ value: e.value
183
+ }))
184
+ }, null, 8, ["modelValue", "label", "items"])
185
+ ]),
186
+ _: 1
187
+ }, 512)
188
+ ]),
189
+ _: 1
190
+ }, 8, ["modelValue", "title", "primary-button-label", "secondary-button-label"]),
191
+ x("div", null, [
192
+ x("p", Ke, B(n(i)("report.section.schema.title")), 1),
193
+ x("p", Qe, B(n(i)("report.section.schema.description")), 1)
194
+ ]),
195
+ (f(!0), L(H, null, re(l.value.schemaNames, (e, m) => (f(), L("div", {
196
+ key: m,
197
+ class: "flex flex-col gap-2 w-full"
198
+ }, [
199
+ x("div", {
200
+ class: "flex items-center gap-2 border rounded-md border-neutral-300 p-2 h-[40px]",
201
+ onClick: (U) => O(m)
202
+ }, [
203
+ x("p", el, B(T(e)), 1),
204
+ p[3] || (p[3] = x("div", { class: "grow" }, null, -1)),
205
+ d(t, {
206
+ name: "close",
207
+ onClick: le(
208
+ () => {
209
+ l.value.schemaNames = n(Pe)(l.value.schemaNames, m);
210
+ },
211
+ ["stop"]
212
+ )
213
+ }, null, 8, ["onClick"])
214
+ ], 8, Ze)
215
+ ]))), 128)),
216
+ d(a, {
217
+ class: "text-fm-color-typo-tertiary",
218
+ onClick: p[2] || (p[2] = () => {
219
+ O();
220
+ })
221
+ }, {
222
+ default: S(() => [
223
+ ue(B(n(i)("report.section.schema.add")), 1)
224
+ ]),
225
+ _: 1
226
+ })
227
+ ]);
228
+ };
229
+ }
230
+ }), al = {
231
+ key: 0,
232
+ class: "flex flex-col my-2 gap-8"
233
+ }, ol = { class: "fm-typo-en-body-lg-600 text-ellipsis line-clamp-1" }, tl = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, nl = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, be = /* @__PURE__ */ Y({
234
+ __name: "DimensionSection",
235
+ props: /* @__PURE__ */ X({
236
+ options: {
237
+ type: Array,
238
+ default: () => []
239
+ },
240
+ label: {
241
+ type: String,
242
+ default: "Dimension"
243
+ },
244
+ max: {
245
+ type: Number,
246
+ default: void 0
247
+ },
248
+ config: {
249
+ type: Object,
250
+ default: () => {
251
+ }
252
+ },
253
+ hasRowColumn: {
254
+ type: Boolean,
255
+ default: !1
256
+ }
257
+ }, {
258
+ modelValue: {
259
+ required: !1,
260
+ default: []
261
+ },
262
+ modelModifiers: {}
263
+ }),
264
+ emits: ["update:modelValue"],
265
+ setup(r) {
266
+ const { t: i } = Q(), l = W(r, "modelValue"), v = r, c = A(!1), s = D(
267
+ () => l.value.map((a, e) => ({
268
+ index: e,
269
+ labels: [a.label || a.name],
270
+ value: a
271
+ }))
272
+ ), b = A(l.value.length > 0 ? 0 : void 0);
273
+ function g(a) {
274
+ var e, m;
275
+ c.value = !0, u.value = a != null && a.value ? JSON.parse(JSON.stringify(a.value)) : void 0, b.value = a == null ? void 0 : a.index, o.value = !!((e = u.value) != null && e.dataFormula || (m = u.value) != null && m.displayFormula);
276
+ }
277
+ D(() => !!v.max && l.value.length === v.max);
278
+ const u = A(void 0), o = A(!1), V = D(
279
+ () => v.options.find(
280
+ (a) => {
281
+ var e, m;
282
+ return a.schemaName === ((e = u.value) == null ? void 0 : e.schemaName) && a.name === ((m = u.value) == null ? void 0 : m.name);
283
+ }
284
+ ) ?? {}
285
+ );
286
+ me(
287
+ () => {
288
+ var a;
289
+ return (a = u.value) == null ? void 0 : a.option;
290
+ },
291
+ () => {
292
+ !T.value && u.value && (u.value.fillGap = !1);
293
+ }
294
+ );
295
+ const T = D(
296
+ () => {
297
+ var a, e, m;
298
+ return (m = (a = V.value) == null ? void 0 : a.fillGapDimensionOptions) == null ? void 0 : m.includes(((e = u.value) == null ? void 0 : e.option) || "");
299
+ }
300
+ );
301
+ function O(a) {
302
+ var e, m;
303
+ (a.schemaName !== ((e = u.value) == null ? void 0 : e.schemaName) || a.name !== ((m = u.value) == null ? void 0 : m.name)) && (u.value = {
304
+ schemaName: a.schemaName,
305
+ name: a.name,
306
+ option: a.dimensionOptions[0],
307
+ label: a.label,
308
+ decimal: a.isNumericType ? 2 : void 0,
309
+ hide: !1
310
+ }, o.value = !1);
311
+ }
312
+ function h() {
313
+ if (!u.value) {
314
+ console.error("new field is undefined");
315
+ return;
316
+ }
317
+ const a = [...s.value.map((e) => e.value)];
318
+ b.value !== void 0 ? a[b.value] = u.value : a.push(u.value), l.value = a, c.value = !1;
319
+ }
320
+ function w(a) {
321
+ const m = [...s.value.map((U) => U.value)].filter((U, E) => E !== a);
322
+ l.value = m;
323
+ }
324
+ function p(a) {
325
+ u.value && (u.value.decimal = Number(a));
326
+ }
327
+ const F = D(
328
+ () => v.options.map((a) => ({
329
+ label: a.labels.join(" "),
330
+ value: a
331
+ }))
332
+ ), t = D(
333
+ () => v.label ? v.label : i(`report.section.dimension.${v.label}`)
334
+ );
335
+ return (a, e) => {
336
+ const m = y("FmTextField"), U = y("FmStepperField"), E = y("FmCheckbox"), q = y("FmTextarea"), Z = y("FmForm"), R = y("FmIcon"), j = y("FmButton"), P = y("FmListItem"), J = y("FmList"), G = y("FmField");
337
+ return r.max !== 0 ? (f(), L("div", al, [
338
+ d(ie, {
339
+ modelValue: c.value,
340
+ "onUpdate:modelValue": e[12] || (e[12] = (k) => c.value = k),
341
+ title: t.value,
342
+ "primary-button-label": n(i)("report.common.confirm"),
343
+ "secondary-button-label": n(i)("report.common.cancel"),
344
+ onConfirm: h
345
+ }, {
346
+ content: S(() => [
347
+ d(Z, {
348
+ ref: "form",
349
+ class: "flex flex-col gap-2 w-[490px]"
350
+ }, {
351
+ default: S(() => {
352
+ var k, I, K, ae, $, Ce;
353
+ return [
354
+ d(z, {
355
+ "model-value": V.value,
356
+ items: F.value,
357
+ placeholder: t.value,
358
+ label: t.value,
359
+ "onUpdate:modelValue": e[0] || (e[0] = (M) => O(M))
360
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
361
+ u.value ? (f(), L(H, { key: 0 }, [
362
+ d(m, {
363
+ modelValue: u.value.label,
364
+ "onUpdate:modelValue": e[1] || (e[1] = (M) => u.value.label = M),
365
+ label: t.value
366
+ }, null, 8, ["modelValue", "label"]),
367
+ (((k = V.value) == null ? void 0 : k.dimensionOptions) || []).length > 0 ? (f(), C(z, {
368
+ key: 0,
369
+ modelValue: u.value.option,
370
+ "onUpdate:modelValue": e[2] || (e[2] = (M) => u.value.option = M),
371
+ items: ((I = V.value) == null ? void 0 : I.dimensionOptions.map((M) => ({
372
+ label: M,
373
+ value: M
374
+ }))) ?? []
375
+ }, null, 8, ["modelValue", "items"])) : _("", !0),
376
+ (K = V.value) != null && K.isNumericType ? (f(), C(U, {
377
+ key: 1,
378
+ label: n(i)("report.common.decimal"),
379
+ "model-value": ((ae = u.value) == null ? void 0 : ae.decimal) ?? 2,
380
+ "onUpdate:modelValue": e[3] || (e[3] = (M) => {
381
+ p(M);
382
+ })
383
+ }, null, 8, ["label", "model-value"])) : _("", !0),
384
+ ($ = V.value) != null && $.isNumericType ? (f(), C(z, {
385
+ key: 2,
386
+ modelValue: u.value.timeFormatter,
387
+ "onUpdate:modelValue": e[4] || (e[4] = (M) => u.value.timeFormatter = M),
388
+ placeholder: n(i)("report.section.dimension.timeFormatter"),
389
+ label: n(i)("report.section.dimension.timeFormatter"),
390
+ items: V.value.timeFormatters.map((M) => ({ label: M, value: M }))
391
+ }, null, 8, ["modelValue", "placeholder", "label", "items"])) : _("", !0),
392
+ T.value ? (f(), C(E, {
393
+ key: 3,
394
+ "model-value": u.value.fillGap ?? !1,
395
+ label: n(i)("report.section.dimension.fillGap"),
396
+ value: "",
397
+ placeholder: "Fill gap",
398
+ "onUpdate:modelValue": e[5] || (e[5] = (M) => {
399
+ u.value && (u.value.fillGap = M);
400
+ })
401
+ }, null, 8, ["model-value", "label"])) : _("", !0),
402
+ ((Ce = V.value) == null ? void 0 : Ce.type) === n(ne).Timestamp ? (f(), C(E, {
403
+ key: 4,
404
+ "model-value": u.value.dateComparison ?? !1,
405
+ label: n(i)("report.section.dimension.dateComparison"),
406
+ value: "",
407
+ "onUpdate:modelValue": e[6] || (e[6] = (M) => {
408
+ u.value && (u.value.dateComparison = M);
409
+ })
410
+ }, null, 8, ["model-value", "label"])) : _("", !0),
411
+ d(E, {
412
+ modelValue: u.value.hide,
413
+ "onUpdate:modelValue": e[7] || (e[7] = (M) => u.value.hide = M),
414
+ label: n(i)("report.section.dimension.hide"),
415
+ value: ""
416
+ }, null, 8, ["modelValue", "label"]),
417
+ v.hasRowColumn ? (f(), C(E, {
418
+ key: 5,
419
+ modelValue: u.value.moveToColumn,
420
+ "onUpdate:modelValue": e[8] || (e[8] = (M) => u.value.moveToColumn = M),
421
+ label: n(i)("report.section.dimension.moveToColumn"),
422
+ value: ""
423
+ }, null, 8, ["modelValue", "label"])) : _("", !0),
424
+ d(E, {
425
+ modelValue: o.value,
426
+ "onUpdate:modelValue": e[9] || (e[9] = (M) => o.value = M),
427
+ label: n(i)("report.section.dimension.advance"),
428
+ value: !0
429
+ }, null, 8, ["modelValue", "label"]),
430
+ o.value ? (f(), C(q, {
431
+ key: 6,
432
+ modelValue: u.value.dataFormula,
433
+ "onUpdate:modelValue": e[10] || (e[10] = (M) => u.value.dataFormula = M),
434
+ placeholder: n(i)("report.section.dimension.dataFormula")
435
+ }, null, 8, ["modelValue", "placeholder"])) : _("", !0),
436
+ o.value ? (f(), C(q, {
437
+ key: 7,
438
+ modelValue: u.value.displayFormula,
439
+ "onUpdate:modelValue": e[11] || (e[11] = (M) => u.value.displayFormula = M),
440
+ placeholder: n(i)("report.section.dimension.displayFormula")
441
+ }, null, 8, ["modelValue", "placeholder"])) : _("", !0)
442
+ ], 64)) : _("", !0)
443
+ ];
444
+ }),
445
+ _: 1
446
+ }, 512)
447
+ ]),
448
+ _: 1
449
+ }, 8, ["modelValue", "title", "primary-button-label", "secondary-button-label"]),
450
+ x("div", null, [
451
+ x("p", ol, B(t.value), 1),
452
+ x("p", tl, B(n(i)("report.section.dimension.description")), 1)
453
+ ]),
454
+ d(J, null, {
455
+ default: S(() => [
456
+ d(n(ve), {
457
+ list: l.value,
458
+ "item-key": "id",
459
+ class: "flex flex-col gap-2"
460
+ }, {
461
+ item: S(({ element: k, index: I }) => [
462
+ d(P, {
463
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
464
+ onClick: le((K) => g(s.value[I]), ["stop"])
465
+ }, {
466
+ default: S(() => [
467
+ d(R, { name: "drag_handle" }),
468
+ x("p", nl, B(k.label), 1),
469
+ e[14] || (e[14] = x("div", { class: "grow" }, null, -1)),
470
+ d(j, {
471
+ icon: "close",
472
+ size: "md",
473
+ variant: "tertiary",
474
+ onClick: le((K) => w(I), ["stop"])
475
+ }, null, 8, ["onClick"])
476
+ ]),
477
+ _: 2
478
+ }, 1032, ["onClick"])
479
+ ]),
480
+ _: 1
481
+ }, 8, ["list"])
482
+ ]),
483
+ _: 1
484
+ }),
485
+ d(G, {
486
+ class: "text-fm-color-typo-tertiary",
487
+ onClick: e[13] || (e[13] = () => {
488
+ g();
489
+ })
490
+ }, {
491
+ default: S(() => [
492
+ ue(B(n(i)("report.section.dimension.add")), 1)
493
+ ]),
494
+ _: 1
495
+ })
496
+ ])) : _("", !0);
497
+ };
498
+ }
499
+ }), Fe = {
500
+ value: "_metric_name"
501
+ };
502
+ function ul(r, i, l) {
503
+ switch (r) {
504
+ case N.BarChart:
505
+ case N.StackBarChart:
506
+ case N.LineChart:
507
+ case N.StackLineChart:
508
+ case N.Circular:
509
+ return i.length > 1;
510
+ default:
511
+ return l;
512
+ }
513
+ }
514
+ function il(r) {
515
+ var v;
516
+ const { rowIds: i, columnIds: l } = Ve(r.widget.config);
517
+ return {
518
+ ...r,
519
+ widget: {
520
+ ...r.widget,
521
+ config: {
522
+ ...r.widget.config,
523
+ rowIds: i,
524
+ columnIds: l,
525
+ isDrillable: ul(
526
+ r.widget.type,
527
+ r.widget.config.dimensions,
528
+ r.widget.config.isDrillable
529
+ ),
530
+ joinDatasources: (v = r.widget.config.joinDatasources) == null ? void 0 : v.map((c) => {
531
+ const { rowIds: s, columnIds: b } = Ve(c);
532
+ return {
533
+ ...c,
534
+ rowIds: s,
535
+ columnIds: b
536
+ };
537
+ })
538
+ }
539
+ }
540
+ };
541
+ }
542
+ function Ve(r) {
543
+ const i = r.dimensions.filter((b) => b.hide !== !0 && !b.moveToColumn).map((b) => pe(b)), l = r.dimensions.filter((b) => b.hide !== !0 && b.moveToColumn == !0).map((b) => pe(b)), v = r.metrics.length > 0;
544
+ v && r.metrics.find((b) => b.moveToRow == !0) ? i.push(Fe.value) : v && l.push(Fe.value);
545
+ const c = [], s = [];
546
+ for (const b of i)
547
+ c.push(b);
548
+ for (const b of l)
549
+ s.push(b);
550
+ return {
551
+ rowIds: c,
552
+ columnIds: s
553
+ };
554
+ }
555
+ const sl = { class: "flex flex-col my-2 gap-8" }, rl = { class: "fm-typo-en-body-lg-600" }, ml = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, dl = { class: "fm-typo-en-body-lg-400 overflow-hidden text-ellipsis line-clamp-1" }, cl = /* @__PURE__ */ Y({
556
+ __name: "MetricSection",
557
+ props: /* @__PURE__ */ X({
558
+ options: {
559
+ type: Array,
560
+ default: () => []
561
+ },
562
+ label: {
563
+ type: String,
564
+ default: "Metric"
565
+ },
566
+ max: {
567
+ type: Number,
568
+ default: void 0
569
+ },
570
+ config: {
571
+ type: Object,
572
+ default: () => {
573
+ }
574
+ },
575
+ hasRowColumn: {
576
+ type: Boolean,
577
+ default: !1
578
+ }
579
+ }, {
580
+ modelValue: { required: !1, default: [] },
581
+ modelModifiers: {}
582
+ }),
583
+ emits: /* @__PURE__ */ X(["config"], ["update:modelValue"]),
584
+ setup(r, { emit: i }) {
585
+ const { t: l } = Q(), v = W(r, "modelValue"), c = r;
586
+ D(() => !!c.max && v.value.length === c.max);
587
+ const s = A(!1), b = D(
588
+ () => v.value.map((e, m) => ({
589
+ index: m,
590
+ labels: [e.label || e.name],
591
+ value: e
592
+ }))
593
+ ), g = A(v.value.length > 0 ? 0 : void 0);
594
+ function u(e) {
595
+ var m, U, E;
596
+ s.value = !0, o.value = e != null && e.value ? JSON.parse(JSON.stringify(e.value)) : void 0, g.value = e == null ? void 0 : e.index, V.value = !!((m = o.value) != null && m.dataFormula || (U = o.value) != null && U.displayFormula), ((E = c.config.rowIds) == null ? void 0 : E.findIndex((q) => q === Fe.value)) !== -1 && o.value && (o.value.moveToRow = !0);
597
+ }
598
+ const o = A(void 0), V = A(!1), T = D(
599
+ () => c.options.find(
600
+ (e) => {
601
+ var m, U;
602
+ return e.schemaName === ((m = o.value) == null ? void 0 : m.schemaName) && e.name === ((U = o.value) == null ? void 0 : U.name);
603
+ }
604
+ ) ?? {}
605
+ );
606
+ function O(e, m) {
607
+ var U;
608
+ return (e == null ? void 0 : e.isNumericType) || ((U = e == null ? void 0 : e.isNumericAggregations) == null ? void 0 : U.includes(m || ""));
609
+ }
610
+ const h = D(
611
+ () => {
612
+ var e;
613
+ return O(T.value, (e = o.value) == null ? void 0 : e.aggregation);
614
+ }
615
+ );
616
+ me(h, (e) => {
617
+ o.value && (e ? o.value.decimal = typeof o.value.decimal != "number" ? 2 : o.value.decimal : o.value.decimal = void 0);
618
+ });
619
+ function w(e) {
620
+ var m, U;
621
+ (e.schemaName !== ((m = o.value) == null ? void 0 : m.schemaName) || e.name !== ((U = o.value) == null ? void 0 : U.name)) && (o.value = {
622
+ schemaName: e.schemaName,
623
+ name: e.name,
624
+ aggregation: e.aggregations[0],
625
+ label: e.label,
626
+ decimal: O(e, e.aggregations[0]) ? 2 : void 0,
627
+ moveToRow: !1,
628
+ hide: !1
629
+ }, V.value = !1);
630
+ }
631
+ function p() {
632
+ const e = [...b.value.map((m) => m.value)];
633
+ o.value && (g.value !== void 0 ? e[g.value] = o.value : e.push(o.value)), v.value = e, s.value = !1;
634
+ }
635
+ function F(e) {
636
+ const m = [...b.value.map((U) => U.value)];
637
+ m.splice(e, 1), v.value = m;
638
+ }
639
+ const t = D(
640
+ () => c.options.map((e) => ({
641
+ label: e.labels.join(" "),
642
+ value: e
643
+ }))
644
+ ), a = D(
645
+ () => c.label ? c.label : l(`report.section.metric.${c.label}`)
646
+ );
647
+ return (e, m) => {
648
+ const U = y("FmTextField"), E = y("FmStepperField"), q = y("FmCheckbox"), Z = y("FmTextarea"), R = y("FmForm"), j = y("FmIcon"), P = y("FmButton"), J = y("FmListItem"), G = y("FmList"), k = y("FmField");
649
+ return f(), L("div", sl, [
650
+ d(ie, {
651
+ modelValue: s.value,
652
+ "onUpdate:modelValue": m[10] || (m[10] = (I) => s.value = I),
653
+ title: a.value,
654
+ onConfirm: p
655
+ }, {
656
+ content: S(() => [
657
+ d(R, {
658
+ ref: "form",
659
+ class: "flex flex-col gap-2 w-[490px]"
660
+ }, {
661
+ default: S(() => {
662
+ var I, K, ae;
663
+ return [
664
+ d(z, {
665
+ "model-value": T.value,
666
+ items: t.value,
667
+ placeholder: a.value,
668
+ label: a.value,
669
+ "onUpdate:modelValue": m[0] || (m[0] = ($) => w($))
670
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
671
+ o.value ? (f(), L(H, { key: 0 }, [
672
+ d(U, {
673
+ modelValue: o.value.label,
674
+ "onUpdate:modelValue": m[1] || (m[1] = ($) => o.value.label = $),
675
+ label: a.value
676
+ }, null, 8, ["modelValue", "label"]),
677
+ (((I = T.value) == null ? void 0 : I.aggregations) || []).length > 0 ? (f(), C(z, {
678
+ key: 0,
679
+ modelValue: o.value.aggregation,
680
+ "onUpdate:modelValue": m[2] || (m[2] = ($) => o.value.aggregation = $),
681
+ label: n(l)("report.section.metric.aggregation"),
682
+ items: ((K = T.value) == null ? void 0 : K.aggregations.map(($) => ({
683
+ label: $,
684
+ value: $
685
+ }))) ?? []
686
+ }, null, 8, ["modelValue", "label", "items"])) : _("", !0),
687
+ h.value ? (f(), C(E, {
688
+ key: 1,
689
+ label: n(l)("report.common.decimal"),
690
+ "model-value": ((ae = o.value) == null ? void 0 : ae.decimal) ?? 2,
691
+ "onUpdate:modelValue": m[3] || (m[3] = ($) => {
692
+ o.value && (o.value.decimal = $);
693
+ })
694
+ }, null, 8, ["label", "model-value"])) : _("", !0),
695
+ h.value ? (f(), C(z, {
696
+ key: 2,
697
+ modelValue: o.value.timeFormatter,
698
+ "onUpdate:modelValue": m[4] || (m[4] = ($) => o.value.timeFormatter = $),
699
+ placeholder: n(l)("report.section.metric.timeFormatter"),
700
+ label: n(l)("report.section.metric.timeFormatter"),
701
+ items: T.value.timeFormatters.map(($) => ({ label: $, value: $ }))
702
+ }, null, 8, ["modelValue", "placeholder", "label", "items"])) : _("", !0),
703
+ d(q, {
704
+ modelValue: o.value.hide,
705
+ "onUpdate:modelValue": m[5] || (m[5] = ($) => o.value.hide = $),
706
+ label: n(l)("report.section.metric.hide"),
707
+ value: ""
708
+ }, null, 8, ["modelValue", "label"]),
709
+ c.hasRowColumn ? (f(), C(q, {
710
+ key: 3,
711
+ modelValue: o.value.moveToRow,
712
+ "onUpdate:modelValue": m[6] || (m[6] = ($) => o.value.moveToRow = $),
713
+ label: n(l)("report.section.metric.moveToRow"),
714
+ value: ""
715
+ }, null, 8, ["modelValue", "label"])) : _("", !0),
716
+ d(q, {
717
+ modelValue: V.value,
718
+ "onUpdate:modelValue": m[7] || (m[7] = ($) => V.value = $),
719
+ label: n(l)("report.section.metric.advance"),
720
+ value: !0
721
+ }, null, 8, ["modelValue", "label"]),
722
+ V.value ? (f(), C(Z, {
723
+ key: 4,
724
+ modelValue: o.value.dataFormula,
725
+ "onUpdate:modelValue": m[8] || (m[8] = ($) => o.value.dataFormula = $),
726
+ placeholder: n(l)("report.section.metric.dataFormula")
727
+ }, null, 8, ["modelValue", "placeholder"])) : _("", !0),
728
+ V.value ? (f(), C(Z, {
729
+ key: 5,
730
+ modelValue: o.value.displayFormula,
731
+ "onUpdate:modelValue": m[9] || (m[9] = ($) => o.value.displayFormula = $),
732
+ placeholder: n(l)("report.section.metric.displayFormula")
733
+ }, null, 8, ["modelValue", "placeholder"])) : _("", !0)
734
+ ], 64)) : _("", !0)
735
+ ];
736
+ }),
737
+ _: 1
738
+ }, 512)
739
+ ]),
740
+ _: 1
741
+ }, 8, ["modelValue", "title"]),
742
+ x("div", null, [
743
+ x("p", rl, B(a.value), 1),
744
+ x("p", ml, B(n(l)("report.section.metric.description")), 1)
745
+ ]),
746
+ d(G, null, {
747
+ default: S(() => [
748
+ d(n(ve), {
749
+ list: v.value,
750
+ "item-key": "id",
751
+ class: "flex flex-col gap-2 w-full"
752
+ }, {
753
+ item: S(({ element: I, index: K }) => [
754
+ d(J, {
755
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
756
+ onClick: le((ae) => u(b.value[K]), ["stop"])
757
+ }, {
758
+ default: S(() => [
759
+ d(j, { name: "drag_handle" }),
760
+ x("p", dl, B(I.label), 1),
761
+ m[12] || (m[12] = x("div", { class: "grow" }, null, -1)),
762
+ d(P, {
763
+ icon: "close",
764
+ size: "md",
765
+ variant: "tertiary",
766
+ onClick: le((ae) => F(K), ["stop"])
767
+ }, null, 8, ["onClick"])
768
+ ]),
769
+ _: 2
770
+ }, 1032, ["onClick"])
771
+ ]),
772
+ _: 1
773
+ }, 8, ["list"])
774
+ ]),
775
+ _: 1
776
+ }),
777
+ d(k, {
778
+ class: "text-fm-color-typo-tertiary",
779
+ onClick: m[11] || (m[11] = () => {
780
+ u();
781
+ })
782
+ }, {
783
+ default: S(() => [
784
+ ue(B(n(l)("report.section.metric.add")), 1)
785
+ ]),
786
+ _: 1
787
+ })
788
+ ]);
789
+ };
790
+ }
791
+ });
792
+ var se = /* @__PURE__ */ ((r) => (r.Select = "Select", r.TextField = "TextField", r.Timestamp = "Timestamp", r))(se || {});
793
+ function pl(r) {
794
+ let i = !1, l = 1;
795
+ switch (r) {
796
+ case ee.Equal:
797
+ case ee.NotEqual:
798
+ case ee.Like:
799
+ case ee.NotLike:
800
+ i = !1, l = 1;
801
+ break;
802
+ case ee.GreaterThan:
803
+ case ee.GreaterThanOrEqual:
804
+ case ee.LessThan:
805
+ case ee.LessThanOrEqual:
806
+ i = !0, l = 1;
807
+ break;
808
+ case ee.Between:
809
+ i = !0, l = 2;
810
+ break;
811
+ }
812
+ return {
813
+ fixed: i,
814
+ count: l
815
+ };
816
+ }
817
+ function vl({
818
+ operator: r,
819
+ dimensionOption: i,
820
+ dataType: l
821
+ }) {
822
+ const { fixed: v, count: c } = pl(r);
823
+ switch (l) {
824
+ case ne.String:
825
+ return {
826
+ type: "TextField",
827
+ fixed: v,
828
+ count: c,
829
+ dataType: void 0,
830
+ default: ""
831
+ };
832
+ case ne.Numeric:
833
+ return {
834
+ type: "TextField",
835
+ fixed: v,
836
+ count: c,
837
+ dataType: "number",
838
+ default: 0
839
+ };
840
+ case ne.Bool:
841
+ return {
842
+ type: "Select",
843
+ fixed: v,
844
+ count: c,
845
+ options: [
846
+ { label: "Yes", value: !0 },
847
+ { label: "No", value: !1 }
848
+ ],
849
+ default: !0
850
+ };
851
+ case ne.Timestamp:
852
+ switch (i) {
853
+ case te.HourOfDay:
854
+ case te.DayOfWeek:
855
+ case te.DayOfMonth:
856
+ case te.MonthOfYear:
857
+ return {
858
+ type: "TextField",
859
+ fixed: v,
860
+ count: c,
861
+ dataType: "number",
862
+ default: "0"
863
+ };
864
+ case te.TimeOfDay:
865
+ return {
866
+ type: "Timestamp",
867
+ fixed: v,
868
+ count: c,
869
+ default: (/* @__PURE__ */ new Date()).toISOString()
870
+ };
871
+ }
872
+ }
873
+ return {
874
+ type: "TextField",
875
+ fixed: v,
876
+ count: c,
877
+ dataType: void 0,
878
+ default: ""
879
+ };
880
+ }
881
+ const fl = { class: "grow" }, bl = {
882
+ key: 2,
883
+ class: "w-full"
884
+ }, gl = { key: 0 }, yl = /* @__PURE__ */ Y({
885
+ __name: "FilterValueInput",
886
+ props: /* @__PURE__ */ X({
887
+ config: {
888
+ type: Object,
889
+ default: () => {
890
+ }
891
+ }
892
+ }, {
893
+ modelValue: { required: !0, default: () => [] },
894
+ modelModifiers: {}
895
+ }),
896
+ emits: ["update:modelValue"],
897
+ setup(r) {
898
+ const i = W(r, "modelValue"), l = r;
899
+ function v(g) {
900
+ return (g ? fe(g) : fe()).format("HH:mm");
901
+ }
902
+ function c({ hour: g, minute: u }) {
903
+ return fe().set("hour", g).set("minute", u).toISOString();
904
+ }
905
+ function s(g, u) {
906
+ var V;
907
+ const o = [...i.value];
908
+ ((V = l.config) == null ? void 0 : V.type) === se.Timestamp ? o[g] = c({
909
+ hour: Number(u.split(":")[0]),
910
+ minute: Number(u.split(":")[1])
911
+ }) : o[g] = u, i.value = o;
912
+ }
913
+ function b(g) {
914
+ if (g === 0)
915
+ i.value = [void 0, ...i.value];
916
+ else {
917
+ const u = [...i.value];
918
+ u.splice(g, 1), i.value = u;
919
+ }
920
+ }
921
+ return (g, u) => {
922
+ const o = y("FmSelect"), V = y("FmTextField"), T = y("FmTimePicker"), O = y("FmButton");
923
+ return f(!0), L(H, null, re(new Array(i.value.length !== 0 ? i.value.length : 1), (h, w) => {
924
+ var p, F, t, a;
925
+ return f(), L("div", {
926
+ key: w,
927
+ class: "flex flex-row align-center gap-2 w-full"
928
+ }, [
929
+ x("div", fl, [
930
+ ((p = l.config) == null ? void 0 : p.type) === n(se).Select ? (f(), C(o, {
931
+ key: 0,
932
+ "model-value": i.value[w],
933
+ items: l.config.options,
934
+ "onUpdate:modelValue": (e) => s(w, e)
935
+ }, null, 8, ["model-value", "items", "onUpdate:modelValue"])) : ((F = l.config) == null ? void 0 : F.type) === n(se).TextField ? (f(), C(V, {
936
+ key: 1,
937
+ "model-value": i.value[w],
938
+ "onUpdate:modelValue": (e) => s(w, e)
939
+ }, null, 8, ["model-value", "onUpdate:modelValue"])) : ((t = l.config) == null ? void 0 : t.type) === n(se).Timestamp ? (f(), L("div", bl, [
940
+ d(T, {
941
+ "model-value": v(i.value[w]),
942
+ "onUpdate:modelValue": (e) => s(w, e)
943
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
944
+ ])) : _("", !0)
945
+ ]),
946
+ ((a = l.config) == null ? void 0 : a.fixed) === !1 ? (f(), L("div", gl, [
947
+ d(O, {
948
+ icon: w === 0 ? "add" : "remove",
949
+ onClick: (e) => b(w)
950
+ }, null, 8, ["icon", "onClick"])
951
+ ])) : _("", !0)
952
+ ]);
953
+ }), 128);
954
+ };
955
+ }
956
+ }), Fl = { class: "flex flex-col my-2 gap-8" }, Vl = { class: "fm-typo-en-body-lg-600" }, hl = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, wl = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, kl = /* @__PURE__ */ Y({
957
+ __name: "FilterSection",
958
+ props: /* @__PURE__ */ X({
959
+ options: {
960
+ type: Array,
961
+ default: () => []
962
+ },
963
+ label: {
964
+ type: String,
965
+ default: "Filter"
966
+ }
967
+ }, {
968
+ modelValue: { required: !1, default: () => [] },
969
+ modelModifiers: {}
970
+ }),
971
+ emits: ["update:modelValue"],
972
+ setup(r) {
973
+ const { t: i } = Q(), l = W(r, "modelValue"), v = r, c = D(() => i(`report.section.filter.${v.label}`)), s = A(!1), b = D(
974
+ () => l.value.map((a, e) => {
975
+ const m = v.options.find(
976
+ (U) => U.schemaName === a.schemaName && U.name === a.name
977
+ );
978
+ return {
979
+ index: e,
980
+ labels: (m == null ? void 0 : m.labels) || [a.schemaName, a.name],
981
+ value: a
982
+ };
983
+ })
984
+ ), g = A(l.value.length > 0 ? 0 : void 0);
985
+ function u(a) {
986
+ var e;
987
+ s.value = !0, o.value = a != null && a.value ? JSON.parse(JSON.stringify(a.value)) : void 0, g.value = a == null ? void 0 : a.index, V.value = !!((e = o.value) != null && e.dataFormula), h();
988
+ }
989
+ const o = A(void 0), V = A(!1), T = A(void 0), O = D(
990
+ () => v.options.find(
991
+ (a) => {
992
+ var e, m;
993
+ return a.schemaName === ((e = o.value) == null ? void 0 : e.schemaName) && a.name === ((m = o.value) == null ? void 0 : m.name);
994
+ }
995
+ ) ?? {}
996
+ );
997
+ me(
998
+ () => {
999
+ var a;
1000
+ return (a = o.value) == null ? void 0 : a.option;
1001
+ },
1002
+ (a, e) => {
1003
+ if (e !== void 0 && a !== e && o.value) {
1004
+ if (h(), !T.value)
1005
+ return;
1006
+ o.value = {
1007
+ ...o.value,
1008
+ values: (
1009
+ // only overwrite the value when it empty
1010
+ o.value.values.map((m) => {
1011
+ var U;
1012
+ return m === null ? (U = T.value) == null ? void 0 : U.default : m;
1013
+ })
1014
+ )
1015
+ };
1016
+ }
1017
+ }
1018
+ ), me(
1019
+ () => {
1020
+ var a;
1021
+ return (a = o.value) == null ? void 0 : a.operator;
1022
+ },
1023
+ (a, e) => {
1024
+ if (a !== e && O.value && o.value) {
1025
+ if (h(), !T.value)
1026
+ return;
1027
+ const m = o.value.values.length - T.value.count;
1028
+ m > 0 && T.value.fixed ? o.value = {
1029
+ ...o.value,
1030
+ values: o.value.values.slice(0, T.value.count)
1031
+ } : m < 0 && (o.value = {
1032
+ ...o.value,
1033
+ values: [
1034
+ ...o.value.values,
1035
+ ...Array(Math.abs(m)).fill(T.value.default)
1036
+ ]
1037
+ });
1038
+ }
1039
+ },
1040
+ {
1041
+ deep: !0
1042
+ }
1043
+ );
1044
+ function h() {
1045
+ O.value && o.value && (T.value = vl({
1046
+ operator: o.value.operator,
1047
+ dataType: O.value.type,
1048
+ dimensionOption: o.value.option
1049
+ }));
1050
+ }
1051
+ function w(a) {
1052
+ var e, m, U;
1053
+ (a.schemaName !== ((e = o.value) == null ? void 0 : e.schemaName) || a.name !== ((m = o.value) == null ? void 0 : m.name)) && (o.value = {
1054
+ schemaName: a.schemaName,
1055
+ name: a.name,
1056
+ operator: a.filterOperators[0],
1057
+ option: a.filterDimensionOptions[0],
1058
+ values: []
1059
+ }, h(), o.value.values = [(U = T.value) == null ? void 0 : U.default]);
1060
+ }
1061
+ function p() {
1062
+ const a = [...b.value.map((e) => e.value)];
1063
+ o.value && (o.value.values = o.value.values.filter(
1064
+ (e) => e !== "" && e !== null
1065
+ ), g.value !== void 0 ? a[Number(g.value)] = o.value : a.push(o.value), l.value = a), s.value = !1;
1066
+ }
1067
+ function F(a) {
1068
+ const e = [...b.value.map((m) => m.value)];
1069
+ e.splice(a, 1), l.value = e, s.value = !1;
1070
+ }
1071
+ const t = D(
1072
+ () => v.options.map((a) => ({
1073
+ label: a.labels.join(" "),
1074
+ value: a
1075
+ }))
1076
+ );
1077
+ return (a, e) => {
1078
+ const m = y("FmCheckbox"), U = y("FmTextarea"), E = y("FmTextField"), q = y("FmForm"), Z = y("FmIcon"), R = y("FmButton"), j = y("FmListItem"), P = y("FmList"), J = y("FmField");
1079
+ return f(), L("div", Fl, [
1080
+ d(ie, {
1081
+ modelValue: s.value,
1082
+ "onUpdate:modelValue": e[6] || (e[6] = (G) => s.value = G),
1083
+ title: c.value,
1084
+ "primary-button-label": n(i)("report.common.confirm"),
1085
+ "secondary-button-label": n(i)("report.common.cancel"),
1086
+ onConfirm: p
1087
+ }, {
1088
+ content: S(() => [
1089
+ d(q, {
1090
+ ref: "form",
1091
+ class: "flex flex-col gap-2 w-[490px]"
1092
+ }, {
1093
+ default: S(() => {
1094
+ var G, k;
1095
+ return [
1096
+ d(z, {
1097
+ "model-value": O.value,
1098
+ items: t.value,
1099
+ placeholder: c.value,
1100
+ label: c.value,
1101
+ "onUpdate:modelValue": e[0] || (e[0] = (I) => w(I))
1102
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
1103
+ o.value ? (f(), L(H, { key: 0 }, [
1104
+ d(m, {
1105
+ modelValue: V.value,
1106
+ "onUpdate:modelValue": e[1] || (e[1] = (I) => V.value = I),
1107
+ label: n(i)("report.section.filter.advance"),
1108
+ value: !0
1109
+ }, null, 8, ["modelValue", "label"]),
1110
+ V.value ? (f(), C(U, {
1111
+ key: 0,
1112
+ modelValue: o.value.dataFormula,
1113
+ "onUpdate:modelValue": e[2] || (e[2] = (I) => o.value.dataFormula = I),
1114
+ placeholder: n(i)("report.section.filter.dataFormula")
1115
+ }, null, 8, ["modelValue", "placeholder"])) : _("", !0),
1116
+ d(E, {
1117
+ modelValue: o.value.option,
1118
+ "onUpdate:modelValue": e[3] || (e[3] = (I) => o.value.option = I),
1119
+ placeholder: n(i)("report.section.filter.timeFormatter"),
1120
+ label: n(i)("report.section.filter.timeFormatter")
1121
+ }, null, 8, ["modelValue", "placeholder", "label"]),
1122
+ (((G = O.value) == null ? void 0 : G.filterOperators) || []).length > 0 ? (f(), C(z, {
1123
+ key: 1,
1124
+ modelValue: o.value.operator,
1125
+ "onUpdate:modelValue": e[4] || (e[4] = (I) => o.value.operator = I),
1126
+ items: ((k = O.value) == null ? void 0 : k.filterOperators.map((I) => ({ label: I, value: I }))) ?? []
1127
+ }, null, 8, ["modelValue", "items"])) : _("", !0),
1128
+ T.value ? (f(), C(yl, {
1129
+ key: 2,
1130
+ modelValue: o.value.values,
1131
+ "onUpdate:modelValue": e[5] || (e[5] = (I) => o.value.values = I),
1132
+ config: T.value
1133
+ }, null, 8, ["modelValue", "config"])) : _("", !0)
1134
+ ], 64)) : _("", !0)
1135
+ ];
1136
+ }),
1137
+ _: 1
1138
+ }, 512)
1139
+ ]),
1140
+ _: 1
1141
+ }, 8, ["modelValue", "title", "primary-button-label", "secondary-button-label"]),
1142
+ x("div", null, [
1143
+ x("p", Vl, B(c.value), 1),
1144
+ x("p", hl, B(n(i)("report.section.filter.description")), 1)
1145
+ ]),
1146
+ d(P, null, {
1147
+ default: S(() => [
1148
+ d(n(ve), {
1149
+ list: l.value,
1150
+ "item-key": "id",
1151
+ class: "flex flex-col gap-2 w-full"
1152
+ }, {
1153
+ item: S(({ element: G, index: k }) => [
1154
+ d(j, {
1155
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
1156
+ onClick: le((I) => u(b.value[k]), ["stop"])
1157
+ }, {
1158
+ default: S(() => [
1159
+ d(Z, { name: "drag_handle" }),
1160
+ x("p", wl, B(n(ke)(G.name)), 1),
1161
+ e[8] || (e[8] = x("div", { class: "grow" }, null, -1)),
1162
+ d(R, {
1163
+ icon: "close",
1164
+ size: "md",
1165
+ variant: "tertiary",
1166
+ onClick: le((I) => F(k), ["stop"])
1167
+ }, null, 8, ["onClick"])
1168
+ ]),
1169
+ _: 2
1170
+ }, 1032, ["onClick"])
1171
+ ]),
1172
+ _: 1
1173
+ }, 8, ["list"])
1174
+ ]),
1175
+ _: 1
1176
+ }),
1177
+ d(J, {
1178
+ class: "text-fm-color-typo-tertiary",
1179
+ onClick: e[7] || (e[7] = () => {
1180
+ u();
1181
+ })
1182
+ }, {
1183
+ default: S(() => [
1184
+ ue(B(n(i)("report.section.filter.add")), 1)
1185
+ ]),
1186
+ _: 1
1187
+ })
1188
+ ]);
1189
+ };
1190
+ }
1191
+ }), xl = { class: "flex flex-col my-2 gap-8" }, Cl = { class: "fm-typo-en-body-lg-600" }, _l = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, Tl = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, Sl = /* @__PURE__ */ Y({
1192
+ __name: "SortSection",
1193
+ props: /* @__PURE__ */ X({
1194
+ options: {
1195
+ type: Array,
1196
+ default: () => []
1197
+ },
1198
+ label: {
1199
+ type: String,
1200
+ default: "Sort"
1201
+ }
1202
+ }, {
1203
+ modelValue: { required: !1, default: [] },
1204
+ modelModifiers: {}
1205
+ }),
1206
+ emits: ["update:modelValue"],
1207
+ setup(r) {
1208
+ const { t: i } = Q(), l = W(r, "modelValue"), v = r, c = D(
1209
+ () => v.label ? v.label : i(`report.section.sort.${v.label}`)
1210
+ ), s = A(!1), b = D(
1211
+ () => l.value.map((F, t) => {
1212
+ const a = v.options.find(
1213
+ (e) => e.schemaName === F.schemaName && e.name === F.name
1214
+ );
1215
+ return {
1216
+ index: t,
1217
+ labels: (a == null ? void 0 : a.labels) || [F.schemaName, F.name],
1218
+ value: F
1219
+ };
1220
+ })
1221
+ ), g = A(l.value.length > 0 ? 0 : void 0);
1222
+ function u(F) {
1223
+ var t;
1224
+ s.value = !0, o.value = F != null && F.value ? JSON.parse(JSON.stringify(F.value)) : void 0, g.value = F == null ? void 0 : F.index, V.value = !!((t = o.value) != null && t.dataFormula);
1225
+ }
1226
+ const o = A(void 0), V = A(!1), T = D(
1227
+ () => v.options.find(
1228
+ (F) => {
1229
+ var t, a;
1230
+ return F.schemaName === ((t = o.value) == null ? void 0 : t.schemaName) && F.name === ((a = o.value) == null ? void 0 : a.name);
1231
+ }
1232
+ ) ?? {}
1233
+ );
1234
+ function O(F) {
1235
+ var t, a;
1236
+ (F.schemaName !== ((t = o.value) == null ? void 0 : t.schemaName) || F.name !== ((a = o.value) == null ? void 0 : a.name)) && (o.value = {
1237
+ schemaName: F.schemaName,
1238
+ name: F.name,
1239
+ dimensionOption: F.dimensionOptions[0],
1240
+ aggregation: null,
1241
+ type: ye.Asc
1242
+ });
1243
+ }
1244
+ function h() {
1245
+ if (!o.value) {
1246
+ console.log("new sort is undefined");
1247
+ return;
1248
+ }
1249
+ const F = [...b.value.map((t) => t.value)];
1250
+ g.value !== void 0 ? F[g.value] = o.value : F.push(o.value), l.value = F, s.value = !1;
1251
+ }
1252
+ function w(F) {
1253
+ const t = [...b.value.map((a) => a.value)];
1254
+ t.splice(F, 1), l.value = t, s.value = !1;
1255
+ }
1256
+ const p = D(
1257
+ () => v.options.map((F) => ({
1258
+ label: F.labels.join(" "),
1259
+ value: F
1260
+ }))
1261
+ );
1262
+ return (F, t) => {
1263
+ const a = y("FmCheckbox"), e = y("FmTextarea"), m = y("FmForm"), U = y("FmIcon"), E = y("FmButton"), q = y("FmListItem"), Z = y("FmList"), R = y("FmField");
1264
+ return f(), L("div", xl, [
1265
+ d(ie, {
1266
+ modelValue: s.value,
1267
+ "onUpdate:modelValue": t[6] || (t[6] = (j) => s.value = j),
1268
+ title: c.value,
1269
+ onConfirm: h
1270
+ }, {
1271
+ content: S(() => [
1272
+ d(m, {
1273
+ ref: "form",
1274
+ class: "flex flex-col gap-2 w-[490px]"
1275
+ }, {
1276
+ default: S(() => {
1277
+ var j, P, J, G;
1278
+ return [
1279
+ d(z, {
1280
+ "model-value": T.value,
1281
+ items: p.value,
1282
+ placeholder: c.value,
1283
+ label: c.value,
1284
+ "onUpdate:modelValue": t[0] || (t[0] = (k) => O(k))
1285
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
1286
+ o.value ? (f(), L(H, { key: 0 }, [
1287
+ (((j = T.value) == null ? void 0 : j.dimensionOptions) || []).length > 0 ? (f(), C(z, {
1288
+ key: 0,
1289
+ modelValue: o.value.dimensionOption,
1290
+ "onUpdate:modelValue": t[1] || (t[1] = (k) => o.value.dimensionOption = k),
1291
+ items: ((P = T.value) == null ? void 0 : P.dimensionOptions.map((k) => ({ label: k, value: k }))) ?? [],
1292
+ placeholder: n(i)("report.section.sort.format"),
1293
+ label: n(i)("report.section.sort.format")
1294
+ }, null, 8, ["modelValue", "items", "placeholder", "label"])) : _("", !0),
1295
+ (((J = T.value) == null ? void 0 : J.aggregations) || []).length > 0 ? (f(), C(z, {
1296
+ key: 1,
1297
+ modelValue: o.value.aggregation,
1298
+ "onUpdate:modelValue": t[2] || (t[2] = (k) => o.value.aggregation = k),
1299
+ items: ((G = T.value) == null ? void 0 : G.aggregations.map((k) => ({ label: k, value: k }))) ?? [],
1300
+ label: n(i)("report.section.sort.aggregation"),
1301
+ placeholder: n(i)("report.section.sort.aggregation")
1302
+ }, null, 8, ["modelValue", "items", "label", "placeholder"])) : _("", !0),
1303
+ d(z, {
1304
+ modelValue: o.value.type,
1305
+ "onUpdate:modelValue": t[3] || (t[3] = (k) => o.value.type = k),
1306
+ items: Object.values(n(ye)).map((k) => ({ label: k, value: k })),
1307
+ placeholder: n(i)("report.section.sort.order"),
1308
+ label: n(i)("report.section.sort.order")
1309
+ }, null, 8, ["modelValue", "items", "placeholder", "label"]),
1310
+ d(a, {
1311
+ modelValue: V.value,
1312
+ "onUpdate:modelValue": t[4] || (t[4] = (k) => V.value = k),
1313
+ label: n(i)("report.section.sort.advance"),
1314
+ value: !0
1315
+ }, null, 8, ["modelValue", "label"]),
1316
+ V.value ? (f(), C(e, {
1317
+ key: 2,
1318
+ modelValue: o.value.dataFormula,
1319
+ "onUpdate:modelValue": t[5] || (t[5] = (k) => o.value.dataFormula = k),
1320
+ placeholder: n(i)("report.section.sort.dataFormula")
1321
+ }, null, 8, ["modelValue", "placeholder"])) : _("", !0)
1322
+ ], 64)) : _("", !0)
1323
+ ];
1324
+ }),
1325
+ _: 1
1326
+ }, 512)
1327
+ ]),
1328
+ _: 1
1329
+ }, 8, ["modelValue", "title"]),
1330
+ x("div", null, [
1331
+ x("p", Cl, B(c.value), 1),
1332
+ x("p", _l, B(n(i)("report.section.sort.description")), 1)
1333
+ ]),
1334
+ d(Z, null, {
1335
+ default: S(() => [
1336
+ d(n(ve), {
1337
+ list: l.value,
1338
+ "item-key": "id",
1339
+ class: "flex flex-col gap-2 w-full"
1340
+ }, {
1341
+ item: S(({ element: j, index: P }) => [
1342
+ d(q, {
1343
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
1344
+ onClick: le((J) => u(b.value[P]), ["stop"])
1345
+ }, {
1346
+ default: S(() => [
1347
+ d(U, { name: "drag_handle" }),
1348
+ x("p", Tl, B(n(ke)(j.name)), 1),
1349
+ t[8] || (t[8] = x("div", { class: "grow" }, null, -1)),
1350
+ d(E, {
1351
+ icon: "close",
1352
+ size: "md",
1353
+ variant: "tertiary",
1354
+ onClick: le((J) => w(P), ["stop"])
1355
+ }, null, 8, ["onClick"])
1356
+ ]),
1357
+ _: 2
1358
+ }, 1032, ["onClick"])
1359
+ ]),
1360
+ _: 1
1361
+ }, 8, ["list"])
1362
+ ]),
1363
+ _: 1
1364
+ }),
1365
+ d(R, {
1366
+ class: "text-fm-color-typo-tertiary",
1367
+ onClick: t[7] || (t[7] = () => {
1368
+ u();
1369
+ })
1370
+ }, {
1371
+ default: S(() => [
1372
+ ue(B(n(i)("report.section.sort.add")), 1)
1373
+ ]),
1374
+ _: 1
1375
+ })
1376
+ ]);
1377
+ };
1378
+ }
1379
+ }), Ul = { class: "fm-typo-en-body-lg-600" }, Nl = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, Dl = /* @__PURE__ */ Y({
1380
+ __name: "LimitSection",
1381
+ props: {
1382
+ modelValue: { required: !0, default: null },
1383
+ modelModifiers: {}
1384
+ },
1385
+ emits: ["update:modelValue"],
1386
+ setup(r) {
1387
+ const { t: i } = Q(), l = W(r, "modelValue"), v = De((c) => {
1388
+ c !== "" ? l.value = c : l.value = null;
1389
+ }, 1e3);
1390
+ return (c, s) => {
1391
+ const b = y("FmTextField");
1392
+ return f(), L(H, null, [
1393
+ x("div", null, [
1394
+ x("p", Ul, B(n(i)("report.section.limit.title")), 1),
1395
+ x("p", Nl, B(n(i)("report.section.limit.description")), 1)
1396
+ ]),
1397
+ d(b, {
1398
+ "model-value": l.value,
1399
+ inputmode: "numeric",
1400
+ placeholder: n(i)("report.section.limit.placeholder"),
1401
+ "onUpdate:modelValue": s[0] || (s[0] = (g) => n(v)(g))
1402
+ }, null, 8, ["model-value", "placeholder"])
1403
+ ], 64);
1404
+ };
1405
+ }
1406
+ }), Ol = { class: "flex flex-col my-2 gap-8" }, $l = { class: "fm-typo-en-body-lg-600" }, Il = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, Ll = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, Bl = /* @__PURE__ */ Y({
1407
+ __name: "ConditionSection",
1408
+ props: /* @__PURE__ */ X({
1409
+ joinFieldOptions: {
1410
+ type: Array,
1411
+ default: () => []
1412
+ },
1413
+ mainFieldOptions: {
1414
+ type: Array,
1415
+ default: () => []
1416
+ }
1417
+ }, {
1418
+ modelValue: { required: !0 },
1419
+ modelModifiers: {}
1420
+ }),
1421
+ emits: ["update:modelValue"],
1422
+ setup(r) {
1423
+ const { t: i } = Q(), l = W(r, "modelValue"), v = r, c = A(!1), s = D(
1424
+ () => l.value.map((t, a) => {
1425
+ var e, m;
1426
+ return {
1427
+ index: a,
1428
+ labels: [(e = t.joinDimension) == null ? void 0 : e.schemaName, (m = t.joinDimension) == null ? void 0 : m.name],
1429
+ value: t
1430
+ };
1431
+ })
1432
+ ), b = A(l.value.length > 0 ? 0 : void 0);
1433
+ function g(t) {
1434
+ t ? (u.value = t != null && t.value ? JSON.parse(JSON.stringify(t.value)) : void 0, b.value = t == null ? void 0 : t.index) : (u.value = {
1435
+ joinDimension: null,
1436
+ operator: "",
1437
+ mainDimensions: []
1438
+ }, b.value = void 0), c.value = !0;
1439
+ }
1440
+ const u = A(void 0), o = D(
1441
+ () => v.joinFieldOptions.find(
1442
+ (t) => {
1443
+ var a, e;
1444
+ return t.schemaName === ((e = (a = u.value) == null ? void 0 : a.joinDimension) == null ? void 0 : e.schemaName) && t.name === u.value.joinDimension.name;
1445
+ }
1446
+ ) ?? {}
1447
+ ), V = D(
1448
+ () => {
1449
+ var t;
1450
+ return (((t = u.value) == null ? void 0 : t.mainDimensions) || []).map(
1451
+ (a) => v.mainFieldOptions.find(
1452
+ (e) => e.schemaName === (a == null ? void 0 : a.schemaName) && e.name === a.name
1453
+ ) ?? {}
1454
+ );
1455
+ }
1456
+ ), T = D(
1457
+ () => v.joinFieldOptions.map((t) => ({ label: t.labels.join(" "), value: t }))
1458
+ );
1459
+ function O(t) {
1460
+ var a, e, m, U;
1461
+ u.value && (u.value && t.schemaName !== ((e = (a = u.value) == null ? void 0 : a.joinDimension) == null ? void 0 : e.schemaName) || t.name !== ((U = (m = u.value) == null ? void 0 : m.joinDimension) == null ? void 0 : U.name)) && (u.value = {
1462
+ ...u.value,
1463
+ joinDimension: {
1464
+ schemaName: t.schemaName,
1465
+ name: t.name,
1466
+ option: t.dimensionOptions[0],
1467
+ label: t.label,
1468
+ hide: !0
1469
+ }
1470
+ }, t.joinConditionOperators.includes(u.value.operator) || w(t.joinConditionOperators[0]));
1471
+ }
1472
+ function h(t, a) {
1473
+ var e, m, U, E;
1474
+ if (u.value && a >= 0 && (u.value && t.schemaName !== ((m = (e = u.value) == null ? void 0 : e.mainDimensions[a]) == null ? void 0 : m.schemaName) || t.name !== ((E = (U = u.value) == null ? void 0 : U.mainDimensions[a]) == null ? void 0 : E.name))) {
1475
+ const q = [...u.value.mainDimensions];
1476
+ q[a] = {
1477
+ schemaName: t.schemaName,
1478
+ name: t.name,
1479
+ option: t.dimensionOptions[0],
1480
+ label: t.label,
1481
+ hide: !0
1482
+ }, u.value = {
1483
+ ...u.value,
1484
+ mainDimensions: q
1485
+ };
1486
+ }
1487
+ }
1488
+ function w(t) {
1489
+ if (u.value)
1490
+ switch (t) {
1491
+ case ee.Between:
1492
+ u.value = {
1493
+ ...u.value,
1494
+ operator: t,
1495
+ mainDimensions: [null, null]
1496
+ };
1497
+ break;
1498
+ default:
1499
+ u.value = {
1500
+ ...u.value,
1501
+ operator: t,
1502
+ mainDimensions: [null]
1503
+ };
1504
+ break;
1505
+ }
1506
+ }
1507
+ function p() {
1508
+ const t = [...s.value.map((a) => a.value)];
1509
+ u.value && (u.value.mainDimensions = u.value.mainDimensions.filter(
1510
+ (a) => a !== "" && a != null
1511
+ ), b.value !== void 0 ? t[b.value] = u.value : t.push(u.value)), l.value = t, c.value = !1;
1512
+ }
1513
+ function F(t) {
1514
+ const a = [...s.value.map((e) => e.value)];
1515
+ a.splice(t, 1), l.value = a;
1516
+ }
1517
+ return (t, a) => {
1518
+ const e = y("FmMenuDivider"), m = y("FmForm"), U = y("FmButton"), E = y("FmListItem"), q = y("FmList"), Z = y("FmField");
1519
+ return f(), L("div", Ol, [
1520
+ d(ie, {
1521
+ modelValue: c.value,
1522
+ "onUpdate:modelValue": a[2] || (a[2] = (R) => c.value = R),
1523
+ title: n(i)("report.section.condition.condition"),
1524
+ onConfirm: p
1525
+ }, {
1526
+ content: S(() => [
1527
+ d(m, {
1528
+ ref: "form",
1529
+ class: "flex flex-col gap-2 w-[490px]"
1530
+ }, {
1531
+ default: S(() => {
1532
+ var R, j, P, J, G;
1533
+ return [
1534
+ d(z, {
1535
+ label: n(i)("report.section.condition.joinDatasource"),
1536
+ "model-value": o.value,
1537
+ items: T.value,
1538
+ placeholder: n(i)("report.section.condition.joinDimension"),
1539
+ "onUpdate:modelValue": a[0] || (a[0] = (k) => O(k))
1540
+ }, null, 8, ["label", "model-value", "items", "placeholder"]),
1541
+ d(e),
1542
+ (R = u.value) != null && R.joinDimension && (((j = o.value) == null ? void 0 : j.dimensionOptions) || []).length > 0 ? (f(), C(z, {
1543
+ key: 0,
1544
+ modelValue: u.value.joinDimension.option,
1545
+ "onUpdate:modelValue": a[1] || (a[1] = (k) => u.value.joinDimension.option = k),
1546
+ label: n(i)("report.section.condition.format"),
1547
+ items: ((P = o.value) == null ? void 0 : P.dimensionOptions.map((k) => ({
1548
+ label: k,
1549
+ value: k
1550
+ }))) ?? []
1551
+ }, null, 8, ["modelValue", "label", "items"])) : _("", !0),
1552
+ u.value && (((J = o.value) == null ? void 0 : J.joinConditionOperators) || []).length > 0 ? (f(), C(z, {
1553
+ key: 1,
1554
+ "model-value": u.value.operator,
1555
+ label: n(i)("report.section.condition.operator"),
1556
+ items: o.value.joinConditionOperators.map((k) => ({
1557
+ label: k,
1558
+ value: k
1559
+ })) ?? [],
1560
+ "onUpdate:modelValue": w
1561
+ }, null, 8, ["model-value", "label", "items"])) : _("", !0),
1562
+ (f(!0), L(H, null, re(((G = u.value) == null ? void 0 : G.mainDimensions) || [], (k, I) => {
1563
+ var K, ae;
1564
+ return f(), L("div", {
1565
+ key: I,
1566
+ class: "flex flex-col gap-2"
1567
+ }, [
1568
+ d(z, {
1569
+ "model-value": V.value[I],
1570
+ label: n(i)("report.section.condition.mainDatasource", { index: I + 1 }),
1571
+ items: v.mainFieldOptions.map(($) => ({
1572
+ label: $.labels.join(" "),
1573
+ value: $
1574
+ })),
1575
+ "onUpdate:modelValue": ($) => h($, I)
1576
+ }, null, 8, ["model-value", "label", "items", "onUpdate:modelValue"]),
1577
+ k && (((K = V.value[I]) == null ? void 0 : K.dimensionOptions) || []).length > 0 && k ? (f(), C(z, {
1578
+ key: 0,
1579
+ modelValue: k.option,
1580
+ "onUpdate:modelValue": ($) => k.option = $,
1581
+ items: (ae = V.value[I]) == null ? void 0 : ae.dimensionOptions.map(($) => ({
1582
+ label: $,
1583
+ value: $
1584
+ }))
1585
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "items"])) : _("", !0),
1586
+ d(e)
1587
+ ]);
1588
+ }), 128))
1589
+ ];
1590
+ }),
1591
+ _: 1
1592
+ }, 512)
1593
+ ]),
1594
+ _: 1
1595
+ }, 8, ["modelValue", "title"]),
1596
+ x("div", null, [
1597
+ x("p", $l, B(n(i)("report.section.condition.condition")), 1),
1598
+ x("p", Il, B(n(i)("report.section.condition.description")), 1)
1599
+ ]),
1600
+ d(q, { class: "flex flex-col gap-2" }, {
1601
+ default: S(() => [
1602
+ (f(!0), L(H, null, re(l.value, (R, j) => (f(), C(E, {
1603
+ key: j,
1604
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
1605
+ onClick: (P) => g(s.value[j])
1606
+ }, {
1607
+ default: S(() => {
1608
+ var P, J;
1609
+ return [
1610
+ x("p", Ll, B(n(Xe)(((P = R.joinDimension) == null ? void 0 : P.schemaName) ?? "")) + " " + B((J = R.joinDimension) == null ? void 0 : J.label), 1),
1611
+ a[4] || (a[4] = x("div", { class: "grow" }, null, -1)),
1612
+ d(U, {
1613
+ icon: "close",
1614
+ size: "md",
1615
+ variant: "tertiary",
1616
+ onClick: le((G) => F(j), ["stop"])
1617
+ }, null, 8, ["onClick"])
1618
+ ];
1619
+ }),
1620
+ _: 2
1621
+ }, 1032, ["onClick"]))), 128))
1622
+ ]),
1623
+ _: 1
1624
+ }),
1625
+ d(Z, {
1626
+ class: "text-fm-color-typo-tertiary cursor-pointer",
1627
+ onClick: a[3] || (a[3] = (R) => g())
1628
+ }, {
1629
+ default: S(() => [
1630
+ ue(B(n(i)("report.section.condition.add")), 1)
1631
+ ]),
1632
+ _: 1
1633
+ })
1634
+ ]);
1635
+ };
1636
+ }
1637
+ }), Rl = /* @__PURE__ */ Y({
1638
+ __name: "LabelSection",
1639
+ props: {
1640
+ model: {}
1641
+ },
1642
+ emits: ["update:model"],
1643
+ setup(r, { emit: i }) {
1644
+ const l = r, v = i, { t: c } = Q(), s = D({
1645
+ get: () => l.model,
1646
+ set: (u) => v("update:model", u)
1647
+ }), b = [
1648
+ { label: c("report.section.datasource.left"), value: oe.left },
1649
+ { label: c("report.section.datasource.center"), value: oe.center },
1650
+ { label: c("report.section.datasource.right"), value: oe.right },
1651
+ { label: c("report.section.datasource.start"), value: oe.start },
1652
+ { label: c("report.section.datasource.end"), value: oe.end },
1653
+ { label: c("report.section.datasource.top"), value: oe.top },
1654
+ { label: c("report.section.datasource.bottom"), value: oe.bottom }
1655
+ ], g = [
1656
+ { label: c("report.section.datasource.start"), value: de.start },
1657
+ { label: c("report.section.datasource.center"), value: de.center },
1658
+ { label: c("report.section.datasource.end"), value: de.end }
1659
+ ];
1660
+ return (u, o) => {
1661
+ const V = y("FmSwitch"), T = y("FmSelect"), O = y("FmTextField");
1662
+ return f(), L(H, null, [
1663
+ d(V, {
1664
+ label: n(c)("report.section.datasource.showLabel"),
1665
+ "label-placement": "right",
1666
+ "model-value": s.value.showLabel ?? !1,
1667
+ "onUpdate:modelValue": o[0] || (o[0] = (h) => s.value.showLabel = h)
1668
+ }, null, 8, ["label", "model-value"]),
1669
+ s.value.showLabel ? (f(), L(H, { key: 0 }, [
1670
+ d(T, {
1671
+ label: n(c)("report.section.datasource.align"),
1672
+ items: b,
1673
+ "model-value": s.value.labelAlign ?? n(oe).center,
1674
+ "onUpdate:modelValue": o[1] || (o[1] = (h) => {
1675
+ s.value = { ...s.value, labelAlign: h };
1676
+ })
1677
+ }, null, 8, ["label", "model-value"]),
1678
+ d(T, {
1679
+ label: n(c)("report.section.datasource.anchor"),
1680
+ items: g,
1681
+ "model-value": s.value.labelAnchor ?? n(de).center,
1682
+ "onUpdate:modelValue": o[2] || (o[2] = (h) => {
1683
+ s.value = { ...s.value, labelAnchor: h };
1684
+ })
1685
+ }, null, 8, ["label", "model-value"]),
1686
+ d(O, {
1687
+ label: n(c)("report.section.datasource.rotation"),
1688
+ type: "number",
1689
+ min: -180,
1690
+ max: 180,
1691
+ step: 1,
1692
+ "model-value": s.value.labelRotation ?? 0,
1693
+ "onUpdate:modelValue": o[3] || (o[3] = (h) => {
1694
+ s.value = { ...s.value, labelRotation: Number(h) };
1695
+ })
1696
+ }, null, 8, ["label", "model-value"]),
1697
+ d(O, {
1698
+ label: n(c)("report.section.datasource.offset"),
1699
+ type: "number",
1700
+ "model-value": s.value.labelOffset ?? 0,
1701
+ "onUpdate:modelValue": o[4] || (o[4] = (h) => {
1702
+ s.value = { ...s.value, labelOffset: Number(h) };
1703
+ })
1704
+ }, null, 8, ["label", "model-value"]),
1705
+ d(O, {
1706
+ label: n(c)("report.section.datasource.fontSize"),
1707
+ type: "number",
1708
+ "model-value": s.value.labelFontSize ?? 12,
1709
+ "onUpdate:modelValue": o[5] || (o[5] = (h) => {
1710
+ s.value = { ...s.value, labelFontSize: Number(h) };
1711
+ })
1712
+ }, null, 8, ["label", "model-value"])
1713
+ ], 64)) : _("", !0)
1714
+ ], 64);
1715
+ };
1716
+ }
1717
+ }), Ml = /* @__PURE__ */ Y({
1718
+ __name: "XySection",
1719
+ props: {
1720
+ model: {}
1721
+ },
1722
+ emits: ["update:model"],
1723
+ setup(r, { emit: i }) {
1724
+ const l = r, v = i, { t: c } = Q(), s = D({
1725
+ get: () => l.model,
1726
+ set: (u) => v("update:model", u)
1727
+ }), b = [
1728
+ { label: c("report.section.datasource.top"), value: "top" },
1729
+ { label: c("report.section.datasource.bottom"), value: "bottom" }
1730
+ ], g = [
1731
+ { label: c("report.section.datasource.left"), value: "left" },
1732
+ { label: c("report.section.datasource.right"), value: "right" }
1733
+ ];
1734
+ return (u, o) => {
1735
+ const V = y("FmSwitch"), T = y("FmSelect"), O = y("FmTextField");
1736
+ return f(), L(H, null, [
1737
+ d(V, {
1738
+ label: n(c)("report.section.datasource.showX"),
1739
+ "label-placement": "right",
1740
+ "model-value": s.value.showX ?? !0,
1741
+ "onUpdate:modelValue": o[0] || (o[0] = (h) => s.value.showX = h)
1742
+ }, null, 8, ["label", "model-value"]),
1743
+ s.value.showX ?? !0 ? (f(), L(H, { key: 0 }, [
1744
+ d(T, {
1745
+ label: n(c)("report.section.datasource.position"),
1746
+ items: b,
1747
+ "model-value": s.value.xPosition ?? "bottom",
1748
+ "onUpdate:modelValue": o[1] || (o[1] = (h) => s.value.xPosition = h)
1749
+ }, null, 8, ["label", "model-value"]),
1750
+ d(V, {
1751
+ label: n(c)("report.section.datasource.showGrid"),
1752
+ "label-placement": "right",
1753
+ "model-value": s.value.showXGrid ?? !1,
1754
+ "onUpdate:modelValue": o[2] || (o[2] = (h) => s.value.showXGrid = h)
1755
+ }, null, 8, ["label", "model-value"]),
1756
+ d(V, {
1757
+ label: n(c)("report.section.datasource.showTick"),
1758
+ "label-placement": "right",
1759
+ "model-value": s.value.showXTick ?? !0,
1760
+ "onUpdate:modelValue": o[3] || (o[3] = (h) => s.value.showXTick = h)
1761
+ }, null, 8, ["label", "model-value"]),
1762
+ s.value.showXTick ?? !0 ? (f(), C(O, {
1763
+ key: 0,
1764
+ label: n(c)("report.section.datasource.fontSize"),
1765
+ type: "number",
1766
+ "model-value": s.value.xTickFontSize ?? 12,
1767
+ "onUpdate:modelValue": o[4] || (o[4] = (h) => {
1768
+ s.value = { ...s.value, xTickFontSize: Number(h) };
1769
+ })
1770
+ }, null, 8, ["label", "model-value"])) : _("", !0)
1771
+ ], 64)) : _("", !0),
1772
+ d(V, {
1773
+ label: n(c)("report.section.datasource.showY"),
1774
+ "label-placement": "right",
1775
+ "model-value": s.value.showY ?? !0,
1776
+ "onUpdate:modelValue": o[5] || (o[5] = (h) => s.value.showY = h)
1777
+ }, null, 8, ["label", "model-value"]),
1778
+ s.value.showY ?? !0 ? (f(), L(H, { key: 1 }, [
1779
+ d(T, {
1780
+ label: n(c)("report.section.datasource.position"),
1781
+ items: g,
1782
+ "model-value": s.value.yPosition ?? "left",
1783
+ "onUpdate:modelValue": o[6] || (o[6] = (h) => s.value.yPosition = h)
1784
+ }, null, 8, ["label", "model-value"]),
1785
+ d(V, {
1786
+ label: n(c)("report.section.datasource.showGrid"),
1787
+ "label-placement": "right",
1788
+ "model-value": s.value.showYGrid ?? !1,
1789
+ "onUpdate:modelValue": o[7] || (o[7] = (h) => s.value.showYGrid = h)
1790
+ }, null, 8, ["label", "model-value"]),
1791
+ d(V, {
1792
+ label: n(c)("report.section.datasource.showTick"),
1793
+ "label-placement": "right",
1794
+ "model-value": s.value.showYTick ?? !0,
1795
+ "onUpdate:modelValue": o[8] || (o[8] = (h) => s.value.showYTick = h)
1796
+ }, null, 8, ["label", "model-value"]),
1797
+ s.value.showYTick ?? !0 ? (f(), C(O, {
1798
+ key: 0,
1799
+ label: n(c)("report.section.datasource.fontSize"),
1800
+ type: "number",
1801
+ "model-value": s.value.yTickFontSize ?? 12,
1802
+ "onUpdate:modelValue": o[9] || (o[9] = (h) => {
1803
+ s.value = { ...s.value, yTickFontSize: Number(h) };
1804
+ })
1805
+ }, null, 8, ["label", "model-value"])) : _("", !0)
1806
+ ], 64)) : _("", !0)
1807
+ ], 64);
1808
+ };
1809
+ }
1810
+ }), _e = /* @__PURE__ */ Y({
1811
+ __name: "Datasource",
1812
+ props: /* @__PURE__ */ X({
1813
+ label: {
1814
+ type: String,
1815
+ default: "Label"
1816
+ },
1817
+ config: {
1818
+ type: Object,
1819
+ default: null
1820
+ },
1821
+ closeable: {
1822
+ type: Boolean,
1823
+ default: !1
1824
+ },
1825
+ mainDatasourceConfig: {
1826
+ type: Object,
1827
+ default: () => {
1828
+ }
1829
+ },
1830
+ modelValue: {
1831
+ type: Object,
1832
+ default: () => {
1833
+ }
1834
+ }
1835
+ }, {
1836
+ modelValue: { required: !0 },
1837
+ modelModifiers: {}
1838
+ }),
1839
+ emits: /* @__PURE__ */ X(["click-close"], ["update:modelValue"]),
1840
+ setup(r, { emit: i }) {
1841
+ const l = W(r, "modelValue");
1842
+ me(
1843
+ [() => l.value.dimensions, () => l.value.metrics],
1844
+ () => {
1845
+ const { rowIds: w, columnIds: p } = Ve(l.value);
1846
+ l.value.rowIds = w, l.value.columnIds = p;
1847
+ },
1848
+ { deep: !0 }
1849
+ );
1850
+ const v = r, c = i, { schemas: s } = we($e()), { t: b } = Q(), g = D(() => !v.mainDatasourceConfig), u = D(
1851
+ () => [N.BarChart, N.LineChart, N.Scorecard].includes(v.config.type)
1852
+ ), o = D(() => {
1853
+ const w = [...l.value.dimensions].filter((p) => !p.hide);
1854
+ return w.sort(
1855
+ (p, F) => (l.value.rowIds || []).indexOf(pe(p)) - (l.value.rowIds || []).indexOf(pe(F))
1856
+ ), w;
1857
+ }), V = D(() => v.config.type === N.Scorecard), T = D(
1858
+ () => {
1859
+ var w;
1860
+ return (((w = v.mainDatasourceConfig) == null ? void 0 : w.schemaNames) || []).reduce(
1861
+ (p, F) => {
1862
+ const t = s.value.find((a) => a.name === F);
1863
+ return t && (p = [
1864
+ ...p,
1865
+ ...t.fields.map((a) => ({
1866
+ ...a,
1867
+ labels: [t.label, a.label || a.name]
1868
+ }))
1869
+ ]), p;
1870
+ },
1871
+ []
1872
+ );
1873
+ }
1874
+ ), O = D(
1875
+ () => l.value.schemaNames.reduce((w, p) => {
1876
+ const F = s.value.find((t) => t.name === p);
1877
+ return F && (w = [
1878
+ ...w,
1879
+ ...F.fields.map((t) => ({
1880
+ ...t,
1881
+ labels: [F.label, t.label || t.name]
1882
+ }))
1883
+ ]), w;
1884
+ }, [])
1885
+ ), h = D(() => [
1886
+ { labels: [b("report.section.datasource.none")], value: null },
1887
+ { labels: [b("report.section.datasource.grandTotal")], value: 0 },
1888
+ ...[...o.value].slice(0, o.value.length - 1).map((w, p) => ({ labels: [w.label], value: p + 1 }))
1889
+ ]);
1890
+ return (w, p) => {
1891
+ const F = y("FmButton"), t = y("FmSwitch"), a = y("FmSelect");
1892
+ return f(), C(ge, null, {
1893
+ header: S(() => [
1894
+ x("p", null, B(v.label), 1),
1895
+ p[19] || (p[19] = x("div", { class: "grow" }, null, -1)),
1896
+ v.closeable ? (f(), C(F, {
1897
+ key: 0,
1898
+ icon: "close",
1899
+ variant: "tertiary",
1900
+ size: "md",
1901
+ onClick: p[0] || (p[0] = le((e) => c("click-close"), ["stop"]))
1902
+ })) : _("", !0)
1903
+ ]),
1904
+ content: S(() => [
1905
+ d(ll, {
1906
+ modelValue: l.value,
1907
+ "onUpdate:modelValue": p[1] || (p[1] = (e) => l.value = e),
1908
+ label: n(b)("report.section.schema.title")
1909
+ }, null, 8, ["modelValue", "label"]),
1910
+ d(be, {
1911
+ modelValue: l.value.dimensions,
1912
+ "onUpdate:modelValue": p[2] || (p[2] = (e) => l.value.dimensions = e),
1913
+ options: O.value,
1914
+ config: l.value,
1915
+ max: v.config.maxDimension,
1916
+ "has-row-column": !0,
1917
+ onConfig: p[3] || (p[3] = (e) => {
1918
+ l.value = e;
1919
+ })
1920
+ }, null, 8, ["modelValue", "options", "config", "max"]),
1921
+ d(t, {
1922
+ "label-placement": "right",
1923
+ label: n(b)("report.section.datasource.comparable"),
1924
+ "model-value": l.value.isComparable ?? !1,
1925
+ "onUpdate:modelValue": p[4] || (p[4] = (e) => {
1926
+ l.value.isComparable = e;
1927
+ })
1928
+ }, null, 8, ["label", "model-value"]),
1929
+ u.value ? (f(), C(t, {
1930
+ key: 0,
1931
+ "label-placement": "right",
1932
+ label: n(b)("report.section.datasource.cumulative"),
1933
+ "model-value": l.value.isCumulative ?? !1,
1934
+ "onUpdate:modelValue": p[5] || (p[5] = (e) => {
1935
+ l.value.isCumulative = e;
1936
+ })
1937
+ }, null, 8, ["label", "model-value"])) : _("", !0),
1938
+ v.config.isDrillConfigurable && g.value ? (f(), C(t, {
1939
+ key: 1,
1940
+ label: n(b)("report.section.datasource.drill"),
1941
+ "label-placement": "right",
1942
+ "model-value": l.value.isDrillable ?? !1,
1943
+ "onUpdate:modelValue": p[6] || (p[6] = (e) => {
1944
+ l.value.isDrillable = e;
1945
+ })
1946
+ }, null, 8, ["label", "model-value"])) : _("", !0),
1947
+ v.config.canRollup && g.value ? (f(), C(a, {
1948
+ key: 2,
1949
+ modelValue: l.value.rollup,
1950
+ "onUpdate:modelValue": p[7] || (p[7] = (e) => l.value.rollup = e),
1951
+ label: n(b)("report.section.datasource.subTotal"),
1952
+ items: h.value.map((e) => ({ label: e.labels[0], value: e.value }))
1953
+ }, null, 8, ["modelValue", "label", "items"])) : _("", !0),
1954
+ v.config.canTranspose && g.value ? (f(), C(t, {
1955
+ key: 3,
1956
+ modelValue: l.value.isTransposed,
1957
+ "onUpdate:modelValue": p[8] || (p[8] = (e) => l.value.isTransposed = e),
1958
+ label: n(b)("report.section.datasource.transpose"),
1959
+ "label-placement": "right"
1960
+ }, null, 8, ["modelValue", "label"])) : _("", !0),
1961
+ v.config.hasLabel ? (f(), C(Rl, {
1962
+ key: 4,
1963
+ model: l.value,
1964
+ "onUpdate:model": p[9] || (p[9] = (e) => l.value = e)
1965
+ }, null, 8, ["model"])) : _("", !0),
1966
+ v.config.hasXy ? (f(), C(Ml, {
1967
+ key: 5,
1968
+ model: l.value,
1969
+ "onUpdate:model": p[10] || (p[10] = (e) => l.value = e)
1970
+ }, null, 8, ["model"])) : _("", !0),
1971
+ v.config.hasBreakdownDimension ? (f(), C(be, {
1972
+ key: 6,
1973
+ "model-value": l.value.breakdownDimension ? [l.value.breakdownDimension] : [],
1974
+ label: n(b)("report.section.dimension.breakdownDimension"),
1975
+ max: 1,
1976
+ options: O.value,
1977
+ "onUpdate:modelValue": p[11] || (p[11] = (e) => {
1978
+ l.value.breakdownDimension = e[0];
1979
+ })
1980
+ }, null, 8, ["model-value", "label", "options"])) : _("", !0),
1981
+ V.value ? (f(), C(be, {
1982
+ key: 7,
1983
+ "model-value": l.value.sparklineDimension ? [l.value.sparklineDimension] : [],
1984
+ label: n(b)("report.section.dimension.sparklineDimension"),
1985
+ max: 1,
1986
+ options: O.value,
1987
+ "onUpdate:modelValue": p[12] || (p[12] = (e) => {
1988
+ l.value.sparklineDimension = e[0];
1989
+ })
1990
+ }, null, 8, ["model-value", "label", "options"])) : _("", !0),
1991
+ d(cl, {
1992
+ modelValue: l.value.metrics,
1993
+ "onUpdate:modelValue": p[13] || (p[13] = (e) => l.value.metrics = e),
1994
+ options: O.value,
1995
+ max: v.config.maxMetric,
1996
+ config: l.value,
1997
+ "has-row-column": v.config.type === n(N).Table,
1998
+ onConfig: p[14] || (p[14] = (e) => {
1999
+ l.value = e;
2000
+ })
2001
+ }, null, 8, ["modelValue", "options", "max", "config", "has-row-column"]),
2002
+ d(kl, {
2003
+ modelValue: l.value.filters,
2004
+ "onUpdate:modelValue": p[15] || (p[15] = (e) => l.value.filters = e),
2005
+ options: O.value
2006
+ }, null, 8, ["modelValue", "options"]),
2007
+ d(Sl, {
2008
+ modelValue: l.value.sorts,
2009
+ "onUpdate:modelValue": p[16] || (p[16] = (e) => l.value.sorts = e),
2010
+ options: O.value
2011
+ }, null, 8, ["modelValue", "options"]),
2012
+ d(Dl, {
2013
+ modelValue: l.value.limit,
2014
+ "onUpdate:modelValue": p[17] || (p[17] = (e) => l.value.limit = e)
2015
+ }, null, 8, ["modelValue"]),
2016
+ l.value.conditions ? (f(), C(Bl, {
2017
+ key: 8,
2018
+ modelValue: l.value.conditions,
2019
+ "onUpdate:modelValue": p[18] || (p[18] = (e) => l.value.conditions = e),
2020
+ "join-field-options": O.value,
2021
+ "main-field-options": T.value
2022
+ }, null, 8, ["modelValue", "join-field-options", "main-field-options"])) : _("", !0)
2023
+ ]),
2024
+ _: 1
2025
+ });
2026
+ };
2027
+ }
2028
+ }), jl = { class: "fm-typo-en-title-sm-600" }, he = /* @__PURE__ */ Y({
2029
+ __name: "TileEditorTabHeader",
2030
+ props: /* @__PURE__ */ X({
2031
+ icon: {
2032
+ type: String,
2033
+ required: !0
2034
+ }
2035
+ }, {
2036
+ modelValue: { type: Boolean, required: !0, default: !1 },
2037
+ modelModifiers: {}
2038
+ }),
2039
+ emits: ["update:modelValue"],
2040
+ setup(r) {
2041
+ const { t: i } = Q(), l = W(r, "modelValue"), v = r;
2042
+ return (c, s) => {
2043
+ const b = y("FmIcon");
2044
+ return f(), L("div", {
2045
+ class: "px-6 py-16 flex items-center gap-2 bg-fm-color-neutral-white border cursor-pointer",
2046
+ onClick: s[0] || (s[0] = (g) => l.value = !l.value)
2047
+ }, [
2048
+ x("p", jl, B(n(i)("report.tile.setting")), 1),
2049
+ s[1] || (s[1] = x("div", { class: "grow" }, null, -1)),
2050
+ d(b, {
2051
+ name: v.icon
2052
+ }, null, 8, ["name"])
2053
+ ]);
2054
+ };
2055
+ }
2056
+ }), El = /* @__PURE__ */ Y({
2057
+ __name: "TileEditorTabDesktop",
2058
+ props: {
2059
+ modelValue: { required: !0, default: !1 },
2060
+ modelModifiers: {}
2061
+ },
2062
+ emits: ["update:modelValue"],
2063
+ setup(r) {
2064
+ const i = W(r, "modelValue");
2065
+ return (l, v) => (f(), L(H, null, [
2066
+ d(he, {
2067
+ modelValue: i.value,
2068
+ "onUpdate:modelValue": v[0] || (v[0] = (c) => i.value = c),
2069
+ icon: "keyboard_double_arrow_left"
2070
+ }, null, 8, ["modelValue"]),
2071
+ Te(l.$slots, "default")
2072
+ ], 64));
2073
+ }
2074
+ }), Al = { class: "fixed bottom-0 w-full" }, Pl = /* @__PURE__ */ Y({
2075
+ __name: "TileEditorTabMobile",
2076
+ props: {
2077
+ modelValue: { required: !0, default: !1 },
2078
+ modelModifiers: {}
2079
+ },
2080
+ emits: ["update:modelValue"],
2081
+ setup(r) {
2082
+ const i = W(r, "modelValue");
2083
+ return (l, v) => {
2084
+ const c = y("FmTopSheet");
2085
+ return f(), L("div", Al, [
2086
+ d(he, {
2087
+ modelValue: i.value,
2088
+ "onUpdate:modelValue": v[0] || (v[0] = (s) => i.value = s),
2089
+ icon: "keyboard_double_arrow_up"
2090
+ }, null, 8, ["modelValue"]),
2091
+ d(c, {
2092
+ modelValue: i.value,
2093
+ "onUpdate:modelValue": v[2] || (v[2] = (s) => i.value = s),
2094
+ "fullscreen-size": "sm"
2095
+ }, {
2096
+ default: S(() => [
2097
+ d(he, {
2098
+ modelValue: i.value,
2099
+ "onUpdate:modelValue": v[1] || (v[1] = (s) => i.value = s),
2100
+ icon: "keyboard_double_arrow_down"
2101
+ }, null, 8, ["modelValue"]),
2102
+ i.value ? Te(l.$slots, "default", { key: 0 }) : _("", !0)
2103
+ ]),
2104
+ _: 3
2105
+ }, 8, ["modelValue"])
2106
+ ]);
2107
+ };
2108
+ }
2109
+ }), ql = { class: "h-[40x]" }, Be = /* @__PURE__ */ Y({
2110
+ __name: "TileEditorTab",
2111
+ props: /* @__PURE__ */ X({
2112
+ hideConfiguration: {
2113
+ type: Boolean,
2114
+ default: !1
2115
+ }
2116
+ }, {
2117
+ modelValue: {
2118
+ required: !0
2119
+ },
2120
+ modelModifiers: {}
2121
+ }),
2122
+ emits: /* @__PURE__ */ X(["hideConfiguration"], ["update:modelValue"]),
2123
+ setup(r, { emit: i }) {
2124
+ const l = W(r, "modelValue"), { breakpoints: v } = Oe(), c = r, { promptMessage: s } = Ne(), b = i, { t: g } = Q();
2125
+ function u(t) {
2126
+ l.value = il(t);
2127
+ }
2128
+ function o() {
2129
+ const t = [...l.value.widget.config.joinDatasources || []];
2130
+ t.push({ ...ze(l.value.widget.type), conditions: [] }), u({
2131
+ ...l.value,
2132
+ widget: {
2133
+ ...l.value.widget,
2134
+ config: {
2135
+ ...l.value.widget.config,
2136
+ joinDatasources: t
2137
+ }
2138
+ }
2139
+ });
2140
+ }
2141
+ async function V(t) {
2142
+ if (!await s({
2143
+ title: g("report.tile.datasource.remove"),
2144
+ message: g("report.tile.datasource.confirmRemove", { index: t + 1 })
2145
+ })) return;
2146
+ const e = [...l.value.widget.config.joinDatasources || []];
2147
+ e.splice(t, 1), u({
2148
+ ...l.value,
2149
+ widget: {
2150
+ ...l.value.widget,
2151
+ config: {
2152
+ ...l.value.widget.config,
2153
+ joinDatasources: e
2154
+ }
2155
+ }
2156
+ });
2157
+ }
2158
+ const T = (t, a) => {
2159
+ let e = 1, m = 1;
2160
+ switch (t) {
2161
+ case N.Scorecard:
2162
+ e = 1, m = 2;
2163
+ break;
2164
+ case N.BarChart:
2165
+ case N.StackBarChart:
2166
+ case N.LineChart:
2167
+ case N.StackLineChart:
2168
+ e = 4, m = 6;
2169
+ break;
2170
+ case N.Table:
2171
+ e = 4, m = 12;
2172
+ break;
2173
+ case N.Circular:
2174
+ e = 4, m = 4;
2175
+ break;
2176
+ case N.Spacer:
2177
+ e = 0, m = 12;
2178
+ break;
2179
+ }
2180
+ return {
2181
+ size: {
2182
+ height: e,
2183
+ width: m
2184
+ },
2185
+ widget: {
2186
+ ...a.widget,
2187
+ type: t
2188
+ }
2189
+ };
2190
+ }, O = D(
2191
+ () => xe.find((t) => t.type === l.value.widget.type)
2192
+ ), h = D(() => l.value.widget.config.joinDatasources), w = D(() => {
2193
+ switch (l.value.widget.type) {
2194
+ case N.Table:
2195
+ case N.BarChart:
2196
+ case N.LineChart:
2197
+ case N.StackBarChart:
2198
+ case N.StackLineChart:
2199
+ case N.Circular:
2200
+ return 4;
2201
+ case N.Scorecard:
2202
+ return 2;
2203
+ default:
2204
+ return 1;
2205
+ }
2206
+ }), p = D(() => {
2207
+ switch (l.value.widget.type) {
2208
+ case N.Table:
2209
+ case N.BarChart:
2210
+ case N.LineChart:
2211
+ case N.StackBarChart:
2212
+ case N.StackLineChart:
2213
+ case N.Circular:
2214
+ return 4;
2215
+ default:
2216
+ return 1;
2217
+ }
2218
+ }), F = De((t) => {
2219
+ l.value.widget.title = t;
2220
+ }, 500);
2221
+ return (t, a) => {
2222
+ const e = y("FmCircularProgress"), m = y("FmTextField"), U = y("FmTextarea"), E = y("FmStepperField"), q = y("FmButton"), Z = y("FmForm");
2223
+ return f(), C(Se(n(v).lg || n(v).md ? El : Pl), {
2224
+ "model-value": c.hideConfiguration,
2225
+ "onUpdate:modelValue": a[6] || (a[6] = (R) => b("hideConfiguration", R))
2226
+ }, {
2227
+ default: S(() => [
2228
+ l.value ? (f(), C(Z, {
2229
+ key: 1,
2230
+ ref: "form",
2231
+ class: "px-6 py-16 flex flex-col gap-24 overflow-y-auto overflow-x-hidden"
2232
+ }, {
2233
+ default: S(() => [
2234
+ d(ge, null, {
2235
+ header: S(() => [
2236
+ x("p", null, B(n(g)("report.tile.widget.details")), 1),
2237
+ a[7] || (a[7] = x("div", { class: "grow" }, null, -1))
2238
+ ]),
2239
+ content: S(() => [
2240
+ d(m, {
2241
+ "model-value": l.value.widget.title,
2242
+ label: n(g)("report.tile.widget.title"),
2243
+ placeholder: n(g)("report.tile.widget.titlePlaceholder"),
2244
+ "onUpdate:modelValue": n(F)
2245
+ }, null, 8, ["model-value", "label", "placeholder", "onUpdate:modelValue"]),
2246
+ d(U, {
2247
+ modelValue: l.value.widget.description,
2248
+ "onUpdate:modelValue": a[0] || (a[0] = (R) => l.value.widget.description = R),
2249
+ disabled: l.value.widget.title === "",
2250
+ label: n(g)("report.tile.widget.description"),
2251
+ placeholder: n(g)("report.tile.widget.descriptionPlaceholder"),
2252
+ "helper-text": n(g)("report.tile.widget.descriptionHelper")
2253
+ }, null, 8, ["modelValue", "disabled", "label", "placeholder", "helper-text"]),
2254
+ x("div", {
2255
+ class: Ue(["flex flex-row", `${n(v).sm || n(v).xs ? "gap-16" : "gap-2"}`])
2256
+ }, [
2257
+ d(E, {
2258
+ modelValue: l.value.size.width,
2259
+ "onUpdate:modelValue": a[1] || (a[1] = (R) => l.value.size.width = R),
2260
+ label: n(g)("report.tile.widget.width"),
2261
+ min: w.value,
2262
+ max: 12
2263
+ }, null, 8, ["modelValue", "label", "min"]),
2264
+ d(E, {
2265
+ modelValue: l.value.size.height,
2266
+ "onUpdate:modelValue": a[2] || (a[2] = (R) => l.value.size.height = R),
2267
+ label: n(g)("report.tile.widget.height"),
2268
+ min: p.value,
2269
+ max: 12,
2270
+ disabled: l.value.widget.type === n(N).Scorecard
2271
+ }, null, 8, ["modelValue", "label", "min", "disabled"])
2272
+ ], 2)
2273
+ ]),
2274
+ _: 1
2275
+ }),
2276
+ d(ge, null, {
2277
+ header: S(() => [
2278
+ x("p", null, B(n(g)("report.tile.widget.type")), 1),
2279
+ a[8] || (a[8] = x("div", { class: "grow" }, null, -1))
2280
+ ]),
2281
+ content: S(() => [
2282
+ d(qe, {
2283
+ "is-list": !0,
2284
+ "model-value": l.value.widget.type,
2285
+ class: "grid grid-cols-1 gap-2",
2286
+ "child-class": "flex flex-row p-[8px] gap-2",
2287
+ "exclude-widge-type": [n(N).Spacer],
2288
+ "onUpdate:modelValue": a[3] || (a[3] = (R) => l.value = T(R, l.value))
2289
+ }, null, 8, ["model-value", "exclude-widge-type"])
2290
+ ]),
2291
+ _: 1
2292
+ }),
2293
+ d(_e, {
2294
+ modelValue: l.value.widget.config,
2295
+ "onUpdate:modelValue": a[4] || (a[4] = (R) => l.value.widget.config = R),
2296
+ label: n(g)("report.tile.datasource.main"),
2297
+ config: O.value
2298
+ }, null, 8, ["modelValue", "label", "config"]),
2299
+ h.value ? (f(!0), L(H, { key: 0 }, re(h.value, (R, j) => (f(), L("div", { key: j }, [
2300
+ d(_e, {
2301
+ modelValue: h.value[j],
2302
+ "onUpdate:modelValue": (P) => h.value[j] = P,
2303
+ label: `Join datasource ${j + 1}`,
2304
+ config: O.value,
2305
+ "main-datasource-config": l.value.widget.config,
2306
+ closeable: !0,
2307
+ onClickClose: (P) => V(j)
2308
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "label", "config", "main-datasource-config", "onClickClose"])
2309
+ ]))), 128)) : _("", !0),
2310
+ x("div", ql, [
2311
+ d(q, {
2312
+ label: n(g)("report.tile.datasource.joinButton"),
2313
+ variant: "secondary",
2314
+ icon: "add",
2315
+ "icon-position": "prepend",
2316
+ "border-color": n(ce).ColorPrimary,
2317
+ "text-color": n(ce).ColorPrimary,
2318
+ class: "w-full",
2319
+ onClick: a[5] || (a[5] = (R) => o())
2320
+ }, null, 8, ["label", "border-color", "text-color"])
2321
+ ])
2322
+ ]),
2323
+ _: 1
2324
+ }, 512)) : (f(), C(e, { key: 0 }))
2325
+ ]),
2326
+ _: 1
2327
+ }, 8, ["model-value"]);
2328
+ };
2329
+ }
2330
+ }), zl = { class: "bg-fm-color-neutral-white flex flex-col h-full w-[400px]" }, Hl = { class: "flex bg-fm-color-neutral-white w-[88px]" }, Yl = { class: "w-full overflow-y-auto" }, Gl = {
2331
+ class: "grid grid-cols-12 w-full p-24",
2332
+ style: { backgroundColor: "#F6F8FC" }
2333
+ }, Xl = /* @__PURE__ */ Y({
2334
+ __name: "TileEditorDesktop",
2335
+ props: /* @__PURE__ */ X({
2336
+ hideConfiguration: { type: Boolean, required: !0, default: !1 },
2337
+ index: { type: Number, required: !0, default: 0 }
2338
+ }, {
2339
+ modelValue: {
2340
+ required: !0
2341
+ },
2342
+ modelModifiers: {}
2343
+ }),
2344
+ emits: /* @__PURE__ */ X(["hideConfiguration"], ["update:modelValue"]),
2345
+ setup(r, { emit: i }) {
2346
+ const l = W(r, "modelValue"), v = r, c = D(
2347
+ () => xe.find((b) => {
2348
+ var g;
2349
+ return b.type === ((g = l.value) == null ? void 0 : g.widget.type);
2350
+ })
2351
+ ), s = i;
2352
+ return (b, g) => {
2353
+ const u = y("FmCircularProgress"), o = y("FmButton");
2354
+ return f(), L("div", null, [
2355
+ l.value ? (f(), L(H, { key: 1 }, [
2356
+ d(He, {
2357
+ "model-value": !r.hideConfiguration
2358
+ }, {
2359
+ right: S(() => [
2360
+ x("div", zl, [
2361
+ d(Be, {
2362
+ modelValue: l.value,
2363
+ "onUpdate:modelValue": g[0] || (g[0] = (V) => l.value = V),
2364
+ config: c.value,
2365
+ "hide-configuration": r.hideConfiguration,
2366
+ onHideConfiguration: g[1] || (g[1] = (V) => {
2367
+ s("hideConfiguration", V);
2368
+ })
2369
+ }, null, 8, ["modelValue", "config", "hide-configuration"])
2370
+ ])
2371
+ ]),
2372
+ left: S(() => [
2373
+ x("div", Hl, [
2374
+ d(o, {
2375
+ variant: "secondary",
2376
+ icon: "keyboard_double_arrow_right",
2377
+ "border-color": n(ce).ColorPrimary,
2378
+ "text-color": n(ce).ColorPrimary,
2379
+ class: "m-24 my-16",
2380
+ size: "md",
2381
+ onClick: g[2] || (g[2] = (V) => s("hideConfiguration", !v.hideConfiguration))
2382
+ }, null, 8, ["border-color", "text-color"])
2383
+ ])
2384
+ ]),
2385
+ _: 1
2386
+ }, 8, ["model-value"]),
2387
+ x("div", Yl, [
2388
+ x("div", Gl, [
2389
+ l.value ? (f(), C(Ie, {
2390
+ key: 0,
2391
+ "model-value": l.value,
2392
+ index: v.index,
2393
+ "hide-export": !0
2394
+ }, null, 8, ["model-value", "index"])) : (f(), C(Le, { key: 1 }))
2395
+ ])
2396
+ ])
2397
+ ], 64)) : (f(), C(u, { key: 0 }))
2398
+ ]);
2399
+ };
2400
+ }
2401
+ }), Jl = {
2402
+ key: 0,
2403
+ class: "flex w-full justify-center items-center"
2404
+ }, Wl = { class: "w-full grid grid-cols-12 pb-28 pt-5 px-5 h-full" }, Kl = /* @__PURE__ */ Y({
2405
+ __name: "TileEditorMobile",
2406
+ props: /* @__PURE__ */ X({
2407
+ hideConfiguration: { type: Boolean, required: !0, default: !1 },
2408
+ index: { type: Number, required: !0, default: 0 }
2409
+ }, {
2410
+ modelValue: {
2411
+ required: !0
2412
+ },
2413
+ modelModifiers: {}
2414
+ }),
2415
+ emits: /* @__PURE__ */ X(["hideConfiguration"], ["update:modelValue"]),
2416
+ setup(r, { emit: i }) {
2417
+ const l = W(r, "modelValue"), v = r, c = D(
2418
+ () => xe.find((b) => {
2419
+ var g;
2420
+ return b.type === ((g = l.value) == null ? void 0 : g.widget.type);
2421
+ })
2422
+ ), s = i;
2423
+ return (b, g) => {
2424
+ const u = y("FmCircularProgress");
2425
+ return f(), L("div", null, [
2426
+ l.value ? (f(), L(H, { key: 1 }, [
2427
+ x("div", Wl, [
2428
+ l.value ? (f(), C(Ie, {
2429
+ key: 0,
2430
+ "model-value": l.value,
2431
+ index: v.index,
2432
+ "hide-export": !0
2433
+ }, null, 8, ["model-value", "index"])) : (f(), C(Le, { key: 1 }))
2434
+ ]),
2435
+ d(Be, {
2436
+ modelValue: l.value,
2437
+ "onUpdate:modelValue": g[0] || (g[0] = (o) => l.value = o),
2438
+ config: c.value,
2439
+ "hide-configuration": r.hideConfiguration,
2440
+ onHideConfiguration: g[1] || (g[1] = (o) => {
2441
+ s("hideConfiguration", o);
2442
+ })
2443
+ }, null, 8, ["modelValue", "config", "hide-configuration"])
2444
+ ], 64)) : (f(), L("div", Jl, [
2445
+ d(u)
2446
+ ]))
2447
+ ]);
2448
+ };
2449
+ }
2450
+ }), Ql = {
2451
+ key: 0,
2452
+ class: "fm-typo-en-title-md-600"
2453
+ }, pa = /* @__PURE__ */ Y({
2454
+ __name: "TileEditor",
2455
+ setup(r) {
2456
+ const i = Ee(), l = Ae(), v = Ge(), { currentSelectWidgetType: c, editingReport: s, editingTile: b, editingIndex: g } = we(v), { breakpoints: u } = Oe(), { promptMessage: o } = Ne(), { t: V } = Q(), T = A(!1);
2457
+ async function O() {
2458
+ var p;
2459
+ if (!s.value) return;
2460
+ await o({
2461
+ title: V("report.tile.save.title"),
2462
+ message: V("report.tile.save.confirm", { title: (p = b.value) == null ? void 0 : p.widget.title })
2463
+ }) && (b.value && (s.value.tiles[g.value] = b.value), c.value = void 0, l.back());
2464
+ }
2465
+ async function h() {
2466
+ var p;
2467
+ if (!s.value) return;
2468
+ await o({
2469
+ title: V("report.tile.cancel.title"),
2470
+ message: V("report.tile.cancel.confirm", { title: (p = b.value) == null ? void 0 : p.widget.title })
2471
+ }) && (c.value = void 0, l.back());
2472
+ }
2473
+ return Re(() => {
2474
+ s.value || l.push({ name: "reports" });
2475
+ }), (w, p) => {
2476
+ const F = y("FmPageHead");
2477
+ return f(), C(Ye, null, {
2478
+ default: S(() => [
2479
+ d(F, {
2480
+ actions: [
2481
+ { label: "Cancel", value: "cancel", isPrimary: !1 },
2482
+ { label: "Save", value: "save", isPrimary: !0 }
2483
+ ],
2484
+ "onClick:action": p[0] || (p[0] = (t) => {
2485
+ t === "cancel" && h(), t === "save" && O();
2486
+ })
2487
+ }, {
2488
+ title: S(() => {
2489
+ var t;
2490
+ return [
2491
+ n(u).lg || n(u).md ? (f(), L("p", Ql, B(n(ke)(((t = n(b)) == null ? void 0 : t.widget.type) ?? "New report")), 1)) : _("", !0)
2492
+ ];
2493
+ }),
2494
+ _: 1
2495
+ }),
2496
+ n(b) ? (f(), C(Se(n(u).lg || n(u).md ? Xl : Kl), {
2497
+ key: 0,
2498
+ modelValue: n(b),
2499
+ "onUpdate:modelValue": p[1] || (p[1] = (t) => je(b) ? b.value = t : null),
2500
+ class: Ue(`${n(u).lg || n(u).md ? "flex" : ""} w-full`),
2501
+ style: Me({ height: `calc( 100% - ${n(u).lg || n(u).md ? 72 : 64}px)` }),
2502
+ "hide-configuration": T.value,
2503
+ index: Number(n(i).params.tileIndex),
2504
+ onHideConfiguration: p[2] || (p[2] = (t) => T.value = t)
2505
+ }, null, 40, ["modelValue", "class", "style", "hide-configuration", "index"])) : _("", !0)
2506
+ ]),
2507
+ _: 1
2508
+ });
2509
+ };
2510
+ }
2511
+ });
2512
+ export {
2513
+ pa as default
2514
+ };