@feedmepos/mf-report 5.26.4 → 5.26.5-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{App-swq2ECTF.js → App-QcOCU8rc.js} +60 -60
  2. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-D2CpsvxS.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-De-0BpSa.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-_zBaKDEK.js → Default.vue_vue_type_script_setup_true_lang-3blnkA-n.js} +1 -1
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-hP3sZIfZ.js +4777 -0
  5. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-Dun5PD4W.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-DHPUtfOs.js} +2521 -2562
  6. package/dist/{InsightView-zWCeytWt.js → InsightView-_wb0GqpG.js} +4 -4
  7. package/dist/{Integration-DYCTpXlU.js → Integration-DyGkKMsa.js} +3 -3
  8. package/dist/{Integrations-ClLIVRa8.js → Integrations-C5ZsHxmd.js} +2 -2
  9. package/dist/{Layout-B4fXLMaj.js → Layout-CmMa2qs4.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-KKttveoS.js → MenuTab.vue_vue_type_script_setup_true_lang-BsE2UhQ5.js} +4 -4
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-CH7w1ORf.js → NavigationTab.vue_vue_type_script_setup_true_lang-ewnLHyBz.js} +3 -3
  12. package/dist/{OverviewView-BhXfogDe.js → OverviewView-DCz3S4k6.js} +4 -4
  13. package/dist/{Report-BwmFIgo-.js → Report-Bksdpnal.js} +3 -3
  14. package/dist/{ReportEditor-CTQ8vCNs.js → ReportEditor-BHONojQQ.js} +228 -228
  15. package/dist/{ReportView-ZCaT-MkZ.js → ReportView-vhrQCIHU.js} +6 -6
  16. package/dist/{Setting-Co8VUFhL.js → Setting-CwwCAzJH.js} +3 -3
  17. package/dist/{Template-22RXwi-V.js → Template-DVYVtNYg.js} +3 -3
  18. package/dist/TileEditor-BXCFEix_.js +4027 -0
  19. package/dist/TransitionFade-B2T5r_vC.js +3360 -0
  20. package/dist/{app-B8enBaoM.js → app-DnkOgWGu.js} +1470 -993
  21. package/dist/app.js +1 -1
  22. package/dist/assets/{formatChartData.worker-CM3TtVoi.js → formatChartData.worker-BwOf9WPp.js} +5 -5
  23. package/dist/assets/{processTableData.worker-BTFUd91t.js → processTableData.worker-BlwP8Wjn.js} +5 -5
  24. package/dist/style.css +1 -1
  25. package/dist/{useRestaurantPermission-Bc9WzEui.js → useRestaurantPermission-CQKnU3lQ.js} +1 -1
  26. package/package.json +1 -1
  27. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-BoRLpJ9M.js +0 -4924
  28. package/dist/TileEditor-Bs4LL9Bo.js +0 -3863
  29. package/dist/TransitionFade-BYmuDYSd.js +0 -2379
