@feedmepos/mf-report 5.4.15-beta.1 → 5.4.15-beta.3

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