@sisense/sdk-ui 1.30.0 → 1.31.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 +4 -2
- package/dist/ai.js +6 -4
- package/dist/analytics-composer.cjs +32 -32
- package/dist/analytics-composer.js +303 -302
- package/dist/{derive-chart-family-B2J2kMs6.js → derive-chart-family-D3iN--j2.js} +726 -700
- package/dist/{derive-chart-family-Bmg9hQGc.cjs → derive-chart-family-Tt7cIUck.cjs} +45 -45
- package/dist/index.cjs +110 -85
- package/dist/index.js +6896 -6214
- package/dist/packages/sdk-ui/src/ai/api/types.d.ts +5 -0
- package/dist/packages/sdk-ui/src/ai/use-get-query-recommendations.d.ts +1 -1
- package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +13 -6
- package/dist/packages/sdk-ui/src/chart-data/chart-data-service.d.ts +1 -13
- package/dist/packages/sdk-ui/src/common/components/popper.d.ts +9 -0
- package/dist/packages/sdk-ui/src/common/hooks/use-was-modified.d.ts +5 -0
- package/dist/packages/sdk-ui/src/const.d.ts +1 -0
- package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/criteria-filter-operations.d.ts +19 -19
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/input.d.ts +9 -3
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/scroll-wrapper.d.ts +13 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/base.d.ts +4 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/searchable-multi-select.d.ts +3 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/searchable-single-select.d.ts +3 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/types.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/small-loader.d.ts +1 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/constants.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/filter-editor-container.d.ts +5 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/filter-editor-numerical.d.ts +8 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/filter-editor-textual.d.ts +8 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/hooks/use-get-attribute-stats.d.ts +28 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/members-section.d.ts +5 -1
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-condition-section/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-condition-section/numeric-condition-section.d.ts +15 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-condition-section/types.d.ts +16 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-condition-section/utils.d.ts +7 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-range-section.d.ts +11 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/text-condition-section.d.ts +6 -2
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/utils.d.ts +4 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/utils.d.ts +1 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/equal-icon.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/greater-than-icon.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/greater-than-or-equal-icon.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/index.d.ts +6 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/not-equal-icon.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/smaller-than-icon.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/smaller-than-or-equal-icon.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/hooks/use-get-filter-members.d.ts +21 -1
- package/dist/packages/sdk-ui/src/index-typedoc.d.ts +28 -0
- package/dist/packages/sdk-ui/src/query-execution/types.d.ts +10 -1
- package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +11 -0
- package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +22 -0
- package/dist/packages/sdk-ui/src/utils/is-numeric-string.d.ts +10 -0
- package/dist/{useQuery-1ixYW8qO.js → use-common-filters-CHBXz5rL.js} +5560 -5555
- package/dist/{useQuery-Ctzmd-JM.cjs → use-common-filters-Dd-gOMfB.cjs} +129 -129
- package/dist/widget-composer-BHf4pbvI.cjs +311 -0
- package/dist/{widget-composer-Ch2kYMok.js → widget-composer-BrQ6SrZ6.js} +212 -202
- package/package.json +8 -7
- package/dist/widget-composer-CdxKUwZf.cjs +0 -308
|
@@ -1,86 +1,90 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var J = Object.defineProperty, V = Object.defineProperties;
|
|
2
|
+
var Z = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var W = Object.getOwnPropertySymbols;
|
|
4
|
+
var H = Object.prototype.hasOwnProperty, X = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var I = (e, t, r) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, d = (e, t) => {
|
|
5
6
|
for (var r in t || (t = {}))
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var r of
|
|
9
|
-
|
|
7
|
+
H.call(t, r) && I(e, r, t[r]);
|
|
8
|
+
if (W)
|
|
9
|
+
for (var r of W(t))
|
|
10
|
+
X.call(t, r) && I(e, r, t[r]);
|
|
10
11
|
return e;
|
|
11
|
-
};
|
|
12
|
-
import {
|
|
13
|
-
class
|
|
12
|
+
}, T = (e, t) => V(e, Z(t));
|
|
13
|
+
import { cM as $, h as G, M as E, T as m, cN as ee, cO as h, cP as j, ae as te, Z as re, ag as ae, m as C, cQ as ie, a4 as w, P as se, B as ne, aW as q } from "./derive-chart-family-D3iN--j2.js";
|
|
14
|
+
class k extends $ {
|
|
14
15
|
constructor(t, r) {
|
|
15
16
|
var a;
|
|
16
|
-
super((a = t.jaql.title) !== null && a !== void 0 ? a : "", r), this.expression = t.jaql.dim || t.jaql.formula, this.metadataItem = t, t.jaql.agg ? this.aggregation = t.jaql.agg : delete this.aggregation, t.jaql.formula ? this.formula = t.jaql.formula : delete this.formula, t.jaql.sort ? this.sortType =
|
|
17
|
+
super((a = t.jaql.title) !== null && a !== void 0 ? a : "", r), this.expression = t.jaql.dim || t.jaql.formula, this.metadataItem = t, t.jaql.agg ? this.aggregation = t.jaql.agg : delete this.aggregation, t.jaql.formula ? this.formula = t.jaql.formula : delete this.formula, t.jaql.sort ? this.sortType = G(t.jaql.sort) : delete this.sortType, this.skipValidation = !0;
|
|
17
18
|
}
|
|
18
19
|
get id() {
|
|
19
20
|
return this.expression;
|
|
20
21
|
}
|
|
21
|
-
jaql() {
|
|
22
|
-
return this.metadataItem;
|
|
22
|
+
jaql(t) {
|
|
23
|
+
return t === !0 ? this.metadataItem.jaql : this.metadataItem;
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
const
|
|
26
|
-
text:
|
|
27
|
-
numeric:
|
|
28
|
-
datetime:
|
|
26
|
+
const oe = {
|
|
27
|
+
text: E.TextAttribute,
|
|
28
|
+
numeric: E.NumericAttribute,
|
|
29
|
+
datetime: E.DateLevel
|
|
29
30
|
};
|
|
30
|
-
function
|
|
31
|
+
function A(e) {
|
|
31
32
|
var t;
|
|
32
|
-
return new
|
|
33
|
+
return new k(e, (t = oe[e.jaql.datatype]) !== null && t !== void 0 ? t : "numeric");
|
|
33
34
|
}
|
|
34
|
-
const
|
|
35
|
+
const Ne = {
|
|
35
36
|
jaql: { datasource: { title: "" }, metadata: [] },
|
|
36
|
-
widgetProps: void 0,
|
|
37
37
|
queryTitle: "",
|
|
38
38
|
chartRecommendations: {}
|
|
39
|
-
},
|
|
39
|
+
}, _e = {
|
|
40
40
|
model: "",
|
|
41
41
|
metadata: [],
|
|
42
42
|
chart: {},
|
|
43
43
|
queryTitle: ""
|
|
44
|
-
},
|
|
45
|
-
function
|
|
44
|
+
}, Re = (e) => "widgetProps" in e, le = (e) => "dashboardOid" in e && "widgetOid" in e;
|
|
45
|
+
function de(e) {
|
|
46
46
|
return e.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function ze(e) {
|
|
49
49
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Ue(e) {
|
|
52
52
|
const t = /\[(.+?)\s\(Calendar\)\]/;
|
|
53
53
|
return e.replace(t, "[$1]").trim();
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function Ke(e) {
|
|
56
56
|
if (e)
|
|
57
57
|
if (e.metadata) {
|
|
58
58
|
if (!e.model)
|
|
59
|
-
throw new
|
|
59
|
+
throw new m("errors.missingModelTitle");
|
|
60
60
|
} else
|
|
61
|
-
throw new
|
|
61
|
+
throw new m("errors.missingMetadata");
|
|
62
62
|
else
|
|
63
|
-
throw new
|
|
63
|
+
throw new m("errors.emptyModel");
|
|
64
64
|
return e;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function ue(e) {
|
|
67
67
|
return !e || !e.jaql.datasource.title || !e.jaql.metadata.length;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
if (![...
|
|
71
|
-
throw new
|
|
69
|
+
function B(e) {
|
|
70
|
+
if (![...ee, "pivot", "pivot2"].includes(e))
|
|
71
|
+
throw new m("errors.chartTypeNotSupported", { chartType: e });
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function ce(e) {
|
|
74
74
|
return "widgetType" in e && e.widgetType === "pivot";
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
return
|
|
76
|
+
function p(e) {
|
|
77
|
+
var t;
|
|
78
|
+
return "column" in e && ((t = e.column) == null ? void 0 : t.expression) && /\(.*\)/.test(e.column.expression);
|
|
79
|
+
}
|
|
80
|
+
function F(e) {
|
|
81
|
+
const t = "measures" in e && o(e.measures) || "values" in e && o(e.values);
|
|
82
|
+
return ce(e) ? "values" in e.dataOptions && o(e.dataOptions.values) : "chartType" in e ? e.chartType === "indicator" ? "value" in e.dataOptions && o(e.dataOptions.value) || "secondary" in e.dataOptions && o(e.dataOptions.secondary) : e.chartType === "table" ? !("columns" in e.dataOptions) || !o(e.dataOptions.columns) ? !1 : e.dataOptions.columns.some((a) => p(a)) : e.chartType === "boxplot" ? !1 : e.chartType === "scatter" ? "x" in e.dataOptions && e.dataOptions.x !== void 0 && p(e.dataOptions.x) || "y" in e.dataOptions && e.dataOptions.y !== void 0 && p(e.dataOptions.y) || "size" in e.dataOptions && e.dataOptions.size !== void 0 : e.chartType === "scattermap" ? "colorBy" in e.dataOptions && e.dataOptions.colorBy !== void 0 && p(e.dataOptions.colorBy) || "details" in e.dataOptions && e.dataOptions.details !== void 0 && p(e.dataOptions.details) || "size" in e.dataOptions && e.dataOptions.size !== void 0 && p(e.dataOptions.size) : e.chartType === "areamap" ? "geo" in e.dataOptions && o(e.dataOptions.geo) && "color" in e.dataOptions && o(e.dataOptions.color) : "value" in e.dataOptions && o(e.dataOptions.value) : t;
|
|
79
83
|
}
|
|
80
|
-
function
|
|
84
|
+
function o(e) {
|
|
81
85
|
return Array.isArray(e) && e.length > 0;
|
|
82
86
|
}
|
|
83
|
-
function
|
|
87
|
+
function me(e) {
|
|
84
88
|
const t = e.split(`
|
|
85
89
|
`);
|
|
86
90
|
for (let r = 0; r < t.length - 1; r++)
|
|
@@ -94,7 +98,7 @@ function oe(e) {
|
|
|
94
98
|
return t.join(`
|
|
95
99
|
`);
|
|
96
100
|
}
|
|
97
|
-
const
|
|
101
|
+
const ge = {
|
|
98
102
|
react: {
|
|
99
103
|
baseChartTmpl: `import { {{componentString}} } from '@sisense/sdk-ui';
|
|
100
104
|
{{extraImportsString}}
|
|
@@ -183,6 +187,7 @@ const CodeExample = () => {
|
|
|
183
187
|
export default CodeExample;
|
|
184
188
|
`,
|
|
185
189
|
executePivotQueryTmpl: `import { useExecutePivotQuery, ExecutePivotQueryParams } from '@sisense/sdk-ui';
|
|
190
|
+
{{extraImportsString}}
|
|
186
191
|
import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
187
192
|
|
|
188
193
|
const CodeExample = () => {
|
|
@@ -190,6 +195,7 @@ const CodeExample = () => {
|
|
|
190
195
|
dataSource: DM.DataSource,
|
|
191
196
|
rows: {{rowsString}},
|
|
192
197
|
values: {{valuesString}},
|
|
198
|
+
filters: {{filtersString}},
|
|
193
199
|
}
|
|
194
200
|
|
|
195
201
|
const { data, isLoading, isError, error } = useExecutePivotQuery(pivotQueryProps);
|
|
@@ -219,6 +225,7 @@ export default function CodeExample() {
|
|
|
219
225
|
title={'{{titleString}}'}
|
|
220
226
|
dataSource={DM.DataSource}
|
|
221
227
|
dataOptions={ {{dataOptionsString}} }
|
|
228
|
+
filters={ {{filtersString}} }
|
|
222
229
|
/>
|
|
223
230
|
);
|
|
224
231
|
}`
|
|
@@ -421,130 +428,131 @@ const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
|
421
428
|
executePivotQueryTmpl: "Not implemented yet",
|
|
422
429
|
pivotTableWidgetTmpl: "Not implemented yet"
|
|
423
430
|
}
|
|
424
|
-
},
|
|
431
|
+
}, N = (e, t) => ge[t][e].replace(
|
|
425
432
|
/{{(.*?)Tmpl}}/g,
|
|
426
|
-
(a,
|
|
427
|
-
),
|
|
428
|
-
const a =
|
|
429
|
-
return
|
|
430
|
-
},
|
|
431
|
-
`,
|
|
433
|
+
(a, i) => N(`${i}Tmpl`, t)
|
|
434
|
+
), pe = (e, t) => e.replace(/{{(.*?)}}/g, (r, a) => a in t ? t[a] : (console.warn(`Placeholder ${a} not found in data`), r)), D = (e, t, r = "react") => {
|
|
435
|
+
const a = N(e, r);
|
|
436
|
+
return me(pe(a, t));
|
|
437
|
+
}, x = `
|
|
438
|
+
`, M = "UNKNOWN", fe = (e, t) => {
|
|
432
439
|
let r = "";
|
|
433
440
|
return r += `measureFactory.customFormula(
|
|
434
|
-
`, r += " ".repeat(t), r += ` '${
|
|
441
|
+
`, r += " ".repeat(t), r += ` '${h(e.title)}',
|
|
435
442
|
`, r += " ".repeat(t), r += ` '${e.formula}',
|
|
436
443
|
`, r += " ".repeat(t), r += ` {
|
|
437
|
-
`, Object.entries(e.context).forEach(([a,
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
444
|
+
`, Object.entries(e.context).forEach(([a, i]) => {
|
|
445
|
+
const s = j(
|
|
446
|
+
i.table || M,
|
|
447
|
+
i.column || M,
|
|
441
448
|
void 0,
|
|
442
449
|
"DM"
|
|
443
450
|
);
|
|
444
|
-
r += " ".repeat(t), r += ` '${a.slice(1, -1)}': ${
|
|
451
|
+
r += " ".repeat(t), r += ` '${a.slice(1, -1)}': ${s},
|
|
445
452
|
`;
|
|
446
453
|
}), r += " ".repeat(t), r += ` }
|
|
447
454
|
`, r += " ".repeat(t), r += ")", r;
|
|
448
|
-
},
|
|
449
|
-
const { level:
|
|
455
|
+
}, ye = (e) => {
|
|
456
|
+
const { level: t, table: r, column: a, agg: i, title: s } = e;
|
|
450
457
|
let n;
|
|
451
|
-
return
|
|
458
|
+
return r && a && (n = j(r, a, t, "DM")), i && r && a && s && (n = `measureFactory.${te.aggregationFromJAQL(
|
|
452
459
|
i
|
|
453
|
-
)}(${n}, '${
|
|
454
|
-
},
|
|
455
|
-
const r = e.jaql().jaql;
|
|
456
|
-
return "formula" in r ?
|
|
457
|
-
},
|
|
460
|
+
)}(${n}, '${h(s)}')`), n || M;
|
|
461
|
+
}, he = (e, t) => {
|
|
462
|
+
const r = e.jaql(!1).jaql;
|
|
463
|
+
return "formula" in r ? fe(r, t) : ye(r);
|
|
464
|
+
}, f = (e, t = 0, r = !1) => {
|
|
458
465
|
if (!e)
|
|
459
466
|
return "";
|
|
460
467
|
if (typeof e == "string")
|
|
461
|
-
return `'${
|
|
462
|
-
if (e instanceof
|
|
463
|
-
return
|
|
464
|
-
if (e instanceof
|
|
468
|
+
return `'${h(e)}'`;
|
|
469
|
+
if (e instanceof k)
|
|
470
|
+
return he(e, t);
|
|
471
|
+
if (e instanceof $)
|
|
465
472
|
return e.composeCode || "";
|
|
466
473
|
let a = "";
|
|
467
|
-
return Array.isArray(e) ? a += `[${e.map((
|
|
468
|
-
r && (
|
|
474
|
+
return Array.isArray(e) ? a += `[${e.map((i) => f(i, t + 2))}${e.length ? x + " ".repeat(t + 2) : ""}]` : (a += `{${x}`, Object.entries(e).forEach(([i, s]) => {
|
|
475
|
+
r && (i = `'${h(i)}'`), a += " ".repeat(t + 2), Array.isArray(s) ? a += `${i}: [${s.map((n) => f(n, t + 4, r))}${s.length ? x + " ".repeat(t + 2) : ""}]` : typeof s == "object" ? a += `${i}: ${f(s, t + 2, r)}` : ["number", "boolean", "undefined", null].includes(typeof s) ? a += `${i}: ${s}` : a += `${i}: '${h(s)}'`, a += `,${x}`;
|
|
469
476
|
}), a += " ".repeat(t), a += "}"), a;
|
|
470
477
|
};
|
|
471
|
-
function
|
|
472
|
-
return
|
|
478
|
+
function Se(e) {
|
|
479
|
+
return f(e, 6);
|
|
473
480
|
}
|
|
474
|
-
function
|
|
481
|
+
function _(e) {
|
|
475
482
|
if (!e)
|
|
476
|
-
throw new
|
|
483
|
+
throw new m("errors.undefinedDataSource");
|
|
477
484
|
let t;
|
|
478
|
-
return typeof e == "object" && "title" in e ? t = e.title : t = e,
|
|
485
|
+
return typeof e == "object" && "title" in e ? t = e.title : t = e, de(t);
|
|
479
486
|
}
|
|
480
|
-
function
|
|
487
|
+
function R(e, t = !0) {
|
|
481
488
|
const r = [];
|
|
482
|
-
return t && r.push("measureFactory"),
|
|
489
|
+
return t && r.push("measureFactory"), o(e) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
|
|
483
490
|
}
|
|
484
|
-
const
|
|
485
|
-
`,
|
|
491
|
+
const P = `
|
|
492
|
+
`, Oe = (e, t) => {
|
|
486
493
|
if (e.composeCode)
|
|
487
|
-
return `${
|
|
494
|
+
return `${P}${" ".repeat(t)}${e.composeCode}`;
|
|
488
495
|
const r = e.jaql().jaql;
|
|
489
|
-
return `${
|
|
496
|
+
return `${P}${" ".repeat(t)}filterFactory.customFilter(${f(
|
|
490
497
|
r,
|
|
491
498
|
t,
|
|
492
499
|
!0
|
|
493
500
|
)})`;
|
|
494
|
-
},
|
|
501
|
+
}, ve = (e, t = 0) => {
|
|
495
502
|
if (!e)
|
|
496
503
|
return "";
|
|
497
504
|
let r = "";
|
|
498
|
-
return r += `[${e.map((a) =>
|
|
505
|
+
return r += `[${e.map((a) => Oe(a, t + 2))}${e.length ? `
|
|
499
506
|
` + " ".repeat(t + 2) : ""}]`, r;
|
|
500
|
-
},
|
|
507
|
+
}, z = (e) => {
|
|
501
508
|
if (!e)
|
|
502
509
|
return "";
|
|
503
510
|
if (Array.isArray(e))
|
|
504
|
-
return
|
|
505
|
-
throw new
|
|
506
|
-
},
|
|
507
|
-
const a =
|
|
511
|
+
return ve(e, 6);
|
|
512
|
+
throw new m("errors.filterRelationsNotSupported");
|
|
513
|
+
}, Te = ["executeQueryByWidgetIdTmpl", "widgetByIdTmpl"], xe = "chartWidgetTmpl", be = "pivotTableWidgetTmpl", Ee = (e) => e, Ce = (e, t, r) => {
|
|
514
|
+
const a = F(e), i = {
|
|
508
515
|
titleString: e.title,
|
|
509
|
-
dataSourceString:
|
|
510
|
-
chartTypeString:
|
|
511
|
-
dataOptionsString:
|
|
512
|
-
filtersString:
|
|
516
|
+
dataSourceString: _(e.dataSource),
|
|
517
|
+
chartTypeString: Ee(e.chartType),
|
|
518
|
+
dataOptionsString: Se(e.dataOptions),
|
|
519
|
+
filtersString: z(e.filters),
|
|
513
520
|
componentString: "ChartWidget",
|
|
514
|
-
extraImportsString:
|
|
521
|
+
extraImportsString: R(e.filters || [], a)
|
|
515
522
|
};
|
|
516
|
-
return
|
|
517
|
-
},
|
|
518
|
-
const a =
|
|
523
|
+
return D(r, i, t);
|
|
524
|
+
}, we = (e, t, r) => {
|
|
525
|
+
const a = F(e), i = {
|
|
519
526
|
titleString: e.title,
|
|
520
|
-
dataSourceString:
|
|
521
|
-
dataOptionsString:
|
|
527
|
+
dataSourceString: _(e.dataSource),
|
|
528
|
+
dataOptionsString: f(e.dataOptions),
|
|
529
|
+
filtersString: z(e.filters),
|
|
522
530
|
componentString: "PivotTableWidget",
|
|
523
|
-
extraImportsString:
|
|
531
|
+
extraImportsString: R(e.filters || [], a)
|
|
524
532
|
};
|
|
525
|
-
return
|
|
526
|
-
},
|
|
533
|
+
return D(r, i, t);
|
|
534
|
+
}, Me = ({
|
|
527
535
|
dashboardOid: e,
|
|
528
536
|
widgetOid: t,
|
|
529
537
|
uiFramework: r = "react",
|
|
530
538
|
chartType: a = "table",
|
|
531
|
-
includeChart:
|
|
539
|
+
includeChart: i = !0
|
|
532
540
|
}) => {
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
return
|
|
536
|
-
},
|
|
541
|
+
B(a);
|
|
542
|
+
const s = { dashboardOid: e, widgetOid: t }, n = Te[Number(i)];
|
|
543
|
+
return D(n, s, r);
|
|
544
|
+
}, De = ({
|
|
537
545
|
widgetProps: e,
|
|
538
546
|
uiFramework: t = "react"
|
|
539
547
|
}) => {
|
|
540
|
-
if (
|
|
541
|
-
return
|
|
542
|
-
if (
|
|
543
|
-
return
|
|
544
|
-
throw new
|
|
545
|
-
},
|
|
546
|
-
dataOptions: { columns: e.map(
|
|
547
|
-
}),
|
|
548
|
+
if (re(e))
|
|
549
|
+
return B(e.chartType), Ce(e, t, xe);
|
|
550
|
+
if (ae(e))
|
|
551
|
+
return we(e, t, be);
|
|
552
|
+
throw new m("errors.otherWidgetTypesNotSupported");
|
|
553
|
+
}, We = (e) => ({
|
|
554
|
+
dataOptions: { columns: e.map(A) }
|
|
555
|
+
}), Ie = Object.freeze({
|
|
548
556
|
convolution: {
|
|
549
557
|
enabled: !0,
|
|
550
558
|
selectedConvolutionType: "bySlicesCount",
|
|
@@ -563,73 +571,74 @@ const W = `
|
|
|
563
571
|
xAxis: {
|
|
564
572
|
gridLines: !1
|
|
565
573
|
}
|
|
566
|
-
}),
|
|
574
|
+
}), L = Object.freeze({
|
|
567
575
|
line: "line/spline",
|
|
568
576
|
pie: "pie/donut",
|
|
569
577
|
bar: "bar/stacked",
|
|
570
578
|
column: "column/stackedcolumn"
|
|
571
|
-
}),
|
|
572
|
-
const
|
|
573
|
-
const [
|
|
574
|
-
return
|
|
575
|
-
var
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
579
|
+
}), qe = (e, t, r) => {
|
|
580
|
+
const a = e.reduce((s, n) => (s[n.jaql.title] = n, s), {}), i = Object.entries(r).reduce((s, n) => {
|
|
581
|
+
const [u, y] = n;
|
|
582
|
+
return s[`${u}`] = Array.isArray(y) ? y.map((b) => {
|
|
583
|
+
var S, O;
|
|
584
|
+
const l = w(b);
|
|
585
|
+
delete l.enabled;
|
|
586
|
+
const c = a[l.column.name];
|
|
587
|
+
if (!c)
|
|
588
|
+
return { column: { type: "", name: l.column.name } };
|
|
589
|
+
const g = A(c);
|
|
590
|
+
if (c.panel === "measures")
|
|
591
|
+
return T(d({}, l), {
|
|
592
|
+
column: g
|
|
593
|
+
});
|
|
594
|
+
if (se(g.type)) {
|
|
595
|
+
const v = (O = (S = c.format) == null ? void 0 : S.mask) == null ? void 0 : O[c.jaql.level];
|
|
596
|
+
if (v)
|
|
597
|
+
return T(d({}, l), {
|
|
598
|
+
column: g,
|
|
599
|
+
dateFormat: v
|
|
600
|
+
});
|
|
592
601
|
}
|
|
593
|
-
return
|
|
594
|
-
}) :
|
|
602
|
+
return T(d({}, l), { column: g });
|
|
603
|
+
}) : y, s;
|
|
595
604
|
}, {});
|
|
596
|
-
switch (
|
|
605
|
+
switch (t) {
|
|
597
606
|
case "cartesian":
|
|
598
|
-
return
|
|
607
|
+
return d({
|
|
599
608
|
category: [],
|
|
600
609
|
value: [],
|
|
601
610
|
breakBy: []
|
|
602
611
|
}, i);
|
|
603
612
|
case "categorical":
|
|
604
|
-
return
|
|
613
|
+
return d({
|
|
605
614
|
category: [],
|
|
606
615
|
value: []
|
|
607
616
|
}, i);
|
|
608
617
|
case "scatter":
|
|
609
|
-
return Object.keys(i).forEach((
|
|
610
|
-
i[`${
|
|
618
|
+
return Object.keys(i).forEach((s) => {
|
|
619
|
+
i[`${s}`] = i[`${s}`][0];
|
|
611
620
|
}), i;
|
|
612
621
|
case "scattermap":
|
|
613
|
-
return Object.keys(i).forEach((
|
|
614
|
-
|
|
622
|
+
return Object.keys(i).forEach((s) => {
|
|
623
|
+
s !== "geo" && (i[`${s}`] = i[`${s}`][0]);
|
|
615
624
|
}), i;
|
|
616
625
|
case "table":
|
|
617
|
-
return Object.keys(i).length === 0 ?
|
|
626
|
+
return Object.keys(i).length === 0 ? We(e).dataOptions : i;
|
|
618
627
|
case "boxplot":
|
|
619
628
|
case "areamap":
|
|
620
629
|
case "indicator":
|
|
621
630
|
default:
|
|
622
631
|
return i;
|
|
623
632
|
}
|
|
624
|
-
},
|
|
625
|
-
var r, a,
|
|
626
|
-
return t === "x" ? (a = (r = e.axesMapping.category) != null ? r : e.axesMapping.x) == null ? void 0 : a.map((
|
|
627
|
-
},
|
|
628
|
-
const a =
|
|
629
|
-
let
|
|
630
|
-
return r && t.chartType in
|
|
631
|
-
|
|
632
|
-
subtype:
|
|
633
|
+
}, Q = (e, t) => {
|
|
634
|
+
var r, a, i, s;
|
|
635
|
+
return t === "x" ? (a = (r = e.axesMapping.category) != null ? r : e.axesMapping.x) == null ? void 0 : a.map((n) => w(n).column.name).join(", ") : (s = (i = e.axesMapping.value) != null ? i : e.axesMapping.y) == null ? void 0 : s.map((n) => w(n).column.name).join(", ");
|
|
636
|
+
}, Pe = (e, t, r = !0) => {
|
|
637
|
+
const { chartFamily: a, axesMapping: i = {}, styleOptions: s = {} } = t, n = qe(e, a, i);
|
|
638
|
+
let u;
|
|
639
|
+
return r && t.chartType in L ? u = C(
|
|
640
|
+
C(Ie, {
|
|
641
|
+
subtype: L[t.chartType]
|
|
633
642
|
}),
|
|
634
643
|
{
|
|
635
644
|
legend: {
|
|
@@ -639,88 +648,89 @@ const W = `
|
|
|
639
648
|
yAxis: {
|
|
640
649
|
title: {
|
|
641
650
|
enabled: !0,
|
|
642
|
-
text:
|
|
651
|
+
text: Q(t, "y")
|
|
643
652
|
}
|
|
644
653
|
},
|
|
645
654
|
xAxis: {
|
|
646
655
|
title: {
|
|
647
656
|
enabled: !0,
|
|
648
|
-
text:
|
|
657
|
+
text: Q(t, "x")
|
|
649
658
|
}
|
|
650
659
|
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
660
|
+
},
|
|
661
|
+
s
|
|
662
|
+
) : u = C(ie(), s), {
|
|
663
|
+
dataOptions: n,
|
|
664
|
+
chartStyleOptions: u
|
|
655
665
|
};
|
|
656
|
-
},
|
|
666
|
+
}, Le = (e) => "chartType" in e ? e : {
|
|
657
667
|
chartType: "table",
|
|
658
668
|
chartFamily: "table",
|
|
659
669
|
axesMapping: {}
|
|
660
|
-
},
|
|
670
|
+
}, Qe = (e) => e.map((t) => ne(t.jaql)), $e = (e) => e.reduce(
|
|
661
671
|
(t, r) => {
|
|
662
|
-
if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(
|
|
663
|
-
const a =
|
|
672
|
+
if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(q(r)), r.panel !== "scope") {
|
|
673
|
+
const a = q(r);
|
|
664
674
|
delete a.jaql.filter, t.metadataColumns.push(a);
|
|
665
675
|
}
|
|
666
676
|
return t;
|
|
667
677
|
},
|
|
668
678
|
{ metadataColumns: [], metadataFilters: [] }
|
|
669
|
-
),
|
|
670
|
-
if (!
|
|
679
|
+
), je = (e, t) => {
|
|
680
|
+
if (!ue(e))
|
|
671
681
|
try {
|
|
672
|
-
const { useCustomizedStyleOptions: r = !1 } = t || {}, { jaql: a, chartRecommendations:
|
|
673
|
-
metadata:
|
|
674
|
-
datasource: { title:
|
|
675
|
-
} = a,
|
|
682
|
+
const { useCustomizedStyleOptions: r = !1 } = t || {}, { jaql: a, chartRecommendations: i, queryTitle: s } = e, {
|
|
683
|
+
metadata: n,
|
|
684
|
+
datasource: { title: u, id: y, type: b = "elasticube" }
|
|
685
|
+
} = a, l = Le(i), c = l.chartType.toLowerCase(), g = {
|
|
676
686
|
cornerRadius: "Small",
|
|
677
687
|
header: {
|
|
678
688
|
// remove info button and render empty toolbar instead
|
|
679
689
|
renderToolbar: () => null
|
|
680
690
|
}
|
|
681
|
-
}, { metadataColumns:
|
|
682
|
-
|
|
683
|
-
|
|
691
|
+
}, { metadataColumns: S, metadataFilters: O } = $e(n), v = Qe(O), { dataOptions: U, chartStyleOptions: K } = Pe(
|
|
692
|
+
S,
|
|
693
|
+
l,
|
|
684
694
|
r
|
|
685
|
-
),
|
|
695
|
+
), Y = d(d({}, K), g);
|
|
686
696
|
return {
|
|
687
697
|
widgetType: "chart",
|
|
688
|
-
id:
|
|
689
|
-
title:
|
|
690
|
-
chartType:
|
|
698
|
+
id: s,
|
|
699
|
+
title: s,
|
|
700
|
+
chartType: c,
|
|
691
701
|
dataSource: {
|
|
692
|
-
title:
|
|
693
|
-
id:
|
|
694
|
-
type:
|
|
702
|
+
title: u,
|
|
703
|
+
id: y,
|
|
704
|
+
type: b
|
|
695
705
|
},
|
|
696
|
-
dataOptions:
|
|
697
|
-
filters:
|
|
698
|
-
styleOptions:
|
|
706
|
+
dataOptions: U,
|
|
707
|
+
filters: v,
|
|
708
|
+
styleOptions: Y
|
|
699
709
|
};
|
|
700
710
|
} catch (r) {
|
|
701
711
|
console.error(r);
|
|
702
712
|
return;
|
|
703
713
|
}
|
|
704
|
-
},
|
|
714
|
+
}, ke = (e, t) => je(e, t), Ae = (e) => le(e) ? Me(e) : De(e), Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
705
715
|
__proto__: null,
|
|
706
|
-
toWidgetCode:
|
|
707
|
-
toWidgetProps:
|
|
716
|
+
toWidgetCode: Ae,
|
|
717
|
+
toWidgetProps: ke
|
|
708
718
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
709
719
|
export {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
720
|
+
_e as E,
|
|
721
|
+
F as a,
|
|
722
|
+
_ as b,
|
|
723
|
+
ze as c,
|
|
724
|
+
f as d,
|
|
725
|
+
z as e,
|
|
726
|
+
R as f,
|
|
727
|
+
D as g,
|
|
728
|
+
Ne as h,
|
|
729
|
+
Re as i,
|
|
730
|
+
le as j,
|
|
731
|
+
pe as p,
|
|
732
|
+
Ue as s,
|
|
733
|
+
ke as t,
|
|
734
|
+
Ke as v,
|
|
735
|
+
Ye as w
|
|
726
736
|
};
|