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