@sisense/sdk-ui 2.1.0 → 2.2.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 +9 -9
- package/dist/ai.js +525 -636
- package/dist/analytics-composer.cjs +1 -1
- package/dist/analytics-composer.js +70 -70
- package/dist/{derive-chart-family-DjbiaKLQ.cjs → derive-chart-family-BsbFdcgd.cjs} +129 -129
- package/dist/{derive-chart-family-BNMFblR9.js → derive-chart-family-C9IDI6UV.js} +11273 -11244
- package/dist/{dimensions-DeTiL-EZ.js → dimensions-HgrcPa-Q.js} +1 -1
- package/dist/{dimensions-DcsEnPSY.cjs → dimensions-mYUylB-h.cjs} +1 -1
- package/dist/index.cjs +25 -21
- package/dist/index.js +13422 -10141
- package/dist/packages/sdk-ui/src/api/rest-api.d.ts +1 -0
- package/dist/packages/sdk-ui/src/api/types/dashboard-dto.d.ts +7 -0
- package/dist/packages/sdk-ui/src/common/hooks/use-state-with-history.d.ts +64 -0
- package/dist/packages/sdk-ui/src/dashboard/components/content-panel.d.ts +1 -1
- package/dist/packages/sdk-ui/src/dashboard/components/dashboard-header.d.ts +1 -1
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/cell-drop-overlay.d.ts +34 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/draggable-line.d.ts +24 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/draggable-widget-wrapper.d.ts +28 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/droppable-zone.d.ts +23 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/resizable-columns.d.ts +31 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/resizable-row.d.ts +39 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/row-drop-overlay.d.ts +30 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/const.d.ts +11 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/editable-layout.d.ts +28 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/helpers.d.ts +42 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/types.d.ts +78 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/utils.d.ts +5 -0
- package/dist/packages/sdk-ui/src/dashboard/constants.d.ts +0 -2
- package/dist/packages/sdk-ui/src/dashboard/dashboard.d.ts +7 -1
- package/dist/packages/sdk-ui/src/dashboard/hooks/use-dashboard-header-toolbar.d.ts +17 -0
- package/dist/packages/sdk-ui/src/dashboard/hooks/use-edit-mode-toolbar.d.ts +52 -0
- package/dist/packages/sdk-ui/src/dashboard/types.d.ts +9 -1
- package/dist/packages/sdk-ui/src/dashboard/use-dashboard-theme.d.ts +4 -0
- package/dist/packages/sdk-ui/src/error-boundary/error-boundary.d.ts +6 -2
- package/dist/packages/sdk-ui/src/index.d.ts +1 -1
- package/dist/packages/sdk-ui/src/models/dashboard/dashboard-model.d.ts +7 -0
- package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-dto-utils.d.ts +3 -1
- package/dist/packages/sdk-ui/src/models/dashboard/types.d.ts +30 -18
- package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model-reducer.d.ts +14 -5
- package/dist/packages/sdk-ui/src/props.d.ts +4 -1
- package/dist/packages/sdk-ui/src/theme-provider/default-theme-settings.d.ts +3 -0
- package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +9 -0
- package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +18 -0
- package/dist/packages/sdk-ui/src/types.d.ts +14 -0
- package/dist/{use-common-filters-DcFu4qRs.cjs → use-common-filters-BKYG6WGA.cjs} +47 -47
- package/dist/{use-common-filters-CJNwlbbh.js → use-common-filters-DkwU7HJ3.js} +3685 -3550
- package/dist/{widget-composer-BEVCXjFv.js → widget-composer-CACtfvw6.js} +98 -95
- package/dist/{widget-composer-fYnr8SDo.cjs → widget-composer-JVl8mNCt.cjs} +1 -1
- package/package.json +10 -7
|
@@ -9,8 +9,8 @@ var $ = (t, e, r) => e in t ? tt(t, e, { enumerable: !0, configurable: !0, writa
|
|
|
9
9
|
for (var r of j(e))
|
|
10
10
|
at.call(e, r) && $(t, r, e[r]);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
13
|
-
import {
|
|
12
|
+
}, c = (t, e) => et(t, rt(e));
|
|
13
|
+
import { ek as _, a3 as st, eq as nt, aP as ot, er as lt, es as dt, M as C, T as S, et as ut, bd as R, e6 as ct, eu as O, em as z, aY as pt, bj as mt, bi as gt, m as M, ev as yt, b4 as I, aO as ft, ay as ht, c4 as P, ew as St } from "./derive-chart-family-C9IDI6UV.js";
|
|
14
14
|
class J extends _ {
|
|
15
15
|
constructor(e, r) {
|
|
16
16
|
var i;
|
|
@@ -30,37 +30,40 @@ class J extends _ {
|
|
|
30
30
|
return e.__serializable = "JaqlElement", e.metadataItem = this.metadataItem, e.type = this.type, e;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const Ot = {
|
|
34
34
|
text: C.TextAttribute,
|
|
35
35
|
numeric: C.NumericAttribute,
|
|
36
36
|
datetime: C.DateLevel
|
|
37
37
|
};
|
|
38
|
-
function
|
|
38
|
+
function Tt(t) {
|
|
39
39
|
var e;
|
|
40
|
-
return new J(t, (e =
|
|
40
|
+
return new J(t, (e = Ot[t.jaql.datatype]) !== null && e !== void 0 ? e : "numeric");
|
|
41
41
|
}
|
|
42
42
|
function Y(t) {
|
|
43
43
|
const { jaql: e } = t;
|
|
44
|
-
|
|
44
|
+
if (e.formula)
|
|
45
|
+
return nt(e);
|
|
46
|
+
const r = ot.translateJaqlToGranularity(e);
|
|
47
|
+
return "agg" in e && e.dim && e.datatype ? lt({
|
|
45
48
|
expression: e.dim,
|
|
46
49
|
dataType: e.datatype,
|
|
47
50
|
agg: e.agg || "",
|
|
48
|
-
granularity:
|
|
51
|
+
granularity: r,
|
|
49
52
|
format: void 0,
|
|
50
53
|
sort: e.sort,
|
|
51
54
|
title: e.title,
|
|
52
55
|
dataSource: e.datasource
|
|
53
|
-
}) : e.dim && e.datatype ?
|
|
56
|
+
}) : e.dim && e.datatype ? dt({
|
|
54
57
|
expression: e.dim,
|
|
55
58
|
dataType: e.datatype,
|
|
56
|
-
granularity:
|
|
59
|
+
granularity: r,
|
|
57
60
|
sort: e.sort,
|
|
58
61
|
title: e.title,
|
|
59
62
|
panel: t.panel,
|
|
60
63
|
dataSource: e.datasource
|
|
61
|
-
}) :
|
|
64
|
+
}) : Tt(t);
|
|
62
65
|
}
|
|
63
|
-
const
|
|
66
|
+
const re = {
|
|
64
67
|
jaql: {
|
|
65
68
|
datasource: {
|
|
66
69
|
title: "",
|
|
@@ -70,23 +73,23 @@ const ee = {
|
|
|
70
73
|
},
|
|
71
74
|
queryTitle: "",
|
|
72
75
|
chartRecommendations: {}
|
|
73
|
-
},
|
|
76
|
+
}, ie = {
|
|
74
77
|
model: "",
|
|
75
78
|
metadata: [],
|
|
76
79
|
chart: {},
|
|
77
80
|
queryTitle: ""
|
|
78
|
-
},
|
|
79
|
-
function
|
|
81
|
+
}, ae = (t) => "widgetProps" in t, bt = (t) => "dashboardOid" in t && "widgetOid" in t, se = (t) => "dashboardProps" in t, ne = (t) => "dashboardOid" in t;
|
|
82
|
+
function vt(t) {
|
|
80
83
|
return t.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
81
84
|
}
|
|
82
|
-
function
|
|
85
|
+
function oe(t) {
|
|
83
86
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
84
87
|
}
|
|
85
|
-
function
|
|
88
|
+
function le(t) {
|
|
86
89
|
const e = /\[(.+?)\s\(Calendar\)\]/;
|
|
87
90
|
return t.replace(e, "[$1]").trim();
|
|
88
91
|
}
|
|
89
|
-
function
|
|
92
|
+
function de(t) {
|
|
90
93
|
if (t)
|
|
91
94
|
if (t.metadata) {
|
|
92
95
|
if (!t.model)
|
|
@@ -97,12 +100,12 @@ function le(t) {
|
|
|
97
100
|
throw new S("errors.emptyModel");
|
|
98
101
|
return t;
|
|
99
102
|
}
|
|
100
|
-
function
|
|
103
|
+
function xt(t) {
|
|
101
104
|
return !t || !t.jaql.datasource.title || !t.jaql.metadata.length;
|
|
102
105
|
}
|
|
103
106
|
function U(t) {
|
|
104
107
|
if (![
|
|
105
|
-
...
|
|
108
|
+
...ut,
|
|
106
109
|
"pivot",
|
|
107
110
|
"pivot2"
|
|
108
111
|
].includes(t))
|
|
@@ -110,7 +113,7 @@ function U(t) {
|
|
|
110
113
|
chartType: t
|
|
111
114
|
});
|
|
112
115
|
}
|
|
113
|
-
function
|
|
116
|
+
function Et(t) {
|
|
114
117
|
return "widgetType" in t && t.widgetType === "pivot";
|
|
115
118
|
}
|
|
116
119
|
function h(t) {
|
|
@@ -118,13 +121,13 @@ function h(t) {
|
|
|
118
121
|
return "column" in t && ((e = t.column) == null ? void 0 : e.expression) && /\(.*\)/.test(t.column.expression);
|
|
119
122
|
}
|
|
120
123
|
function L(t) {
|
|
121
|
-
const e = "measures" in t &&
|
|
122
|
-
return
|
|
124
|
+
const e = "measures" in t && u(t.measures) || "values" in t && u(t.values);
|
|
125
|
+
return Et(t) ? "values" in t.dataOptions && u(t.dataOptions.values) : "chartType" in t ? t.chartType === "indicator" ? "value" in t.dataOptions && u(t.dataOptions.value) || "secondary" in t.dataOptions && u(t.dataOptions.secondary) : t.chartType === "table" ? !("columns" in t.dataOptions) || !u(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 && u(t.dataOptions.geo) && "color" in t.dataOptions && u(t.dataOptions.color) : "value" in t.dataOptions && u(t.dataOptions.value) : e;
|
|
123
126
|
}
|
|
124
|
-
function
|
|
127
|
+
function u(t) {
|
|
125
128
|
return Array.isArray(t) && t.length > 0;
|
|
126
129
|
}
|
|
127
|
-
function
|
|
130
|
+
function Dt(t) {
|
|
128
131
|
const e = t.split(`
|
|
129
132
|
`);
|
|
130
133
|
for (let r = 0; r < e.length - 1; r++)
|
|
@@ -138,7 +141,7 @@ function Et(t) {
|
|
|
138
141
|
return e.join(`
|
|
139
142
|
`);
|
|
140
143
|
}
|
|
141
|
-
const
|
|
144
|
+
const wt = {
|
|
142
145
|
react: {
|
|
143
146
|
baseChartTmpl: `import { {{componentString}} } from '@sisense/sdk-ui';
|
|
144
147
|
{{extraImportsString}}
|
|
@@ -597,10 +600,10 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
597
600
|
</template>`,
|
|
598
601
|
dashboardTmpl: "/** COMING SOON */"
|
|
599
602
|
}
|
|
600
|
-
}, K = (t, e) =>
|
|
603
|
+
}, K = (t, e) => wt[e][t].replace(/{{(.*?)Tmpl}}/g, (i, a) => K(`${a}Tmpl`, e)), Ct = (t, e) => t.replace(/{{(.*?)}}/g, (r, i) => i in e ? e[i] : (console.warn(`Placeholder ${i} not found in data`), r)), q = (t, e, r = "react") => {
|
|
601
604
|
const i = K(t, r);
|
|
602
|
-
return
|
|
603
|
-
},
|
|
605
|
+
return Dt(Ct(i, e));
|
|
606
|
+
}, Mt = () => Object.values(ct).map((e) => R.aggregationToJAQL(e)).join("|"), V = (t) => {
|
|
604
607
|
const { formula: e, context: r, filter: i } = t;
|
|
605
608
|
if (!r || !e)
|
|
606
609
|
return t;
|
|
@@ -610,7 +613,7 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
610
613
|
const s = a[0];
|
|
611
614
|
if (typeof s != "string")
|
|
612
615
|
return t;
|
|
613
|
-
const n = r[`${s}`], l =
|
|
616
|
+
const n = r[`${s}`], l = Mt(), m = new RegExp(`^\\s*(${l})\\(\\[\\w+\\]\\)$`), y = e.match(m);
|
|
614
617
|
if (y && e.includes(s)) {
|
|
615
618
|
const d = y[1];
|
|
616
619
|
return o({
|
|
@@ -634,20 +637,20 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
634
637
|
}), e.context = r;
|
|
635
638
|
}
|
|
636
639
|
return e;
|
|
637
|
-
},
|
|
640
|
+
}, It = (t) => {
|
|
638
641
|
var i;
|
|
639
642
|
const e = t;
|
|
640
643
|
if (e.panel !== "scope")
|
|
641
644
|
return e;
|
|
642
645
|
const { jaql: r } = e;
|
|
643
|
-
return (i = r.filter) != null && i.by && (r.filter.by = V(r.filter.by)),
|
|
646
|
+
return (i = r.filter) != null && i.by && (r.filter.by = V(r.filter.by)), c(o({}, e), {
|
|
644
647
|
jaql: r
|
|
645
648
|
});
|
|
646
|
-
},
|
|
649
|
+
}, qt = (t) => {
|
|
647
650
|
let e = t;
|
|
648
|
-
e =
|
|
651
|
+
e = It(e);
|
|
649
652
|
const { jaql: r, measure: i, by: a } = e;
|
|
650
|
-
return o(o(
|
|
653
|
+
return o(o(c(o({}, e), {
|
|
651
654
|
jaql: D(r)
|
|
652
655
|
}), a ? {
|
|
653
656
|
by: D(a)
|
|
@@ -655,7 +658,7 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
655
658
|
measure: D(i)
|
|
656
659
|
} : {});
|
|
657
660
|
}, w = 6, E = `
|
|
658
|
-
`, W = "UNKNOWN",
|
|
661
|
+
`, W = "UNKNOWN", Wt = (t, e) => {
|
|
659
662
|
let r = "";
|
|
660
663
|
return r += `measureFactory.customFormula(
|
|
661
664
|
`, r += " ".repeat(e), r += ` '${O(t.title)}',
|
|
@@ -667,20 +670,20 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
667
670
|
`;
|
|
668
671
|
}), r += " ".repeat(e), r += ` }
|
|
669
672
|
`, r += " ".repeat(e), r += ")", r;
|
|
670
|
-
},
|
|
673
|
+
}, jt = (t) => {
|
|
671
674
|
const { level: e, table: r, column: i, agg: a, title: s } = t;
|
|
672
675
|
let n;
|
|
673
676
|
return r && i && (n = z(r, i, e, "DM")), a && r && i && s && (n = `measureFactory.${R.aggregationFromJAQL(a)}(${n}, '${O(s)}')`), n || W;
|
|
674
|
-
},
|
|
677
|
+
}, $t = (t, e) => {
|
|
675
678
|
const r = t.jaql(!1).jaql;
|
|
676
|
-
return "formula" in r ?
|
|
679
|
+
return "formula" in r ? Wt(r, e) : jt(r);
|
|
677
680
|
}, p = (t, e = 0, r = !1) => {
|
|
678
681
|
if (!t)
|
|
679
682
|
return "";
|
|
680
683
|
if (typeof t == "string")
|
|
681
684
|
return `'${O(t)}'`;
|
|
682
685
|
if (t instanceof J)
|
|
683
|
-
return
|
|
686
|
+
return $t(t, e);
|
|
684
687
|
if (t instanceof _)
|
|
685
688
|
return t.composeCode || "";
|
|
686
689
|
let i = "";
|
|
@@ -692,51 +695,51 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
692
695
|
].includes(typeof s) || s === null ? i += `${a}: ${s}` : typeof s == "string" ? i += `${a}: '${O(s)}'` : i += `${a}: ${s}`, i += `,${E}`;
|
|
693
696
|
}), i += " ".repeat(e), i += "}"), i;
|
|
694
697
|
};
|
|
695
|
-
function
|
|
698
|
+
function Pt(t) {
|
|
696
699
|
return p(t, w);
|
|
697
700
|
}
|
|
698
701
|
function Q(t, e = "data-source-placeholder") {
|
|
699
702
|
if (!t)
|
|
700
703
|
return e;
|
|
701
704
|
const r = typeof t == "object" && "title" in t ? t.title : t;
|
|
702
|
-
return
|
|
705
|
+
return vt(r);
|
|
703
706
|
}
|
|
704
707
|
function A(t, e = !0) {
|
|
705
708
|
const r = [];
|
|
706
|
-
return e && r.push("measureFactory"),
|
|
709
|
+
return e && r.push("measureFactory"), u(t) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
|
|
707
710
|
}
|
|
708
711
|
const k = `
|
|
709
|
-
`,
|
|
712
|
+
`, Lt = (t, e) => {
|
|
710
713
|
if (t.composeCode)
|
|
711
714
|
return `${k}${" ".repeat(e)}${t.composeCode}`;
|
|
712
715
|
const r = t.jaql().jaql;
|
|
713
716
|
return `${k}${" ".repeat(e)}filterFactory.customFilter(${p(r, e, !0)})`;
|
|
714
|
-
},
|
|
717
|
+
}, Qt = (t, e = 0) => {
|
|
715
718
|
if (!t)
|
|
716
719
|
return "";
|
|
717
720
|
let r = "";
|
|
718
|
-
return r += `[${t.map((i) =>
|
|
721
|
+
return r += `[${t.map((i) => Lt(i, e + 2))}${t.length ? `
|
|
719
722
|
` + " ".repeat(e + 2) : ""}]`, r;
|
|
720
|
-
}, B = (t) => t ? Array.isArray(t) ?
|
|
723
|
+
}, B = (t) => t ? Array.isArray(t) ? Qt(t, 6) : "/** Filter relations not supported yet */" : "[]", At = [
|
|
721
724
|
"executeQueryByWidgetIdTmpl",
|
|
722
725
|
"widgetByIdTmpl"
|
|
723
|
-
],
|
|
726
|
+
], kt = "chartWidgetTmpl", Bt = "pivotTableWidgetTmpl", Ft = (t) => t, Nt = ({ dashboardOid: t, widgetOid: e, uiFramework: r = "react", chartType: i = "table", includeChart: a = !0 }) => {
|
|
724
727
|
U(i);
|
|
725
728
|
const s = {
|
|
726
729
|
dashboardOid: t,
|
|
727
730
|
widgetOid: e
|
|
728
|
-
}, n =
|
|
731
|
+
}, n = At[Number(a)];
|
|
729
732
|
return q(n, s, r);
|
|
730
|
-
},
|
|
731
|
-
if (
|
|
733
|
+
}, _t = (t, e, r) => {
|
|
734
|
+
if (pt(t)) {
|
|
732
735
|
U(t.chartType);
|
|
733
736
|
const i = L(t), a = {
|
|
734
737
|
idString: t.id,
|
|
735
738
|
widgetTypeString: "chart",
|
|
736
739
|
titleString: t.title,
|
|
737
740
|
dataSourceString: Q(t.dataSource),
|
|
738
|
-
chartTypeString:
|
|
739
|
-
dataOptionsString:
|
|
741
|
+
chartTypeString: Ft(t.chartType),
|
|
742
|
+
dataOptionsString: Pt(t.dataOptions),
|
|
740
743
|
filtersString: B(t.filters),
|
|
741
744
|
componentString: "ChartWidget",
|
|
742
745
|
extraImportsString: A(t.filters || [], i),
|
|
@@ -745,7 +748,7 @@ const k = `
|
|
|
745
748
|
};
|
|
746
749
|
return q(r.chart, a, e);
|
|
747
750
|
}
|
|
748
|
-
if (
|
|
751
|
+
if (mt(t)) {
|
|
749
752
|
const i = L(t), a = {
|
|
750
753
|
idString: t.id,
|
|
751
754
|
widgetTypeString: "pivot",
|
|
@@ -759,17 +762,17 @@ const k = `
|
|
|
759
762
|
};
|
|
760
763
|
return q(r.pivot, a, e);
|
|
761
764
|
}
|
|
762
|
-
if (
|
|
765
|
+
if (gt(t))
|
|
763
766
|
return "/** Plugin widget code not supported yet */";
|
|
764
767
|
throw new S("errors.otherWidgetTypesNotSupported");
|
|
765
|
-
},
|
|
766
|
-
chart:
|
|
767
|
-
pivot:
|
|
768
|
-
}),
|
|
768
|
+
}, Rt = ({ widgetProps: t, uiFramework: e = "react" }) => _t(t, e, {
|
|
769
|
+
chart: kt,
|
|
770
|
+
pivot: Bt
|
|
771
|
+
}), zt = (t) => ({
|
|
769
772
|
dataOptions: {
|
|
770
773
|
columns: t.map(Y)
|
|
771
774
|
}
|
|
772
|
-
}),
|
|
775
|
+
}), Jt = Object.freeze({
|
|
773
776
|
convolution: {
|
|
774
777
|
enabled: !0,
|
|
775
778
|
selectedConvolutionType: "bySlicesCount",
|
|
@@ -795,7 +798,7 @@ const k = `
|
|
|
795
798
|
pie: "pie/donut",
|
|
796
799
|
bar: "bar/stacked",
|
|
797
800
|
column: "column/stackedcolumn"
|
|
798
|
-
}),
|
|
801
|
+
}), Yt = (t, e, r) => {
|
|
799
802
|
const i = t.reduce((s, n) => (s[n.jaql.title] = n, s), {}), a = Object.entries(r).reduce((s, n) => {
|
|
800
803
|
const [l, m] = n;
|
|
801
804
|
return s[`${l}`] = Array.isArray(m) ? m.map((y) => {
|
|
@@ -812,18 +815,18 @@ const k = `
|
|
|
812
815
|
};
|
|
813
816
|
const f = Y(g);
|
|
814
817
|
if (g.panel === "measures")
|
|
815
|
-
return
|
|
818
|
+
return c(o({}, d), {
|
|
816
819
|
column: f
|
|
817
820
|
});
|
|
818
|
-
if (
|
|
821
|
+
if (ft(f.type)) {
|
|
819
822
|
const v = (b = (T = g.format) == null ? void 0 : T.mask) == null ? void 0 : b[g.jaql.level];
|
|
820
823
|
if (v)
|
|
821
|
-
return
|
|
824
|
+
return c(o({}, d), {
|
|
822
825
|
column: f,
|
|
823
826
|
dateFormat: v
|
|
824
827
|
});
|
|
825
828
|
}
|
|
826
|
-
return
|
|
829
|
+
return c(o({}, d), {
|
|
827
830
|
column: f
|
|
828
831
|
});
|
|
829
832
|
}) : m, s;
|
|
@@ -849,7 +852,7 @@ const k = `
|
|
|
849
852
|
s !== "geo" && (a[`${s}`] = a[`${s}`][0]);
|
|
850
853
|
}), a;
|
|
851
854
|
case "table":
|
|
852
|
-
return Object.keys(a).length === 0 ?
|
|
855
|
+
return Object.keys(a).length === 0 ? zt(t).dataOptions : a;
|
|
853
856
|
case "boxplot":
|
|
854
857
|
case "areamap":
|
|
855
858
|
case "indicator":
|
|
@@ -859,10 +862,10 @@ const k = `
|
|
|
859
862
|
}, N = (t, e) => {
|
|
860
863
|
var r, i, a, s;
|
|
861
864
|
return e === "x" ? (i = (r = t.axesMapping.category) != null ? r : t.axesMapping.x) == null ? void 0 : i.map((n) => I(n).column.name).join(", ") : (s = (a = t.axesMapping.value) != null ? a : t.axesMapping.y) == null ? void 0 : s.map((n) => I(n).column.name).join(", ");
|
|
862
|
-
},
|
|
863
|
-
const { chartFamily: i, axesMapping: a = {}, styleOptions: s = {} } = e, n =
|
|
865
|
+
}, Ut = (t, e, r = !0) => {
|
|
866
|
+
const { chartFamily: i, axesMapping: a = {}, styleOptions: s = {} } = e, n = Yt(t, i, a);
|
|
864
867
|
let l;
|
|
865
|
-
return r && e.chartType in F ? l = M(M(
|
|
868
|
+
return r && e.chartType in F ? l = M(M(Jt, {
|
|
866
869
|
subtype: F[e.chartType]
|
|
867
870
|
}), {
|
|
868
871
|
legend: {
|
|
@@ -881,15 +884,15 @@ const k = `
|
|
|
881
884
|
text: N(e, "x")
|
|
882
885
|
}
|
|
883
886
|
}
|
|
884
|
-
}, s) : l = M(
|
|
887
|
+
}, s) : l = M(yt(), s), {
|
|
885
888
|
dataOptions: n,
|
|
886
889
|
chartStyleOptions: l
|
|
887
890
|
};
|
|
888
|
-
},
|
|
891
|
+
}, Kt = (t) => "chartType" in t ? t : {
|
|
889
892
|
chartType: "table",
|
|
890
893
|
chartFamily: "table",
|
|
891
894
|
axesMapping: {}
|
|
892
|
-
},
|
|
895
|
+
}, Vt = (t) => t.map((e) => ht(e.jaql)), Ht = (t) => t.reduce((e, r) => {
|
|
893
896
|
if ((r.panel === "scope" || r.jaql.filter) && e.metadataFilters.push(P(r)), r.panel !== "scope") {
|
|
894
897
|
const i = P(r);
|
|
895
898
|
delete i.jaql.filter, e.metadataColumns.push(i);
|
|
@@ -898,22 +901,22 @@ const k = `
|
|
|
898
901
|
}, {
|
|
899
902
|
metadataColumns: [],
|
|
900
903
|
metadataFilters: []
|
|
901
|
-
}),
|
|
902
|
-
if (!
|
|
904
|
+
}), Gt = (t, e) => {
|
|
905
|
+
if (!xt(t))
|
|
903
906
|
try {
|
|
904
|
-
const { useCustomizedStyleOptions: r = !1 } = e || {}, { jaql: i, chartRecommendations: a, queryTitle: s } = t, { metadata: n, datasource: l } = i, m =
|
|
907
|
+
const { useCustomizedStyleOptions: r = !1 } = e || {}, { jaql: i, chartRecommendations: a, queryTitle: s } = t, { metadata: n, datasource: l } = i, m = c(o({}, l), {
|
|
905
908
|
type: l.type || "elasticube"
|
|
906
|
-
}), y =
|
|
907
|
-
jaql:
|
|
909
|
+
}), y = St(m), d = n.map((x) => qt(x)).map((x) => c(o({}, x), {
|
|
910
|
+
jaql: c(o({}, x.jaql), {
|
|
908
911
|
datasource: y
|
|
909
912
|
})
|
|
910
|
-
})), g =
|
|
913
|
+
})), g = Kt(a), f = g.chartType.toLowerCase(), T = {
|
|
911
914
|
cornerRadius: "Small",
|
|
912
915
|
header: {
|
|
913
916
|
// remove info button and render empty toolbar instead
|
|
914
917
|
renderToolbar: () => null
|
|
915
918
|
}
|
|
916
|
-
}, { metadataColumns: b, metadataFilters: v } =
|
|
919
|
+
}, { metadataColumns: b, metadataFilters: v } = Ht(d), H = Vt(v), { dataOptions: G, chartStyleOptions: X } = Ut(b, g, r), Z = o(o({}, X), T);
|
|
917
920
|
return {
|
|
918
921
|
widgetType: "chart",
|
|
919
922
|
id: s,
|
|
@@ -928,32 +931,32 @@ const k = `
|
|
|
928
931
|
console.error(r);
|
|
929
932
|
return;
|
|
930
933
|
}
|
|
931
|
-
},
|
|
934
|
+
}, Xt = (t, e) => Gt(t, e), Zt = (t) => bt(t) ? Nt(t) : Rt(t), ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
932
935
|
__proto__: null,
|
|
933
|
-
toWidgetCode:
|
|
934
|
-
toWidgetProps:
|
|
936
|
+
toWidgetCode: Zt,
|
|
937
|
+
toWidgetProps: Xt
|
|
935
938
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
936
939
|
export {
|
|
937
940
|
w as C,
|
|
938
|
-
|
|
941
|
+
ie as E,
|
|
939
942
|
J,
|
|
940
943
|
q as a,
|
|
941
944
|
L as b,
|
|
942
|
-
|
|
945
|
+
oe as c,
|
|
943
946
|
Q as d,
|
|
944
947
|
B as e,
|
|
945
948
|
A as f,
|
|
946
|
-
|
|
949
|
+
_t as g,
|
|
947
950
|
p as h,
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
951
|
+
ne as i,
|
|
952
|
+
re as j,
|
|
953
|
+
ae as k,
|
|
954
|
+
bt as l,
|
|
955
|
+
se as m,
|
|
956
|
+
qt as n,
|
|
957
|
+
Ct as p,
|
|
958
|
+
le as s,
|
|
959
|
+
Xt as t,
|
|
960
|
+
de as v,
|
|
961
|
+
ue as w
|
|
959
962
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var G=Object.defineProperty,X=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var j=Object.getOwnPropertySymbols;var tt=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var L=(t,e,r)=>e in t?G(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))tt.call(e,r)&&L(t,r,e[r]);if(j)for(var r of j(e))et.call(e,r)&&L(t,r,e[r]);return t},m=(t,e)=>X(t,Z(e));const n=require("./derive-chart-family-
|
|
1
|
+
"use strict";var G=Object.defineProperty,X=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var j=Object.getOwnPropertySymbols;var tt=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var L=(t,e,r)=>e in t?G(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))tt.call(e,r)&&L(t,r,e[r]);if(j)for(var r of j(e))et.call(e,r)&&L(t,r,e[r]);return t},m=(t,e)=>X(t,Z(e));const n=require("./derive-chart-family-BsbFdcgd.cjs");class P extends n.DimensionalElement{constructor(e,r){var i;super((i=e.jaql.title)!==null&&i!==void 0?i:"",r),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=n.getSortType(e.jaql.sort):delete this.sortType,this.skipValidation=!0}get id(){return this.expression}jaql(e){return e===!0?this.metadataItem.jaql:this.metadataItem}serialize(){const e=super.serialize();return e.__serializable="JaqlElement",e.metadataItem=this.metadataItem,e.type=this.type,e}}const rt={text:n.MetadataTypes.TextAttribute,numeric:n.MetadataTypes.NumericAttribute,datetime:n.MetadataTypes.DateLevel};function it(t){var e;return new P(t,(e=rt[t.jaql.datatype])!==null&&e!==void 0?e:"numeric")}function B(t){const{jaql:e}=t;if(e.formula)return n.createCalculatedMeasureHelper(e);const r=n.DimensionalLevelAttribute.translateJaqlToGranularity(e);return"agg"in e&&e.dim&&e.datatype?n.createMeasureHelper({expression:e.dim,dataType:e.datatype,agg:e.agg||"",granularity:r,format:void 0,sort:e.sort,title:e.title,dataSource:e.datasource}):e.dim&&e.datatype?n.createAttributeHelper({expression:e.dim,dataType:e.datatype,granularity:r,sort:e.sort,title:e.title,panel:t.panel,dataSource:e.datasource}):it(t)}const at={jaql:{datasource:{title:"",type:"elasticube"},metadata:[]},queryTitle:"",chartRecommendations:{}},st={model:"",metadata:[],chart:{},queryTitle:""},nt=t=>"widgetProps"in t,k=t=>"dashboardOid"in t&&"widgetOid"in t,ot=t=>"dashboardProps"in t,lt=t=>"dashboardOid"in t;function dt(t){return t.replace(/\s+/g,"-").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ut(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ct(t){const e=/\[(.+?)\s\(Calendar\)\]/;return t.replace(e,"[$1]").trim()}function pt(t){if(t)if(t.metadata){if(!t.model)throw new n.TranslatableError("errors.missingModelTitle")}else throw new n.TranslatableError("errors.missingMetadata");else throw new n.TranslatableError("errors.emptyModel");return t}function mt(t){return!t||!t.jaql.datasource.title||!t.jaql.metadata.length}function _(t){if(![...n.ALL_CHART_TYPES,"pivot","pivot2"].includes(t))throw new n.TranslatableError("errors.chartTypeNotSupported",{chartType:t})}function gt(t){return"widgetType"in t&&t.widgetType==="pivot"}function h(t){var e;return"column"in t&&((e=t.column)==null?void 0:e.expression)&&/\(.*\)/.test(t.column.expression)}function w(t){const e="measures"in t&&c(t.measures)||"values"in t&&c(t.values);return gt(t)?"values"in t.dataOptions&&c(t.dataOptions.values):"chartType"in t?t.chartType==="indicator"?"value"in t.dataOptions&&c(t.dataOptions.value)||"secondary"in t.dataOptions&&c(t.dataOptions.secondary):t.chartType==="table"?!("columns"in t.dataOptions)||!c(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&&c(t.dataOptions.geo)&&"color"in t.dataOptions&&c(t.dataOptions.color):"value"in t.dataOptions&&c(t.dataOptions.value):e}function c(t){return Array.isArray(t)&&t.length>0}function yt(t){const e=t.split(`
|
|
2
2
|
`);for(let r=0;r<e.length-1;r++)if(e[r].trim()===""){const i=e[r+1].trim();if(i.startsWith("import *")||i.startsWith("import {")){e.splice(r,1);break}}return e.join(`
|
|
3
3
|
`)}const ft={react:{baseChartTmpl:`import { {{componentString}} } from '@sisense/sdk-ui';
|
|
4
4
|
{{extraImportsString}}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Sisense",
|
|
12
12
|
"Compose SDK"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.2.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -49,17 +49,20 @@
|
|
|
49
49
|
"author": "Sisense",
|
|
50
50
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@dnd-kit/core": "^6.3.1",
|
|
53
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
54
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
52
55
|
"@emotion/cache": "^11.10.5",
|
|
53
56
|
"@emotion/react": "^11.10.5",
|
|
54
57
|
"@emotion/styled": "^11.10.5",
|
|
55
58
|
"@mui/material": "^5.16.7",
|
|
56
59
|
"@mui/system": "^5.16.7",
|
|
57
|
-
"@sisense/sdk-common": "
|
|
58
|
-
"@sisense/sdk-data": "
|
|
59
|
-
"@sisense/sdk-pivot-client": "
|
|
60
|
-
"@sisense/sdk-query-client": "
|
|
61
|
-
"@sisense/sdk-rest-client": "
|
|
62
|
-
"@sisense/sdk-tracking": "
|
|
60
|
+
"@sisense/sdk-common": "2.2.0",
|
|
61
|
+
"@sisense/sdk-data": "2.2.0",
|
|
62
|
+
"@sisense/sdk-pivot-client": "2.2.0",
|
|
63
|
+
"@sisense/sdk-query-client": "2.2.0",
|
|
64
|
+
"@sisense/sdk-rest-client": "2.2.0",
|
|
65
|
+
"@sisense/sdk-tracking": "2.2.0",
|
|
63
66
|
"@sisense/sisense-charts": "5.1.1",
|
|
64
67
|
"@tanstack/react-query": "4.36.1",
|
|
65
68
|
"classnames": "^2.3.2",
|