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