@sisense/sdk-ui 2.6.0 → 2.7.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.
- package/dist/ai.cjs +17 -17
- package/dist/ai.js +653 -650
- package/dist/analytics-composer.cjs +1 -1
- package/dist/analytics-composer.js +4 -4
- package/dist/derive-chart-family-BCY-GLVZ.cjs +672 -0
- package/dist/derive-chart-family-DvYmrG1k.js +93730 -0
- package/dist/{dimensions-BgPl9ZS9.cjs → dimensions-DAISVpEZ.cjs} +1 -1
- package/dist/{dimensions-DuHaCozA.js → dimensions-WmjaZcrG.js} +1 -1
- package/dist/index.cjs +14 -14
- package/dist/index.js +4367 -4327
- package/dist/index.umd.js +294 -294
- package/dist/packages/sdk-ui/src/ai/api/types.d.ts +1 -0
- package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +7 -0
- package/dist/packages/sdk-ui/src/ai/use-get-query-recommendations.d.ts +7 -0
- package/dist/packages/sdk-ui/src/analytics-composer/query/fix-ranking-filter-jaql.d.ts +8 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/highchart-options/get-legacy-cartesian-chart-options.d.ts +3 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/highchart-options/legend.d.ts +2 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/highchart-options/tooltip.d.ts +4 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/stackable/bar-chart/{highcharts-options-builder.d.ts → highchart-options/highcharts-options-builder.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/stackable/bar-chart/highchart-options/legend.d.ts +3 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/{cartesian-chart-options.d.ts → cartesian/cartesian-chart-options.d.ts} +6 -6
- package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/axis-configuration.d.ts +41 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/chart-configuration.d.ts +13 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/chart-spacing-calculator.d.ts +41 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/series-processor.d.ts +57 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/tooltip.d.ts +3 -29
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/scatter-plot-options.d.ts +2 -2
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/scatter-tooltip.d.ts +2 -2
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/tooltip-utils.d.ts +17 -2
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/tooltip.d.ts +3 -3
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/translations-to-highcharts.d.ts +7 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/treemap/treemap-tooltip.d.ts +3 -4
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/value-label-section.d.ts +3 -3
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/utils.d.ts +7 -1
- package/dist/packages/sdk-ui/src/decorators/component-decorators/with-tracking/index.d.ts +1 -1
- package/dist/packages/sdk-ui/src/decorators/component-decorators/with-tracking/use-track-component-init.d.ts +4 -1
- package/dist/packages/sdk-ui/src/decorators/component-decorators/with-tracking/with-tracking.d.ts +10 -2
- package/dist/packages/sdk-ui/src/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/types.d.ts +27 -0
- package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +1 -1
- package/dist/{use-common-filters-CRgYdKcV.cjs → use-common-filters-CRrL9rOQ.cjs} +66 -66
- package/dist/{use-common-filters-B1RKY2KD.js → use-common-filters-CVgB69Xe.js} +858 -853
- package/dist/{widget-composer-I9gUFBZt.js → widget-composer-B4eAv2pf.js} +232 -194
- package/dist/{widget-composer-B2r2a9Oh.cjs → widget-composer-D0FZj1tX.cjs} +8 -8
- package/package.json +20 -18
- package/dist/derive-chart-family-BPYK8evJ.js +0 -90579
- package/dist/derive-chart-family-yUBZXP4x.cjs +0 -669
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/get-legacy-cartesian-chart-options.d.ts +0 -3
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var at = Object.defineProperty, st = Object.defineProperties;
|
|
2
|
+
var nt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var E = Object.getOwnPropertySymbols;
|
|
4
|
+
var P = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var $ = (t, e, r) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, o = (t, e) => {
|
|
6
6
|
for (var r in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var r of
|
|
10
|
-
|
|
7
|
+
P.call(e, r) && $(t, r, e[r]);
|
|
8
|
+
if (E)
|
|
9
|
+
for (var r of E(e))
|
|
10
|
+
L.call(e, r) && $(t, r, e[r]);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
}, c = (t, e) => st(t, nt(e));
|
|
13
|
+
var A = (t, e) => {
|
|
14
|
+
var r = {};
|
|
15
|
+
for (var i in t)
|
|
16
|
+
P.call(t, i) && e.indexOf(i) < 0 && (r[i] = t[i]);
|
|
17
|
+
if (t != null && E)
|
|
18
|
+
for (var i of E(t))
|
|
19
|
+
e.indexOf(i) < 0 && L.call(t, i) && (r[i] = t[i]);
|
|
20
|
+
return r;
|
|
21
|
+
};
|
|
22
|
+
import { eb as ot, ec as lt, ed as dt, ee as ct, e5 as J, w as ut, m as q, T as S, ef as pt, aU as K, dM as mt, eg as O, e7 as U, aD as gt, b5 as yt, b4 as ft, aL as I, at as ht, n as M, eh as St, a8 as Ot, bN as Q, ei as Tt } from "./derive-chart-family-DvYmrG1k.js";
|
|
23
|
+
class Y extends J {
|
|
15
24
|
constructor(e, r) {
|
|
16
25
|
var i;
|
|
17
|
-
super((i = e.jaql.title) !== null && i !== void 0 ? i : "", r), this.__serializable = "JaqlElement", this.expression = e.jaql.dim || e.jaql.formula, this.metadataItem = e, e.jaql.agg ? this.aggregation = e.jaql.agg : delete this.aggregation, e.jaql.formula ? this.formula = e.jaql.formula : delete this.formula, e.jaql.sort ? this.sortType =
|
|
26
|
+
super((i = e.jaql.title) !== null && i !== void 0 ? i : "", r), this.__serializable = "JaqlElement", this.expression = e.jaql.dim || e.jaql.formula, this.metadataItem = e, e.jaql.agg ? this.aggregation = e.jaql.agg : delete this.aggregation, e.jaql.formula ? this.formula = e.jaql.formula : delete this.formula, e.jaql.sort ? this.sortType = ut(e.jaql.sort) : delete this.sortType, this.skipValidation = !0;
|
|
18
27
|
}
|
|
19
28
|
get id() {
|
|
20
29
|
return this.expression;
|
|
@@ -30,21 +39,21 @@ class J extends _ {
|
|
|
30
39
|
return e.metadataItem = this.metadataItem, e.type = this.type, e;
|
|
31
40
|
}
|
|
32
41
|
}
|
|
33
|
-
const
|
|
34
|
-
text:
|
|
35
|
-
numeric:
|
|
36
|
-
datetime:
|
|
37
|
-
},
|
|
38
|
-
function
|
|
42
|
+
const bt = {
|
|
43
|
+
text: q.TextAttribute,
|
|
44
|
+
numeric: q.NumericAttribute,
|
|
45
|
+
datetime: q.DateLevel
|
|
46
|
+
}, le = (t) => t && t.__serializable === "JaqlElement";
|
|
47
|
+
function vt(t) {
|
|
39
48
|
var e;
|
|
40
|
-
return new
|
|
49
|
+
return new Y(t, (e = bt[t.jaql.datatype]) !== null && e !== void 0 ? e : "numeric");
|
|
41
50
|
}
|
|
42
|
-
function
|
|
51
|
+
function V(t) {
|
|
43
52
|
const { jaql: e } = t;
|
|
44
53
|
if (e.formula)
|
|
45
|
-
return
|
|
46
|
-
const r =
|
|
47
|
-
return "agg" in e && e.dim && e.datatype ?
|
|
54
|
+
return ot(e);
|
|
55
|
+
const r = lt(e);
|
|
56
|
+
return "agg" in e && e.dim && e.datatype ? dt({
|
|
48
57
|
expression: e.dim,
|
|
49
58
|
dataType: e.datatype,
|
|
50
59
|
agg: e.agg || "",
|
|
@@ -53,7 +62,7 @@ function K(t) {
|
|
|
53
62
|
sort: e.sort,
|
|
54
63
|
title: e.title,
|
|
55
64
|
dataSource: e.datasource
|
|
56
|
-
}) : e.dim && e.datatype ?
|
|
65
|
+
}) : e.dim && e.datatype ? ct({
|
|
57
66
|
expression: e.dim,
|
|
58
67
|
dataType: e.datatype,
|
|
59
68
|
granularity: r,
|
|
@@ -61,9 +70,9 @@ function K(t) {
|
|
|
61
70
|
title: e.title,
|
|
62
71
|
panel: t.panel,
|
|
63
72
|
dataSource: e.datasource
|
|
64
|
-
}) :
|
|
73
|
+
}) : vt(t);
|
|
65
74
|
}
|
|
66
|
-
const
|
|
75
|
+
const de = {
|
|
67
76
|
jaql: {
|
|
68
77
|
datasource: {
|
|
69
78
|
title: "",
|
|
@@ -73,23 +82,23 @@ const se = {
|
|
|
73
82
|
},
|
|
74
83
|
queryTitle: "",
|
|
75
84
|
chartRecommendations: {}
|
|
76
|
-
},
|
|
85
|
+
}, ce = {
|
|
77
86
|
model: "",
|
|
78
87
|
metadata: [],
|
|
79
88
|
chart: {},
|
|
80
89
|
queryTitle: ""
|
|
81
|
-
},
|
|
82
|
-
function
|
|
90
|
+
}, ue = (t) => "widgetProps" in t, xt = (t) => "dashboardOid" in t && "widgetOid" in t, pe = (t) => "dashboardProps" in t, me = (t) => "dashboardOid" in t;
|
|
91
|
+
function Et(t) {
|
|
83
92
|
return t.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
84
93
|
}
|
|
85
|
-
function
|
|
94
|
+
function ge(t) {
|
|
86
95
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
87
96
|
}
|
|
88
|
-
function
|
|
97
|
+
function ye(t) {
|
|
89
98
|
const e = /\[(.+?)\s\(Calendar\)\]/;
|
|
90
99
|
return t.replace(e, "[$1]").trim();
|
|
91
100
|
}
|
|
92
|
-
function
|
|
101
|
+
function fe(t) {
|
|
93
102
|
if (t)
|
|
94
103
|
if (t.metadata) {
|
|
95
104
|
if (!t.model)
|
|
@@ -100,12 +109,12 @@ function pe(t) {
|
|
|
100
109
|
throw new S("errors.emptyModel");
|
|
101
110
|
return t;
|
|
102
111
|
}
|
|
103
|
-
function
|
|
112
|
+
function Dt(t) {
|
|
104
113
|
return !t || !t.jaql.datasource.title || !t.jaql.metadata.length;
|
|
105
114
|
}
|
|
106
|
-
function
|
|
115
|
+
function H(t) {
|
|
107
116
|
if (![
|
|
108
|
-
...
|
|
117
|
+
...pt,
|
|
109
118
|
"pivot",
|
|
110
119
|
"pivot2"
|
|
111
120
|
].includes(t))
|
|
@@ -113,21 +122,21 @@ function U(t) {
|
|
|
113
122
|
chartType: t
|
|
114
123
|
});
|
|
115
124
|
}
|
|
116
|
-
function
|
|
125
|
+
function wt(t) {
|
|
117
126
|
return "widgetType" in t && t.widgetType === "pivot";
|
|
118
127
|
}
|
|
119
128
|
function h(t) {
|
|
120
129
|
var e;
|
|
121
130
|
return "column" in t && ((e = t.column) == null ? void 0 : e.expression) && /\(.*\)/.test(t.column.expression);
|
|
122
131
|
}
|
|
123
|
-
function
|
|
124
|
-
const e = "measures" in t &&
|
|
125
|
-
return
|
|
132
|
+
function k(t) {
|
|
133
|
+
const e = "measures" in t && p(t.measures) || "values" in t && p(t.values);
|
|
134
|
+
return wt(t) ? "values" in t.dataOptions && p(t.dataOptions.values) : "chartType" in t ? t.chartType === "indicator" ? "value" in t.dataOptions && p(t.dataOptions.value) || "secondary" in t.dataOptions && p(t.dataOptions.secondary) : t.chartType === "table" ? !("columns" in t.dataOptions) || !p(t.dataOptions.columns) ? !1 : t.dataOptions.columns.some((i) => h(i)) : t.chartType === "boxplot" ? !1 : t.chartType === "scatter" ? "x" in t.dataOptions && t.dataOptions.x !== void 0 && h(t.dataOptions.x) || "y" in t.dataOptions && t.dataOptions.y !== void 0 && h(t.dataOptions.y) || "size" in t.dataOptions && t.dataOptions.size !== void 0 : t.chartType === "scattermap" ? "colorBy" in t.dataOptions && t.dataOptions.colorBy !== void 0 && h(t.dataOptions.colorBy) || "details" in t.dataOptions && t.dataOptions.details !== void 0 && h(t.dataOptions.details) || "size" in t.dataOptions && t.dataOptions.size !== void 0 && h(t.dataOptions.size) : t.chartType === "areamap" ? "geo" in t.dataOptions && p(t.dataOptions.geo) && "color" in t.dataOptions && p(t.dataOptions.color) : "value" in t.dataOptions && p(t.dataOptions.value) : e;
|
|
126
135
|
}
|
|
127
|
-
function
|
|
136
|
+
function p(t) {
|
|
128
137
|
return Array.isArray(t) && t.length > 0;
|
|
129
138
|
}
|
|
130
|
-
function
|
|
139
|
+
function Ct(t) {
|
|
131
140
|
const e = t.split(`
|
|
132
141
|
`);
|
|
133
142
|
for (let r = 0; r < e.length - 1; r++)
|
|
@@ -141,7 +150,7 @@ function Dt(t) {
|
|
|
141
150
|
return e.join(`
|
|
142
151
|
`);
|
|
143
152
|
}
|
|
144
|
-
function
|
|
153
|
+
function qt(t) {
|
|
145
154
|
const e = (i) => /^[$A-Z_][0-9A-Z_$]*$/i.test(i);
|
|
146
155
|
if ("composeCode" in t)
|
|
147
156
|
return t;
|
|
@@ -152,7 +161,7 @@ function wt(t) {
|
|
|
152
161
|
}
|
|
153
162
|
return r;
|
|
154
163
|
}
|
|
155
|
-
const
|
|
164
|
+
const Mt = {
|
|
156
165
|
react: {
|
|
157
166
|
baseChartTmpl: `import { {{componentString}} } from '@sisense/sdk-ui';
|
|
158
167
|
{{extraImportsString}}
|
|
@@ -611,10 +620,10 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
611
620
|
</template>`,
|
|
612
621
|
dashboardTmpl: "/** COMING SOON */"
|
|
613
622
|
}
|
|
614
|
-
},
|
|
615
|
-
const i =
|
|
616
|
-
return
|
|
617
|
-
},
|
|
623
|
+
}, G = (t, e) => Mt[e][t].replace(/{{(.*?)Tmpl}}/g, (i, a) => G(`${a}Tmpl`, e)), It = (t, e) => t.replace(/{{(.*?)}}/g, (r, i) => i in e ? e[i] : (console.warn(`Placeholder ${i} not found in data`), r)), j = (t, e, r = "react") => {
|
|
624
|
+
const i = G(t, r);
|
|
625
|
+
return Ct(It(i, e));
|
|
626
|
+
}, jt = () => Object.values(mt).map((e) => K.aggregationToJAQL(e)).join("|"), Z = (t) => {
|
|
618
627
|
const { formula: e, context: r, filter: i } = t;
|
|
619
628
|
if (!r || !e)
|
|
620
629
|
return t;
|
|
@@ -624,9 +633,9 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
624
633
|
const s = a[0];
|
|
625
634
|
if (typeof s != "string")
|
|
626
635
|
return t;
|
|
627
|
-
const n = r[`${s}`],
|
|
628
|
-
if (
|
|
629
|
-
const d =
|
|
636
|
+
const n = r[`${s}`], u = jt(), l = new RegExp(`^\\s*(${u})\\(\\[\\w+\\]\\)$`), g = e.match(l);
|
|
637
|
+
if (g && e.includes(s)) {
|
|
638
|
+
const d = g[1];
|
|
630
639
|
return o({
|
|
631
640
|
dim: n.dim,
|
|
632
641
|
table: n.table,
|
|
@@ -639,162 +648,162 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
639
648
|
} : {});
|
|
640
649
|
}
|
|
641
650
|
return t;
|
|
642
|
-
},
|
|
651
|
+
}, w = (t) => {
|
|
643
652
|
let e = t;
|
|
644
|
-
if ("formula" in t && (e =
|
|
653
|
+
if ("formula" in t && (e = Z(t)), "context" in e) {
|
|
645
654
|
const r = o({}, e.context);
|
|
646
655
|
Object.keys(r).forEach((i) => {
|
|
647
|
-
r[`${i}`] =
|
|
656
|
+
r[`${i}`] = w(r[`${i}`]);
|
|
648
657
|
}), e.context = r;
|
|
649
658
|
}
|
|
650
659
|
return e;
|
|
651
|
-
},
|
|
660
|
+
}, Wt = (t) => {
|
|
652
661
|
var i;
|
|
653
662
|
const e = t;
|
|
654
663
|
if (e.panel !== "scope")
|
|
655
664
|
return e;
|
|
656
665
|
const { jaql: r } = e;
|
|
657
|
-
return (i = r.filter) != null && i.by && (r.filter.by =
|
|
666
|
+
return (i = r.filter) != null && i.by && (r.filter.by = Z(r.filter.by)), c(o({}, e), {
|
|
658
667
|
jaql: r
|
|
659
668
|
});
|
|
660
|
-
},
|
|
669
|
+
}, $t = (t) => {
|
|
661
670
|
let e = t;
|
|
662
|
-
e =
|
|
671
|
+
e = Wt(e);
|
|
663
672
|
const { jaql: r, measure: i, by: a } = e;
|
|
664
|
-
return o(o(
|
|
665
|
-
jaql:
|
|
673
|
+
return o(o(c(o({}, e), {
|
|
674
|
+
jaql: w(r)
|
|
666
675
|
}), a ? {
|
|
667
|
-
by:
|
|
676
|
+
by: w(a)
|
|
668
677
|
} : {}), i ? {
|
|
669
|
-
measure:
|
|
678
|
+
measure: w(i)
|
|
670
679
|
} : {});
|
|
671
|
-
},
|
|
672
|
-
`, W = "UNKNOWN",
|
|
680
|
+
}, C = 6, D = `
|
|
681
|
+
`, W = "UNKNOWN", Pt = (t, e) => {
|
|
673
682
|
let r = "";
|
|
674
683
|
return r += `measureFactory.customFormula(
|
|
675
684
|
`, r += " ".repeat(e), r += ` '${O(t.title)}',
|
|
676
685
|
`, r += " ".repeat(e), r += ` '${t.formula}',
|
|
677
686
|
`, r += " ".repeat(e), r += ` {
|
|
678
687
|
`, Object.entries(t.context).forEach(([i, a]) => {
|
|
679
|
-
const s =
|
|
688
|
+
const s = U(a.table || W, a.column || W, void 0, "DM");
|
|
680
689
|
r += " ".repeat(e), r += ` '${i.slice(1, -1)}': ${s},
|
|
681
690
|
`;
|
|
682
691
|
}), r += " ".repeat(e), r += ` }
|
|
683
692
|
`, r += " ".repeat(e), r += ")", r;
|
|
684
|
-
},
|
|
693
|
+
}, Lt = (t) => {
|
|
685
694
|
const { level: e, table: r, column: i, agg: a, title: s } = t;
|
|
686
695
|
let n;
|
|
687
|
-
return r && i && (n =
|
|
688
|
-
},
|
|
696
|
+
return r && i && (n = U(r, i, e, "DM")), a && r && i && s && (n = `measureFactory.${K.aggregationFromJAQL(a)}(${n}, '${O(s)}')`), n || W;
|
|
697
|
+
}, At = (t, e) => {
|
|
689
698
|
const r = t.jaql(!1).jaql;
|
|
690
|
-
return "formula" in r ?
|
|
691
|
-
},
|
|
699
|
+
return "formula" in r ? Pt(r, e) : Lt(r);
|
|
700
|
+
}, m = (t, e = 0, r = !1) => {
|
|
692
701
|
if (!t)
|
|
693
702
|
return "";
|
|
694
703
|
if (typeof t == "string")
|
|
695
704
|
return `'${O(t)}'`;
|
|
705
|
+
if (t instanceof Y)
|
|
706
|
+
return At(t, e);
|
|
696
707
|
if (t instanceof J)
|
|
697
|
-
return Lt(t, e);
|
|
698
|
-
if (t instanceof _)
|
|
699
708
|
return t.composeCode || "";
|
|
700
709
|
let i = "";
|
|
701
|
-
return Array.isArray(t) ? i += `[${t.map((a) =>
|
|
710
|
+
return Array.isArray(t) ? i += `[${t.map((a) => m(a, e + 2))}${t.length ? D + " ".repeat(e + 2) : ""}]` : (i += `{${D}`, Object.entries(t).forEach(([a, s]) => {
|
|
702
711
|
if (r && typeof a == "string" && (a = `'${O(a)}'`), i += " ".repeat(e + 2), Array.isArray(s))
|
|
703
|
-
i += `${a}: [${s.map((n) =>
|
|
712
|
+
i += `${a}: [${s.map((n) => m(n, e + 4, r))}${s.length ? D + " ".repeat(e + 2) : ""}]`;
|
|
704
713
|
else if (typeof s == "object" && s !== null) {
|
|
705
|
-
const n = Array.isArray(s) ? s :
|
|
706
|
-
i += `${a}: ${
|
|
714
|
+
const n = Array.isArray(s) ? s : qt(s);
|
|
715
|
+
i += `${a}: ${m(n, e + 2, r)}`;
|
|
707
716
|
} else
|
|
708
717
|
[
|
|
709
718
|
"number",
|
|
710
719
|
"boolean",
|
|
711
720
|
"undefined"
|
|
712
721
|
].includes(typeof s) || s === null ? i += `${a}: ${s}` : typeof s == "string" ? i += `${a}: '${O(s)}'` : i += `${a}: ${s}`;
|
|
713
|
-
i += `,${
|
|
722
|
+
i += `,${D}`;
|
|
714
723
|
}), i += " ".repeat(e), i += "}"), i;
|
|
715
724
|
};
|
|
716
|
-
function
|
|
717
|
-
return
|
|
725
|
+
function Qt(t) {
|
|
726
|
+
return m(t, C);
|
|
718
727
|
}
|
|
719
|
-
function
|
|
728
|
+
function B(t, e = "data-source-placeholder") {
|
|
720
729
|
if (!t)
|
|
721
730
|
return e;
|
|
722
731
|
const r = typeof t == "object" && "title" in t ? t.title : t;
|
|
723
|
-
return
|
|
732
|
+
return Et(r);
|
|
724
733
|
}
|
|
725
|
-
function
|
|
734
|
+
function F(t, e = !0) {
|
|
726
735
|
const r = [];
|
|
727
|
-
return e && r.push("measureFactory"),
|
|
736
|
+
return e && r.push("measureFactory"), p(t) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
|
|
728
737
|
}
|
|
729
|
-
const
|
|
730
|
-
`,
|
|
738
|
+
const R = `
|
|
739
|
+
`, kt = (t, e) => {
|
|
731
740
|
if (t.composeCode)
|
|
732
|
-
return `${
|
|
741
|
+
return `${R}${" ".repeat(e)}${t.composeCode}`;
|
|
733
742
|
const r = t.jaql().jaql;
|
|
734
|
-
return `${
|
|
735
|
-
},
|
|
743
|
+
return `${R}${" ".repeat(e)}filterFactory.customFilter(${m(r, e, !0)})`;
|
|
744
|
+
}, Bt = (t, e = 0) => {
|
|
736
745
|
if (!t)
|
|
737
746
|
return "";
|
|
738
747
|
let r = "";
|
|
739
|
-
return r += `[${t.map((i) =>
|
|
748
|
+
return r += `[${t.map((i) => kt(i, e + 2))}${t.length ? `
|
|
740
749
|
` + " ".repeat(e + 2) : ""}]`, r;
|
|
741
|
-
},
|
|
750
|
+
}, _ = (t) => t ? Array.isArray(t) ? Bt(t, 6) : "/** Filter relations not supported yet */" : "[]", Ft = [
|
|
742
751
|
"executeQueryByWidgetIdTmpl",
|
|
743
752
|
"widgetByIdTmpl"
|
|
744
|
-
],
|
|
745
|
-
|
|
753
|
+
], Rt = "chartWidgetTmpl", _t = "pivotTableWidgetTmpl", Nt = (t) => t, zt = ({ dashboardOid: t, widgetOid: e, uiFramework: r = "react", chartType: i = "table", includeChart: a = !0 }) => {
|
|
754
|
+
H(i);
|
|
746
755
|
const s = {
|
|
747
756
|
dashboardOid: t,
|
|
748
757
|
widgetOid: e
|
|
749
|
-
}, n =
|
|
750
|
-
return
|
|
751
|
-
},
|
|
752
|
-
if (
|
|
753
|
-
|
|
754
|
-
const i =
|
|
758
|
+
}, n = Ft[Number(a)];
|
|
759
|
+
return j(n, s, r);
|
|
760
|
+
}, Jt = (t, e, r) => {
|
|
761
|
+
if (gt(t)) {
|
|
762
|
+
H(t.chartType);
|
|
763
|
+
const i = k(t), a = {
|
|
755
764
|
idString: t.id,
|
|
756
765
|
widgetTypeString: "chart",
|
|
757
766
|
titleString: t.title,
|
|
758
|
-
dataSourceString:
|
|
759
|
-
chartTypeString:
|
|
760
|
-
dataOptionsString:
|
|
761
|
-
filtersString:
|
|
767
|
+
dataSourceString: B(t.dataSource),
|
|
768
|
+
chartTypeString: Nt(t.chartType),
|
|
769
|
+
dataOptionsString: Qt(t.dataOptions),
|
|
770
|
+
filtersString: _(t.filters),
|
|
762
771
|
componentString: "ChartWidget",
|
|
763
|
-
extraImportsString:
|
|
764
|
-
styleOptionsString:
|
|
765
|
-
drilldownOptionsString:
|
|
772
|
+
extraImportsString: F(t.filters || [], i),
|
|
773
|
+
styleOptionsString: m(t.styleOptions || {}, C),
|
|
774
|
+
drilldownOptionsString: m(t.drilldownOptions || {}, C)
|
|
766
775
|
};
|
|
767
|
-
return
|
|
776
|
+
return j(r.chart, a, e);
|
|
768
777
|
}
|
|
769
|
-
if (
|
|
770
|
-
const i =
|
|
778
|
+
if (yt(t)) {
|
|
779
|
+
const i = k(t), a = {
|
|
771
780
|
idString: t.id,
|
|
772
781
|
widgetTypeString: "pivot",
|
|
773
782
|
titleString: t.title,
|
|
774
|
-
dataSourceString:
|
|
775
|
-
dataOptionsString:
|
|
776
|
-
filtersString:
|
|
783
|
+
dataSourceString: B(t.dataSource),
|
|
784
|
+
dataOptionsString: m(t.dataOptions),
|
|
785
|
+
filtersString: _(t.filters),
|
|
777
786
|
componentString: "PivotTableWidget",
|
|
778
|
-
extraImportsString:
|
|
779
|
-
styleOptionsString:
|
|
787
|
+
extraImportsString: F(t.filters || [], i),
|
|
788
|
+
styleOptionsString: m(t.styleOptions || {}, C)
|
|
780
789
|
};
|
|
781
|
-
return
|
|
790
|
+
return j(r.pivot, a, e);
|
|
782
791
|
}
|
|
783
|
-
if (
|
|
792
|
+
if (ft(t))
|
|
784
793
|
return "/** Custom widget code not supported yet */";
|
|
785
794
|
throw new S("errors.otherWidgetTypesNotSupported");
|
|
786
|
-
},
|
|
787
|
-
chart:
|
|
788
|
-
pivot:
|
|
789
|
-
}),
|
|
795
|
+
}, Kt = ({ widgetProps: t, uiFramework: e = "react" }) => Jt(t, e, {
|
|
796
|
+
chart: Rt,
|
|
797
|
+
pivot: _t
|
|
798
|
+
}), he = (t) => "chartType" in t.chartRecommendations ? t.chartRecommendations : {
|
|
790
799
|
chartType: "table",
|
|
791
800
|
chartFamily: "table",
|
|
792
801
|
axesMapping: {}
|
|
793
|
-
},
|
|
802
|
+
}, Ut = (t) => ({
|
|
794
803
|
dataOptions: {
|
|
795
|
-
columns: t.map(
|
|
804
|
+
columns: t.map(V)
|
|
796
805
|
}
|
|
797
|
-
}),
|
|
806
|
+
}), Yt = Object.freeze({
|
|
798
807
|
convolution: {
|
|
799
808
|
enabled: !0,
|
|
800
809
|
selectedConvolutionType: "bySlicesCount",
|
|
@@ -815,40 +824,40 @@ const k = `
|
|
|
815
824
|
xAxis: {
|
|
816
825
|
gridLines: !1
|
|
817
826
|
}
|
|
818
|
-
}),
|
|
827
|
+
}), N = Object.freeze({
|
|
819
828
|
line: "line/spline",
|
|
820
829
|
pie: "pie/donut",
|
|
821
830
|
bar: "bar/stacked",
|
|
822
831
|
column: "column/stackedcolumn"
|
|
823
|
-
}),
|
|
832
|
+
}), Vt = (t, e, r) => {
|
|
824
833
|
const i = t.reduce((s, n) => (s[n.jaql.title] = n, s), {}), a = Object.entries(r).reduce((s, n) => {
|
|
825
|
-
const [
|
|
826
|
-
return s[`${
|
|
834
|
+
const [u, l] = n;
|
|
835
|
+
return s[`${u}`] = Array.isArray(l) ? l.map((g) => {
|
|
827
836
|
var T, b;
|
|
828
|
-
const d = I(
|
|
837
|
+
const d = I(g);
|
|
829
838
|
delete d.enabled;
|
|
830
|
-
const
|
|
831
|
-
if (!
|
|
839
|
+
const y = i[d.column.name];
|
|
840
|
+
if (!y)
|
|
832
841
|
return {
|
|
833
842
|
column: {
|
|
834
843
|
type: "",
|
|
835
844
|
name: d.column.name
|
|
836
845
|
}
|
|
837
846
|
};
|
|
838
|
-
const f =
|
|
839
|
-
if (
|
|
840
|
-
return
|
|
847
|
+
const f = V(y);
|
|
848
|
+
if (y.panel === "measures")
|
|
849
|
+
return c(o({}, d), {
|
|
841
850
|
column: f
|
|
842
851
|
});
|
|
843
|
-
if (
|
|
844
|
-
const v = (b = (T =
|
|
852
|
+
if (ht(f.type)) {
|
|
853
|
+
const v = (b = (T = y.format) == null ? void 0 : T.mask) == null ? void 0 : b[y.jaql.level];
|
|
845
854
|
if (v)
|
|
846
|
-
return
|
|
855
|
+
return c(o({}, d), {
|
|
847
856
|
column: f,
|
|
848
857
|
dateFormat: v
|
|
849
858
|
});
|
|
850
859
|
}
|
|
851
|
-
return
|
|
860
|
+
return c(o({}, d), {
|
|
852
861
|
column: f
|
|
853
862
|
});
|
|
854
863
|
}) : l, s;
|
|
@@ -874,20 +883,20 @@ const k = `
|
|
|
874
883
|
s !== "geo" && (a[`${s}`] = a[`${s}`][0]);
|
|
875
884
|
}), a;
|
|
876
885
|
case "table":
|
|
877
|
-
return Object.keys(a).length === 0 ?
|
|
886
|
+
return Object.keys(a).length === 0 ? Ut(t).dataOptions : a;
|
|
878
887
|
case "boxplot":
|
|
879
888
|
case "areamap":
|
|
880
889
|
case "indicator":
|
|
881
890
|
default:
|
|
882
891
|
return a;
|
|
883
892
|
}
|
|
884
|
-
},
|
|
893
|
+
}, z = (t, e) => {
|
|
885
894
|
var r, i, a, s;
|
|
886
895
|
return e === "x" ? (i = (r = t.category) != null ? r : t.x) == null ? void 0 : i.map((n) => I(n).column.name).join(", ") : (s = (a = t.value) != null ? a : t.y) == null ? void 0 : s.map((n) => I(n).column.name).join(", ");
|
|
887
|
-
},
|
|
896
|
+
}, Ht = (t, e, r, i) => {
|
|
888
897
|
let a;
|
|
889
|
-
return i && t in
|
|
890
|
-
subtype:
|
|
898
|
+
return i && t in N ? a = M(M(Yt, {
|
|
899
|
+
subtype: N[`${t}`]
|
|
891
900
|
}), {
|
|
892
901
|
legend: {
|
|
893
902
|
enabled: !0,
|
|
@@ -896,96 +905,125 @@ const k = `
|
|
|
896
905
|
yAxis: {
|
|
897
906
|
title: {
|
|
898
907
|
enabled: !0,
|
|
899
|
-
text:
|
|
908
|
+
text: z(e, "y")
|
|
900
909
|
}
|
|
901
910
|
},
|
|
902
911
|
xAxis: {
|
|
903
912
|
title: {
|
|
904
913
|
enabled: !0,
|
|
905
|
-
text:
|
|
914
|
+
text: z(e, "x")
|
|
906
915
|
}
|
|
907
916
|
}
|
|
908
|
-
}, r) : a = M(
|
|
909
|
-
},
|
|
910
|
-
const { chartFamily: i, chartType: a, axesMapping: s = {}, styleOptions: n = {} } = e,
|
|
917
|
+
}, r) : a = M(St(), r), a;
|
|
918
|
+
}, Gt = (t, e, r = !0) => {
|
|
919
|
+
const { chartFamily: i, chartType: a, axesMapping: s = {}, styleOptions: n = {} } = e, u = Vt(t, i, s), l = Ht(a, s, n, r);
|
|
911
920
|
return {
|
|
912
|
-
dataOptions:
|
|
921
|
+
dataOptions: u,
|
|
913
922
|
chartStyleOptions: l
|
|
914
923
|
};
|
|
915
|
-
}
|
|
924
|
+
};
|
|
925
|
+
function Zt(t) {
|
|
926
|
+
return !!(t && (t.top !== void 0 || t.bottom !== void 0));
|
|
927
|
+
}
|
|
928
|
+
const Xt = (t) => {
|
|
929
|
+
const e = t.find((r) => r.panel === "rows");
|
|
930
|
+
return e ? t.map((r) => {
|
|
931
|
+
const i = r.jaql.filter;
|
|
932
|
+
if (!(r.panel === "scope" && Zt(i) && i.by === void 0))
|
|
933
|
+
return r;
|
|
934
|
+
const d = r.jaql, { type: s, context: n, formula: u, filter: l } = d, g = A(d, ["type", "context", "formula", "filter"]);
|
|
935
|
+
return c(o({}, r), {
|
|
936
|
+
jaql: o({
|
|
937
|
+
// Copy dimension properties from rows dimension
|
|
938
|
+
dim: e.jaql.dim,
|
|
939
|
+
table: e.jaql.table,
|
|
940
|
+
column: e.jaql.column,
|
|
941
|
+
datatype: e.jaql.datatype,
|
|
942
|
+
// Keep the filter but add the by clause
|
|
943
|
+
filter: c(o({}, l), {
|
|
944
|
+
by: {
|
|
945
|
+
type: s,
|
|
946
|
+
context: n,
|
|
947
|
+
formula: u
|
|
948
|
+
}
|
|
949
|
+
})
|
|
950
|
+
}, g)
|
|
951
|
+
});
|
|
952
|
+
}) : t;
|
|
953
|
+
}, te = (t) => "chartType" in t ? t : {
|
|
916
954
|
chartType: "table",
|
|
917
955
|
chartFamily: "table",
|
|
918
956
|
axesMapping: {}
|
|
919
|
-
},
|
|
920
|
-
if ((r.panel === "scope" || r.jaql.filter) && e.metadataFilters.push(
|
|
921
|
-
const i =
|
|
957
|
+
}, ee = (t) => t.map((e) => Ot(e.jaql)), re = (t) => t.reduce((e, r) => {
|
|
958
|
+
if ((r.panel === "scope" || r.jaql.filter) && e.metadataFilters.push(Q(r)), r.panel !== "scope") {
|
|
959
|
+
const i = Q(r);
|
|
922
960
|
delete i.jaql.filter, e.metadataColumns.push(i);
|
|
923
961
|
}
|
|
924
962
|
return e;
|
|
925
963
|
}, {
|
|
926
964
|
metadataColumns: [],
|
|
927
965
|
metadataFilters: []
|
|
928
|
-
}),
|
|
929
|
-
if (!
|
|
966
|
+
}), ie = (t, e) => {
|
|
967
|
+
if (!Dt(t))
|
|
930
968
|
try {
|
|
931
|
-
const { useCustomizedStyleOptions: r = !1 } = e || {}, { jaql: i, chartRecommendations: a, queryTitle: s } = t, { metadata: n, datasource:
|
|
932
|
-
type:
|
|
933
|
-
}),
|
|
934
|
-
jaql:
|
|
935
|
-
datasource:
|
|
969
|
+
const { useCustomizedStyleOptions: r = !1 } = e || {}, { jaql: i, chartRecommendations: a, queryTitle: s } = t, { metadata: n, datasource: u } = i, l = c(o({}, u), {
|
|
970
|
+
type: u.type || "elasticube"
|
|
971
|
+
}), g = Tt(l), y = Xt(n).map((x) => $t(x)).map((x) => c(o({}, x), {
|
|
972
|
+
jaql: c(o({}, x.jaql), {
|
|
973
|
+
datasource: g
|
|
936
974
|
})
|
|
937
|
-
})),
|
|
975
|
+
})), f = te(a), T = f.chartType.toLowerCase(), b = {
|
|
938
976
|
cornerRadius: "Small",
|
|
939
977
|
header: {
|
|
940
978
|
// remove info button and render empty toolbar instead
|
|
941
979
|
renderToolbar: () => null
|
|
942
980
|
}
|
|
943
|
-
}, { metadataColumns:
|
|
981
|
+
}, { metadataColumns: v, metadataFilters: X } = re(y), tt = ee(X), { dataOptions: et, chartStyleOptions: rt } = Gt(v, f, r), it = o(o({}, rt), b);
|
|
944
982
|
return {
|
|
945
983
|
widgetType: "chart",
|
|
946
984
|
id: s,
|
|
947
985
|
title: s,
|
|
948
|
-
chartType:
|
|
986
|
+
chartType: T,
|
|
949
987
|
dataSource: l,
|
|
950
|
-
dataOptions:
|
|
951
|
-
filters:
|
|
952
|
-
styleOptions:
|
|
988
|
+
dataOptions: et,
|
|
989
|
+
filters: tt,
|
|
990
|
+
styleOptions: it
|
|
953
991
|
};
|
|
954
992
|
} catch (r) {
|
|
955
993
|
console.error(r);
|
|
956
994
|
return;
|
|
957
995
|
}
|
|
958
|
-
},
|
|
996
|
+
}, ae = (t, e) => ie(t, e), se = (t) => xt(t) ? zt(t) : Kt(t), Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
959
997
|
__proto__: null,
|
|
960
|
-
toWidgetCode:
|
|
961
|
-
toWidgetProps:
|
|
998
|
+
toWidgetCode: se,
|
|
999
|
+
toWidgetProps: ae
|
|
962
1000
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
963
1001
|
export {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
J,
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1002
|
+
C,
|
|
1003
|
+
ce as E,
|
|
1004
|
+
Y as J,
|
|
1005
|
+
j as a,
|
|
1006
|
+
k as b,
|
|
1007
|
+
ge as c,
|
|
1008
|
+
B as d,
|
|
1009
|
+
_ as e,
|
|
1010
|
+
F as f,
|
|
1011
|
+
Jt as g,
|
|
1012
|
+
m as h,
|
|
1013
|
+
me as i,
|
|
1014
|
+
le as j,
|
|
1015
|
+
de as k,
|
|
1016
|
+
ue as l,
|
|
1017
|
+
xt as m,
|
|
1018
|
+
pe as n,
|
|
1019
|
+
$t as o,
|
|
1020
|
+
It as p,
|
|
1021
|
+
he as q,
|
|
1022
|
+
Vt as r,
|
|
1023
|
+
ye as s,
|
|
1024
|
+
ae as t,
|
|
1025
|
+
Ht as u,
|
|
1026
|
+
fe as v,
|
|
1027
|
+
Se as w,
|
|
1028
|
+
Gt as x
|
|
991
1029
|
};
|