@feedmepos/mf-report 5.7.1 → 5.7.2

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