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