@@ -0,0 +1,4027 @@
1
+ import { defineComponent as ue, mergeModels as ve, useModel as ye, computed as k, ref as le, resolveComponent as M, createElementBlock as X, openBlock as g, createVNode as m, createElementVNode as h, unref as l, withCtx as Q, toDisplayString as J, Fragment as de, renderList as _e, withModifiers as Ce, createTextVNode as ze, watch as Ve, createCommentVNode as E, createBlock as R, renderSlot as bl, onBeforeUnmount as nl, resolveDynamicComponent as hl, normalizeClass as $e, withDirectives as ke, vShow as Te, onMounted as wl, withKeys as dl, vModelText as Il, normalizeStyle as tl, isRef as zl } from "vue";
2
+ import { useRoute as Rl, useRouter as Pl } from "vue-router";
3
+ import { h as El, u as il, c as Ie, F as Oe, d as Je, S as ol, a as Wl, W as Xl, e as ql, T as Hl, b as Gl } from "./TransitionFade-B2T5r_vC.js";
4
+ import { W as Y, a as Cl, f as Re, D as Yl, S as ml, C as Jl, u as xl, P as cl, d as Kl, b as Ql } from "./GlobalFilterSelect.vue_vue_type_script_setup_true_lang-DHPUtfOs.js";
5
+ import { storeToRefs as je } from "pinia";
6
+ import { u as Fl } from "./message-dialog-UoMWOnil.js";
7
+ import { useSnackbar as Zl, useBreakpoints as Vl, FmButtonColorThemeVariant as Me } from "@feedmepos/ui-library";
8
+ import { a as be, b as kl, _ as _l } from "./SelectComponent.vue_vue_type_script_setup_true_lang-BL1jpiXN.js";
9
+ import { u as ge } from "./vue-i18n-DVWuTfed.js";
10
+ import { r as re } from "./i18n-CI_sQ5d_.js";
11
+ import { g as we, R as pl, L as Be, a as Ze, S as ie, d as fe, b as el, c as vl, _ as Sl } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-hP3sZIfZ.js";
12
+ import { a as Ne, d as He } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-De-0BpSa.js";
13
+ import { a as et, d as qe } from "./app-DnkOgWGu.js";
14
+ const Ke = [
15
+ {
16
+ type: Y.Circular,
17
+ maxDimension: null,
18
+ maxMetric: 1,
19
+ hasBreakdownDimension: !1,
20
+ canTranspose: !1,
21
+ isDrillConfigurable: !1,
22
+ hasChart: !0,
23
+ hasTable: !1,
24
+ hasLabel: !0,
25
+ hasLegend: !0,
26
+ hasXy: !1,
27
+ canRollup: !1,
28
+ showRollupPosition: !1,
29
+ canSearch: !1,
30
+ periodType: null
31
+ },
32
+ {
33
+ type: Y.Table,
34
+ maxDimension: null,
35
+ maxMetric: null,
36
+ hasBreakdownDimension: !1,
37
+ canTranspose: !1,
38
+ isDrillConfigurable: !0,
39
+ hasChart: !1,
40
+ hasTable: !0,
41
+ hasLabel: !1,
42
+ hasLegend: !1,
43
+ hasXy: !1,
44
+ canRollup: !0,
45
+ showRollupPosition: !0,
46
+ canSearch: !0,
47
+ periodType: null
48
+ },
49
+ {
50
+ type: Y.BarChart,
51
+ maxDimension: null,
52
+ maxMetric: 1,
53
+ hasBreakdownDimension: !0,
54
+ canTranspose: !0,
55
+ isDrillConfigurable: !1,
56
+ hasChart: !0,
57
+ hasTable: !1,
58
+ hasLabel: !0,
59
+ hasLegend: !0,
60
+ hasXy: !0,
61
+ canRollup: !1,
62
+ showRollupPosition: !1,
63
+ canSearch: !1,
64
+ periodType: null
65
+ },
66
+ {
67
+ type: Y.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
+ periodType: null
82
+ },
83
+ {
84
+ type: Y.StackBarChart,
85
+ maxDimension: null,
86
+ maxMetric: 1,
87
+ hasBreakdownDimension: !0,
88
+ canTranspose: !0,
89
+ isDrillConfigurable: !1,
90
+ hasChart: !0,
91
+ hasTable: !1,
92
+ hasLabel: !0,
93
+ hasLegend: !0,
94
+ hasXy: !0,
95
+ canRollup: !1,
96
+ showRollupPosition: !1,
97
+ canSearch: !1,
98
+ periodType: null
99
+ },
100
+ {
101
+ type: Y.ClusteredStackBarChart,
102
+ maxDimension: null,
103
+ maxMetric: 1,
104
+ hasBreakdownDimension: !0,
105
+ canTranspose: !0,
106
+ isDrillConfigurable: !1,
107
+ hasChart: !0,
108
+ hasTable: !1,
109
+ hasLabel: !0,
110
+ hasLegend: !0,
111
+ hasXy: !0,
112
+ canRollup: !1,
113
+ showRollupPosition: !1,
114
+ canSearch: !1,
115
+ periodType: null
116
+ },
117
+ {
118
+ type: Y.StackLineChart,
119
+ maxDimension: null,
120
+ maxMetric: 1,
121
+ hasBreakdownDimension: !0,
122
+ canTranspose: !0,
123
+ isDrillConfigurable: !1,
124
+ hasChart: !0,
125
+ hasTable: !1,
126
+ hasLabel: !0,
127
+ hasLegend: !0,
128
+ hasXy: !0,
129
+ canRollup: !1,
130
+ showRollupPosition: !1,
131
+ canSearch: !1,
132
+ periodType: null
133
+ },
134
+ {
135
+ type: Y.Scorecard,
136
+ maxDimension: null,
137
+ maxMetric: 1,
138
+ hasBreakdownDimension: !1,
139
+ canTranspose: !1,
140
+ isDrillConfigurable: !1,
141
+ hasChart: !1,
142
+ hasTable: !1,
143
+ hasLabel: !1,
144
+ hasLegend: !1,
145
+ hasXy: !1,
146
+ canRollup: !1,
147
+ showRollupPosition: !1,
148
+ canSearch: !1,
149
+ periodType: null
150
+ },
151
+ {
152
+ type: Y.Spacer,
153
+ maxDimension: 0,
154
+ maxMetric: 0,
155
+ hasBreakdownDimension: !1,
156
+ canTranspose: !1,
157
+ isDrillConfigurable: !1,
158
+ hasChart: !1,
159
+ hasTable: !1,
160
+ hasLabel: !1,
161
+ hasLegend: !1,
162
+ hasXy: !1,
163
+ canRollup: !1,
164
+ showRollupPosition: !1,
165
+ canSearch: !1,
166
+ periodType: null
167
+ }
168
+ ], lt = { class: "flex flex-col my-2 gap-8" }, tt = { class: "fm-typo-en-body-lg-600" }, ot = { class: "text-sm text-fm-color-neutral-gray-400" }, at = ["onClick"], nt = { class: "fm-typo-en-body-lg-400 overflow-hidden text-ellipsis line-clamp-1" }, it = /* @__PURE__ */ ue({
169
+ __name: "SchemaSection",
170
+ props: /* @__PURE__ */ ve({
171
+ options: {
172
+ type: Array,
173
+ default: () => []
174
+ },
175
+ label: {
176
+ type: String,
177
+ default: "Schema"
178
+ }
179
+ }, {
180
+ modelValue: { required: !0 },
181
+ modelModifiers: {}
182
+ }),
183
+ emits: ["update:modelValue"],
184
+ setup(B) {
185
+ const { t: p, te: e } = ge(), t = ye(B, "modelValue"), a = B, { schemas: U } = je(Cl()), w = k(
186
+ () => U.value.map((n) => ({
187
+ label: n.label,
188
+ value: n.name,
189
+ raw: n
190
+ }))
191
+ ), c = k(() => {
192
+ if (t.value.schemaNames.length === 0 || o.value === 0)
193
+ return w.value.filter((n) => !n.raw.isJoinOnly);
194
+ {
195
+ const n = t.value.schemaNames[0], v = U.value.find((P) => P.name === n), I = ((v == null ? void 0 : v.joins) || []).map((P) => P);
196
+ return w.value.filter((P) => I.includes(P.raw.name));
197
+ }
198
+ }), T = le(!1), L = le(""), o = le(), r = Zl();
199
+ function i(n) {
200
+ var v;
201
+ return re(
202
+ p,
203
+ e,
204
+ (v = U.value.find((I) => I.name === n)) == null ? void 0 : v.label,
205
+ "schema"
206
+ );
207
+ }
208
+ function x(n) {
209
+ o.value = n, T.value = !0, n !== void 0 ? L.value = t.value.schemaNames[n] : L.value = "";
210
+ }
211
+ function A() {
212
+ L.value !== "" ? (o.value !== void 0 ? t.value.schemaNames[o.value] = L.value : t.value.schemaNames.push(L.value), T.value = !1) : r.open({ message: p("report.section.schema.nothingSelected"), type: "error" });
213
+ }
214
+ return (n, v) => {
215
+ const I = M("FmForm"), P = M("FmIcon"), b = M("FmField");
216
+ return g(), X("div", lt, [
217
+ m(Re, {
218
+ modelValue: T.value,
219
+ "onUpdate:modelValue": v[1] || (v[1] = (s) => T.value = s),
220
+ title: a.label,
221
+ "primary-button-label": l(p)("report.common.confirm"),
222
+ "secondary-button-label": l(p)("report.common.cancel"),
223
+ onConfirm: A
224
+ }, {
225
+ content: Q(() => [
226
+ m(I, { ref: "form" }, {
227
+ default: Q(() => [
228
+ m(be, {
229
+ modelValue: L.value,
230
+ "onUpdate:modelValue": v[0] || (v[0] = (s) => L.value = s),
231
+ label: l(p)("report.section.schema.title"),
232
+ items: o.value === 0 ? w.value.map((s) => ({
233
+ label: l(re)(l(p), l(e), s.label, "schema"),
234
+ value: s.value
235
+ })) : c.value.map((s) => ({
236
+ label: l(re)(l(p), l(e), s.label, "schema"),
237
+ value: s.value
238
+ }))
239
+ }, null, 8, ["modelValue", "label", "items"])
240
+ ]),
241
+ _: 1
242
+ }, 512)
243
+ ]),
244
+ _: 1
245
+ }, 8, ["modelValue", "title", "primary-button-label", "secondary-button-label"]),
246
+ h("div", null, [
247
+ h("p", tt, J(l(p)("report.section.schema.title")), 1),
248
+ h("p", ot, J(l(p)("report.section.schema.description")), 1)
249
+ ]),
250
+ (g(!0), X(de, null, _e(t.value.schemaNames, (s, j) => (g(), X("div", {
251
+ key: j,
252
+ class: "flex flex-col gap-2 w-full"
253
+ }, [
254
+ h("div", {
255
+ class: "flex items-center gap-2 border rounded-md border-neutral-300 p-2 h-[40px]",
256
+ onClick: (N) => x(j)
257
+ }, [
258
+ h("p", nt, J(i(s)), 1),
259
+ v[3] || (v[3] = h("div", { class: "grow" }, null, -1)),
260
+ m(P, {
261
+ name: "close",
262
+ onClick: Ce(
263
+ () => {
264
+ t.value.schemaNames = l(El)(t.value.schemaNames, j);
265
+ },
266
+ ["stop"]
267
+ )
268
+ }, null, 8, ["onClick"])
269
+ ], 8, at)
270
+ ]))), 128)),
271
+ m(b, {
272
+ class: "text-fm-color-typo-tertiary",
273
+ onClick: v[2] || (v[2] = () => {
274
+ x();
275
+ })
276
+ }, {
277
+ default: Q(() => [
278
+ ze(J(l(p)("report.section.schema.add")), 1)
279
+ ]),
280
+ _: 1
281
+ })
282
+ ]);
283
+ };
284
+ }
285
+ });
286
+ function fl(B) {
287
+ return "aggregation" in B;
288
+ }
289
+ function Tl({
290
+ options: B,
291
+ primaryFields: p,
292
+ secondaryFields: e,
293
+ getLabel: t
294
+ }) {
295
+ const a = k(() => {
296
+ const c = /* @__PURE__ */ new Map();
297
+ for (const T of p.value)
298
+ c.set(we(T), T);
299
+ for (const T of e.value)
300
+ c.set(we(T), T);
301
+ return Array.from(c.values());
302
+ }), U = k(
303
+ () => a.value.map((c) => ({
304
+ label: t(c),
305
+ value: we(c),
306
+ badge: fl(c) ? "Metric" : "Dimension",
307
+ meta: fl(c) ? c.aggregation : void 0
308
+ }))
309
+ ), w = k(
310
+ () => a.value.map((c) => {
311
+ var L;
312
+ const T = (L = B.value.find(
313
+ (o) => o.schemaName === c.schemaName && o.name === c.name
314
+ )) == null ? void 0 : L.type;
315
+ return T ? {
316
+ fieldId: we(c),
317
+ type: T
318
+ } : void 0;
319
+ }).filter((c) => !!c)
320
+ );
321
+ return {
322
+ formulaSuggestionFields: a,
323
+ formulaFieldDataList: U,
324
+ allowedFormulaFields: w
325
+ };
326
+ }
327
+ const st = {
328
+ key: 0,
329
+ class: "flex flex-col my-2 gap-8"
330
+ }, rt = { class: "fm-typo-en-body-lg-600 text-ellipsis line-clamp-1" }, ut = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, dt = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, ll = /* @__PURE__ */ ue({
331
+ __name: "DimensionSection",
332
+ props: /* @__PURE__ */ ve({
333
+ options: {
334
+ type: Array,
335
+ default: () => []
336
+ },
337
+ label: {
338
+ type: String,
339
+ default: "title"
340
+ },
341
+ max: {
342
+ type: Number,
343
+ default: void 0
344
+ },
345
+ config: {
346
+ type: Object,
347
+ default: () => {
348
+ }
349
+ },
350
+ hasRowColumn: {
351
+ type: Boolean,
352
+ default: !1
353
+ }
354
+ }, {
355
+ modelValue: {
356
+ required: !1,
357
+ default: []
358
+ },
359
+ modelModifiers: {}
360
+ }),
361
+ emits: ["update:modelValue"],
362
+ setup(B) {
363
+ const { t: p, te: e } = ge(), t = ye(B, "modelValue"), a = B, U = k(() => p(`report.section.dimension.${a.label}`)), w = le(!1), c = k(
364
+ () => t.value.map((u, $) => ({
365
+ index: $,
366
+ labels: [u.label || u.name],
367
+ value: u
368
+ }))
369
+ ), T = le(t.value.length > 0 ? 0 : void 0);
370
+ function L(u) {
371
+ var $, z, ae, se;
372
+ w.value = !0, o.value = u != null && u.value ? JSON.parse(
373
+ JSON.stringify({
374
+ ...u.value,
375
+ label: re(p, e, ($ = u.value) == null ? void 0 : $.label, "other"),
376
+ moveToColumn: (((z = a.config) == null ? void 0 : z.columnIds) || []).includes(we(u.value))
377
+ })
378
+ ) : void 0, T.value = u == null ? void 0 : u.index, r.value = !!((ae = o.value) != null && ae.dataFormula || (se = o.value) != null && se.displayFormula), o.value && o.value.formatter === void 0 && u != null && u.value.timeFormatter && o.value.formatter === void 0 && (o.value.formatter = u == null ? void 0 : u.value.timeFormatter, o.value.timeFormatter = void 0);
379
+ }
380
+ const o = le(void 0), r = le(!1), i = k(
381
+ () => a.options.find(
382
+ (u) => {
383
+ var $, z;
384
+ return u.schemaName === (($ = o.value) == null ? void 0 : $.schemaName) && u.name === ((z = o.value) == null ? void 0 : z.name);
385
+ }
386
+ ) ?? {}
387
+ );
388
+ Ve(
389
+ () => {
390
+ var u;
391
+ return (u = o.value) == null ? void 0 : u.option;
392
+ },
393
+ () => {
394
+ !x.value && o.value && (o.value.fillGap = !1);
395
+ }
396
+ );
397
+ const x = k(
398
+ () => {
399
+ var u, $, z;
400
+ return (z = (u = i.value) == null ? void 0 : u.fillGapDimensionOptions) == null ? void 0 : z.includes((($ = o.value) == null ? void 0 : $.option) || "");
401
+ }
402
+ );
403
+ function A(u) {
404
+ var $, z;
405
+ (u.schemaName !== (($ = o.value) == null ? void 0 : $.schemaName) || u.name !== ((z = o.value) == null ? void 0 : z.name)) && (o.value = {
406
+ schemaName: u.schemaName,
407
+ name: u.name,
408
+ option: u.dimensionOptions[0],
409
+ label: re(p, e, u.label, "other"),
410
+ decimal: u.isNumericType ? 2 : void 0,
411
+ hide: !1
412
+ }, r.value = !1);
413
+ }
414
+ function n() {
415
+ if (!o.value) {
416
+ console.error("new field is undefined");
417
+ return;
418
+ }
419
+ const u = [...c.value.map(($) => $.value)];
420
+ r.value || (o.value.dataFormula = void 0, o.value.displayFormula = void 0), T.value !== void 0 ? u[T.value] = o.value : u.push(o.value), t.value = u, w.value = !1;
421
+ }
422
+ function v(u) {
423
+ const z = [...c.value.map((ae) => ae.value)].filter((ae, se) => se !== u);
424
+ t.value = z;
425
+ }
426
+ function I(u) {
427
+ o.value && (o.value.decimal = Number(u));
428
+ }
429
+ function P(u) {
430
+ const $ = `report.section.filter.${Ne(u)}`;
431
+ return e($) ? p($) : re(p, e, u, "field");
432
+ }
433
+ function b(u) {
434
+ const $ = `report.section.metric.formatterType.${u}`;
435
+ return e($) ? p($) : u;
436
+ }
437
+ function s(u) {
438
+ return Array.isArray(u) ? u.length > 0 : u;
439
+ }
440
+ const j = k(
441
+ () => a.options.map((u) => ({
442
+ label: u.labels.join(" "),
443
+ value: u
444
+ }))
445
+ );
446
+ function N(u) {
447
+ return [u.schemaName, u.name, re(p, e, u.label, "other")].join(" ");
448
+ }
449
+ function f(u) {
450
+ return [u.schemaName, u.name, u.option || ""].join("__");
451
+ }
452
+ const F = k(() => {
453
+ var z;
454
+ const u = /* @__PURE__ */ new Map(), $ = o.value ? f(o.value) : "";
455
+ for (const ae of ((z = a.config) == null ? void 0 : z.dimensions) ?? [])
456
+ $ && f(ae) === $ || u.set(we(ae), ae);
457
+ return o.value && u.set(we(o.value), o.value), Array.from(u.values());
458
+ }), { formulaFieldDataList: d, allowedFormulaFields: _ } = Tl({
459
+ options: k(() => a.options),
460
+ primaryFields: F,
461
+ secondaryFields: k(() => {
462
+ var u;
463
+ return ((u = a.config) == null ? void 0 : u.metrics) ?? [];
464
+ }),
465
+ getLabel: N
466
+ }), { dataValidation: K, displayValidation: O, isDataValidating: y, isDisplayValidating: V } = il({
467
+ getDataFormula: () => {
468
+ var u;
469
+ return (u = o.value) == null ? void 0 : u.dataFormula;
470
+ },
471
+ getDisplayFormula: () => {
472
+ var u;
473
+ return (u = o.value) == null ? void 0 : u.displayFormula;
474
+ },
475
+ getIsAdvance: () => r.value,
476
+ getAllowedFields: () => _.value
477
+ });
478
+ return (u, $) => {
479
+ const z = M("FmTextField"), ae = M("FmStepperField"), se = M("FmCheckbox"), ce = M("FmForm"), pe = M("FmIcon"), De = M("FmButton"), oe = M("FmListItem"), xe = M("FmList"), Se = M("FmField");
480
+ return B.max !== 0 ? (g(), X("div", st, [
481
+ m(Re, {
482
+ modelValue: w.value,
483
+ "onUpdate:modelValue": $[12] || ($[12] = (he) => w.value = he),
484
+ title: U.value,
485
+ "primary-button-label": l(p)("report.common.confirm"),
486
+ "secondary-button-label": l(p)("report.common.cancel"),
487
+ onConfirm: n
488
+ }, {
489
+ content: Q(() => [
490
+ m(ce, {
491
+ ref: "form",
492
+ class: "flex flex-col gap-2 w-[490px]"
493
+ }, {
494
+ default: Q(() => {
495
+ var he, Fe, ee, Pe, Ee, We, Xe;
496
+ return [
497
+ m(be, {
498
+ "model-value": i.value,
499
+ items: j.value,
500
+ placeholder: U.value,
501
+ label: U.value,
502
+ "onUpdate:modelValue": $[0] || ($[0] = (ne) => A(ne))
503
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
504
+ o.value ? (g(), X(de, { key: 0 }, [
505
+ m(z, {
506
+ modelValue: o.value.label,
507
+ "onUpdate:modelValue": $[1] || ($[1] = (ne) => o.value.label = ne),
508
+ label: l(p)("report.section.dimension.label")
509
+ }, null, 8, ["modelValue", "label"]),
510
+ (((he = i.value) == null ? void 0 : he.dimensionOptions) || []).length > 0 ? (g(), R(be, {
511
+ key: 0,
512
+ modelValue: o.value.option,
513
+ "onUpdate:modelValue": $[2] || ($[2] = (ne) => o.value.option = ne),
514
+ items: ((Fe = i.value) == null ? void 0 : Fe.dimensionOptions.map((ne) => ({
515
+ label: P(ne),
516
+ value: ne
517
+ }))) ?? []
518
+ }, null, 8, ["modelValue", "items"])) : E("", !0),
519
+ (ee = i.value) != null && ee.isNumericType ? (g(), R(ae, {
520
+ key: 1,
521
+ label: l(p)("report.common.decimal"),
522
+ "model-value": ((Pe = o.value) == null ? void 0 : Pe.decimal) ?? 2,
523
+ "onUpdate:modelValue": $[3] || ($[3] = (ne) => {
524
+ I(ne);
525
+ })
526
+ }, null, 8, ["label", "model-value"])) : E("", !0),
527
+ (Ee = i.value) != null && Ee.isNumericType ? (g(), R(be, {
528
+ key: 2,
529
+ modelValue: o.value.formatter,
530
+ "onUpdate:modelValue": $[4] || ($[4] = (ne) => o.value.formatter = ne),
531
+ placeholder: l(p)("report.section.dimension.formatter"),
532
+ label: l(p)("report.section.dimension.formatter"),
533
+ items: [
534
+ { label: l(p)("report.section.metric.formatterType.NONE"), value: null },
535
+ ...(((We = i.value) == null ? void 0 : We.formatters) || []).map((ne) => ({
536
+ label: b(ne),
537
+ value: ne
538
+ }))
539
+ ]
540
+ }, null, 8, ["modelValue", "placeholder", "label", "items"])) : E("", !0),
541
+ x.value ? (g(), R(se, {
542
+ key: 3,
543
+ "model-value": o.value.fillGap ?? !1,
544
+ label: l(p)("report.section.dimension.fillGap"),
545
+ value: "",
546
+ placeholder: "Fill gap",
547
+ "onUpdate:modelValue": $[5] || ($[5] = (ne) => {
548
+ o.value && (o.value.fillGap = s(ne));
549
+ })
550
+ }, null, 8, ["model-value", "label"])) : E("", !0),
551
+ ((Xe = i.value) == null ? void 0 : Xe.type) === l(Yl).Timestamp ? (g(), R(se, {
552
+ key: 4,
553
+ "model-value": o.value.dateComparison ?? !1,
554
+ label: l(p)("report.section.dimension.dateComparison"),
555
+ value: "",
556
+ "onUpdate:modelValue": $[6] || ($[6] = (ne) => {
557
+ o.value && (o.value.dateComparison = s(ne));
558
+ })
559
+ }, null, 8, ["model-value", "label"])) : E("", !0),
560
+ m(se, {
561
+ modelValue: o.value.hide,
562
+ "onUpdate:modelValue": $[7] || ($[7] = (ne) => o.value.hide = ne),
563
+ label: l(p)("report.section.dimension.hide"),
564
+ value: ""
565
+ }, null, 8, ["modelValue", "label"]),
566
+ a.hasRowColumn ? (g(), R(se, {
567
+ key: 5,
568
+ "model-value": o.value.moveToColumn ?? !1,
569
+ label: l(p)("report.section.dimension.moveToColumn"),
570
+ value: "",
571
+ "onUpdate:modelValue": $[8] || ($[8] = (ne) => {
572
+ o.value && (o.value.moveToColumn = s(ne));
573
+ })
574
+ }, null, 8, ["model-value", "label"])) : E("", !0),
575
+ m(se, {
576
+ modelValue: r.value,
577
+ "onUpdate:modelValue": $[9] || ($[9] = (ne) => r.value = ne),
578
+ label: l(p)("report.section.dimension.advance"),
579
+ value: !0
580
+ }, null, 8, ["modelValue", "label"]),
581
+ r.value ? (g(), R(Ie, {
582
+ key: 6,
583
+ modelValue: o.value.dataFormula,
584
+ "onUpdate:modelValue": $[10] || ($[10] = (ne) => o.value.dataFormula = ne),
585
+ placeholder: l(p)("report.section.dimension.dataFormula"),
586
+ "field-data-list": l(d),
587
+ "formula-field": l(Oe).Dimension,
588
+ "validation-result": l(K),
589
+ "is-validating": l(y),
590
+ "valid-formula-label": l(p)("report.common.validFormula")
591
+ }, null, 8, ["modelValue", "placeholder", "field-data-list", "formula-field", "validation-result", "is-validating", "valid-formula-label"])) : E("", !0),
592
+ r.value ? (g(), R(Ie, {
593
+ key: 7,
594
+ modelValue: o.value.displayFormula,
595
+ "onUpdate:modelValue": $[11] || ($[11] = (ne) => o.value.displayFormula = ne),
596
+ placeholder: l(p)("report.section.dimension.displayFormula"),
597
+ "field-data-list": l(d),
598
+ "formula-field": l(Oe).Dimension,
599
+ "validation-result": l(O),
600
+ "is-validating": l(V),
601
+ "valid-formula-label": l(p)("report.common.validFormula")
602
+ }, null, 8, ["modelValue", "placeholder", "field-data-list", "formula-field", "validation-result", "is-validating", "valid-formula-label"])) : E("", !0)
603
+ ], 64)) : E("", !0)
604
+ ];
605
+ }),
606
+ _: 1
607
+ }, 512)
608
+ ]),
609
+ _: 1
610
+ }, 8, ["modelValue", "title", "primary-button-label", "secondary-button-label"]),
611
+ h("div", null, [
612
+ h("p", rt, J(U.value), 1),
613
+ h("p", ut, J(l(p)("report.section.dimension.description")), 1)
614
+ ]),
615
+ m(xe, null, {
616
+ default: Q(() => [
617
+ m(l(Je), {
618
+ list: t.value,
619
+ "item-key": (he) => l(we)(he),
620
+ class: "flex flex-col gap-2"
621
+ }, {
622
+ item: Q(({ element: he, index: Fe }) => [
623
+ m(oe, {
624
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
625
+ onClick: Ce((ee) => L(c.value[Fe]), ["stop"])
626
+ }, {
627
+ default: Q(() => [
628
+ m(pe, { name: "drag_handle" }),
629
+ h("p", dt, J(l(re)(l(p), l(e), he.label, "other")), 1),
630
+ $[14] || ($[14] = h("div", { class: "grow" }, null, -1)),
631
+ m(De, {
632
+ icon: "close",
633
+ size: "md",
634
+ variant: "tertiary",
635
+ onClick: Ce((ee) => v(Fe), ["stop"])
636
+ }, null, 8, ["onClick"])
637
+ ]),
638
+ _: 2
639
+ }, 1032, ["onClick"])
640
+ ]),
641
+ _: 1
642
+ }, 8, ["list", "item-key"])
643
+ ]),
644
+ _: 1
645
+ }),
646
+ m(Se, {
647
+ class: "text-fm-color-typo-tertiary",
648
+ onClick: $[13] || ($[13] = () => {
649
+ L();
650
+ })
651
+ }, {
652
+ default: Q(() => [
653
+ ze(J(l(p)("report.section.dimension.add")), 1)
654
+ ]),
655
+ _: 1
656
+ })
657
+ ])) : E("", !0);
658
+ };
659
+ }
660
+ }), al = {
661
+ value: "_metric_name"
662
+ };
663
+ function mt(B, p, e) {
664
+ switch (B) {
665
+ case Y.BarChart:
666
+ case Y.StackBarChart:
667
+ case Y.ClusteredStackBarChart:
668
+ case Y.LineChart:
669
+ case Y.StackLineChart:
670
+ case Y.Circular:
671
+ return p.length > 1;
672
+ default:
673
+ return e;
674
+ }
675
+ }
676
+ function ct(B) {
677
+ var t;
678
+ const { rowIds: p, columnIds: e } = Ge(B.widget.config);
679
+ return {
680
+ ...B,
681
+ widget: {
682
+ ...B.widget,
683
+ config: {
684
+ ...B.widget.config,
685
+ rowIds: p,
686
+ columnIds: e,
687
+ isDrillable: mt(
688
+ B.widget.type,
689
+ B.widget.config.dimensions,
690
+ B.widget.config.isDrillable
691
+ ),
692
+ joinDatasources: (t = B.widget.config.joinDatasources) == null ? void 0 : t.map((a) => {
693
+ const { rowIds: U, columnIds: w } = Ge(a);
694
+ return {
695
+ ...a,
696
+ rowIds: U,
697
+ columnIds: w
698
+ };
699
+ })
700
+ }
701
+ }
702
+ };
703
+ }
704
+ function Ge(B) {
705
+ const p = B.dimensions.filter((w) => w.hide !== !0 && !w.moveToColumn).map((w) => we(w)), e = B.dimensions.filter((w) => w.hide !== !0 && w.moveToColumn == !0).map((w) => we(w)), t = B.metrics.length > 0;
706
+ t && B.metrics.find((w) => w.moveToRow == !0) ? p.push(al.value) : t && e.push(al.value);
707
+ const a = [], U = [];
708
+ for (const w of p)
709
+ a.push(w);
710
+ for (const w of e)
711
+ U.push(w);
712
+ return {
713
+ rowIds: a,
714
+ columnIds: U
715
+ };
716
+ }
717
+ const pt = { class: "flex flex-col my-2 gap-8" }, vt = { class: "fm-typo-en-body-lg-600" }, ft = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, gt = { class: "fm-typo-en-body-lg-400 overflow-hidden text-ellipsis line-clamp-1" }, yt = /* @__PURE__ */ ue({
718
+ __name: "MetricSection",
719
+ props: /* @__PURE__ */ ve({
720
+ options: {
721
+ type: Array,
722
+ default: () => []
723
+ },
724
+ label: {
725
+ type: String,
726
+ default: "title"
727
+ },
728
+ max: {
729
+ type: Number,
730
+ default: void 0
731
+ },
732
+ config: {
733
+ type: Object,
734
+ default: () => {
735
+ }
736
+ },
737
+ hasRowColumn: {
738
+ type: Boolean,
739
+ default: !1
740
+ },
741
+ hasXy: {
742
+ type: Boolean,
743
+ default: !1
744
+ }
745
+ }, {
746
+ modelValue: { required: !1, default: [] },
747
+ modelModifiers: {}
748
+ }),
749
+ emits: /* @__PURE__ */ ve(["config"], ["update:modelValue"]),
750
+ setup(B, { emit: p }) {
751
+ const { t: e, te: t } = ge(), a = ye(B, "modelValue"), U = B;
752
+ k(() => !!U.max && a.value.length === U.max);
753
+ const w = k(() => e(`report.section.metric.${U.label}`)), c = le(!1), T = k(
754
+ () => a.value.map((y, V) => ({
755
+ index: V,
756
+ labels: [y.label || y.name],
757
+ value: y
758
+ }))
759
+ ), L = le(a.value.length > 0 ? 0 : void 0);
760
+ function o(y) {
761
+ var V, u, $;
762
+ c.value = !0, r.value = y != null && y.value ? JSON.parse(
763
+ JSON.stringify({
764
+ ...y.value,
765
+ label: re(e, t, y.value.label, "other")
766
+ })
767
+ ) : void 0, L.value = y == null ? void 0 : y.index, i.value = !!((V = r.value) != null && V.dataFormula || (u = r.value) != null && u.displayFormula), r.value && r.value.formatter === void 0 && y != null && y.value.timeFormatter && r.value.formatter === void 0 && (r.value.formatter = y == null ? void 0 : y.value.timeFormatter, r.value.timeFormatter = void 0), (($ = U.config.rowIds) == null ? void 0 : $.findIndex((z) => z === al.value)) !== -1 && r.value && (r.value.moveToRow = !0), r.value && (!U.hasXy || r.value.nullable === void 0) && (r.value.nullable = !1);
768
+ }
769
+ const r = le(void 0), i = le(!1), x = k(
770
+ () => U.options.find(
771
+ (y) => {
772
+ var V, u;
773
+ return y.schemaName === ((V = r.value) == null ? void 0 : V.schemaName) && y.name === ((u = r.value) == null ? void 0 : u.name);
774
+ }
775
+ ) ?? {}
776
+ );
777
+ function A(y, V) {
778
+ var u;
779
+ return (y == null ? void 0 : y.isNumericType) || ((u = y == null ? void 0 : y.isNumericAggregations) == null ? void 0 : u.includes(V || ""));
780
+ }
781
+ const n = k(
782
+ () => {
783
+ var y;
784
+ return A(x.value, (y = r.value) == null ? void 0 : y.aggregation);
785
+ }
786
+ );
787
+ Ve(n, (y) => {
788
+ r.value && (y ? r.value.decimal = typeof r.value.decimal != "number" ? 2 : r.value.decimal : r.value.decimal = void 0);
789
+ });
790
+ function v(y) {
791
+ var V, u;
792
+ (y.schemaName !== ((V = r.value) == null ? void 0 : V.schemaName) || y.name !== ((u = r.value) == null ? void 0 : u.name)) && (r.value = {
793
+ schemaName: y.schemaName,
794
+ name: y.name,
795
+ aggregation: y.aggregations[0],
796
+ label: re(e, t, y.label, "other"),
797
+ nullable: !1,
798
+ decimal: A(y, y.aggregations[0]) ? 2 : void 0,
799
+ moveToRow: !1,
800
+ hide: !1
801
+ }, i.value = !1);
802
+ }
803
+ function I() {
804
+ const y = [...T.value.map((V) => V.value)];
805
+ r.value && (i.value || (r.value.dataFormula = void 0, r.value.displayFormula = void 0), U.hasXy || (r.value.nullable = !1), L.value !== void 0 ? y[L.value] = r.value : y.push(r.value)), a.value = y, c.value = !1;
806
+ }
807
+ function P(y) {
808
+ const V = [...T.value.map((u) => u.value)];
809
+ V.splice(y, 1), a.value = V;
810
+ }
811
+ const b = k(
812
+ () => U.options.map((y) => ({
813
+ label: y.labels.join(" "),
814
+ value: y
815
+ }))
816
+ );
817
+ function s(y) {
818
+ return [y.schemaName, y.name, re(e, t, y.label, "other")].join(" ");
819
+ }
820
+ function j(y) {
821
+ return [y.schemaName, y.name, y.aggregation || ""].join("__");
822
+ }
823
+ const N = k(() => {
824
+ var u;
825
+ const y = /* @__PURE__ */ new Map(), V = r.value ? j(r.value) : "";
826
+ for (const $ of ((u = U.config) == null ? void 0 : u.metrics) ?? [])
827
+ V && j($) === V || y.set(we($), $);
828
+ return r.value && y.set(we(r.value), r.value), Array.from(y.values());
829
+ }), { formulaFieldDataList: f, allowedFormulaFields: F } = Tl({
830
+ options: k(() => U.options),
831
+ primaryFields: k(() => {
832
+ var y;
833
+ return ((y = U.config) == null ? void 0 : y.dimensions) ?? [];
834
+ }),
835
+ secondaryFields: N,
836
+ getLabel: s
837
+ }), { dataValidation: d, displayValidation: _, isDataValidating: K, isDisplayValidating: O } = il({
838
+ getDataFormula: () => {
839
+ var y;
840
+ return (y = r.value) == null ? void 0 : y.dataFormula;
841
+ },
842
+ getDisplayFormula: () => {
843
+ var y;
844
+ return (y = r.value) == null ? void 0 : y.displayFormula;
845
+ },
846
+ getIsAdvance: () => i.value,
847
+ getAllowedFields: () => F.value
848
+ });
849
+ return (y, V) => {
850
+ const u = M("FmTextField"), $ = M("FmStepperField"), z = M("FmCheckbox"), ae = M("FmForm"), se = M("FmIcon"), ce = M("FmButton"), pe = M("FmListItem"), De = M("FmList"), oe = M("FmField");
851
+ return g(), X("div", pt, [
852
+ m(Re, {
853
+ modelValue: c.value,
854
+ "onUpdate:modelValue": V[11] || (V[11] = (xe) => c.value = xe),
855
+ title: w.value,
856
+ onConfirm: I
857
+ }, {
858
+ content: Q(() => [
859
+ m(ae, {
860
+ ref: "form",
861
+ class: "flex flex-col gap-2 w-[490px]"
862
+ }, {
863
+ default: Q(() => {
864
+ var xe, Se, he, Fe;
865
+ return [
866
+ m(be, {
867
+ "model-value": x.value,
868
+ items: b.value,
869
+ placeholder: w.value,
870
+ label: w.value,
871
+ "onUpdate:modelValue": V[0] || (V[0] = (ee) => v(ee))
872
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
873
+ r.value ? (g(), X(de, { key: 0 }, [
874
+ m(u, {
875
+ modelValue: r.value.label,
876
+ "onUpdate:modelValue": V[1] || (V[1] = (ee) => r.value.label = ee),
877
+ label: l(e)("report.section.metric.label")
878
+ }, null, 8, ["modelValue", "label"]),
879
+ (((xe = x.value) == null ? void 0 : xe.aggregations) || []).length > 0 ? (g(), R(be, {
880
+ key: 0,
881
+ modelValue: r.value.aggregation,
882
+ "onUpdate:modelValue": V[2] || (V[2] = (ee) => r.value.aggregation = ee),
883
+ label: l(e)("report.section.metric.aggregation"),
884
+ items: ((Se = x.value) == null ? void 0 : Se.aggregations.map((ee) => ({
885
+ label: l(t)(`report.section.metric.aggregationType.${ee}`) ? l(e)(`report.section.metric.aggregationType.${ee}`) : l(re)(l(e), l(t), ee, "field"),
886
+ value: ee
887
+ }))) ?? []
888
+ }, null, 8, ["modelValue", "label", "items"])) : E("", !0),
889
+ n.value ? (g(), R($, {
890
+ key: 1,
891
+ label: l(e)("report.common.decimal"),
892
+ "model-value": ((he = r.value) == null ? void 0 : he.decimal) ?? 2,
893
+ "onUpdate:modelValue": V[3] || (V[3] = (ee) => {
894
+ r.value && (r.value.decimal = ee);
895
+ })
896
+ }, null, 8, ["label", "model-value"])) : E("", !0),
897
+ n.value ? (g(), R(be, {
898
+ key: 2,
899
+ modelValue: r.value.formatter,
900
+ "onUpdate:modelValue": V[4] || (V[4] = (ee) => r.value.formatter = ee),
901
+ placeholder: l(e)("report.section.metric.formatter"),
902
+ label: l(e)("report.section.metric.formatter"),
903
+ items: [
904
+ { label: l(e)("report.section.metric.formatterType.NONE"), value: null },
905
+ ...(((Fe = x.value) == null ? void 0 : Fe.formatters) || []).map((ee) => ({
906
+ label: l(t)(`report.section.metric.formatterType.${ee}`) ? l(e)(`report.section.metric.formatterType.${ee}`) : l(re)(l(e), l(t), ee, "field"),
907
+ value: ee
908
+ }))
909
+ ]
910
+ }, null, 8, ["modelValue", "placeholder", "label", "items"])) : E("", !0),
911
+ m(z, {
912
+ modelValue: r.value.hide,
913
+ "onUpdate:modelValue": V[5] || (V[5] = (ee) => r.value.hide = ee),
914
+ label: l(e)("report.section.metric.hide"),
915
+ value: ""
916
+ }, null, 8, ["modelValue", "label"]),
917
+ U.hasXy ? (g(), R(z, {
918
+ key: 3,
919
+ "model-value": r.value.nullable ?? !1,
920
+ label: l(e)("report.section.metric.nullable"),
921
+ value: !0,
922
+ "onUpdate:modelValue": V[6] || (V[6] = (ee) => {
923
+ r.value && (r.value.nullable = ee);
924
+ })
925
+ }, null, 8, ["model-value", "label"])) : E("", !0),
926
+ U.hasRowColumn ? (g(), R(z, {
927
+ key: 4,
928
+ "model-value": r.value.moveToRow ?? !1,
929
+ label: l(e)("report.section.metric.moveToRow"),
930
+ value: "",
931
+ "onUpdate:modelValue": V[7] || (V[7] = (ee) => {
932
+ r.value && (r.value.moveToRow = Array.isArray(ee) ? ee.length > 0 : ee);
933
+ })
934
+ }, null, 8, ["model-value", "label"])) : E("", !0),
935
+ m(z, {
936
+ modelValue: i.value,
937
+ "onUpdate:modelValue": V[8] || (V[8] = (ee) => i.value = ee),
938
+ label: l(e)("report.section.metric.advance"),
939
+ value: !0
940
+ }, null, 8, ["modelValue", "label"]),
941
+ i.value ? (g(), R(Ie, {
942
+ key: 5,
943
+ modelValue: r.value.dataFormula,
944
+ "onUpdate:modelValue": V[9] || (V[9] = (ee) => r.value.dataFormula = ee),
945
+ placeholder: l(e)("report.section.metric.dataFormula"),
946
+ "field-data-list": l(f),
947
+ "formula-field": l(Oe).Metric,
948
+ "validation-result": l(d),
949
+ "is-validating": l(K),
950
+ "valid-formula-label": l(e)("report.common.validFormula")
951
+ }, null, 8, ["modelValue", "placeholder", "field-data-list", "formula-field", "validation-result", "is-validating", "valid-formula-label"])) : E("", !0),
952
+ i.value ? (g(), R(Ie, {
953
+ key: 6,
954
+ modelValue: r.value.displayFormula,
955
+ "onUpdate:modelValue": V[10] || (V[10] = (ee) => r.value.displayFormula = ee),
956
+ placeholder: l(e)("report.section.metric.displayFormula"),
957
+ "field-data-list": l(f),
958
+ "formula-field": l(Oe).Metric,
959
+ "validation-result": l(_),
960
+ "is-validating": l(O),
961
+ "valid-formula-label": l(e)("report.common.validFormula")
962
+ }, null, 8, ["modelValue", "placeholder", "field-data-list", "formula-field", "validation-result", "is-validating", "valid-formula-label"])) : E("", !0)
963
+ ], 64)) : E("", !0)
964
+ ];
965
+ }),
966
+ _: 1
967
+ }, 512)
968
+ ]),
969
+ _: 1
970
+ }, 8, ["modelValue", "title"]),
971
+ h("div", null, [
972
+ h("p", vt, J(w.value), 1),
973
+ h("p", ft, J(l(e)("report.section.metric.description")), 1)
974
+ ]),
975
+ m(De, null, {
976
+ default: Q(() => [
977
+ m(l(Je), {
978
+ list: a.value,
979
+ "item-key": "id",
980
+ class: "flex flex-col gap-2 w-full"
981
+ }, {
982
+ item: Q(({ element: xe, index: Se }) => [
983
+ m(pe, {
984
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
985
+ onClick: Ce((he) => o(T.value[Se]), ["stop"])
986
+ }, {
987
+ default: Q(() => [
988
+ m(se, { name: "drag_handle" }),
989
+ h("p", gt, J(l(re)(l(e), l(t), xe.label, "other")), 1),
990
+ V[13] || (V[13] = h("div", { class: "grow" }, null, -1)),
991
+ m(ce, {
992
+ icon: "close",
993
+ size: "md",
994
+ variant: "tertiary",
995
+ onClick: Ce((he) => P(Se), ["stop"])
996
+ }, null, 8, ["onClick"])
997
+ ]),
998
+ _: 2
999
+ }, 1032, ["onClick"])
1000
+ ]),
1001
+ _: 1
1002
+ }, 8, ["list"])
1003
+ ]),
1004
+ _: 1
1005
+ }),
1006
+ m(oe, {
1007
+ class: "text-fm-color-typo-tertiary",
1008
+ onClick: V[12] || (V[12] = () => {
1009
+ o();
1010
+ })
1011
+ }, {
1012
+ default: Q(() => [
1013
+ ze(J(l(e)("report.section.metric.add")), 1)
1014
+ ]),
1015
+ _: 1
1016
+ })
1017
+ ]);
1018
+ };
1019
+ }
1020
+ }), bt = { class: "flex flex-col my-2 gap-8" }, ht = { class: "fm-typo-en-body-lg-600" }, wt = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, Ct = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, xt = /* @__PURE__ */ ue({
1021
+ __name: "SortSection",
1022
+ props: /* @__PURE__ */ ve({
1023
+ options: {
1024
+ type: Array,
1025
+ default: () => []
1026
+ },
1027
+ label: {
1028
+ type: String,
1029
+ default: "title"
1030
+ }
1031
+ }, {
1032
+ modelValue: { required: !1, default: [] },
1033
+ modelModifiers: {}
1034
+ }),
1035
+ emits: ["update:modelValue"],
1036
+ setup(B) {
1037
+ const { t: p, te: e } = ge(), t = ye(B, "modelValue"), a = B, U = k(() => p(`report.section.sort.${a.label}`)), w = le(!1), c = k(
1038
+ () => t.value.map((d, _) => {
1039
+ const K = a.options.find(
1040
+ (y) => y.schemaName === d.schemaName && y.name === d.name
1041
+ ), O = (K == null ? void 0 : K.labels) || [d.schemaName, d.name];
1042
+ return {
1043
+ index: _,
1044
+ label: O.map((y) => re(p, e, y, "other")).join(" "),
1045
+ value: d
1046
+ };
1047
+ })
1048
+ ), T = le(t.value.length > 0 ? 0 : void 0);
1049
+ function L(d) {
1050
+ var _;
1051
+ w.value = !0, o.value = d != null && d.value ? JSON.parse(JSON.stringify(d.value)) : void 0, T.value = d == null ? void 0 : d.index, r.value = !!((_ = o.value) != null && _.dataFormula);
1052
+ }
1053
+ const o = le(void 0), r = le(!1), i = k(
1054
+ () => a.options.find(
1055
+ (d) => {
1056
+ var _, K;
1057
+ return d.schemaName === ((_ = o.value) == null ? void 0 : _.schemaName) && d.name === ((K = o.value) == null ? void 0 : K.name);
1058
+ }
1059
+ ) ?? {}
1060
+ );
1061
+ function x(d) {
1062
+ var _, K;
1063
+ (d.schemaName !== ((_ = o.value) == null ? void 0 : _.schemaName) || d.name !== ((K = o.value) == null ? void 0 : K.name)) && (o.value = {
1064
+ schemaName: d.schemaName,
1065
+ name: d.name,
1066
+ dimensionOption: d.dimensionOptions[0],
1067
+ aggregation: null,
1068
+ type: ml.Asc
1069
+ });
1070
+ }
1071
+ function A() {
1072
+ if (!o.value) {
1073
+ console.log("new sort is undefined");
1074
+ return;
1075
+ }
1076
+ const d = [...c.value.map((_) => _.value)];
1077
+ r.value || (o.value.dataFormula = void 0), T.value !== void 0 ? d[T.value] = o.value : d.push(o.value), t.value = d, w.value = !1;
1078
+ }
1079
+ function n(d) {
1080
+ const _ = [...c.value.map((K) => K.value)];
1081
+ _.splice(d, 1), t.value = _, w.value = !1;
1082
+ }
1083
+ function v(d) {
1084
+ const _ = `report.section.filter.${Ne(d)}`;
1085
+ return e(_) ? p(_) : re(p, e, d, "field");
1086
+ }
1087
+ const I = k(
1088
+ () => a.options.map((d) => ({
1089
+ label: d.labels.join(" "),
1090
+ value: d
1091
+ }))
1092
+ );
1093
+ function P(d) {
1094
+ return `${d.schemaName}_${d.name}`.toLowerCase();
1095
+ }
1096
+ function b(d) {
1097
+ return [d.schemaName, d.name, re(p, e, d.label, "other")].join(" ");
1098
+ }
1099
+ const s = k(
1100
+ () => {
1101
+ var d;
1102
+ return !o.value || !((d = i.value) != null && d.name) ? [] : [
1103
+ {
1104
+ label: `@self (${b(i.value)})`,
1105
+ value: "@self"
1106
+ }
1107
+ ];
1108
+ }
1109
+ ), j = k(
1110
+ () => {
1111
+ var d, _;
1112
+ return !((d = i.value) != null && d.name) || !((_ = i.value) != null && _.type) ? [] : [
1113
+ {
1114
+ fieldId: P(i.value),
1115
+ type: i.value.type
1116
+ }
1117
+ ];
1118
+ }
1119
+ );
1120
+ function N(d) {
1121
+ var K;
1122
+ const _ = (K = i.value) != null && K.name ? P(i.value) : void 0;
1123
+ return _ ? d == null ? void 0 : d.replace(/@self/g, _) : d;
1124
+ }
1125
+ const { dataValidation: f, isDataValidating: F } = il({
1126
+ getDataFormula: () => {
1127
+ var d;
1128
+ return N((d = o.value) == null ? void 0 : d.dataFormula);
1129
+ },
1130
+ getDisplayFormula: () => {
1131
+ },
1132
+ getIsAdvance: () => r.value,
1133
+ getAllowedFields: () => j.value
1134
+ });
1135
+ return (d, _) => {
1136
+ const K = M("FmCheckbox"), O = M("FmForm"), y = M("FmIcon"), V = M("FmButton"), u = M("FmListItem"), $ = M("FmList"), z = M("FmField");
1137
+ return g(), X("div", bt, [
1138
+ m(Re, {
1139
+ modelValue: w.value,
1140
+ "onUpdate:modelValue": _[6] || (_[6] = (ae) => w.value = ae),
1141
+ title: U.value,
1142
+ onConfirm: A
1143
+ }, {
1144
+ content: Q(() => [
1145
+ m(O, {
1146
+ ref: "form",
1147
+ class: "flex flex-col gap-2 w-[490px]"
1148
+ }, {
1149
+ default: Q(() => {
1150
+ var ae, se, ce, pe, De;
1151
+ return [
1152
+ m(be, {
1153
+ "model-value": i.value,
1154
+ items: I.value,
1155
+ placeholder: U.value,
1156
+ label: U.value,
1157
+ "onUpdate:modelValue": _[0] || (_[0] = (oe) => x(oe))
1158
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
1159
+ o.value ? (g(), X(de, { key: 0 }, [
1160
+ (((ae = i.value) == null ? void 0 : ae.dimensionOptions) || []).length > 0 ? (g(), R(be, {
1161
+ key: 0,
1162
+ modelValue: o.value.dimensionOption,
1163
+ "onUpdate:modelValue": _[1] || (_[1] = (oe) => o.value.dimensionOption = oe),
1164
+ items: ((se = i.value) == null ? void 0 : se.dimensionOptions.map((oe) => ({
1165
+ label: v(oe),
1166
+ value: oe
1167
+ }))) ?? [],
1168
+ placeholder: l(p)("report.section.sort.format"),
1169
+ label: l(p)("report.section.sort.format")
1170
+ }, null, 8, ["modelValue", "items", "placeholder", "label"])) : E("", !0),
1171
+ (((ce = i.value) == null ? void 0 : ce.aggregations) || []).length > 0 ? (g(), R(be, {
1172
+ key: 1,
1173
+ modelValue: o.value.aggregation,
1174
+ "onUpdate:modelValue": _[2] || (_[2] = (oe) => o.value.aggregation = oe),
1175
+ items: ((pe = i.value) == null ? void 0 : pe.aggregations.map((oe) => ({
1176
+ label: l(e)(`report.section.metric.aggregationType.${oe}`) ? l(p)(`report.section.metric.aggregationType.${oe}`) : oe,
1177
+ value: oe
1178
+ }))) ?? [],
1179
+ label: l(p)("report.section.sort.aggregation"),
1180
+ placeholder: l(p)("report.section.sort.aggregation")
1181
+ }, null, 8, ["modelValue", "items", "label", "placeholder"])) : E("", !0),
1182
+ m(be, {
1183
+ modelValue: o.value.type,
1184
+ "onUpdate:modelValue": _[3] || (_[3] = (oe) => o.value.type = oe),
1185
+ items: Object.values(l(ml)).map((oe) => ({
1186
+ label: l(e)(`report.section.sort.sortType.${oe}`) ? l(p)(`report.section.sort.sortType.${oe}`) : oe,
1187
+ value: oe
1188
+ })),
1189
+ placeholder: l(p)("report.section.sort.order"),
1190
+ label: l(p)("report.section.sort.order")
1191
+ }, null, 8, ["modelValue", "items", "placeholder", "label"]),
1192
+ m(K, {
1193
+ modelValue: r.value,
1194
+ "onUpdate:modelValue": _[4] || (_[4] = (oe) => r.value = oe),
1195
+ label: l(p)("report.section.sort.advance"),
1196
+ value: !0
1197
+ }, null, 8, ["modelValue", "label"]),
1198
+ r.value ? (g(), R(Ie, {
1199
+ key: 2,
1200
+ modelValue: o.value.dataFormula,
1201
+ "onUpdate:modelValue": _[5] || (_[5] = (oe) => o.value.dataFormula = oe),
1202
+ placeholder: l(p)("report.section.sort.dataFormula"),
1203
+ "field-data-list": s.value,
1204
+ "formula-field": ((De = i.value) == null ? void 0 : De.type) === "NUMERIC" ? l(Oe).Metric : l(Oe).Dimension,
1205
+ "validation-result": l(f),
1206
+ "is-validating": l(F),
1207
+ "valid-formula-label": l(p)("report.common.validFormula")
1208
+ }, null, 8, ["modelValue", "placeholder", "field-data-list", "formula-field", "validation-result", "is-validating", "valid-formula-label"])) : E("", !0)
1209
+ ], 64)) : E("", !0)
1210
+ ];
1211
+ }),
1212
+ _: 1
1213
+ }, 512)
1214
+ ]),
1215
+ _: 1
1216
+ }, 8, ["modelValue", "title"]),
1217
+ h("div", null, [
1218
+ h("p", ht, J(U.value), 1),
1219
+ h("p", wt, J(l(p)("report.section.sort.description")), 1)
1220
+ ]),
1221
+ m($, null, {
1222
+ default: Q(() => [
1223
+ m(l(Je), {
1224
+ list: t.value,
1225
+ "item-key": "id",
1226
+ class: "flex flex-col gap-2 w-full"
1227
+ }, {
1228
+ item: Q(({ element: ae, index: se }) => [
1229
+ m(u, {
1230
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
1231
+ onClick: Ce((ce) => L(c.value[se]), ["stop"])
1232
+ }, {
1233
+ default: Q(() => [
1234
+ m(y, { name: "drag_handle" }),
1235
+ h("p", Ct, J(c.value[se].label), 1),
1236
+ _[8] || (_[8] = h("div", { class: "grow" }, null, -1)),
1237
+ m(V, {
1238
+ icon: "close",
1239
+ size: "md",
1240
+ variant: "tertiary",
1241
+ onClick: Ce((ce) => n(se), ["stop"])
1242
+ }, null, 8, ["onClick"])
1243
+ ]),
1244
+ _: 2
1245
+ }, 1032, ["onClick"])
1246
+ ]),
1247
+ _: 1
1248
+ }, 8, ["list"])
1249
+ ]),
1250
+ _: 1
1251
+ }),
1252
+ m(z, {
1253
+ class: "text-fm-color-typo-tertiary",
1254
+ onClick: _[7] || (_[7] = () => {
1255
+ L();
1256
+ })
1257
+ }, {
1258
+ default: Q(() => [
1259
+ ze(J(l(p)("report.section.sort.add")), 1)
1260
+ ]),
1261
+ _: 1
1262
+ })
1263
+ ]);
1264
+ };
1265
+ }
1266
+ }), Ft = { class: "fm-typo-en-body-lg-600" }, Vt = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, kt = /* @__PURE__ */ ue({
1267
+ __name: "LimitSection",
1268
+ props: {
1269
+ modelValue: { required: !0, default: null },
1270
+ modelModifiers: {}
1271
+ },
1272
+ emits: ["update:modelValue"],
1273
+ setup(B) {
1274
+ const { t: p } = ge(), e = ye(B, "modelValue"), t = He((a) => {
1275
+ a !== "" ? e.value = a : e.value = null;
1276
+ }, 1e3);
1277
+ return (a, U) => {
1278
+ const w = M("FmTextField");
1279
+ return g(), X(de, null, [
1280
+ h("div", null, [
1281
+ h("p", Ft, J(l(p)("report.section.limit.title")), 1),
1282
+ h("p", Vt, J(l(p)("report.section.limit.description")), 1)
1283
+ ]),
1284
+ m(w, {
1285
+ "model-value": e.value,
1286
+ inputmode: "numeric",
1287
+ placeholder: l(p)("report.section.limit.placeholder"),
1288
+ "onUpdate:modelValue": U[0] || (U[0] = (c) => l(t)(c))
1289
+ }, null, 8, ["model-value", "placeholder"])
1290
+ ], 64);
1291
+ };
1292
+ }
1293
+ }), _t = { class: "flex flex-col my-2 gap-8" }, St = { class: "fm-typo-en-body-lg-600" }, Tt = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, $t = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, Dt = /* @__PURE__ */ ue({
1294
+ __name: "ConditionSection",
1295
+ props: /* @__PURE__ */ ve({
1296
+ joinFieldOptions: {
1297
+ type: Array,
1298
+ default: () => []
1299
+ },
1300
+ mainFieldOptions: {
1301
+ type: Array,
1302
+ default: () => []
1303
+ },
1304
+ label: {
1305
+ type: String,
1306
+ default: "title"
1307
+ }
1308
+ }, {
1309
+ modelValue: { required: !0 },
1310
+ modelModifiers: {}
1311
+ }),
1312
+ emits: ["update:modelValue"],
1313
+ setup(B) {
1314
+ const { t: p, te: e } = ge(), t = ye(B, "modelValue"), a = B, U = k(() => p(`report.section.condition.${a.label}`)), w = le(!1), c = k(
1315
+ () => t.value.map((b, s) => {
1316
+ var f, F;
1317
+ const j = a.joinFieldOptions.find(
1318
+ (d) => {
1319
+ var _, K;
1320
+ return d.schemaName === ((_ = b.joinDimension) == null ? void 0 : _.schemaName) && d.name === ((K = b.joinDimension) == null ? void 0 : K.name);
1321
+ }
1322
+ ), N = (j == null ? void 0 : j.labels) || [
1323
+ (f = b.joinDimension) == null ? void 0 : f.schemaName,
1324
+ (F = b.joinDimension) == null ? void 0 : F.name
1325
+ ];
1326
+ return {
1327
+ index: s,
1328
+ label: N.map((d) => re(p, e, d, "other")).join(" "),
1329
+ value: b
1330
+ };
1331
+ })
1332
+ ), T = le(t.value.length > 0 ? 0 : void 0);
1333
+ function L(b) {
1334
+ b ? (o.value = b != null && b.value ? JSON.parse(JSON.stringify(b.value)) : void 0, T.value = b == null ? void 0 : b.index) : (o.value = {
1335
+ joinDimension: null,
1336
+ operator: "",
1337
+ mainDimensions: []
1338
+ }, T.value = void 0), w.value = !0;
1339
+ }
1340
+ const o = le(void 0), r = k(
1341
+ () => a.joinFieldOptions.find(
1342
+ (b) => {
1343
+ var s, j;
1344
+ return b.schemaName === ((j = (s = o.value) == null ? void 0 : s.joinDimension) == null ? void 0 : j.schemaName) && b.name === o.value.joinDimension.name;
1345
+ }
1346
+ ) ?? {}
1347
+ ), i = k(
1348
+ () => {
1349
+ var b;
1350
+ return (((b = o.value) == null ? void 0 : b.mainDimensions) || []).map(
1351
+ (s) => a.mainFieldOptions.find(
1352
+ (j) => j.schemaName === (s == null ? void 0 : s.schemaName) && j.name === s.name
1353
+ ) ?? {}
1354
+ );
1355
+ }
1356
+ ), x = k(
1357
+ () => a.joinFieldOptions.map((b) => ({ label: b.labels.join(" "), value: b }))
1358
+ );
1359
+ function A(b) {
1360
+ var s, j, N, f;
1361
+ o.value && (o.value && b.schemaName !== ((j = (s = o.value) == null ? void 0 : s.joinDimension) == null ? void 0 : j.schemaName) || b.name !== ((f = (N = o.value) == null ? void 0 : N.joinDimension) == null ? void 0 : f.name)) && (o.value = {
1362
+ ...o.value,
1363
+ joinDimension: {
1364
+ schemaName: b.schemaName,
1365
+ name: b.name,
1366
+ option: b.dimensionOptions[0],
1367
+ label: `_${b.label}`,
1368
+ hide: !0
1369
+ }
1370
+ }, b.joinConditionOperators.includes(o.value.operator) || v(b.joinConditionOperators[0]));
1371
+ }
1372
+ function n(b, s) {
1373
+ var j, N, f, F;
1374
+ if (o.value && s >= 0 && (o.value && b.schemaName !== ((N = (j = o.value) == null ? void 0 : j.mainDimensions[s]) == null ? void 0 : N.schemaName) || b.name !== ((F = (f = o.value) == null ? void 0 : f.mainDimensions[s]) == null ? void 0 : F.name))) {
1375
+ const d = [...o.value.mainDimensions];
1376
+ d[s] = {
1377
+ schemaName: b.schemaName,
1378
+ name: b.name,
1379
+ option: b.dimensionOptions[0],
1380
+ label: b.label,
1381
+ hide: !0
1382
+ }, o.value = {
1383
+ ...o.value,
1384
+ mainDimensions: d
1385
+ };
1386
+ }
1387
+ }
1388
+ function v(b) {
1389
+ if (o.value)
1390
+ switch (b) {
1391
+ case Jl.Between:
1392
+ o.value = {
1393
+ ...o.value,
1394
+ operator: b,
1395
+ mainDimensions: [null, null]
1396
+ };
1397
+ break;
1398
+ default:
1399
+ o.value = {
1400
+ ...o.value,
1401
+ operator: b,
1402
+ mainDimensions: [null]
1403
+ };
1404
+ break;
1405
+ }
1406
+ }
1407
+ function I() {
1408
+ const b = [...c.value.map((s) => s.value)];
1409
+ o.value && (o.value.mainDimensions = o.value.mainDimensions.filter(
1410
+ (s) => s !== "" && s != null
1411
+ ), T.value !== void 0 ? b[T.value] = o.value : b.push(o.value)), t.value = b, w.value = !1;
1412
+ }
1413
+ function P(b) {
1414
+ const s = [...c.value.map((j) => j.value)];
1415
+ s.splice(b, 1), t.value = s;
1416
+ }
1417
+ return (b, s) => {
1418
+ const j = M("FmMenuDivider"), N = M("FmForm"), f = M("FmIcon"), F = M("FmButton"), d = M("FmListItem"), _ = M("FmList"), K = M("FmField");
1419
+ return g(), X("div", _t, [
1420
+ m(Re, {
1421
+ modelValue: w.value,
1422
+ "onUpdate:modelValue": s[2] || (s[2] = (O) => w.value = O),
1423
+ title: U.value,
1424
+ onConfirm: I
1425
+ }, {
1426
+ content: Q(() => [
1427
+ m(N, {
1428
+ ref: "form",
1429
+ class: "flex flex-col gap-2 w-[490px]"
1430
+ }, {
1431
+ default: Q(() => {
1432
+ var O, y, V, u, $;
1433
+ return [
1434
+ m(be, {
1435
+ label: l(p)("report.section.condition.joinDatasource"),
1436
+ "model-value": r.value,
1437
+ items: x.value,
1438
+ placeholder: l(p)("report.section.condition.joinDimension"),
1439
+ "onUpdate:modelValue": s[0] || (s[0] = (z) => A(z))
1440
+ }, null, 8, ["label", "model-value", "items", "placeholder"]),
1441
+ m(j),
1442
+ (O = o.value) != null && O.joinDimension && (((y = r.value) == null ? void 0 : y.dimensionOptions) || []).length > 0 ? (g(), R(be, {
1443
+ key: 0,
1444
+ modelValue: o.value.joinDimension.option,
1445
+ "onUpdate:modelValue": s[1] || (s[1] = (z) => o.value.joinDimension.option = z),
1446
+ label: l(p)("report.section.condition.format"),
1447
+ items: ((V = r.value) == null ? void 0 : V.dimensionOptions.map((z) => ({
1448
+ label: l(e)(`report.section.filter.${l(Ne)(z)}`) ? l(p)(`report.section.filter.${l(Ne)(z)}`) : z,
1449
+ value: z
1450
+ }))) ?? []
1451
+ }, null, 8, ["modelValue", "label", "items"])) : E("", !0),
1452
+ o.value && (((u = r.value) == null ? void 0 : u.joinConditionOperators) || []).length > 0 ? (g(), R(be, {
1453
+ key: 1,
1454
+ "model-value": o.value.operator,
1455
+ label: l(p)("report.section.condition.operator"),
1456
+ items: r.value.joinConditionOperators.map((z) => ({
1457
+ label: l(p)("report.section.comparisonOperator." + z),
1458
+ value: z
1459
+ })) ?? [],
1460
+ "onUpdate:modelValue": v
1461
+ }, null, 8, ["model-value", "label", "items"])) : E("", !0),
1462
+ (g(!0), X(de, null, _e((($ = o.value) == null ? void 0 : $.mainDimensions) || [], (z, ae) => {
1463
+ var se, ce;
1464
+ return g(), X("div", {
1465
+ key: ae,
1466
+ class: "flex flex-col gap-2"
1467
+ }, [
1468
+ m(be, {
1469
+ "model-value": i.value[ae],
1470
+ label: l(p)("report.section.condition.mainDatasource", { index: ae + 1 }),
1471
+ items: a.mainFieldOptions.map((pe) => ({
1472
+ label: pe.labels.join(" "),
1473
+ value: pe
1474
+ })),
1475
+ "onUpdate:modelValue": (pe) => n(pe, ae)
1476
+ }, null, 8, ["model-value", "label", "items", "onUpdate:modelValue"]),
1477
+ z && (((se = i.value[ae]) == null ? void 0 : se.dimensionOptions) || []).length > 0 && z ? (g(), R(be, {
1478
+ key: 0,
1479
+ modelValue: z.option,
1480
+ "onUpdate:modelValue": (pe) => z.option = pe,
1481
+ items: (ce = i.value[ae]) == null ? void 0 : ce.dimensionOptions.map((pe) => ({
1482
+ label: l(e)(`report.section.filter.${l(Ne)(pe)}`) ? l(p)(`report.section.filter.${l(Ne)(pe)}`) : pe,
1483
+ value: pe
1484
+ }))
1485
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "items"])) : E("", !0),
1486
+ m(j)
1487
+ ]);
1488
+ }), 128))
1489
+ ];
1490
+ }),
1491
+ _: 1
1492
+ }, 512)
1493
+ ]),
1494
+ _: 1
1495
+ }, 8, ["modelValue", "title"]),
1496
+ h("div", null, [
1497
+ h("p", St, J(U.value), 1),
1498
+ h("p", Tt, J(l(p)("report.section.condition.description")), 1)
1499
+ ]),
1500
+ m(_, { class: "flex flex-col gap-2" }, {
1501
+ default: Q(() => [
1502
+ m(l(Je), {
1503
+ list: t.value,
1504
+ "item-key": (O) => {
1505
+ var y, V;
1506
+ return `${(y = O.joinDimension) == null ? void 0 : y.schemaName}:${(V = O.joinDimension) == null ? void 0 : V.name}`;
1507
+ },
1508
+ class: "flex flex-col gap-2 w-full"
1509
+ }, {
1510
+ item: Q(({
1511
+ element: O,
1512
+ index: y
1513
+ }) => [
1514
+ m(d, {
1515
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
1516
+ onClick: Ce((V) => L(c.value[y]), ["stop"])
1517
+ }, {
1518
+ default: Q(() => [
1519
+ m(f, { name: "drag_handle" }),
1520
+ h("p", $t, J(c.value[y].label), 1),
1521
+ s[4] || (s[4] = h("div", { class: "grow" }, null, -1)),
1522
+ m(F, {
1523
+ icon: "close",
1524
+ size: "md",
1525
+ variant: "tertiary",
1526
+ onClick: Ce((V) => P(y), ["stop"])
1527
+ }, null, 8, ["onClick"])
1528
+ ]),
1529
+ _: 2
1530
+ }, 1032, ["onClick"])
1531
+ ]),
1532
+ _: 1
1533
+ }, 8, ["list", "item-key"])
1534
+ ]),
1535
+ _: 1
1536
+ }),
1537
+ m(K, {
1538
+ class: "text-fm-color-typo-tertiary cursor-pointer",
1539
+ onClick: s[3] || (s[3] = (O) => L())
1540
+ }, {
1541
+ default: Q(() => [
1542
+ ze(J(l(p)("report.section.condition.add")), 1)
1543
+ ]),
1544
+ _: 1
1545
+ })
1546
+ ]);
1547
+ };
1548
+ }
1549
+ }), gl = /* @__PURE__ */ ue({
1550
+ __name: "Datasource",
1551
+ props: /* @__PURE__ */ ve({
1552
+ label: {
1553
+ type: String,
1554
+ default: "Label"
1555
+ },
1556
+ config: {
1557
+ type: Object,
1558
+ default: null
1559
+ },
1560
+ closeable: {
1561
+ type: Boolean,
1562
+ default: !1
1563
+ },
1564
+ mainDatasourceConfig: {
1565
+ type: Object,
1566
+ default: () => {
1567
+ }
1568
+ },
1569
+ modelValue: {
1570
+ type: Object,
1571
+ default: () => {
1572
+ }
1573
+ }
1574
+ }, {
1575
+ modelValue: { required: !0 },
1576
+ modelModifiers: {}
1577
+ }),
1578
+ emits: /* @__PURE__ */ ve(["click-close"], ["update:modelValue"]),
1579
+ setup(B, { emit: p }) {
1580
+ const e = ye(B, "modelValue");
1581
+ Ve(
1582
+ [() => e.value.dimensions, () => e.value.metrics],
1583
+ () => {
1584
+ const { rowIds: N, columnIds: f } = Ge(e.value);
1585
+ e.value.rowIds = N, e.value.columnIds = f;
1586
+ },
1587
+ { deep: !0 }
1588
+ );
1589
+ const t = B, a = p, { schemas: U } = je(Cl()), { editingReport: w } = je(xl()), c = k(() => {
1590
+ var N;
1591
+ return ((N = w.value) == null ? void 0 : N.queryVersion) === "v2";
1592
+ }), { t: T, te: L, locale: o } = ge(), r = k(() => !t.mainDatasourceConfig), i = k(
1593
+ () => [Y.BarChart, Y.LineChart, Y.Scorecard].includes(t.config.type)
1594
+ ), x = k(() => {
1595
+ const N = [...e.value.dimensions].filter((f) => !f.hide);
1596
+ return N.sort(
1597
+ (f, F) => (e.value.rowIds || []).indexOf(we(f)) - (e.value.rowIds || []).indexOf(we(F))
1598
+ ), N;
1599
+ }), A = k(() => t.config.type === Y.Scorecard), n = k(
1600
+ () => {
1601
+ var N;
1602
+ return (((N = t.mainDatasourceConfig) == null ? void 0 : N.schemaNames) || []).reduce(
1603
+ (f, F) => {
1604
+ const d = U.value.find((_) => _.name === F);
1605
+ return d && (f = [
1606
+ ...f,
1607
+ ...d.fields.map((_) => ({
1608
+ ..._,
1609
+ labels: [
1610
+ re(T, L, d.label, "schema"),
1611
+ re(T, L, _.label || _.name, "other")
1612
+ ]
1613
+ }))
1614
+ ]), f;
1615
+ },
1616
+ []
1617
+ );
1618
+ }
1619
+ ), v = k(
1620
+ () => e.value.schemaNames.reduce((N, f) => {
1621
+ const F = U.value.find((d) => d.name === f);
1622
+ return F && (N = [
1623
+ ...N,
1624
+ ...F.fields.map((d) => ({
1625
+ ...d,
1626
+ labels: [
1627
+ re(T, L, F.label, "schema"),
1628
+ re(T, L, d.label || d.name, "other")
1629
+ ]
1630
+ }))
1631
+ ]), N;
1632
+ }, [])
1633
+ ), I = k(() => [
1634
+ { label: T("report.section.datasource.none"), value: null },
1635
+ { label: T("report.section.datasource.grandTotal"), value: 0 },
1636
+ ...[...x.value].slice(0, x.value.length - 1).map((N, f) => ({
1637
+ label: re(T, L, N.label, "other"),
1638
+ value: f + 1
1639
+ }))
1640
+ ]), P = k(() => [
1641
+ {
1642
+ label: T("report.section.datasource.position.top"),
1643
+ value: pl.top
1644
+ },
1645
+ {
1646
+ label: T("report.section.datasource.position.bottom"),
1647
+ value: pl.bottom
1648
+ }
1649
+ ]), b = k(
1650
+ () => `rollup-${o.value}-${x.value.map((N) => we(N)).join("|")}`
1651
+ ), s = k(() => [
1652
+ {
1653
+ label: T("report.section.datasource.none"),
1654
+ value: null
1655
+ },
1656
+ ...Object.keys(cl).map((N) => ({
1657
+ label: L(`report.section.datasource.periodType.${N}`) ? T(`report.section.datasource.periodType.${N}`) : N,
1658
+ value: cl[N]
1659
+ }))
1660
+ ]), j = k(() => [
1661
+ { label: T("report.section.datasource.joinType.left"), value: "LEFT" },
1662
+ { label: T("report.section.datasource.joinType.fullOuter"), value: "FULL_OUTER" }
1663
+ ]);
1664
+ return (N, f) => {
1665
+ const F = M("FmButton"), d = M("FmSwitch"), _ = M("FmSelect"), K = M("FmTextField");
1666
+ return g(), R(ol, null, {
1667
+ header: Q(() => [
1668
+ h("p", null, J(t.label), 1),
1669
+ f[22] || (f[22] = h("div", { class: "grow" }, null, -1)),
1670
+ t.closeable ? (g(), R(F, {
1671
+ key: 0,
1672
+ icon: "close",
1673
+ variant: "tertiary",
1674
+ size: "md",
1675
+ onClick: f[0] || (f[0] = Ce((O) => a("click-close"), ["stop"]))
1676
+ })) : E("", !0)
1677
+ ]),
1678
+ content: Q(() => [
1679
+ m(it, {
1680
+ modelValue: e.value,
1681
+ "onUpdate:modelValue": f[1] || (f[1] = (O) => e.value = O),
1682
+ label: l(T)("report.section.schema.title")
1683
+ }, null, 8, ["modelValue", "label"]),
1684
+ m(ll, {
1685
+ modelValue: e.value.dimensions,
1686
+ "onUpdate:modelValue": f[2] || (f[2] = (O) => e.value.dimensions = O),
1687
+ options: v.value,
1688
+ config: e.value,
1689
+ max: t.config.maxDimension,
1690
+ "has-row-column": !0,
1691
+ onConfig: f[3] || (f[3] = (O) => {
1692
+ e.value = O;
1693
+ })
1694
+ }, null, 8, ["modelValue", "options", "config", "max"]),
1695
+ m(d, {
1696
+ "label-placement": "right",
1697
+ label: l(T)("report.section.datasource.comparable"),
1698
+ "model-value": e.value.isComparable ?? !1,
1699
+ "onUpdate:modelValue": f[4] || (f[4] = (O) => {
1700
+ e.value.isComparable = O;
1701
+ })
1702
+ }, null, 8, ["label", "model-value"]),
1703
+ i.value ? (g(), R(d, {
1704
+ key: 0,
1705
+ "label-placement": "right",
1706
+ label: l(T)("report.section.datasource.cumulative"),
1707
+ "model-value": e.value.isCumulative ?? !1,
1708
+ "onUpdate:modelValue": f[5] || (f[5] = (O) => {
1709
+ e.value.isCumulative = O;
1710
+ })
1711
+ }, null, 8, ["label", "model-value"])) : E("", !0),
1712
+ t.config.isDrillConfigurable && r.value ? (g(), R(d, {
1713
+ key: 1,
1714
+ label: l(T)("report.section.datasource.drill"),
1715
+ "label-placement": "right",
1716
+ "model-value": e.value.isDrillable ?? !1,
1717
+ "onUpdate:modelValue": f[6] || (f[6] = (O) => {
1718
+ e.value.isDrillable = O;
1719
+ })
1720
+ }, null, 8, ["label", "model-value"])) : E("", !0),
1721
+ r.value ? (g(), R(d, {
1722
+ key: 2,
1723
+ modelValue: e.value.isBlend,
1724
+ "onUpdate:modelValue": f[7] || (f[7] = (O) => e.value.isBlend = O),
1725
+ label: l(T)("report.section.datasource.blend"),
1726
+ "label-placement": "right"
1727
+ }, null, 8, ["modelValue", "label"])) : E("", !0),
1728
+ t.config.canRollup && r.value ? (g(), R(_, {
1729
+ key: b.value,
1730
+ modelValue: e.value.rollup,
1731
+ "onUpdate:modelValue": f[8] || (f[8] = (O) => e.value.rollup = O),
1732
+ label: l(T)("report.section.datasource.subTotal"),
1733
+ items: I.value
1734
+ }, null, 8, ["modelValue", "label", "items"])) : E("", !0),
1735
+ t.config.showRollupPosition && r.value ? (g(), R(_, {
1736
+ key: `rollup-position-${l(o)}`,
1737
+ modelValue: e.value.rollupPosition,
1738
+ "onUpdate:modelValue": f[9] || (f[9] = (O) => e.value.rollupPosition = O),
1739
+ label: l(T)("report.section.datasource.position.showPosition"),
1740
+ items: P.value
1741
+ }, null, 8, ["modelValue", "label", "items"])) : E("", !0),
1742
+ t.config.type === l(Y).Table && r.value ? (g(), R(K, {
1743
+ key: 5,
1744
+ modelValue: e.value.grandTotalLabel,
1745
+ "onUpdate:modelValue": f[10] || (f[10] = (O) => e.value.grandTotalLabel = O),
1746
+ label: l(T)("report.section.datasource.grandTotalLabel"),
1747
+ placeholder: l(T)("report.section.datasource.grandTotal")
1748
+ }, null, 8, ["modelValue", "label", "placeholder"])) : E("", !0),
1749
+ r.value ? E("", !0) : (g(), R(_, {
1750
+ key: `periodType-${l(o)}`,
1751
+ modelValue: e.value.periodType,
1752
+ "onUpdate:modelValue": f[11] || (f[11] = (O) => e.value.periodType = O),
1753
+ label: l(T)("report.section.datasource.periodType.label"),
1754
+ items: s.value
1755
+ }, null, 8, ["modelValue", "label", "items"])),
1756
+ t.config.canTranspose && r.value ? (g(), R(d, {
1757
+ key: 7,
1758
+ modelValue: e.value.isTransposed,
1759
+ "onUpdate:modelValue": f[12] || (f[12] = (O) => e.value.isTransposed = O),
1760
+ label: l(T)("report.section.datasource.transpose"),
1761
+ "label-placement": "right"
1762
+ }, null, 8, ["modelValue", "label"])) : E("", !0),
1763
+ t.config.hasBreakdownDimension ? (g(), R(ll, {
1764
+ key: 8,
1765
+ "model-value": e.value.breakdownDimension ? [e.value.breakdownDimension] : [],
1766
+ label: "breakdownDimension",
1767
+ max: 1,
1768
+ options: v.value,
1769
+ "onUpdate:modelValue": f[13] || (f[13] = (O) => {
1770
+ e.value.breakdownDimension = O[0];
1771
+ })
1772
+ }, null, 8, ["model-value", "options"])) : E("", !0),
1773
+ A.value ? (g(), R(ll, {
1774
+ key: 9,
1775
+ "model-value": e.value.sparklineDimension ? [e.value.sparklineDimension] : [],
1776
+ label: "sparklineDimension",
1777
+ max: 1,
1778
+ options: v.value,
1779
+ "onUpdate:modelValue": f[14] || (f[14] = (O) => {
1780
+ e.value.sparklineDimension = O[0];
1781
+ })
1782
+ }, null, 8, ["model-value", "options"])) : E("", !0),
1783
+ m(yt, {
1784
+ modelValue: e.value.metrics,
1785
+ "onUpdate:modelValue": f[15] || (f[15] = (O) => e.value.metrics = O),
1786
+ options: v.value,
1787
+ max: t.config.maxMetric,
1788
+ config: e.value,
1789
+ "has-row-column": t.config.type === l(Y).Table,
1790
+ "has-xy": t.config.hasXy,
1791
+ onConfig: f[16] || (f[16] = (O) => {
1792
+ e.value = O;
1793
+ })
1794
+ }, null, 8, ["modelValue", "options", "max", "config", "has-row-column", "has-xy"]),
1795
+ m(Wl, {
1796
+ modelValue: e.value.filters,
1797
+ "onUpdate:modelValue": f[17] || (f[17] = (O) => e.value.filters = O),
1798
+ options: v.value
1799
+ }, null, 8, ["modelValue", "options"]),
1800
+ m(xt, {
1801
+ modelValue: e.value.sorts,
1802
+ "onUpdate:modelValue": f[18] || (f[18] = (O) => e.value.sorts = O),
1803
+ options: v.value
1804
+ }, null, 8, ["modelValue", "options"]),
1805
+ m(kt, {
1806
+ modelValue: e.value.limit,
1807
+ "onUpdate:modelValue": f[19] || (f[19] = (O) => e.value.limit = O)
1808
+ }, null, 8, ["modelValue"]),
1809
+ e.value.conditions && c.value ? (g(), R(_, {
1810
+ key: 10,
1811
+ "model-value": e.value.joinType ?? "LEFT",
1812
+ label: l(T)("report.section.datasource.joinType.label"),
1813
+ items: j.value,
1814
+ "onUpdate:modelValue": f[20] || (f[20] = (O) => {
1815
+ e.value.joinType = O;
1816
+ })
1817
+ }, null, 8, ["model-value", "label", "items"])) : E("", !0),
1818
+ e.value.conditions ? (g(), R(Dt, {
1819
+ key: 11,
1820
+ modelValue: e.value.conditions,
1821
+ "onUpdate:modelValue": f[21] || (f[21] = (O) => e.value.conditions = O),
1822
+ "join-field-options": v.value,
1823
+ "main-field-options": n.value
1824
+ }, null, 8, ["modelValue", "join-field-options", "main-field-options"])) : E("", !0)
1825
+ ]),
1826
+ _: 1
1827
+ });
1828
+ };
1829
+ }
1830
+ }), Ut = { class: "fm-typo-en-title-sm-600" }, Ye = /* @__PURE__ */ ue({
1831
+ __name: "TileEditorTabHeader",
1832
+ props: /* @__PURE__ */ ve({
1833
+ icon: {
1834
+ type: String,
1835
+ required: !0
1836
+ },
1837
+ title: {
1838
+ type: String,
1839
+ default: void 0
1840
+ }
1841
+ }, {
1842
+ modelValue: { type: Boolean, required: !0, default: !1 },
1843
+ modelModifiers: {}
1844
+ }),
1845
+ emits: ["update:modelValue"],
1846
+ setup(B) {
1847
+ const { t: p } = ge(), e = ye(B, "modelValue"), t = B, a = k(() => t.title || p("report.tile.setting"));
1848
+ return (U, w) => {
1849
+ const c = M("FmIcon");
1850
+ return g(), X("div", {
1851
+ class: "px-6 py-16 flex items-center gap-2 bg-fm-color-neutral-white border cursor-pointer",
1852
+ onClick: w[0] || (w[0] = (T) => e.value = !e.value)
1853
+ }, [
1854
+ h("p", Ut, J(a.value), 1),
1855
+ w[1] || (w[1] = h("div", { class: "grow" }, null, -1)),
1856
+ m(c, {
1857
+ name: t.icon
1858
+ }, null, 8, ["name"])
1859
+ ]);
1860
+ };
1861
+ }
1862
+ }), Bt = /* @__PURE__ */ ue({
1863
+ __name: "TileEditorTabDesktop",
1864
+ props: {
1865
+ modelValue: { required: !0, default: !1 },
1866
+ modelModifiers: {}
1867
+ },
1868
+ emits: ["update:modelValue"],
1869
+ setup(B) {
1870
+ const p = ye(B, "modelValue");
1871
+ return (e, t) => (g(), X(de, null, [
1872
+ m(Ye, {
1873
+ modelValue: p.value,
1874
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => p.value = a),
1875
+ icon: "keyboard_double_arrow_left"
1876
+ }, null, 8, ["modelValue"]),
1877
+ bl(e.$slots, "default")
1878
+ ], 64));
1879
+ }
1880
+ }), Lt = { class: "fixed bottom-0 w-full" }, At = /* @__PURE__ */ ue({
1881
+ __name: "TileEditorTabMobile",
1882
+ props: {
1883
+ modelValue: { required: !0, default: !1 },
1884
+ modelModifiers: {}
1885
+ },
1886
+ emits: ["update:modelValue"],
1887
+ setup(B) {
1888
+ const p = ye(B, "modelValue");
1889
+ return (e, t) => {
1890
+ const a = M("FmTopSheet");
1891
+ return g(), X("div", Lt, [
1892
+ m(Ye, {
1893
+ modelValue: p.value,
1894
+ "onUpdate:modelValue": t[0] || (t[0] = (U) => p.value = U),
1895
+ icon: "keyboard_double_arrow_up"
1896
+ }, null, 8, ["modelValue"]),
1897
+ m(a, {
1898
+ modelValue: p.value,
1899
+ "onUpdate:modelValue": t[2] || (t[2] = (U) => p.value = U),
1900
+ "fullscreen-size": "sm"
1901
+ }, {
1902
+ default: Q(() => [
1903
+ m(Ye, {
1904
+ modelValue: p.value,
1905
+ "onUpdate:modelValue": t[1] || (t[1] = (U) => p.value = U),
1906
+ icon: "keyboard_double_arrow_down"
1907
+ }, null, 8, ["modelValue"]),
1908
+ p.value ? bl(e.$slots, "default", { key: 0 }) : E("", !0)
1909
+ ]),
1910
+ _: 3
1911
+ }, 8, ["modelValue"])
1912
+ ]);
1913
+ };
1914
+ }
1915
+ });
1916
+ function $l(B, p = 600) {
1917
+ const e = le(null);
1918
+ function t() {
1919
+ B.value = !0, e.value && clearTimeout(e.value), e.value = setTimeout(() => {
1920
+ B.value = !1, e.value = null;
1921
+ }, p);
1922
+ }
1923
+ function a() {
1924
+ e.value && (clearTimeout(e.value), e.value = null), B.value = !1;
1925
+ }
1926
+ return nl(() => {
1927
+ a();
1928
+ }), {
1929
+ markStyleEditing: t,
1930
+ resetStyleEditing: a
1931
+ };
1932
+ }
1933
+ const Mt = { class: "flex flex-col gap-5" }, Nt = { class: "fm-typo-en-body-lg-600" }, Ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary" }, jt = { class: "flex gap-16" }, It = { class: "flex flex-col gap-8 max-w-[120px]" }, zt = { class: "fm-typo-en-body-lg-600" }, Rt = { class: "flex flex-col gap-16" }, Pt = { class: "fm-typo-en-body-lg-600" }, Et = { class: "flex flex-row gap-8" }, Wt = /* @__PURE__ */ ue({
1934
+ __name: "TitleSection",
1935
+ props: /* @__PURE__ */ ve({
1936
+ title: {},
1937
+ description: {},
1938
+ model: {}
1939
+ }, {
1940
+ isEditingStyle: { type: Boolean, required: !1, default: !1 },
1941
+ isEditingStyleModifiers: {}
1942
+ }),
1943
+ emits: /* @__PURE__ */ ve(["update:model", "update:title", "update:description"], ["update:isEditingStyle"]),
1944
+ setup(B, { emit: p }) {
1945
+ const e = ye(B, "isEditingStyle"), { markStyleEditing: t } = $l(e), a = B, U = p, { t: w } = ge(), c = He((n) => {
1946
+ U("update:title", n);
1947
+ }, 500), T = k({
1948
+ get: () => a.title ?? "",
1949
+ set: (n) => {
1950
+ t(), c(n);
1951
+ }
1952
+ }), L = k({
1953
+ get: () => a.description ?? "",
1954
+ set: (n) => {
1955
+ t(), U("update:description", n);
1956
+ }
1957
+ }), o = k({
1958
+ get: () => a.model.showTitle ?? !0,
1959
+ set: (n) => {
1960
+ t(), U("update:model", { ...a.model, showTitle: n });
1961
+ }
1962
+ }), r = k({
1963
+ get: () => a.model.titleFontSize ?? 14,
1964
+ set: (n) => {
1965
+ t(), U("update:model", { ...a.model, titleFontSize: Math.min(Number(n), 24) });
1966
+ }
1967
+ }), i = k({
1968
+ get: () => a.model.titleBold ?? !1,
1969
+ set: (n) => {
1970
+ t(), U("update:model", { ...a.model, titleBold: n });
1971
+ }
1972
+ }), x = k({
1973
+ get: () => a.model.titleItalic ?? !1,
1974
+ set: (n) => {
1975
+ t(), U("update:model", { ...a.model, titleItalic: n });
1976
+ }
1977
+ }), A = k({
1978
+ get: () => a.model.titleUnderline ?? !1,
1979
+ set: (n) => {
1980
+ t(), U("update:model", { ...a.model, titleUnderline: n });
1981
+ }
1982
+ });
1983
+ return (n, v) => {
1984
+ const I = M("FmTextField"), P = M("FmTextarea"), b = M("FmStepperField"), s = M("FmButton"), j = M("FmSwitch");
1985
+ return g(), X(de, null, [
1986
+ h("div", Mt, [
1987
+ m(I, {
1988
+ modelValue: T.value,
1989
+ "onUpdate:modelValue": v[0] || (v[0] = (N) => T.value = N),
1990
+ label: l(w)("report.tile.widget.title"),
1991
+ placeholder: l(w)("report.tile.widget.titlePlaceholder")
1992
+ }, null, 8, ["modelValue", "label", "placeholder"]),
1993
+ m(P, {
1994
+ modelValue: L.value,
1995
+ "onUpdate:modelValue": v[1] || (v[1] = (N) => L.value = N),
1996
+ disabled: T.value === "",
1997
+ placeholder: l(w)("report.tile.widget.descriptionPlaceholder"),
1998
+ "helper-text": l(w)("report.tile.widget.descriptionHelper")
1999
+ }, {
2000
+ label: Q(() => [
2001
+ h("p", Nt, J(l(w)("report.tile.widget.widgetDescription")), 1),
2002
+ h("p", Ot, " (" + J(l(w)("report.tile.widget.optional")) + ") ", 1)
2003
+ ]),
2004
+ _: 1
2005
+ }, 8, ["modelValue", "disabled", "placeholder", "helper-text"]),
2006
+ h("div", jt, [
2007
+ h("div", It, [
2008
+ h("p", zt, J(l(w)("report.section.datasource.title.titleFontSize")), 1),
2009
+ m(b, {
2010
+ modelValue: r.value,
2011
+ "onUpdate:modelValue": v[2] || (v[2] = (N) => r.value = N),
2012
+ max: 24,
2013
+ min: 1,
2014
+ type: "number"
2015
+ }, null, 8, ["modelValue"])
2016
+ ]),
2017
+ h("div", Rt, [
2018
+ h("p", Pt, J(l(w)("report.section.datasource.title.textStyleFormat")), 1),
2019
+ h("div", Et, [
2020
+ m(s, {
2021
+ "append-icon": "format_bold",
2022
+ "model-value": n.model.titleBold ?? !1,
2023
+ variant: "tertiary",
2024
+ "icon-color": n.model.titleBold ? "neutral-gray-400" : "neutral-gray-300",
2025
+ "bg-color": n.model.titleBold ? "neutral-gray-100" : "neutral-white",
2026
+ class: "rounded-sm",
2027
+ onClick: v[3] || (v[3] = (N) => i.value = !i.value)
2028
+ }, null, 8, ["model-value", "icon-color", "bg-color"]),
2029
+ m(s, {
2030
+ "append-icon": "format_italic",
2031
+ "model-value": n.model.titleItalic ?? !1,
2032
+ "icon-color": n.model.titleItalic ? "neutral-gray-400" : "neutral-gray-300",
2033
+ "bg-color": n.model.titleItalic ? "neutral-gray-100" : "neutral-white",
2034
+ class: "rounded-sm",
2035
+ onClick: v[4] || (v[4] = (N) => x.value = !x.value)
2036
+ }, null, 8, ["model-value", "icon-color", "bg-color"]),
2037
+ m(s, {
2038
+ "append-icon": "format_underlined",
2039
+ "model-value": n.model.titleUnderline ?? !1,
2040
+ "icon-color": n.model.titleUnderline ? "neutral-gray-400" : "neutral-gray-300",
2041
+ "bg-color": n.model.titleUnderline ? "neutral-gray-100" : "neutral-white",
2042
+ class: "rounded-sm",
2043
+ onClick: v[5] || (v[5] = (N) => A.value = !A.value)
2044
+ }, null, 8, ["model-value", "icon-color", "bg-color"])
2045
+ ])
2046
+ ])
2047
+ ])
2048
+ ]),
2049
+ m(j, {
2050
+ modelValue: o.value,
2051
+ "onUpdate:modelValue": v[6] || (v[6] = (N) => o.value = N),
2052
+ label: l(w)("report.section.datasource.title.showTitle"),
2053
+ "label-placement": "right"
2054
+ }, null, 8, ["modelValue", "label"])
2055
+ ], 64);
2056
+ };
2057
+ }
2058
+ }), Xt = { class: "flex gap-16 justify-center items-center" }, qt = { class: "fm-typo-en-title-sm-600" }, Ht = { class: "h-[40x]" }, yl = "YYYY-MM-DD", Dl = /* @__PURE__ */ ue({
2059
+ __name: "TileEditorTab",
2060
+ props: /* @__PURE__ */ ve({
2061
+ hideConfiguration: {
2062
+ type: Boolean,
2063
+ default: !1
2064
+ }
2065
+ }, {
2066
+ modelValue: {
2067
+ required: !0
2068
+ },
2069
+ modelModifiers: {},
2070
+ isEditingStyle: { type: Boolean, required: !1, default: !1 },
2071
+ isEditingStyleModifiers: {}
2072
+ }),
2073
+ emits: /* @__PURE__ */ ve(["hideConfiguration"], ["update:modelValue", "update:isEditingStyle"]),
2074
+ setup(B, { emit: p }) {
2075
+ var j, N;
2076
+ const e = et(), { dateRange: t, timezone: a } = je(e), U = {
2077
+ startDate: t.value.startDate,
2078
+ endDate: t.value.endDate
2079
+ }, w = le({
2080
+ startDate: (j = qe(t.value.startDate)) == null ? void 0 : j.tz(a.value).format(yl),
2081
+ endDate: (N = qe(t.value.endDate)) == null ? void 0 : N.tz(a.value).format(yl)
2082
+ });
2083
+ Ve(
2084
+ w,
2085
+ () => {
2086
+ w.value.endDate || (w.value.endDate = w.value.startDate);
2087
+ const f = {
2088
+ startDate: qe.tz(w.value.startDate, a.value).startOf("day").utc().toISOString(),
2089
+ endDate: qe.tz(w.value.endDate, a.value).endOf("day").utc().toISOString()
2090
+ };
2091
+ t.value = f;
2092
+ },
2093
+ { deep: !0 }
2094
+ ), nl(() => {
2095
+ t.value = { ...U };
2096
+ });
2097
+ const c = ye(B, "modelValue"), T = ye(B, "isEditingStyle"), { breakpoints: L } = Vl(), o = B, { promptMessage: r } = Fl(), i = p, { t: x, locale: A } = ge();
2098
+ function n(f) {
2099
+ c.value = ct(f);
2100
+ }
2101
+ function v() {
2102
+ const f = [...c.value.widget.config.joinDatasources || []];
2103
+ f.push({ ...ql(c.value.widget.type), conditions: [] }), n({
2104
+ ...c.value,
2105
+ widget: {
2106
+ ...c.value.widget,
2107
+ config: {
2108
+ ...c.value.widget.config,
2109
+ joinDatasources: f
2110
+ }
2111
+ }
2112
+ });
2113
+ }
2114
+ async function I(f) {
2115
+ if (!await r({
2116
+ title: x("report.tile.datasource.remove"),
2117
+ message: x("report.tile.datasource.confirmRemove", { index: f + 1 })
2118
+ })) return;
2119
+ const d = [...c.value.widget.config.joinDatasources || []];
2120
+ d.splice(f, 1), n({
2121
+ ...c.value,
2122
+ widget: {
2123
+ ...c.value.widget,
2124
+ config: {
2125
+ ...c.value.widget.config,
2126
+ joinDatasources: d
2127
+ }
2128
+ }
2129
+ });
2130
+ }
2131
+ const P = (f, F) => {
2132
+ let d = 1, _ = 1;
2133
+ switch (f) {
2134
+ case Y.Scorecard:
2135
+ d = 1, _ = 2;
2136
+ break;
2137
+ case Y.BarChart:
2138
+ case Y.StackBarChart:
2139
+ case Y.ClusteredStackBarChart:
2140
+ case Y.LineChart:
2141
+ case Y.StackLineChart:
2142
+ d = 4, _ = 6;
2143
+ break;
2144
+ case Y.Table:
2145
+ d = 4, _ = 12;
2146
+ break;
2147
+ case Y.Circular:
2148
+ d = 4, _ = 4;
2149
+ break;
2150
+ case Y.Spacer:
2151
+ d = 0, _ = 12;
2152
+ break;
2153
+ }
2154
+ return {
2155
+ id: F.id,
2156
+ size: {
2157
+ height: d,
2158
+ width: _
2159
+ },
2160
+ widget: {
2161
+ ...F.widget,
2162
+ type: f
2163
+ }
2164
+ };
2165
+ }, b = k(
2166
+ () => Ke.find((f) => f.type === c.value.widget.type)
2167
+ ), s = k(() => c.value.widget.config.joinDatasources);
2168
+ return Ve(
2169
+ () => c.value.size.height,
2170
+ (f) => {
2171
+ f < 1 && (c.value.size.height = 1), f > 12 && (c.value.size.height = 12);
2172
+ }
2173
+ ), Ve(
2174
+ () => c.value.size.width,
2175
+ (f) => {
2176
+ f < 1 && (c.value.size.width = 1), f > 12 && (c.value.size.width = 12);
2177
+ }
2178
+ ), (f, F) => {
2179
+ const d = M("FmCircularProgress"), _ = M("FmSimpleDateRangePicker"), K = M("FmStepperField"), O = M("FmButton"), y = M("FmForm");
2180
+ return g(), R(hl(l(L).lg || l(L).md ? Bt : At), {
2181
+ "model-value": o.hideConfiguration,
2182
+ "onUpdate:modelValue": F[10] || (F[10] = (V) => i("hideConfiguration", V))
2183
+ }, {
2184
+ default: Q(() => [
2185
+ c.value ? (g(), R(y, {
2186
+ key: 1,
2187
+ ref: "form",
2188
+ class: "px-6 py-16 flex flex-col gap-24 overflow-y-auto overflow-x-hidden"
2189
+ }, {
2190
+ default: Q(() => [
2191
+ h("div", Xt, [
2192
+ (g(), R(_, {
2193
+ key: `date-picker-${l(A)}`,
2194
+ modelValue: w.value,
2195
+ "onUpdate:modelValue": F[0] || (F[0] = (V) => w.value = V)
2196
+ }, null, 8, ["modelValue"]))
2197
+ ]),
2198
+ m(ol, null, {
2199
+ header: Q(() => [
2200
+ h("p", qt, J(l(x)("report.tile.widget.details")), 1),
2201
+ F[11] || (F[11] = h("div", { class: "grow" }, null, -1))
2202
+ ]),
2203
+ content: Q(() => [
2204
+ m(Wt, {
2205
+ title: c.value.widget.title,
2206
+ description: c.value.widget.description,
2207
+ model: c.value.widget.config,
2208
+ "is-editing-style": T.value,
2209
+ "onUpdate:isEditingStyle": F[1] || (F[1] = (V) => T.value = V),
2210
+ "onUpdate:title": F[2] || (F[2] = (V) => c.value.widget.title = V),
2211
+ "onUpdate:description": F[3] || (F[3] = (V) => c.value.widget.description = V),
2212
+ "onUpdate:model": F[4] || (F[4] = (V) => c.value.widget.config = V)
2213
+ }, null, 8, ["title", "description", "model", "is-editing-style"]),
2214
+ h("div", {
2215
+ class: $e(["flex flex-row", `${l(L).sm || l(L).xs ? "gap-16" : "gap-2"}`])
2216
+ }, [
2217
+ m(K, {
2218
+ modelValue: c.value.size.width,
2219
+ "onUpdate:modelValue": F[5] || (F[5] = (V) => c.value.size.width = V),
2220
+ label: l(x)("report.tile.widget.width"),
2221
+ min: 1,
2222
+ max: 12
2223
+ }, null, 8, ["modelValue", "label"]),
2224
+ m(K, {
2225
+ modelValue: c.value.size.height,
2226
+ "onUpdate:modelValue": F[6] || (F[6] = (V) => c.value.size.height = V),
2227
+ label: l(x)("report.tile.widget.height"),
2228
+ min: 1,
2229
+ max: 12,
2230
+ disabled: c.value.widget.type === l(Y).Scorecard
2231
+ }, null, 8, ["modelValue", "label", "disabled"])
2232
+ ], 2)
2233
+ ]),
2234
+ _: 1
2235
+ }),
2236
+ m(ol, null, {
2237
+ header: Q(() => [
2238
+ h("p", null, J(l(x)("report.tile.widget.type")), 1),
2239
+ F[12] || (F[12] = h("div", { class: "grow" }, null, -1))
2240
+ ]),
2241
+ content: Q(() => [
2242
+ m(Xl, {
2243
+ "is-list": !0,
2244
+ "model-value": c.value.widget.type,
2245
+ class: "grid grid-cols-1 gap-2",
2246
+ "child-class": "flex flex-row p-[8px] gap-2",
2247
+ "exclude-widge-type": [l(Y).Spacer],
2248
+ "onUpdate:modelValue": F[7] || (F[7] = (V) => c.value = P(V, c.value))
2249
+ }, null, 8, ["model-value", "exclude-widge-type"])
2250
+ ]),
2251
+ _: 1
2252
+ }),
2253
+ m(gl, {
2254
+ modelValue: c.value.widget.config,
2255
+ "onUpdate:modelValue": F[8] || (F[8] = (V) => c.value.widget.config = V),
2256
+ label: l(x)("report.tile.datasource.main"),
2257
+ config: b.value
2258
+ }, null, 8, ["modelValue", "label", "config"]),
2259
+ s.value ? (g(!0), X(de, { key: 0 }, _e(s.value, (V, u) => (g(), X("div", { key: u }, [
2260
+ m(gl, {
2261
+ modelValue: s.value[u],
2262
+ "onUpdate:modelValue": ($) => s.value[u] = $,
2263
+ label: l(x)("report.tile.datasource.join", { index: u + 1 }),
2264
+ config: b.value,
2265
+ "main-datasource-config": c.value.widget.config,
2266
+ closeable: !0,
2267
+ onClickClose: ($) => I(u)
2268
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "label", "config", "main-datasource-config", "onClickClose"])
2269
+ ]))), 128)) : E("", !0),
2270
+ h("div", Ht, [
2271
+ m(O, {
2272
+ label: l(x)("report.tile.datasource.joinButton"),
2273
+ variant: "secondary",
2274
+ icon: "add",
2275
+ "icon-position": "prepend",
2276
+ "border-color": "primary",
2277
+ "text-color": "primary",
2278
+ class: "w-full",
2279
+ onClick: F[9] || (F[9] = (V) => v())
2280
+ }, null, 8, ["label"])
2281
+ ])
2282
+ ]),
2283
+ _: 1
2284
+ }, 512)) : (g(), R(d, { key: 0 }))
2285
+ ]),
2286
+ _: 1
2287
+ }, 8, ["model-value"]);
2288
+ };
2289
+ }
2290
+ }), Gt = { class: "flex flex-col gap-8" }, Yt = { class: "pl-32 flex flex-col gap-8" }, Jt = { class: "fm-typo-en-body-lg-600" }, Kt = { class: "flex flex-row gap-8" }, Qt = { class: "fm-typo-en-body-lg-600" }, Zt = { class: "flex flex-row gap-8" }, eo = /* @__PURE__ */ ue({
2291
+ __name: "LabelSection",
2292
+ props: {
2293
+ model: {}
2294
+ },
2295
+ emits: ["update:model"],
2296
+ setup(B, { emit: p }) {
2297
+ const e = B, t = p, { t: a } = ge(), U = k({
2298
+ get: () => e.model.showLabel ?? !1,
2299
+ set: (x) => {
2300
+ t("update:model", { ...e.model, showLabel: x });
2301
+ }
2302
+ }), w = k({
2303
+ get: () => e.model.labelRotation ?? 0,
2304
+ set: (x) => t("update:model", { ...e.model, labelRotation: x })
2305
+ }), c = k({
2306
+ get: () => e.model.labelOffset ?? 0,
2307
+ set: (x) => t("update:model", { ...e.model, labelOffset: x })
2308
+ }), T = k({
2309
+ get: () => e.model.labelFontSize ?? 12,
2310
+ set: (x) => t("update:model", { ...e.model, labelFontSize: x })
2311
+ }), L = (x) => {
2312
+ t("update:model", {
2313
+ ...e.model,
2314
+ labelAlign: e.model.labelAlign === x ? void 0 : x
2315
+ });
2316
+ }, o = (x) => {
2317
+ t("update:model", {
2318
+ ...e.model,
2319
+ labelAnchor: e.model.labelAnchor === x ? void 0 : x
2320
+ });
2321
+ }, r = [
2322
+ { icon: "align_horizontal_left", value: Be.left, tooltip: "alignLeft" },
2323
+ { icon: "align_justify_center", value: Be.center, tooltip: "alignCenter" },
2324
+ { icon: "align_horizontal_right", value: Be.right, tooltip: "alignRight" },
2325
+ { icon: "align_justify_flex_start", value: Be.start, tooltip: "alignStart" },
2326
+ { icon: "align_justify_flex_end", value: Be.end, tooltip: "alignEnd" },
2327
+ { icon: "align_flex_start", value: Be.top, tooltip: "alignTop" },
2328
+ { icon: "align_flex_end", value: Be.bottom, tooltip: "alignBottom" }
2329
+ ], i = [
2330
+ { icon: "format_align_left", value: Ze.start, tooltip: "anchorStart" },
2331
+ { icon: "format_align_center", value: Ze.center, tooltip: "anchorCenter" },
2332
+ { icon: "format_align_right", value: Ze.end, tooltip: "anchorEnd" }
2333
+ ];
2334
+ return (x, A) => {
2335
+ const n = M("FmCheckbox"), v = M("FmButton"), I = M("FmTooltip"), P = M("FmTextField"), b = M("FmStepperField");
2336
+ return g(), X("div", Gt, [
2337
+ m(n, {
2338
+ modelValue: U.value,
2339
+ "onUpdate:modelValue": A[0] || (A[0] = (s) => U.value = s),
2340
+ value: !1,
2341
+ label: l(a)("report.section.datasource.label.showLabel"),
2342
+ "label-placement": "right",
2343
+ class: "fm-typo-en-body-lg-400"
2344
+ }, null, 8, ["modelValue", "label"]),
2345
+ ke(h("div", Yt, [
2346
+ h("p", Jt, J(l(a)("report.section.datasource.alignment.textAlignment")), 1),
2347
+ h("div", Kt, [
2348
+ (g(), X(de, null, _e(r, ({ icon: s, value: j, tooltip: N }) => m(I, {
2349
+ key: j,
2350
+ variant: "plain",
2351
+ placement: "top",
2352
+ content: l(a)(`report.section.datasource.alignment.alignOptions.${N}`),
2353
+ "z-index": 50
2354
+ }, {
2355
+ default: Q(() => [
2356
+ m(v, {
2357
+ "append-icon": s,
2358
+ variant: "tertiary",
2359
+ "icon-color": x.model.labelAlign === j ? "neutral-gray-400" : "neutral-gray-300",
2360
+ "bg-color": x.model.labelAlign === j ? "neutral-gray-100" : "neutral-white",
2361
+ class: "rounded-sm",
2362
+ onClick: (f) => L(j)
2363
+ }, null, 8, ["append-icon", "icon-color", "bg-color", "onClick"])
2364
+ ]),
2365
+ _: 2
2366
+ }, 1032, ["content"])), 64))
2367
+ ]),
2368
+ h("p", Qt, J(l(a)("report.section.datasource.alignment.anchor")), 1),
2369
+ h("div", Zt, [
2370
+ (g(), X(de, null, _e(i, ({ icon: s, value: j, tooltip: N }) => m(I, {
2371
+ key: j,
2372
+ variant: "plain",
2373
+ placement: "top",
2374
+ content: l(a)(`report.section.datasource.alignment.anchorOptions.${N}`),
2375
+ "z-index": 50
2376
+ }, {
2377
+ default: Q(() => [
2378
+ m(v, {
2379
+ "append-icon": s,
2380
+ variant: "tertiary",
2381
+ "icon-color": x.model.labelAnchor === j ? "neutral-gray-400" : "neutral-gray-300",
2382
+ "bg-color": x.model.labelAnchor === j ? "neutral-gray-100" : "neutral-white",
2383
+ class: "rounded-sm",
2384
+ onClick: (f) => o(j)
2385
+ }, null, 8, ["append-icon", "icon-color", "bg-color", "onClick"])
2386
+ ]),
2387
+ _: 2
2388
+ }, 1032, ["content"])), 64))
2389
+ ]),
2390
+ m(P, {
2391
+ modelValue: w.value,
2392
+ "onUpdate:modelValue": A[1] || (A[1] = (s) => w.value = s),
2393
+ label: l(a)("report.section.datasource.alignment.rotation"),
2394
+ type: "number",
2395
+ min: -180,
2396
+ max: 180,
2397
+ step: 1
2398
+ }, null, 8, ["modelValue", "label"]),
2399
+ m(P, {
2400
+ modelValue: c.value,
2401
+ "onUpdate:modelValue": A[2] || (A[2] = (s) => c.value = s),
2402
+ label: l(a)("report.section.datasource.alignment.offset"),
2403
+ type: "number"
2404
+ }, null, 8, ["modelValue", "label"]),
2405
+ m(b, {
2406
+ modelValue: T.value,
2407
+ "onUpdate:modelValue": A[3] || (A[3] = (s) => T.value = s),
2408
+ label: l(a)("report.section.datasource.fontSize"),
2409
+ type: "number",
2410
+ min: 1
2411
+ }, null, 8, ["modelValue", "label"])
2412
+ ], 512), [
2413
+ [Te, U.value]
2414
+ ])
2415
+ ]);
2416
+ };
2417
+ }
2418
+ }), lo = { class: "flex flex-col gap-8" }, to = { class: "pl-32 flex flex-col gap-8" }, oo = { class: "pl-32 flex flex-col gap-8" }, ao = { class: "pl-32 flex flex-col gap-8" }, no = { class: "pl-32 flex flex-col gap-8" }, io = { class: "pl-32 flex flex-col gap-8" }, so = { class: "pl-32 flex flex-col gap-8" }, ro = /* @__PURE__ */ ue({
2419
+ __name: "XySection",
2420
+ props: {
2421
+ model: {}
2422
+ },
2423
+ emits: ["update:model"],
2424
+ setup(B, { emit: p }) {
2425
+ const e = B, t = p, { t: a } = ge(), U = k({
2426
+ get: () => e.model.showX ?? !0,
2427
+ set: (n) => {
2428
+ t("update:model", { ...e.model, showX: n });
2429
+ }
2430
+ }), w = k({
2431
+ get: () => e.model.showXGrid ?? !1,
2432
+ set: (n) => {
2433
+ t("update:model", { ...e.model, showXGrid: n });
2434
+ }
2435
+ }), c = k({
2436
+ get: () => e.model.showXTick ?? !0,
2437
+ set: (n) => {
2438
+ t("update:model", { ...e.model, showXTick: n });
2439
+ }
2440
+ }), T = k({
2441
+ get: () => e.model.showY ?? !0,
2442
+ set: (n) => {
2443
+ t("update:model", { ...e.model, showY: n });
2444
+ }
2445
+ }), L = k({
2446
+ get: () => e.model.showYGrid ?? !1,
2447
+ set: (n) => {
2448
+ t("update:model", { ...e.model, showYGrid: n });
2449
+ }
2450
+ }), o = k({
2451
+ get: () => e.model.showYTick ?? !0,
2452
+ set: (n) => {
2453
+ t("update:model", { ...e.model, showYTick: n });
2454
+ }
2455
+ }), r = k({
2456
+ get: () => e.model.showXTitle ?? !1,
2457
+ set: (n) => {
2458
+ t("update:model", { ...e.model, showXTitle: n });
2459
+ }
2460
+ }), i = k({
2461
+ get: () => e.model.showYTitle ?? !1,
2462
+ set: (n) => {
2463
+ t("update:model", { ...e.model, showYTitle: n });
2464
+ }
2465
+ }), x = He((n) => {
2466
+ t("update:model", { ...e.model, xTitle: n });
2467
+ }, 500), A = He((n) => {
2468
+ t("update:model", { ...e.model, yTitle: n });
2469
+ }, 500);
2470
+ return wl(() => {
2471
+ var n, v, I, P;
2472
+ !e.model.xTitle && ((v = (n = e.model.metrics) == null ? void 0 : n[0]) != null && v.label) && x(e.model.metrics[0].label), !e.model.yTitle && ((P = (I = e.model.dimensions) == null ? void 0 : I[0]) != null && P.label) && A(e.model.dimensions[0].label);
2473
+ }), (n, v) => {
2474
+ const I = M("FmCheckbox"), P = M("FmStepperField"), b = M("FmTextField");
2475
+ return g(), X("div", lo, [
2476
+ m(I, {
2477
+ modelValue: U.value,
2478
+ "onUpdate:modelValue": v[0] || (v[0] = (s) => U.value = s),
2479
+ label: l(a)("report.section.datasource.axis.showX"),
2480
+ "label-placement": "right",
2481
+ value: !0
2482
+ }, null, 8, ["modelValue", "label"]),
2483
+ ke(h("div", to, [
2484
+ m(I, {
2485
+ modelValue: w.value,
2486
+ "onUpdate:modelValue": v[1] || (v[1] = (s) => w.value = s),
2487
+ label: l(a)("report.section.datasource.axis.showGrid"),
2488
+ "label-placement": "right",
2489
+ value: !1
2490
+ }, null, 8, ["modelValue", "label"]),
2491
+ m(I, {
2492
+ modelValue: c.value,
2493
+ "onUpdate:modelValue": v[2] || (v[2] = (s) => c.value = s),
2494
+ label: l(a)("report.section.datasource.axis.showTick"),
2495
+ "label-placement": "right",
2496
+ value: !0
2497
+ }, null, 8, ["modelValue", "label"]),
2498
+ ke(h("div", oo, [
2499
+ m(P, {
2500
+ label: l(a)("report.section.datasource.fontSize"),
2501
+ type: "number",
2502
+ "model-value": n.model.xTickFontSize ?? 12,
2503
+ min: 1,
2504
+ "onUpdate:modelValue": v[3] || (v[3] = (s) => {
2505
+ t("update:model", { ...n.model, xTickFontSize: Number(s) });
2506
+ })
2507
+ }, null, 8, ["label", "model-value"])
2508
+ ], 512), [
2509
+ [Te, n.model.showXTick ?? !0]
2510
+ ]),
2511
+ m(I, {
2512
+ modelValue: r.value,
2513
+ "onUpdate:modelValue": v[4] || (v[4] = (s) => r.value = s),
2514
+ label: l(a)("report.section.datasource.axis.showTitle"),
2515
+ "label-placement": "right",
2516
+ value: !0
2517
+ }, null, 8, ["modelValue", "label"]),
2518
+ ke(h("div", ao, [
2519
+ m(b, {
2520
+ "model-value": n.model.xTitle,
2521
+ label: l(a)("report.common.title"),
2522
+ placeholder: l(a)("report.tile.widget.titlePlaceholder"),
2523
+ "onUpdate:modelValue": l(x)
2524
+ }, null, 8, ["model-value", "label", "placeholder", "onUpdate:modelValue"]),
2525
+ m(P, {
2526
+ label: l(a)("report.section.datasource.fontSize"),
2527
+ type: "number",
2528
+ "model-value": n.model.xTitleFontSize ?? 12,
2529
+ min: 1,
2530
+ "onUpdate:modelValue": v[5] || (v[5] = (s) => {
2531
+ t("update:model", { ...n.model, xTitleFontSize: Number(s) });
2532
+ })
2533
+ }, null, 8, ["label", "model-value"])
2534
+ ], 512), [
2535
+ [Te, r.value]
2536
+ ])
2537
+ ], 512), [
2538
+ [Te, n.model.showX ?? !0]
2539
+ ]),
2540
+ m(I, {
2541
+ modelValue: T.value,
2542
+ "onUpdate:modelValue": v[6] || (v[6] = (s) => T.value = s),
2543
+ label: l(a)("report.section.datasource.axis.showY"),
2544
+ "label-placement": "right",
2545
+ value: !0
2546
+ }, null, 8, ["modelValue", "label"]),
2547
+ ke(h("div", no, [
2548
+ m(I, {
2549
+ modelValue: L.value,
2550
+ "onUpdate:modelValue": v[7] || (v[7] = (s) => L.value = s),
2551
+ label: l(a)("report.section.datasource.axis.showGrid"),
2552
+ "label-placement": "right",
2553
+ value: !1
2554
+ }, null, 8, ["modelValue", "label"]),
2555
+ m(I, {
2556
+ modelValue: o.value,
2557
+ "onUpdate:modelValue": v[8] || (v[8] = (s) => o.value = s),
2558
+ label: l(a)("report.section.datasource.axis.showTick"),
2559
+ "label-placement": "right",
2560
+ value: !0
2561
+ }, null, 8, ["modelValue", "label"]),
2562
+ ke(h("div", io, [
2563
+ m(P, {
2564
+ label: l(a)("report.section.datasource.fontSize"),
2565
+ type: "number",
2566
+ "model-value": n.model.yTickFontSize ?? 12,
2567
+ min: 1,
2568
+ "onUpdate:modelValue": v[9] || (v[9] = (s) => {
2569
+ t("update:model", { ...n.model, yTickFontSize: Number(s) });
2570
+ })
2571
+ }, null, 8, ["label", "model-value"])
2572
+ ], 512), [
2573
+ [Te, n.model.showYTick ?? !0]
2574
+ ]),
2575
+ m(I, {
2576
+ modelValue: i.value,
2577
+ "onUpdate:modelValue": v[10] || (v[10] = (s) => i.value = s),
2578
+ label: l(a)("report.section.datasource.axis.showTitle"),
2579
+ "label-placement": "right",
2580
+ value: !0
2581
+ }, null, 8, ["modelValue", "label"]),
2582
+ ke(h("div", so, [
2583
+ m(b, {
2584
+ "model-value": n.model.yTitle,
2585
+ label: l(a)("report.common.title"),
2586
+ placeholder: l(a)("report.tile.widget.titlePlaceholder"),
2587
+ "onUpdate:modelValue": l(A)
2588
+ }, null, 8, ["model-value", "label", "placeholder", "onUpdate:modelValue"]),
2589
+ m(P, {
2590
+ label: l(a)("report.section.datasource.fontSize"),
2591
+ type: "number",
2592
+ "model-value": n.model.yTitleFontSize ?? 12,
2593
+ min: 1,
2594
+ "onUpdate:modelValue": v[11] || (v[11] = (s) => {
2595
+ t("update:model", { ...n.model, yTitleFontSize: Number(s) });
2596
+ })
2597
+ }, null, 8, ["label", "model-value"])
2598
+ ], 512), [
2599
+ [Te, i.value]
2600
+ ])
2601
+ ], 512), [
2602
+ [Te, n.model.showY ?? !0]
2603
+ ])
2604
+ ]);
2605
+ };
2606
+ }
2607
+ }), uo = { class: "flex flex-col gap-8" }, mo = { class: "pl-32 flex flex-col gap-8" }, co = { class: "text-fm-color-typo-primary fm-typo-en-body-lg-600" }, po = ["onKeydown"], vo = /* @__PURE__ */ ue({
2608
+ __name: "LegendSection",
2609
+ props: {
2610
+ model: {},
2611
+ isCircularWidget: { type: Boolean }
2612
+ },
2613
+ emits: ["update:model"],
2614
+ setup(B, { emit: p }) {
2615
+ const e = B, t = p, { t: a } = ge(), U = [
2616
+ { label: a("report.section.datasource.position.top"), value: "top" },
2617
+ { label: a("report.section.datasource.position.bottom"), value: "bottom" },
2618
+ { label: a("report.section.datasource.position.left"), value: "left" },
2619
+ { label: a("report.section.datasource.position.right"), value: "right" }
2620
+ ], w = k({
2621
+ get: () => e.model.showLegend !== void 0 ? e.model.showLegend : e.isCircularWidget === !0,
2622
+ set: (A) => {
2623
+ t("update:model", { ...e.model, showLegend: A });
2624
+ }
2625
+ }), c = k({
2626
+ get: () => e.model.usePointStyle ?? !0,
2627
+ set: (A) => {
2628
+ t("update:model", { ...e.model, usePointStyle: A });
2629
+ }
2630
+ }), T = k({
2631
+ get: () => e.model.legendFontSize ?? null,
2632
+ set: (A) => {
2633
+ if (A == null) {
2634
+ t("update:model", { ...e.model, legendFontSize: void 0 });
2635
+ return;
2636
+ }
2637
+ t("update:model", { ...e.model, legendFontSize: Math.min(Number(A), 24) });
2638
+ }
2639
+ }), L = k(() => e.model.legendColor ?? "#6b6b6b"), o = le(L.value), r = le(null);
2640
+ Ve(
2641
+ () => e.model.legendColor,
2642
+ (A) => {
2643
+ o.value = A ?? "#6b6b6b";
2644
+ }
2645
+ );
2646
+ function i() {
2647
+ t("update:model", { ...e.model, legendColor: o.value });
2648
+ }
2649
+ function x() {
2650
+ var A;
2651
+ (A = r.value) == null || A.click();
2652
+ }
2653
+ return (A, n) => {
2654
+ const v = M("FmCheckbox"), I = M("FmSelect"), P = M("FmStepperField"), b = M("FmButton");
2655
+ return g(), X("div", uo, [
2656
+ m(v, {
2657
+ modelValue: w.value,
2658
+ "onUpdate:modelValue": n[0] || (n[0] = (s) => w.value = s),
2659
+ class: "fm-typo-en-body-lg-400",
2660
+ value: !1,
2661
+ label: l(a)("report.section.datasource.legend.showLegend")
2662
+ }, null, 8, ["modelValue", "label"]),
2663
+ ke(h("div", mo, [
2664
+ m(v, {
2665
+ modelValue: c.value,
2666
+ "onUpdate:modelValue": n[1] || (n[1] = (s) => c.value = s),
2667
+ label: l(a)("report.section.datasource.legend.usePointStyle"),
2668
+ value: !1
2669
+ }, null, 8, ["modelValue", "label"]),
2670
+ m(I, {
2671
+ label: l(a)("report.section.datasource.position.showPosition"),
2672
+ items: U,
2673
+ "model-value": A.model.legendPosition ?? "top",
2674
+ "onUpdate:modelValue": n[2] || (n[2] = (s) => t("update:model", { ...A.model, legendPosition: s }))
2675
+ }, null, 8, ["label", "model-value"]),
2676
+ m(P, {
2677
+ modelValue: T.value,
2678
+ "onUpdate:modelValue": n[3] || (n[3] = (s) => T.value = s),
2679
+ label: l(a)("report.section.datasource.legend.fontSize"),
2680
+ max: 24,
2681
+ min: 1,
2682
+ type: "number",
2683
+ placeholder: "Auto"
2684
+ }, null, 8, ["modelValue", "label"]),
2685
+ h("p", co, J(l(a)("report.section.datasource.legend.color")), 1),
2686
+ h("div", {
2687
+ class: "fm-field fm-field--sm flex items-center justify-between gap-8 border rounded-md p-2 border-[#c7c7cc] cursor-pointer",
2688
+ role: "button",
2689
+ tabindex: "0",
2690
+ onClick: x,
2691
+ onKeydown: [
2692
+ dl(Ce(x, ["prevent"]), ["enter"]),
2693
+ dl(Ce(x, ["prevent"]), ["space"])
2694
+ ]
2695
+ }, [
2696
+ ke(h("input", {
2697
+ ref_key: "colorInputRef",
2698
+ ref: r,
2699
+ "onUpdate:modelValue": n[4] || (n[4] = (s) => o.value = s),
2700
+ type: "color",
2701
+ class: "legend-color-input cursor-pointer"
2702
+ }, null, 512), [
2703
+ [Il, o.value]
2704
+ ])
2705
+ ], 40, po),
2706
+ m(b, {
2707
+ size: "md",
2708
+ label: l(a)("report.common.apply"),
2709
+ disabled: o.value === L.value,
2710
+ onClick: i
2711
+ }, null, 8, ["label", "disabled"])
2712
+ ], 512), [
2713
+ [Te, w.value]
2714
+ ])
2715
+ ]);
2716
+ };
2717
+ }
2718
+ }), fo = /* @__PURE__ */ kl(vo, [["__scopeId", "data-v-0e072961"]]), go = { class: "flex flex-col gap-8" }, yo = { class: "flex flex-col sm:flex-row items-center" }, bo = { class: "flex flex-col gap-8" }, ho = { class: "flex w-full gap-8 text-fm-color-system-info-300" }, wo = {
2719
+ key: 1,
2720
+ class: "grid grid-cols-1 gap-8 sm:grid-cols-2"
2721
+ }, Co = ["title"], xo = ["aria-label"], Fo = { class: "min-w-0 truncate text-[12px] uppercase leading-none tracking-[0.02em] text-[#6b6b6b]" }, Vo = ["value", "onInput", "onChange"], ko = {
2722
+ key: 0,
2723
+ class: "flex items-center gap-8"
2724
+ }, _o = {
2725
+ key: 2,
2726
+ class: "flex flex-col gap-8"
2727
+ }, So = { class: "fm-shadow-light-100 rounded-md border border-fm-color-neutral-gray-100 bg-fm-color-neutral-white p-10" }, To = { class: "mb-8 flex min-w-0 items-center gap-[8px] pb-8" }, $o = ["title"], Do = ["title"], Uo = { class: "flex w-full items-center gap-8 sm:w-auto sm:shrink-0" }, Bo = ["aria-label"], Lo = { class: "min-w-0 truncate text-[12px] uppercase leading-none tracking-[0.02em]" }, Ao = ["value", "disabled", "onInput", "onChange"], Mo = {
2728
+ key: 0,
2729
+ class: "flex items-center gap-8"
2730
+ }, Ue = 10, No = /* @__PURE__ */ ue({
2731
+ __name: "ChartColorSection",
2732
+ props: {
2733
+ model: {},
2734
+ showLayerControl: { type: Boolean },
2735
+ limitToSeriesMode: { type: Boolean }
2736
+ },
2737
+ emits: ["update:model"],
2738
+ setup(B, { emit: p }) {
2739
+ const e = B, t = p, { t: a } = ge(), U = k(() => e.limitToSeriesMode ? [
2740
+ {
2741
+ label: a("report.section.datasource.styleTarget.series"),
2742
+ value: ie.series
2743
+ }
2744
+ ] : [
2745
+ {
2746
+ label: a("report.section.datasource.styleTarget.series"),
2747
+ value: ie.series
2748
+ },
2749
+ {
2750
+ label: a("report.section.datasource.styleTarget.metric"),
2751
+ value: ie.metric
2752
+ },
2753
+ {
2754
+ label: a("report.section.datasource.styleTarget.breakdown"),
2755
+ value: ie.breakdown
2756
+ }
2757
+ ]);
2758
+ function w(C) {
2759
+ return e.limitToSeriesMode ? ie.series : C === ie.breakdown ? ie.breakdown : C === ie.metric ? ie.metric : ie.series;
2760
+ }
2761
+ function c() {
2762
+ const C = Array.isArray(e.model.metrics) ? e.model.metrics : [];
2763
+ if (!e.model.isBlend)
2764
+ return C;
2765
+ const S = Array.isArray(e.model.joinDatasources) ? e.model.joinDatasources.flatMap(
2766
+ (D) => Array.isArray(D == null ? void 0 : D.metrics) ? D.metrics : []
2767
+ ) : [];
2768
+ return [...C, ...S];
2769
+ }
2770
+ function T(C, S) {
2771
+ var W, G;
2772
+ return C ? ((W = C.label) == null ? void 0 : W.trim()) || ((G = C.name) == null ? void 0 : G.trim()) || `${a("report.section.datasource.styleTarget.metric")} ${S + 1}` : `${a("report.section.datasource.styleTarget.metric")} ${S + 1}`;
2773
+ }
2774
+ function L(C) {
2775
+ if (C === ie.breakdown)
2776
+ return [];
2777
+ if (C === ie.metric) {
2778
+ const S = c();
2779
+ if (S.length > 0)
2780
+ return S.map((D, W) => T(D, W));
2781
+ }
2782
+ return fe.map(
2783
+ (S, D) => `${a("report.section.datasource.chartColor.series")} ${D + 1}`
2784
+ );
2785
+ }
2786
+ function o(C) {
2787
+ return Array.from({ length: Math.max(1, C) }).map(
2788
+ (S, D) => `${a("report.section.datasource.chartColor.series")} ${D + 1}`
2789
+ );
2790
+ }
2791
+ function r(C, S) {
2792
+ const D = Array.isArray(C) ? C.length : 0, W = Array.isArray(S) ? S.length : 0;
2793
+ return Math.max(fe.length, D, W, 1);
2794
+ }
2795
+ const i = k(() => {
2796
+ const C = c();
2797
+ return C.length === 0 ? [a("report.section.datasource.styleTarget.metric")] : C.map((S, D) => T(S, D));
2798
+ }), x = le(fe.length), A = le(fe.length);
2799
+ function n(C, S) {
2800
+ const D = Math.max(1, S), W = Array.isArray(C) ? C.length : 0, G = W > 0 ? Math.ceil(W / D) : 0;
2801
+ return Math.max(fe.length, G, 1);
2802
+ }
2803
+ const v = k(() => {
2804
+ const C = Math.max(1, A.value);
2805
+ return Array.from({ length: C }).map(
2806
+ (S, D) => `${a("report.section.datasource.styleTarget.breakdown")} ${D + 1}`
2807
+ );
2808
+ });
2809
+ function I(C, S) {
2810
+ const D = N(C) ?? "#000000", W = (G) => {
2811
+ const q = Number.parseInt(D.slice(G, G + 2), 16);
2812
+ return Math.round(q + (255 - q) * S).toString(16).padStart(2, "0").toUpperCase();
2813
+ };
2814
+ return `#${W(1)}${W(3)}${W(5)}`;
2815
+ }
2816
+ function P(C) {
2817
+ return Math.min(0.55 + (C - 1) * 0.18, 0.95);
2818
+ }
2819
+ function b(C, S, D) {
2820
+ return C * D + S;
2821
+ }
2822
+ function s(C, S, D, W) {
2823
+ const G = S.length;
2824
+ if (C.length === 0 || G <= 0)
2825
+ return [];
2826
+ const q = el(C.length);
2827
+ return C.flatMap((H, te) => {
2828
+ const Z = q[te], me = D == null ? void 0 : D[b(te, 0, G)], Le = N(me) ?? Z;
2829
+ return S.map((Qe, Ae) => {
2830
+ const jl = b(te, Ae, G), ul = Ae === 0 ? Le : I(Le, P(Ae));
2831
+ return W && Ae > 0 ? ul : N(D == null ? void 0 : D[jl]) ?? ul;
2832
+ });
2833
+ });
2834
+ }
2835
+ const j = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
2836
+ function N(C) {
2837
+ if (!C)
2838
+ return null;
2839
+ const S = C.trim();
2840
+ if (!j.test(S))
2841
+ return null;
2842
+ if (S.length === 4) {
2843
+ const D = S.charAt(1), W = S.charAt(2), G = S.charAt(3);
2844
+ return `#${D}${D}${W}${W}${G}${G}`.toUpperCase();
2845
+ }
2846
+ return S.toUpperCase();
2847
+ }
2848
+ function f() {
2849
+ const C = () => Math.floor(Math.random() * 256).toString(16).padStart(2, "0").toUpperCase();
2850
+ return `#${C()}${C()}${C()}`;
2851
+ }
2852
+ function F(C, S) {
2853
+ const D = el(S);
2854
+ return !Array.isArray(C) || C.length === 0 ? D : Array.from({ length: S }).map((W, G) => {
2855
+ const q = D[G];
2856
+ return N(C[G]) ?? q;
2857
+ });
2858
+ }
2859
+ function d(C, S) {
2860
+ if (S <= 0)
2861
+ return [];
2862
+ const D = Array.from({ length: S }, () => 0), W = /* @__PURE__ */ new Set();
2863
+ for (let q = 0; q < S; q++) {
2864
+ const H = Number(C == null ? void 0 : C[q]);
2865
+ Number.isInteger(H) && H >= 1 && H <= S && !W.has(H) && (D[q] = H, W.add(H));
2866
+ }
2867
+ let G = 1;
2868
+ for (let q = 0; q < S; q++)
2869
+ if (D[q] === 0) {
2870
+ for (; W.has(G) && G <= S; )
2871
+ G++;
2872
+ D[q] = Math.min(G, S), W.add(D[q]);
2873
+ }
2874
+ return D;
2875
+ }
2876
+ const _ = k(() => z.value === ie.series ? o(x.value) : L(z.value)), K = k(
2877
+ () => Array.from({ length: _.value.length }).map((C, S) => ({
2878
+ label: `L${S + 1}`,
2879
+ value: S + 1
2880
+ }))
2881
+ ), O = k(() => typeof e.showLayerControl == "boolean" ? e.showLayerControl : !!e.model.stackBarOverlap), y = le([]), V = le([]), u = le([]), $ = le(!0), z = le(ie.series), ae = le(!0), se = le(!1), ce = le(!1);
2882
+ Ve(
2883
+ [
2884
+ () => e.model.chartColors,
2885
+ () => e.model.chartColorBinding,
2886
+ () => e.model.chartBreakdownColors,
2887
+ () => e.model.chartUseSecondaryMetricShades,
2888
+ () => e.model.metrics,
2889
+ () => e.model.isBlend,
2890
+ () => e.model.joinDatasources
2891
+ ],
2892
+ ([C, S]) => {
2893
+ se.value = !0, z.value = w(S), x.value = r(
2894
+ C,
2895
+ e.model.chartColorLayers
2896
+ ), A.value = n(
2897
+ e.model.chartBreakdownColors,
2898
+ Math.max(1, i.value.length)
2899
+ );
2900
+ const D = z.value === ie.series ? x.value : L(z.value).length;
2901
+ y.value = F(C, D), V.value = d(e.model.chartColorLayers, D), $.value = e.model.chartUseSecondaryMetricShades !== !1, u.value = s(
2902
+ v.value,
2903
+ i.value,
2904
+ e.model.chartBreakdownColors,
2905
+ $.value
2906
+ ), se.value = !1;
2907
+ },
2908
+ { immediate: !0, deep: !0 }
2909
+ );
2910
+ function pe() {
2911
+ const C = z.value === ie.series, S = z.value === ie.series ? fe.length : L(z.value).length, D = F(void 0, S), W = d(void 0, S), G = y.value.length === D.length && y.value.every((Z, me) => Z === D[me]), q = V.value.length === W.length && V.value.every((Z, me) => Z === W[me]), H = s(
2912
+ Array.from({ length: fe.length }, (Z, me) => `breakdown-${me + 1}`),
2913
+ i.value,
2914
+ void 0,
2915
+ $.value
2916
+ ), te = u.value.length === H.length && u.value.every((Z, me) => Z === H[me]);
2917
+ return {
2918
+ ...e.model,
2919
+ chartColorBinding: C ? void 0 : z.value,
2920
+ chartColors: G ? void 0 : [...y.value],
2921
+ chartColorLayers: q ? void 0 : [...V.value],
2922
+ chartBreakdownColors: te ? void 0 : [...u.value],
2923
+ chartUseSecondaryMetricShades: $.value
2924
+ };
2925
+ }
2926
+ function De() {
2927
+ const C = pe();
2928
+ Al(C) || t("update:model", C);
2929
+ }
2930
+ function oe() {
2931
+ se.value || ce.value || De();
2932
+ }
2933
+ Ve(
2934
+ [
2935
+ y,
2936
+ V,
2937
+ u,
2938
+ $,
2939
+ z,
2940
+ x,
2941
+ A
2942
+ ],
2943
+ () => {
2944
+ oe();
2945
+ },
2946
+ { deep: !0 }
2947
+ );
2948
+ function xe(C, S) {
2949
+ const D = [...y.value], W = el(Math.max(D.length, C + 1))[C];
2950
+ D[C] = N(S) ?? W, y.value = D;
2951
+ }
2952
+ function Se(C) {
2953
+ xe(C, f());
2954
+ }
2955
+ function he(C) {
2956
+ if (e.limitToSeriesMode)
2957
+ return;
2958
+ const S = w(C);
2959
+ if (S === z.value)
2960
+ return;
2961
+ const D = S === ie.series ? x.value : L(S).length;
2962
+ z.value = S, y.value = F(y.value, D), V.value = d(V.value, D), S === ie.breakdown && (u.value = s(
2963
+ v.value,
2964
+ i.value,
2965
+ u.value,
2966
+ $.value
2967
+ ));
2968
+ }
2969
+ function Fe(C, S) {
2970
+ return C + 1 === S ? "add" : "remove";
2971
+ }
2972
+ function ee(C) {
2973
+ const S = Math.max(fe.length, x.value), D = C + 1;
2974
+ if (D === S) {
2975
+ const Z = S + Ue;
2976
+ x.value = Z, y.value = F(y.value, Z), V.value = d(V.value, Z);
2977
+ return;
2978
+ }
2979
+ if (S <= fe.length)
2980
+ return;
2981
+ const G = D, q = Math.max(fe.length, S - Ue), H = [...y.value], te = [...V.value];
2982
+ H.splice(G, Ue), te.splice(G, Ue), x.value = q, y.value = F(H, q), V.value = d(te, q);
2983
+ }
2984
+ function Pe(C) {
2985
+ const S = Math.max(fe.length, A.value), D = C + 1;
2986
+ if (D === S) {
2987
+ const Le = S + Ue;
2988
+ A.value = Le, u.value = s(
2989
+ Array.from({ length: Le }, (Qe, Ae) => `breakdown-${Ae + 1}`),
2990
+ i.value,
2991
+ u.value,
2992
+ $.value
2993
+ );
2994
+ return;
2995
+ }
2996
+ if (S <= fe.length)
2997
+ return;
2998
+ const G = Math.max(1, i.value.length), H = D * G, te = Ue * G, Z = Math.max(fe.length, S - Ue), me = [...u.value];
2999
+ me.splice(H, te), A.value = Z, u.value = s(
3000
+ Array.from({ length: Z }, (Le, Qe) => `breakdown-${Qe + 1}`),
3001
+ i.value,
3002
+ me,
3003
+ $.value
3004
+ );
3005
+ }
3006
+ function Ee(C, S) {
3007
+ const D = V.value.length;
3008
+ if (D <= 0)
3009
+ return;
3010
+ const W = Number(S);
3011
+ if (!Number.isInteger(W) || W < 1 || W > D)
3012
+ return;
3013
+ const G = [...V.value], q = G[C];
3014
+ if (q === W)
3015
+ return;
3016
+ const H = G.findIndex(
3017
+ (te, Z) => Z !== C && te === W
3018
+ );
3019
+ H >= 0 && (G[H] = q), G[C] = W, V.value = G;
3020
+ }
3021
+ function We(C, S) {
3022
+ const D = S.target;
3023
+ D && (ce.value = !0, xe(C, D.value));
3024
+ }
3025
+ function Xe(C, S) {
3026
+ const D = S.target;
3027
+ D && (xe(C, D.value), ce.value = !1, oe());
3028
+ }
3029
+ function ne(C, S, D) {
3030
+ const W = D.target;
3031
+ if (!W)
3032
+ return;
3033
+ ce.value = !0;
3034
+ const G = N(W.value);
3035
+ if (!G)
3036
+ return;
3037
+ const q = i.value.length;
3038
+ if (q <= 0)
3039
+ return;
3040
+ const H = b(C, S, q), te = [...u.value];
3041
+ if (te[H] = G, $.value && S === 0)
3042
+ for (let Z = 1; Z < q; Z++) {
3043
+ const me = b(C, Z, q);
3044
+ te[me] = I(G, P(Z));
3045
+ }
3046
+ u.value = te;
3047
+ }
3048
+ function Ul(C, S, D) {
3049
+ const W = D.target;
3050
+ if (!W)
3051
+ return;
3052
+ const G = N(W.value);
3053
+ if (!G) {
3054
+ ce.value = !1, oe();
3055
+ return;
3056
+ }
3057
+ const q = i.value.length;
3058
+ if (q <= 0) {
3059
+ ce.value = !1, oe();
3060
+ return;
3061
+ }
3062
+ const H = b(C, S, q), te = [...u.value];
3063
+ if (te[H] = G, $.value && S === 0)
3064
+ for (let Z = 1; Z < q; Z++) {
3065
+ const me = b(C, Z, q);
3066
+ te[me] = I(G, P(Z));
3067
+ }
3068
+ u.value = te, ce.value = !1, oe();
3069
+ }
3070
+ function Bl(C, S) {
3071
+ const D = f(), W = i.value.length;
3072
+ if (W <= 0)
3073
+ return;
3074
+ const G = b(C, S, W), q = [...u.value];
3075
+ if (q[G] = D, $.value && S === 0)
3076
+ for (let H = 1; H < W; H++) {
3077
+ const te = b(C, H, W);
3078
+ q[te] = I(D, P(H));
3079
+ }
3080
+ u.value = q;
3081
+ }
3082
+ function sl(C, S) {
3083
+ const D = Array.isArray(C) ? C : [], W = Array.isArray(S) ? S : [];
3084
+ return D.length !== W.length ? !1 : D.every((G, q) => G === W[q]);
3085
+ }
3086
+ function Ll(C, S) {
3087
+ const D = Array.isArray(C) ? C : [], W = Array.isArray(S) ? S : [];
3088
+ return D.length !== W.length ? !1 : D.every((G, q) => Number(G) === Number(W[q]));
3089
+ }
3090
+ function Al(C) {
3091
+ return C.chartColorBinding === e.model.chartColorBinding && C.chartUseSecondaryMetricShades === e.model.chartUseSecondaryMetricShades && sl(C.chartColors, e.model.chartColors) && Ll(C.chartColorLayers, e.model.chartColorLayers) && sl(C.chartBreakdownColors, e.model.chartBreakdownColors);
3092
+ }
3093
+ function Ml(C) {
3094
+ $.value = C, u.value = s(
3095
+ Array.from({ length: A.value }, (S, D) => `breakdown-${D + 1}`),
3096
+ i.value,
3097
+ u.value,
3098
+ $.value
3099
+ );
3100
+ }
3101
+ function Nl() {
3102
+ z.value = ie.series, x.value = fe.length, A.value = fe.length, y.value = F(void 0, fe.length), V.value = d(void 0, fe.length), $.value = !0, u.value = s(
3103
+ Array.from({ length: fe.length }, (C, S) => `breakdown-${S + 1}`),
3104
+ i.value,
3105
+ void 0,
3106
+ !0
3107
+ );
3108
+ }
3109
+ function Ol() {
3110
+ ae.value = !ae.value;
3111
+ }
3112
+ function rl(C) {
3113
+ return (C + 1) % Ue === 0;
3114
+ }
3115
+ return nl(() => {
3116
+ ce.value = !1;
3117
+ }), (C, S) => {
3118
+ const D = M("FmButton"), W = M("FmSelect"), G = M("FmCheckbox");
3119
+ return g(), X("div", go, [
3120
+ h("div", yo, [
3121
+ m(D, {
3122
+ variant: "tertiary",
3123
+ size: "md",
3124
+ class: "min-w-0 w-full sm:flex-1 sm:w-auto !justify-start",
3125
+ label: l(a)("report.section.datasource.chartColor.title"),
3126
+ "prepend-icon": ae.value ? "expand_less" : "expand_more",
3127
+ "aria-expanded": ae.value ? "true" : "false",
3128
+ onClick: Ol
3129
+ }, null, 8, ["label", "prepend-icon", "aria-expanded"])
3130
+ ]),
3131
+ ke(h("div", bo, [
3132
+ m(W, {
3133
+ "model-value": z.value,
3134
+ items: U.value,
3135
+ "onUpdate:modelValue": he
3136
+ }, null, 8, ["model-value", "items"]),
3137
+ h("div", ho, [
3138
+ m(D, {
3139
+ variant: "tertiary",
3140
+ "text-color": "text-fm-color-system-info-300",
3141
+ size: "md",
3142
+ class: "w-full",
3143
+ label: l(a)("report.section.datasource.chartColor.reset"),
3144
+ onClick: Nl
3145
+ }, null, 8, ["label"])
3146
+ ]),
3147
+ z.value === l(ie).breakdown ? (g(), R(G, {
3148
+ key: 0,
3149
+ "model-value": $.value,
3150
+ value: !1,
3151
+ label: l(a)("report.section.datasource.chartColor.secondaryMetricAutoShade"),
3152
+ "onUpdate:modelValue": S[0] || (S[0] = (q) => Ml(!!q)),
3153
+ class: "p-4"
3154
+ }, null, 8, ["model-value", "label"])) : E("", !0),
3155
+ z.value !== l(ie).breakdown ? (g(), X("div", wo, [
3156
+ (g(!0), X(de, null, _e(y.value, (q, H) => (g(), X(de, {
3157
+ key: `series-color-${H}`
3158
+ }, [
3159
+ h("div", {
3160
+ class: $e([
3161
+ "fm-shadow-light-100 rounded-md border border-fm-color-neutral-gray-100 p-10",
3162
+ O.value ? "flex flex-col gap-8" : "flex flex-col gap-8 sm:flex-row sm:items-center sm:justify-between sm:gap-12"
3163
+ ])
3164
+ }, [
3165
+ h("span", {
3166
+ class: $e([
3167
+ "fm-typo-en-body-lg-600 min-w-0",
3168
+ O.value ? "line-clamp-2 break-words" : "whitespace-normal break-words sm:flex-1"
3169
+ ]),
3170
+ title: _.value[H] || `${l(a)("report.section.datasource.chartColor.color")} ${H + 1}`
3171
+ }, J(_.value[H] || `${l(a)("report.section.datasource.chartColor.color")} ${H + 1}`), 11, Co),
3172
+ h("div", {
3173
+ class: $e([
3174
+ "flex items-center gap-8",
3175
+ O.value ? "justify-between" : "w-full flex-wrap items-center justify-between sm:w-auto sm:flex-nowrap sm:shrink-0"
3176
+ ])
3177
+ }, [
3178
+ O.value ? (g(), R(W, {
3179
+ key: 0,
3180
+ class: "min-w-[92px]",
3181
+ "model-value": V.value[H],
3182
+ items: K.value,
3183
+ "onUpdate:modelValue": (te) => Ee(H, te)
3184
+ }, null, 8, ["model-value", "items", "onUpdate:modelValue"])) : E("", !0),
3185
+ h("label", {
3186
+ class: "relative inline-flex min-h-[34px] min-w-0 flex-1 cursor-pointer items-center gap-[8px] rounded-[8px] border border-[#d8d8d8] bg-white py-[4px] pl-[4px] pr-[8px] sm:flex-none",
3187
+ "aria-label": `Color ${H + 1}`
3188
+ }, [
3189
+ h("span", {
3190
+ class: "inline-block h-[20px] w-[28px] rounded-[4px] border border-[#cfcfcf]",
3191
+ style: tl({ backgroundColor: q })
3192
+ }, null, 4),
3193
+ h("span", Fo, J(q), 1),
3194
+ h("input", {
3195
+ type: "color",
3196
+ value: q,
3197
+ class: "absolute inset-0 cursor-pointer opacity-0",
3198
+ onInput: (te) => We(H, te),
3199
+ onChange: (te) => Xe(H, te)
3200
+ }, null, 40, Vo)
3201
+ ], 8, xo),
3202
+ m(D, {
3203
+ variant: "tertiary",
3204
+ size: "md",
3205
+ icon: "casino",
3206
+ onClick: (te) => Se(H)
3207
+ }, null, 8, ["onClick"])
3208
+ ], 2)
3209
+ ], 2),
3210
+ rl(H) ? (g(), X("div", ko, [
3211
+ m(D, {
3212
+ class: "w-full",
3213
+ size: "md",
3214
+ icon: Fe(H, x.value),
3215
+ onClick: (te) => ee(H)
3216
+ }, null, 8, ["icon", "onClick"])
3217
+ ])) : E("", !0)
3218
+ ], 64))), 128))
3219
+ ])) : (g(), X("div", _o, [
3220
+ (g(!0), X(de, null, _e(v.value, (q, H) => (g(), X(de, {
3221
+ key: `breakdown-group-${H}`
3222
+ }, [
3223
+ h("div", So, [
3224
+ h("div", To, [
3225
+ h("span", {
3226
+ class: "fm-typo-en-body-lg-600 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
3227
+ title: q
3228
+ }, J(q), 9, $o)
3229
+ ]),
3230
+ (g(!0), X(de, null, _e(i.value, (te, Z) => (g(), X("div", {
3231
+ key: `${q}-${te}-${Z}`,
3232
+ class: "flex flex-col items-stretch gap-8 py-4 sm:flex-row sm:items-center sm:justify-between"
3233
+ }, [
3234
+ h("span", {
3235
+ class: "fm-typo-en-body-md-400 min-w-0 flex-1 break-words sm:overflow-hidden sm:text-ellipsis sm:whitespace-nowrap",
3236
+ title: te
3237
+ }, J(te), 9, Do),
3238
+ h("div", Uo, [
3239
+ h("label", {
3240
+ class: $e(["relative inline-flex min-h-[34px] min-w-0 flex-1 items-center gap-[8px] rounded-[8px] border border-[#d8d8d8] bg-white py-[4px] pl-[4px] pr-[8px] sm:w-full sm:max-w-[126px]", {
3241
+ "cursor-not-allowed opacity-[0.55]": $.value && Z > 0,
3242
+ "cursor-pointer": !($.value && Z > 0)
3243
+ }]),
3244
+ "aria-label": `Breakdown color ${H + 1}-${Z + 1}`
3245
+ }, [
3246
+ h("span", {
3247
+ class: "inline-block h-[20px] w-[28px] rounded-[4px] border border-[#cfcfcf]",
3248
+ style: tl({
3249
+ backgroundColor: u.value[b(H, Z, i.value.length)]
3250
+ })
3251
+ }, null, 4),
3252
+ h("span", Lo, J(u.value[b(H, Z, i.value.length)]), 1),
3253
+ h("input", {
3254
+ type: "color",
3255
+ value: u.value[b(H, Z, i.value.length)],
3256
+ class: $e(["absolute inset-0 opacity-0", {
3257
+ "cursor-not-allowed": $.value && Z > 0,
3258
+ "cursor-pointer": !($.value && Z > 0)
3259
+ }]),
3260
+ disabled: $.value && Z > 0,
3261
+ onInput: (me) => ne(H, Z, me),
3262
+ onChange: (me) => Ul(H, Z, me)
3263
+ }, null, 42, Ao)
3264
+ ], 10, Bo),
3265
+ m(D, {
3266
+ variant: "tertiary",
3267
+ size: "md",
3268
+ icon: "casino",
3269
+ class: "shrink-0",
3270
+ disabled: $.value && Z > 0,
3271
+ onClick: (me) => Bl(H, Z)
3272
+ }, null, 8, ["disabled", "onClick"])
3273
+ ])
3274
+ ]))), 128))
3275
+ ]),
3276
+ rl(H) ? (g(), X("div", Mo, [
3277
+ m(D, {
3278
+ class: "w-full",
3279
+ size: "md",
3280
+ icon: Fe(H, A.value),
3281
+ onClick: (te) => Pe(H)
3282
+ }, null, 8, ["icon", "onClick"])
3283
+ ])) : E("", !0)
3284
+ ], 64))), 128))
3285
+ ]))
3286
+ ], 512), [
3287
+ [Te, ae.value]
3288
+ ])
3289
+ ]);
3290
+ };
3291
+ }
3292
+ }), Oo = { class: "flex flex-col gap-8" }, jo = { class: "flex items-center justify-between" }, Io = { class: "fm-typo-en-body-lg-600" }, zo = { class: "flex items-center gap-8 text-fm-color-system-info-300" }, Ro = { class: "grid grid-cols-2 gap-8" }, Po = { class: "flex items-center gap-8" }, Eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Wo = /* @__PURE__ */ ue({
3293
+ __name: "ChartLineStyleSection",
3294
+ props: {
3295
+ model: {}
3296
+ },
3297
+ emits: ["update:model"],
3298
+ setup(B, { emit: p }) {
3299
+ const e = B, t = p, { t: a } = ge(), U = k(() => [
3300
+ {
3301
+ label: a("report.section.datasource.styleTarget.series"),
3302
+ value: ie.series
3303
+ },
3304
+ {
3305
+ label: a("report.section.datasource.styleTarget.metric"),
3306
+ value: ie.metric
3307
+ }
3308
+ ]);
3309
+ function w(F) {
3310
+ return F && typeof F == "object" && "value" in F ? w(F.value) : F === ie.metric ? ie.metric : ie.series;
3311
+ }
3312
+ function c(F, d) {
3313
+ var K, O;
3314
+ return F ? ((K = F.label) == null ? void 0 : K.trim()) || ((O = F.name) == null ? void 0 : O.trim()) || `${a("report.section.datasource.styleTarget.metric")} ${d + 1}` : `${a("report.section.datasource.styleTarget.metric")} ${d + 1}`;
3315
+ }
3316
+ function T() {
3317
+ const F = Array.isArray(e.model.metrics) ? e.model.metrics : [];
3318
+ if (!e.model.isBlend)
3319
+ return F;
3320
+ const d = Array.isArray(e.model.joinDatasources) ? e.model.joinDatasources.flatMap(
3321
+ (_) => Array.isArray(_ == null ? void 0 : _.metrics) ? _.metrics : []
3322
+ ) : [];
3323
+ return [...F, ...d];
3324
+ }
3325
+ function L(F) {
3326
+ if (F === ie.metric) {
3327
+ const d = T();
3328
+ if (d.length > 0)
3329
+ return d.map((_, K) => c(_, K));
3330
+ }
3331
+ return fe.map(
3332
+ (d, _) => `${a("report.section.datasource.lineStyle.series")} ${_ + 1}`
3333
+ );
3334
+ }
3335
+ const o = k(() => [
3336
+ {
3337
+ label: a("report.section.datasource.lineStyle.solid"),
3338
+ value: "solid"
3339
+ },
3340
+ {
3341
+ label: a("report.section.datasource.lineStyle.dashed"),
3342
+ value: "dashed"
3343
+ },
3344
+ {
3345
+ label: a("report.section.datasource.lineStyle.dotted"),
3346
+ value: "dotted"
3347
+ }
3348
+ ]);
3349
+ function r(F) {
3350
+ return F && typeof F == "object" && "value" in F ? r(F.value) : F === "dashed" || F === "DASHED" ? "dashed" : F === "dotted" || F === "DOTTED" ? "dotted" : "solid";
3351
+ }
3352
+ function i(F) {
3353
+ return F === "dashed" ? "line-style-icon--dashed" : F === "dotted" ? "line-style-icon--dotted" : "line-style-icon--solid";
3354
+ }
3355
+ function x(F, d) {
3356
+ return !Array.isArray(F) || F.length === 0 ? Array.from({ length: d }).map(
3357
+ (_, K) => vl[K] ?? "solid"
3358
+ ) : Array.from({ length: d }).map(
3359
+ (_, K) => r(F[K])
3360
+ );
3361
+ }
3362
+ const A = k(
3363
+ () => w(e.model.lineStyleBinding)
3364
+ ), n = k(() => L(P.value)), v = k(
3365
+ () => x(e.model.lineStyles, L(A.value).length)
3366
+ ), I = le([]), P = le(ie.series);
3367
+ Ve(
3368
+ [
3369
+ () => e.model.lineStyles,
3370
+ () => e.model.lineStyleBinding,
3371
+ () => e.model.metrics,
3372
+ () => e.model.isBlend,
3373
+ () => e.model.joinDatasources
3374
+ ],
3375
+ ([F, d]) => {
3376
+ P.value = w(d), I.value = x(
3377
+ F,
3378
+ L(P.value).length
3379
+ );
3380
+ },
3381
+ { immediate: !0, deep: !0 }
3382
+ );
3383
+ const b = k(() => P.value !== A.value || I.value.length !== v.value.length ? !0 : I.value.some((F, d) => F !== v.value[d]));
3384
+ function s(F, d) {
3385
+ const _ = [...I.value];
3386
+ _[F] = r(d), I.value = _;
3387
+ }
3388
+ function j(F) {
3389
+ const d = w(F);
3390
+ if (d === P.value)
3391
+ return;
3392
+ const _ = L(d).length;
3393
+ P.value = d, I.value = x(I.value, _);
3394
+ }
3395
+ function N() {
3396
+ P.value = ie.series, I.value = [...vl];
3397
+ }
3398
+ function f() {
3399
+ const F = P.value === ie.series, d = I.value.every((_) => _ === "solid");
3400
+ t("update:model", {
3401
+ ...e.model,
3402
+ lineStyleBinding: F ? void 0 : P.value,
3403
+ lineStyles: d ? void 0 : [...I.value]
3404
+ });
3405
+ }
3406
+ return (F, d) => {
3407
+ const _ = M("FmButton"), K = M("FmSelect");
3408
+ return g(), X("div", Oo, [
3409
+ h("div", jo, [
3410
+ h("p", Io, J(l(a)("report.section.datasource.lineStyle.title")), 1),
3411
+ h("div", zo, [
3412
+ m(_, {
3413
+ variant: "tertiary",
3414
+ "text-color": "text-fm-color-system-info-300",
3415
+ size: "md",
3416
+ label: l(a)("report.section.datasource.lineStyle.reset"),
3417
+ onClick: N
3418
+ }, null, 8, ["label"])
3419
+ ])
3420
+ ]),
3421
+ m(K, {
3422
+ "model-value": P.value,
3423
+ items: U.value,
3424
+ label: l(a)("report.section.datasource.styleTarget.title"),
3425
+ "onUpdate:modelValue": j
3426
+ }, null, 8, ["model-value", "items", "label"]),
3427
+ h("div", Ro, [
3428
+ (g(!0), X(de, null, _e(I.value, (O, y) => (g(), X("div", {
3429
+ key: y,
3430
+ class: "flex items-center justify-between gap-8 rounded-md border border-fm-color-neutral-gray-100 px-8 py-6"
3431
+ }, [
3432
+ h("div", Po, [
3433
+ h("span", {
3434
+ class: $e(["line-style-icon", i(O)]),
3435
+ "aria-hidden": "true"
3436
+ }, null, 2),
3437
+ h("span", Eo, J(n.value[y] || `${l(a)("report.section.datasource.lineStyle.line")} ${y + 1}`), 1)
3438
+ ]),
3439
+ m(K, {
3440
+ "model-value": O,
3441
+ items: o.value,
3442
+ class: "w-[130px]",
3443
+ "onUpdate:modelValue": (V) => s(y, V)
3444
+ }, null, 8, ["model-value", "items", "onUpdate:modelValue"])
3445
+ ]))), 128))
3446
+ ]),
3447
+ m(_, {
3448
+ size: "md",
3449
+ label: l(a)("report.common.apply"),
3450
+ disabled: !b.value,
3451
+ onClick: f
3452
+ }, null, 8, ["label", "disabled"])
3453
+ ]);
3454
+ };
3455
+ }
3456
+ }), Xo = /* @__PURE__ */ kl(Wo, [["__scopeId", "data-v-f1c35513"]]), qo = { class: "flex flex-col gap-16" }, Ho = {
3457
+ key: 1,
3458
+ class: "h-px w-full bg-fm-color-neutral-gray-100"
3459
+ }, Go = { class: "flex flex-col gap-8" }, Yo = { class: "fm-typo-en-body-lg-600" }, Jo = { class: "flex flex-col gap-8" }, Ko = /* @__PURE__ */ ue({
3460
+ __name: "StyleDatasource",
3461
+ props: /* @__PURE__ */ ve({
3462
+ label: {
3463
+ type: String,
3464
+ default: "Label"
3465
+ },
3466
+ config: {
3467
+ type: Object,
3468
+ default: null
3469
+ },
3470
+ closeable: {
3471
+ type: Boolean,
3472
+ default: !1
3473
+ },
3474
+ mainDatasourceConfig: {
3475
+ type: Object,
3476
+ default: () => {
3477
+ }
3478
+ },
3479
+ modelValue: {
3480
+ type: Object,
3481
+ default: () => {
3482
+ }
3483
+ }
3484
+ }, {
3485
+ modelValue: { required: !0 },
3486
+ modelModifiers: {}
3487
+ }),
3488
+ emits: /* @__PURE__ */ ve(["click-close"], ["update:modelValue"]),
3489
+ setup(B, { emit: p }) {
3490
+ const e = ye(B, "modelValue");
3491
+ Ve(
3492
+ [() => e.value.dimensions, () => e.value.metrics],
3493
+ () => {
3494
+ const { rowIds: r, columnIds: i } = Ge(e.value);
3495
+ e.value.rowIds = r, e.value.columnIds = i;
3496
+ },
3497
+ { deep: !0 }
3498
+ );
3499
+ const t = B, a = p, { t: U } = ge(), w = k(() => t.config.type === Y.Circular), c = k(
3500
+ () => t.config.type === Y.StackBarChart || t.config.type === Y.ClusteredStackBarChart
3501
+ ), T = k(
3502
+ () => t.config.type === Y.LineChart || t.config.type === Y.StackLineChart
3503
+ ), L = k({
3504
+ get: () => e.value.maxTooltipItems ?? null,
3505
+ set: (r) => {
3506
+ e.value = {
3507
+ ...e.value,
3508
+ maxTooltipItems: r ?? void 0
3509
+ };
3510
+ }
3511
+ }), o = k({
3512
+ get: () => e.value.stackBarOverlap ?? !1,
3513
+ set: (r) => {
3514
+ e.value = {
3515
+ ...e.value,
3516
+ stackBarOverlap: r
3517
+ };
3518
+ }
3519
+ });
3520
+ return (r, i) => {
3521
+ const x = M("FmButton"), A = M("FmCheckbox"), n = M("FmStepperField");
3522
+ return g(), X(de, null, [
3523
+ i[9] || (i[9] = h("div", { class: "grow" }, null, -1)),
3524
+ t.closeable ? (g(), R(x, {
3525
+ key: 0,
3526
+ icon: "close",
3527
+ variant: "tertiary",
3528
+ size: "md",
3529
+ onClick: i[0] || (i[0] = Ce((v) => a("click-close"), ["stop"]))
3530
+ })) : E("", !0),
3531
+ h("div", qo, [
3532
+ t.config.hasChart ? (g(), R(No, {
3533
+ key: 0,
3534
+ model: e.value,
3535
+ "show-layer-control": c.value && o.value,
3536
+ "limit-to-series-mode": w.value,
3537
+ "onUpdate:model": i[1] || (i[1] = (v) => e.value = v)
3538
+ }, null, 8, ["model", "show-layer-control", "limit-to-series-mode"])) : E("", !0),
3539
+ t.config.hasChart && T.value ? (g(), X("div", Ho)) : E("", !0),
3540
+ t.config.hasChart && T.value ? (g(), R(Xo, {
3541
+ key: 2,
3542
+ model: e.value,
3543
+ "onUpdate:model": i[2] || (i[2] = (v) => e.value = v)
3544
+ }, null, 8, ["model"])) : E("", !0),
3545
+ i[8] || (i[8] = h("div", { class: "h-px w-full bg-fm-color-neutral-gray-100" }, null, -1)),
3546
+ h("div", Go, [
3547
+ h("p", Yo, J(l(U)("report.section.style.configuration")), 1),
3548
+ h("div", Jo, [
3549
+ c.value ? (g(), R(A, {
3550
+ key: 0,
3551
+ modelValue: o.value,
3552
+ "onUpdate:modelValue": i[3] || (i[3] = (v) => o.value = v),
3553
+ class: "fm-typo-en-body-lg-400",
3554
+ label: l(U)("report.section.datasource.stackBar.overlapBars")
3555
+ }, null, 8, ["modelValue", "label"])) : E("", !0),
3556
+ t.config.hasLabel ? (g(), R(eo, {
3557
+ key: 1,
3558
+ model: e.value,
3559
+ "onUpdate:model": i[4] || (i[4] = (v) => e.value = v)
3560
+ }, null, 8, ["model"])) : E("", !0),
3561
+ t.config.hasLegend ? (g(), R(fo, {
3562
+ key: 2,
3563
+ model: e.value,
3564
+ "is-circular-widget": w.value,
3565
+ "onUpdate:model": i[5] || (i[5] = (v) => e.value = v)
3566
+ }, null, 8, ["model", "is-circular-widget"])) : E("", !0),
3567
+ t.config.hasXy ? (g(), R(ro, {
3568
+ key: 3,
3569
+ model: e.value,
3570
+ "onUpdate:model": i[6] || (i[6] = (v) => e.value = v)
3571
+ }, null, 8, ["model"])) : E("", !0),
3572
+ t.config.hasXy ? (g(), R(n, {
3573
+ key: 4,
3574
+ modelValue: L.value,
3575
+ "onUpdate:modelValue": i[7] || (i[7] = (v) => L.value = v),
3576
+ type: "number",
3577
+ label: l(U)("report.section.datasource.tooltip.maxTooltipItems"),
3578
+ min: 2,
3579
+ max: 20,
3580
+ placeholder: "Auto"
3581
+ }, null, 8, ["modelValue", "label"])) : E("", !0)
3582
+ ])
3583
+ ])
3584
+ ])
3585
+ ], 64);
3586
+ };
3587
+ }
3588
+ }), Qo = { class: "flex flex-col gap-8" }, Zo = { class: "flex flex-col border-fm-color-neutral-gray-200 p-12" }, ea = { class: "flex items-center" }, la = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ta = { class: "flex flex-col gap-8" }, oa = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, aa = { class: "flex flex-col border-fm-color-neutral-gray-200 p-12" }, na = { class: "flex items-center" }, ia = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, sa = {
3589
+ key: 0,
3590
+ class: "flex flex-col gap-8"
3591
+ }, ra = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, ua = {
3592
+ key: 1,
3593
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
3594
+ }, da = /* @__PURE__ */ ue({
3595
+ __name: "TableResizeSection",
3596
+ props: {
3597
+ layout: {},
3598
+ columns: {}
3599
+ },
3600
+ emits: ["update:layout"],
3601
+ setup(B, { emit: p }) {
3602
+ const { t: e } = ge(), t = B, a = p, U = k({
3603
+ get: () => {
3604
+ var i;
3605
+ return (i = t.layout) != null && i.rowHeight && t.layout.rowHeight >= 30 ? t.layout.rowHeight : null;
3606
+ },
3607
+ set: (i) => {
3608
+ var x;
3609
+ a("update:layout", {
3610
+ ...t.layout,
3611
+ rowHeight: i && i >= 30 ? i : null,
3612
+ colWidths: c((x = t.layout) == null ? void 0 : x.colWidths)
3613
+ });
3614
+ }
3615
+ }), w = k(() => {
3616
+ var i;
3617
+ return ((i = t.columns) == null ? void 0 : i.length) ?? 0;
3618
+ });
3619
+ function c(i) {
3620
+ if (!i) return null;
3621
+ const x = Object.entries(i).reduce(
3622
+ (A, n) => {
3623
+ const [v, I] = n;
3624
+ return I && I >= 40 ? A[v] = I : A[v] = null, A;
3625
+ },
3626
+ {}
3627
+ );
3628
+ return Object.values(x).some((A) => (A ?? 0) >= 40) ? x : null;
3629
+ }
3630
+ function T(i) {
3631
+ var x;
3632
+ return (x = t.columns) == null ? void 0 : x[i];
3633
+ }
3634
+ function L(i, x) {
3635
+ const A = x && x >= 40 ? x : null, n = { ...t.layout.colWidths ?? {} }, v = T(i);
3636
+ v != null && v.key && (n[v.key] = A), a("update:layout", {
3637
+ ...t.layout,
3638
+ rowHeight: U.value ?? null,
3639
+ colWidths: c(n)
3640
+ });
3641
+ }
3642
+ function o(i) {
3643
+ var n, v;
3644
+ const x = T(i), A = x != null && x.key ? (v = (n = t.layout) == null ? void 0 : n.colWidths) == null ? void 0 : v[x.key] : void 0;
3645
+ return A && A >= 40 ? A : null;
3646
+ }
3647
+ function r(i) {
3648
+ var x;
3649
+ return ((x = T(i)) == null ? void 0 : x.label) || "Column " + (i + 1);
3650
+ }
3651
+ return (i, x) => {
3652
+ const A = M("FmStepperField");
3653
+ return g(), X("div", Qo, [
3654
+ h("div", Zo, [
3655
+ h("div", ea, [
3656
+ h("p", la, J(l(e)("report.section.datasource.rowHeight")), 1)
3657
+ ]),
3658
+ h("div", ta, [
3659
+ h("p", oa, J(l(e)("report.section.datasource.rowHeightHelper")), 1),
3660
+ m(A, {
3661
+ modelValue: U.value,
3662
+ "onUpdate:modelValue": x[0] || (x[0] = (n) => U.value = n),
3663
+ type: "number",
3664
+ suffix: "px",
3665
+ min: 30,
3666
+ placeholder: l(e)("report.common.auto")
3667
+ }, null, 8, ["modelValue", "placeholder"])
3668
+ ])
3669
+ ]),
3670
+ h("div", aa, [
3671
+ h("div", na, [
3672
+ h("p", ia, J(l(e)("report.section.datasource.columnWidth")), 1)
3673
+ ]),
3674
+ w.value > 0 ? (g(), X("div", sa, [
3675
+ h("p", ra, J(l(e)("report.section.datasource.columnWidthHelper")), 1),
3676
+ (g(!0), X(de, null, _e(w.value, (n) => (g(), R(A, {
3677
+ key: r(n - 1),
3678
+ type: "number",
3679
+ "model-value": o(n - 1),
3680
+ label: r(n - 1),
3681
+ suffix: "px",
3682
+ min: 40,
3683
+ placeholder: l(e)("report.common.auto"),
3684
+ "onUpdate:modelValue": (v) => L(n - 1, Number(v) || null)
3685
+ }, null, 8, ["model-value", "label", "placeholder", "onUpdate:modelValue"]))), 128))
3686
+ ])) : (g(), X("p", ua, J(l(e)("report.section.datasource.columnWidthUnavailable")), 1))
3687
+ ])
3688
+ ]);
3689
+ };
3690
+ }
3691
+ }), ma = {
3692
+ key: 0,
3693
+ class: "bg-fm-color-neutral-white flex flex-col h-full w-[510px]"
3694
+ }, ca = {
3695
+ key: 1,
3696
+ class: "px-6 py-16 flex flex-col overflow-y-auto overflow-x-hidden"
3697
+ }, pa = { class: "text-center" }, va = /* @__PURE__ */ ue({
3698
+ __name: "StyleEditorTab",
3699
+ props: /* @__PURE__ */ ve({
3700
+ tableResponse: {}
3701
+ }, {
3702
+ modelValue: {
3703
+ required: !0
3704
+ },
3705
+ modelModifiers: {},
3706
+ isEditingStyle: { type: Boolean, required: !1, default: !1 },
3707
+ isEditingStyleModifiers: {}
3708
+ }),
3709
+ emits: ["update:modelValue", "update:isEditingStyle"],
3710
+ setup(B) {
3711
+ const { t: p, locale: e } = ge(), t = ye(B, "modelValue"), a = k(
3712
+ () => Ke.find((b) => b.type === t.value.widget.type)
3713
+ ), U = ye(B, "isEditingStyle"), w = le(!1), { markStyleEditing: c, resetStyleEditing: T } = $l(U), L = B, o = [
3714
+ Y.BarChart,
3715
+ Y.StackBarChart,
3716
+ Y.ClusteredStackBarChart,
3717
+ Y.LineChart,
3718
+ Y.StackLineChart,
3719
+ Y.Circular
3720
+ ], r = k(() => o.includes(t.value.widget.type)), i = k(() => t.value.widget.type === Y.Table), x = k(() => e.value.toLowerCase().startsWith("en")), A = k({
3721
+ get: () => ({
3722
+ rowHeight: t.value.widget.config.rowHeight,
3723
+ colWidths: t.value.widget.config.colWidths
3724
+ }),
3725
+ set: (b) => {
3726
+ c(), t.value.widget.config.rowHeight = b.rowHeight, t.value.widget.config.colWidths = b.colWidths;
3727
+ }
3728
+ }), n = k({
3729
+ get: () => t.value.widget.config,
3730
+ set: (b) => {
3731
+ c(), t.value.widget.config = b;
3732
+ }
3733
+ }), v = k(() => {
3734
+ var b, s;
3735
+ return i.value ? ((s = (b = L.tableResponse) == null ? void 0 : b.columns) == null ? void 0 : s.map((j) => ({
3736
+ key: j.key,
3737
+ label: j.label
3738
+ }))) ?? [] : [];
3739
+ });
3740
+ function I() {
3741
+ w.value = !0;
3742
+ }
3743
+ function P() {
3744
+ w.value = !1, T();
3745
+ }
3746
+ return (b, s) => {
3747
+ const j = M("FmCircularProgress"), N = M("FmButton");
3748
+ return w.value ? (g(), X("div", ma, [
3749
+ m(Ye, {
3750
+ "model-value": w.value,
3751
+ icon: "keyboard_double_arrow_right",
3752
+ title: l(p)("report.section.style.title"),
3753
+ "onUpdate:modelValue": s[0] || (s[0] = (f) => f ? I() : P())
3754
+ }, null, 8, ["model-value", "title"]),
3755
+ t.value ? (g(), X("div", ca, [
3756
+ r.value ? (g(), R(Ko, {
3757
+ key: 0,
3758
+ modelValue: n.value,
3759
+ "onUpdate:modelValue": s[1] || (s[1] = (f) => n.value = f),
3760
+ config: a.value
3761
+ }, null, 8, ["modelValue", "config"])) : E("", !0),
3762
+ i.value ? (g(), R(da, {
3763
+ key: 1,
3764
+ layout: A.value,
3765
+ "onUpdate:layout": s[2] || (s[2] = (f) => A.value = f),
3766
+ columns: v.value
3767
+ }, null, 8, ["layout", "columns"])) : E("", !0)
3768
+ ])) : (g(), R(j, { key: 0 }))
3769
+ ])) : (g(), X("div", {
3770
+ key: 1,
3771
+ class: $e([
3772
+ "bg-fm-color-neutral-white pt-16",
3773
+ x.value ? "flex h-full w-[156px] flex-col items-center justify-start gap-12 px-12" : "flex h-full w-[88px] flex-col items-center justify-start gap-16"
3774
+ ])
3775
+ }, [
3776
+ x.value ? (g(), X("button", {
3777
+ key: 0,
3778
+ class: "flex flex-col items-center gap-16 fm-typo-en-title-sm-600 text-fm-color-typo-primary",
3779
+ type: "button",
3780
+ onClick: I
3781
+ }, [
3782
+ m(N, {
3783
+ variant: "secondary",
3784
+ icon: "keyboard_double_arrow_left",
3785
+ "border-color": l(Me).ColorPrimary,
3786
+ "text-color": l(Me).ColorPrimary,
3787
+ size: "md"
3788
+ }, null, 8, ["border-color", "text-color"]),
3789
+ h("span", pa, J(l(p)("report.section.style.title")), 1)
3790
+ ])) : (g(), X(de, { key: 1 }, [
3791
+ m(N, {
3792
+ variant: "secondary",
3793
+ icon: "keyboard_double_arrow_left",
3794
+ "border-color": l(Me).ColorPrimary,
3795
+ "text-color": l(Me).ColorPrimary,
3796
+ size: "md",
3797
+ onClick: I
3798
+ }, null, 8, ["border-color", "text-color"]),
3799
+ h("button", {
3800
+ class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary [text-orientation:mixed] [writing-mode:vertical-rl]",
3801
+ type: "button",
3802
+ onClick: I
3803
+ }, J(l(p)("report.section.style.title")), 1)
3804
+ ], 64))
3805
+ ], 2));
3806
+ };
3807
+ }
3808
+ }), fa = { class: "bg-fm-color-neutral-white flex flex-col h-full w-[510px]" }, ga = { class: "flex bg-fm-color-neutral-white w-[88px]" }, ya = { class: "w-full overflow-y-auto" }, ba = {
3809
+ class: "grid grid-cols-12 w-full p-24",
3810
+ style: { backgroundColor: "#F6F8FC" }
3811
+ }, ha = /* @__PURE__ */ ue({
3812
+ __name: "TileEditorDesktop",
3813
+ props: /* @__PURE__ */ ve({
3814
+ hideConfiguration: { type: Boolean, required: !0, default: !1 },
3815
+ index: { type: Number, required: !0, default: 0 }
3816
+ }, {
3817
+ modelValue: {
3818
+ required: !0
3819
+ },
3820
+ modelModifiers: {}
3821
+ }),
3822
+ emits: /* @__PURE__ */ ve(["hideConfiguration"], ["update:modelValue"]),
3823
+ setup(B, { emit: p }) {
3824
+ const e = ye(B, "modelValue"), t = B, a = k(
3825
+ () => Ke.find((r) => {
3826
+ var i;
3827
+ return r.type === ((i = e.value) == null ? void 0 : i.widget.type);
3828
+ })
3829
+ ), U = p, c = [...[
3830
+ Y.BarChart,
3831
+ Y.StackBarChart,
3832
+ Y.ClusteredStackBarChart,
3833
+ Y.LineChart,
3834
+ Y.StackLineChart,
3835
+ Y.Circular
3836
+ ], Y.Table], T = k(() => c.includes(e.value.widget.type)), L = le(!1), o = le(null);
3837
+ return (r, i) => {
3838
+ const x = M("FmCircularProgress"), A = M("FmButton");
3839
+ return g(), X("div", null, [
3840
+ e.value ? (g(), X(de, { key: 1 }, [
3841
+ m(Hl, {
3842
+ "model-value": !B.hideConfiguration
3843
+ }, {
3844
+ right: Q(() => [
3845
+ h("div", fa, [
3846
+ m(Dl, {
3847
+ modelValue: e.value,
3848
+ "onUpdate:modelValue": i[0] || (i[0] = (n) => e.value = n),
3849
+ "is-editing-style": L.value,
3850
+ "onUpdate:isEditingStyle": i[1] || (i[1] = (n) => L.value = n),
3851
+ config: a.value,
3852
+ "hide-configuration": B.hideConfiguration,
3853
+ onHideConfiguration: i[2] || (i[2] = (n) => {
3854
+ U("hideConfiguration", n);
3855
+ })
3856
+ }, null, 8, ["modelValue", "is-editing-style", "config", "hide-configuration"])
3857
+ ])
3858
+ ]),
3859
+ left: Q(() => [
3860
+ h("div", ga, [
3861
+ m(A, {
3862
+ variant: "secondary",
3863
+ icon: "keyboard_double_arrow_right",
3864
+ "border-color": l(Me).ColorPrimary,
3865
+ "text-color": l(Me).ColorPrimary,
3866
+ class: "m-24 my-16",
3867
+ size: "md",
3868
+ onClick: i[3] || (i[3] = (n) => U("hideConfiguration", !t.hideConfiguration))
3869
+ }, null, 8, ["border-color", "text-color"])
3870
+ ])
3871
+ ]),
3872
+ _: 1
3873
+ }, 8, ["model-value"]),
3874
+ h("div", ya, [
3875
+ h("div", ba, [
3876
+ e.value ? (g(), R(Sl, {
3877
+ key: 0,
3878
+ "model-value": e.value,
3879
+ index: t.index,
3880
+ "hide-export": !0,
3881
+ "is-editing-style": L.value,
3882
+ "onUpdate:tableResponse": i[4] || (i[4] = (n) => o.value = n)
3883
+ }, null, 8, ["model-value", "index", "is-editing-style"])) : (g(), R(_l, { key: 1 }))
3884
+ ])
3885
+ ]),
3886
+ T.value ? (g(), R(va, {
3887
+ key: 0,
3888
+ modelValue: e.value,
3889
+ "onUpdate:modelValue": i[5] || (i[5] = (n) => e.value = n),
3890
+ "is-editing-style": L.value,
3891
+ "onUpdate:isEditingStyle": i[6] || (i[6] = (n) => L.value = n),
3892
+ "table-response": o.value
3893
+ }, null, 8, ["modelValue", "is-editing-style", "table-response"])) : E("", !0)
3894
+ ], 64)) : (g(), R(x, { key: 0 }))
3895
+ ]);
3896
+ };
3897
+ }
3898
+ }), wa = {
3899
+ key: 0,
3900
+ class: "flex w-full justify-center items-center"
3901
+ }, Ca = { class: "w-full grid grid-cols-12 pb-28 pt-5 px-5 h-full" }, xa = /* @__PURE__ */ ue({
3902
+ __name: "TileEditorMobile",
3903
+ props: /* @__PURE__ */ ve({
3904
+ hideConfiguration: { type: Boolean, required: !0, default: !1 },
3905
+ index: { type: Number, required: !0, default: 0 }
3906
+ }, {
3907
+ modelValue: {
3908
+ required: !0
3909
+ },
3910
+ modelModifiers: {}
3911
+ }),
3912
+ emits: /* @__PURE__ */ ve(["hideConfiguration"], ["update:modelValue"]),
3913
+ setup(B, { emit: p }) {
3914
+ const e = ye(B, "modelValue"), t = B, a = k(
3915
+ () => Ke.find((w) => {
3916
+ var c;
3917
+ return w.type === ((c = e.value) == null ? void 0 : c.widget.type);
3918
+ })
3919
+ ), U = p;
3920
+ return (w, c) => {
3921
+ const T = M("FmCircularProgress");
3922
+ return g(), X("div", null, [
3923
+ e.value ? (g(), X(de, { key: 1 }, [
3924
+ h("div", Ca, [
3925
+ e.value ? (g(), R(Sl, {
3926
+ key: 0,
3927
+ "model-value": e.value,
3928
+ index: t.index,
3929
+ "hide-export": !0
3930
+ }, null, 8, ["model-value", "index"])) : (g(), R(_l, { key: 1 }))
3931
+ ]),
3932
+ m(Dl, {
3933
+ modelValue: e.value,
3934
+ "onUpdate:modelValue": c[0] || (c[0] = (L) => e.value = L),
3935
+ config: a.value,
3936
+ "hide-configuration": B.hideConfiguration,
3937
+ onHideConfiguration: c[1] || (c[1] = (L) => {
3938
+ U("hideConfiguration", L);
3939
+ })
3940
+ }, null, 8, ["modelValue", "config", "hide-configuration"])
3941
+ ], 64)) : (g(), X("div", wa, [
3942
+ m(T)
3943
+ ]))
3944
+ ]);
3945
+ };
3946
+ }
3947
+ }), Fa = {
3948
+ key: 0,
3949
+ class: "fm-typo-en-title-md-600"
3950
+ }, Va = {
3951
+ key: 0,
3952
+ class: "flex items-start justify-start px-24 py-12 flex-wrap w-full"
3953
+ }, ja = /* @__PURE__ */ ue({
3954
+ __name: "TileEditor",
3955
+ setup(B) {
3956
+ const p = Rl(), e = Pl(), t = xl(), { globalFilters: a } = je(Kl()), { currentSelectWidgetType: U, editingReport: w, editingTile: c, editingTileIndex: T } = je(t), { breakpoints: L } = Vl(), { promptMessage: o } = Fl(), { t: r, te: i } = ge(), x = k(() => {
3957
+ var s;
3958
+ const P = (s = c.value) == null ? void 0 : s.widget.type;
3959
+ if (!P)
3960
+ return r("report.editor.newReport");
3961
+ const b = `report.widget.types.${P.toLowerCase()}`;
3962
+ return i(b) ? r(b) : P;
3963
+ }), A = le(!1);
3964
+ function n() {
3965
+ U.value = void 0, c.value = void 0, T.value = -1, e.back();
3966
+ }
3967
+ async function v() {
3968
+ var b;
3969
+ if (!w.value) return;
3970
+ await o({
3971
+ title: r("report.tile.save.title"),
3972
+ message: r("report.tile.save.confirm", { title: (b = c.value) == null ? void 0 : b.widget.title })
3973
+ }) && c.value && (T.value === -1 ? w.value.tiles.push(c.value) : w.value.tiles[T.value] = c.value, n());
3974
+ }
3975
+ async function I() {
3976
+ var b;
3977
+ if (!w.value) return;
3978
+ await o({
3979
+ title: r("report.tile.cancel.title"),
3980
+ message: r("report.tile.cancel.confirm", { title: (b = c.value) == null ? void 0 : b.widget.title })
3981
+ }) && n();
3982
+ }
3983
+ return wl(() => {
3984
+ w.value || e.push({ name: "reports" });
3985
+ }), (P, b) => {
3986
+ const s = M("FmPageHead");
3987
+ return g(), R(Gl, null, {
3988
+ default: Q(() => [
3989
+ m(s, {
3990
+ actions: [
3991
+ { label: l(r)("report.common.cancel"), value: "cancel", isPrimary: !1 },
3992
+ { label: l(r)("report.common.save"), value: "save", isPrimary: !0 }
3993
+ ],
3994
+ "onClick:action": b[0] || (b[0] = (j) => {
3995
+ j === "cancel" && I(), j === "save" && v();
3996
+ })
3997
+ }, {
3998
+ title: Q(() => [
3999
+ l(L).lg || l(L).md ? (g(), X("p", Fa, J(x.value), 1)) : E("", !0)
4000
+ ]),
4001
+ _: 1
4002
+ }, 8, ["actions"]),
4003
+ l(c) && (l(a) || []).some((j) => {
4004
+ const N = j.tileIds, f = l(c) && l(c).id;
4005
+ return Array.isArray(N) && typeof f == "string" && N.includes(f);
4006
+ }) ? (g(), X("div", Va, [
4007
+ m(Ql)
4008
+ ])) : E("", !0),
4009
+ l(c) ? (g(), R(hl(l(L).lg || l(L).md ? ha : xa), {
4010
+ key: 1,
4011
+ modelValue: l(c),
4012
+ "onUpdate:modelValue": b[1] || (b[1] = (j) => zl(c) ? c.value = j : null),
4013
+ class: $e(`${l(L).lg || l(L).md ? "flex" : ""} w-full`),
4014
+ style: tl({ height: `calc( 100% - ${l(L).lg || l(L).md ? 72 : 64}px)` }),
4015
+ "hide-configuration": A.value,
4016
+ index: Number(l(p).params.tileIndex),
4017
+ onHideConfiguration: b[2] || (b[2] = (j) => A.value = j)
4018
+ }, null, 40, ["modelValue", "class", "style", "hide-configuration", "index"])) : E("", !0)
4019
+ ]),
4020
+ _: 1
4021
+ });
4022
+ };
4023
+ }
4024
+ });
4025
+ export {
4026
+ ja as default
4027
+ };