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