@sisense/sdk-ui 1.25.0 → 1.26.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 +53 -52
- package/dist/ai.js +934 -787
- package/dist/analytics-composer.cjs +38 -38
- package/dist/analytics-composer.js +475 -464
- package/dist/{derive-chart-family-C_c2ZQQd.cjs → derive-chart-family-DOmv279l.cjs} +19 -19
- package/dist/{derive-chart-family-BlFbAr2V.js → derive-chart-family-ZvvF5lty.js} +255 -246
- package/dist/index.cjs +42 -42
- package/dist/index.js +1817 -1767
- package/dist/packages/sdk-ui/src/ai/api/types.d.ts +6 -1
- package/dist/packages/sdk-ui/src/ai/icons/close-dialog-icon.d.ts +3 -1
- package/dist/packages/sdk-ui/src/ai/icons/sisense-logo.d.ts +2 -4
- package/dist/packages/sdk-ui/src/ai/use-chat-session.d.ts +2 -1
- package/dist/packages/sdk-ui/src/analytics-composer/common/utils.d.ts +1 -1
- package/dist/packages/sdk-ui/src/analytics-composer/execute-query/execute-query-composer.d.ts +8 -1
- package/dist/packages/sdk-ui/src/analytics-composer/execute-query/to-execute-query-code.d.ts +2 -1
- package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +8 -2
- package/dist/packages/sdk-ui/src/api/rest-api.d.ts +13 -1
- package/dist/packages/sdk-ui/src/chart/helpers/use-synced-data.d.ts +14 -1
- package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +9 -1
- package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +14 -2
- package/dist/useQuery-9lk4MNnb.cjs +889 -0
- package/dist/{useQuery-P9b5LtGq.js → useQuery-BtpTzoxI.js} +21289 -20599
- package/dist/widget-composer-DbpSzSub.cjs +298 -0
- package/dist/{widget-composer-DXM5t9rq.js → widget-composer-ygehKLLR.js} +229 -150
- package/package.json +7 -7
- package/dist/useQuery-BYxzPyc5.cjs +0 -870
- package/dist/widget-composer-DPsDPrFM.cjs +0 -237
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var E = Object.getOwnPropertySymbols;
|
|
3
|
+
var R = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var w = (e, t, r) => t in e ? _(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, f = (e, t) => {
|
|
5
5
|
for (var r in t || (t = {}))
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var r of
|
|
9
|
-
|
|
6
|
+
R.call(t, r) && w(e, r, t[r]);
|
|
7
|
+
if (E)
|
|
8
|
+
for (var r of E(t))
|
|
9
|
+
K.call(t, r) && w(e, r, t[r]);
|
|
10
10
|
return e;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
class
|
|
12
|
+
import { cZ as U, h as I, M as x, T as u, c_ as Y, c$ as W, a9 as z, ag as J, ae as V, m as C, d0 as Z, J as H, B as X, aT as D } from "./derive-chart-family-ZvvF5lty.js";
|
|
13
|
+
class Q extends U {
|
|
14
14
|
constructor(t, r) {
|
|
15
15
|
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 =
|
|
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 = I(t.jaql.sort) : delete this.sortType, this.skipValidation = !0;
|
|
17
17
|
}
|
|
18
18
|
get id() {
|
|
19
19
|
return this.expression;
|
|
@@ -22,36 +22,36 @@ class M extends k {
|
|
|
22
22
|
return this.metadataItem;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
text:
|
|
27
|
-
numeric:
|
|
28
|
-
datetime:
|
|
25
|
+
const G = {
|
|
26
|
+
text: x.TextAttribute,
|
|
27
|
+
numeric: x.NumericAttribute,
|
|
28
|
+
datetime: x.DateLevel
|
|
29
29
|
};
|
|
30
|
-
function
|
|
30
|
+
function P(e) {
|
|
31
31
|
var t;
|
|
32
|
-
return new
|
|
32
|
+
return new Q(e, (t = G[e.jaql.datatype]) !== null && t !== void 0 ? t : "numeric");
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const We = {
|
|
35
35
|
jaql: { datasource: { title: "" }, metadata: [] },
|
|
36
36
|
queryTitle: "",
|
|
37
37
|
chartRecommendations: {}
|
|
38
|
-
},
|
|
38
|
+
}, Qe = {
|
|
39
39
|
model: "",
|
|
40
40
|
metadata: [],
|
|
41
41
|
chart: {},
|
|
42
42
|
queryTitle: ""
|
|
43
|
-
},
|
|
44
|
-
function
|
|
43
|
+
}, Pe = (e) => "widgetProps" in e, ee = (e) => "dashboardOid" in e && "widgetOid" in e;
|
|
44
|
+
function te(e) {
|
|
45
45
|
return e.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Le(e) {
|
|
48
48
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function je(e) {
|
|
51
51
|
const t = /\[(.+?)\s\(Calendar\)\]/;
|
|
52
52
|
return e.replace(t, "[$1]").trim();
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Ae(e) {
|
|
55
55
|
if (e)
|
|
56
56
|
if (e.metadata) {
|
|
57
57
|
if (!e.model)
|
|
@@ -62,17 +62,17 @@ function Le(e) {
|
|
|
62
62
|
throw new u("errors.emptyModel");
|
|
63
63
|
return e;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function re(e) {
|
|
66
66
|
return !e || !e.jaql.datasource.title || !e.jaql.metadata.length;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function h(e) {
|
|
69
69
|
return e && e.replace(new RegExp("(?<!\\\\)'", "g"), "\\'");
|
|
70
70
|
}
|
|
71
71
|
function L(e) {
|
|
72
|
-
if (!
|
|
72
|
+
if (![...Y, "pivot", "pivot2"].includes(e))
|
|
73
73
|
throw new u("errors.chartTypeNotSupported", { chartType: e });
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const ae = {
|
|
76
76
|
react: {
|
|
77
77
|
baseChartTmpl: `import { {{componentString}} } from '@sisense/sdk-ui';
|
|
78
78
|
{{extraImportsString}}
|
|
@@ -110,7 +110,7 @@ export default CodeExample;
|
|
|
110
110
|
executeQueryByWidgetIdTmpl: `import { useExecuteQueryByWidgetId } from '@sisense/sdk-ui';
|
|
111
111
|
|
|
112
112
|
const CodeExample = () => {
|
|
113
|
-
const { data, isLoading, isError } = useExecuteQueryByWidgetId({
|
|
113
|
+
const { data, isLoading, isError, error } = useExecuteQueryByWidgetId({
|
|
114
114
|
widgetOid: "{{widgetOid}}",
|
|
115
115
|
dashboardOid: "{{dashboardOid}}"
|
|
116
116
|
});
|
|
@@ -119,7 +119,7 @@ const CodeExample = () => {
|
|
|
119
119
|
return <div>Loading...</div>;
|
|
120
120
|
}
|
|
121
121
|
if (isError) {
|
|
122
|
-
return <div>Error</div>;
|
|
122
|
+
return <div>Error: {error.message}</div>;
|
|
123
123
|
}
|
|
124
124
|
if (data) {
|
|
125
125
|
return <div>Total Rows: {data.rows.length}</div>;
|
|
@@ -143,13 +143,13 @@ const CodeExample = () => {
|
|
|
143
143
|
highlights: {{highlightsString}},
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
const { data, isLoading, isError } = useExecuteQuery(queryProps);
|
|
146
|
+
const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
147
147
|
|
|
148
148
|
if (isLoading) {
|
|
149
149
|
return <div>Loading...</div>;
|
|
150
150
|
}
|
|
151
151
|
if (isError) {
|
|
152
|
-
return <div>Error</div>;
|
|
152
|
+
return <div>Error: {error.message}</div>;
|
|
153
153
|
}
|
|
154
154
|
if (data) {
|
|
155
155
|
return <div>Total Rows: {data.rows.length}</div>;
|
|
@@ -159,7 +159,47 @@ const CodeExample = () => {
|
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
export default CodeExample;
|
|
162
|
-
|
|
162
|
+
`,
|
|
163
|
+
executePivotQueryTmpl: `import { useExecutePivotQuery, ExecutePivotQueryParams } from '@sisense/sdk-ui';
|
|
164
|
+
import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
165
|
+
|
|
166
|
+
const CodeExample = () => {
|
|
167
|
+
const pivotQueryProps: ExecutePivotQueryParams = {
|
|
168
|
+
dataSource: DM.DataSource,
|
|
169
|
+
rows: {{rowsString}},
|
|
170
|
+
values: {{valuesString}},
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const { data, isLoading, isError, error } = useExecutePivotQuery(pivotQueryProps);
|
|
174
|
+
|
|
175
|
+
if (isLoading) {
|
|
176
|
+
return <div>Loading...</div>;
|
|
177
|
+
}
|
|
178
|
+
if (isError) {
|
|
179
|
+
return <div>Error: {error.message}</div>;
|
|
180
|
+
}
|
|
181
|
+
if (data) {
|
|
182
|
+
return <div>Total Rows: {data.rows.length}</div>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return null;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default CodeExample;
|
|
189
|
+
`,
|
|
190
|
+
pivotTableWidgetTmpl: `import { {{componentString}} } from '@sisense/sdk-ui';
|
|
191
|
+
{{extraImportsString}}
|
|
192
|
+
import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
193
|
+
|
|
194
|
+
export default function CodeExample() {
|
|
195
|
+
return (
|
|
196
|
+
<{{componentString}}
|
|
197
|
+
title={'{{titleString}}'}
|
|
198
|
+
dataSource={DM.DataSource}
|
|
199
|
+
dataOptions={ {{dataOptionsString}} }
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
202
|
+
}`
|
|
163
203
|
},
|
|
164
204
|
angular: {
|
|
165
205
|
baseChartTmpl: `import { Component } from '@angular/core';
|
|
@@ -208,20 +248,31 @@ import { type QueryResultData } from '@sisense/sdk-data';
|
|
|
208
248
|
|
|
209
249
|
@Component({
|
|
210
250
|
selector: 'code-example',
|
|
211
|
-
template:
|
|
251
|
+
template: \`<div>
|
|
252
|
+
<div *ngIf="errorMessage">Error: {{ errorMessage }}</div>
|
|
253
|
+
<div *ngIf="!errorMessage">Total Rows: {{ queryResult.rows.length }}</div>
|
|
254
|
+
</div>\`,
|
|
212
255
|
})
|
|
213
256
|
|
|
214
257
|
export class CodeExample {
|
|
215
258
|
queryResult: QueryResultData = { rows: [], columns: [] };
|
|
216
259
|
|
|
260
|
+
errorMessage: string | null = null;
|
|
261
|
+
|
|
217
262
|
constructor(private queryService: QueryService) {}
|
|
218
263
|
|
|
219
264
|
async ngOnInit(): Promise<void> {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
265
|
+
try {
|
|
266
|
+
const { data } = await this.queryService.executeQueryByWidgetId({
|
|
267
|
+
widgetOid: "{{widgetOid}}",
|
|
268
|
+
dashboardOid: "{{dashboardOid}}",
|
|
269
|
+
});
|
|
270
|
+
this.queryResult = data as QueryResultData;
|
|
271
|
+
} catch(error: unknown) {
|
|
272
|
+
if (error instanceof Error) {
|
|
273
|
+
this.errorMessage = error.message;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
225
276
|
}
|
|
226
277
|
}
|
|
227
278
|
`,
|
|
@@ -233,12 +284,17 @@ import { QueryService } from '@sisense/sdk-ui-angular';
|
|
|
233
284
|
|
|
234
285
|
@Component({
|
|
235
286
|
selector: 'code-example',
|
|
236
|
-
template:
|
|
287
|
+
template: \`<div>
|
|
288
|
+
<div *ngIf="errorMessage">Error: {{ errorMessage }}</div>
|
|
289
|
+
<div *ngIf="!errorMessage">Total Rows: {{ queryResult.rows.length }}</div>
|
|
290
|
+
</div>\`,
|
|
237
291
|
})
|
|
238
292
|
|
|
239
293
|
export class CodeExample {
|
|
240
294
|
queryResult: QueryResultData = { rows: [], columns: [] };
|
|
241
295
|
|
|
296
|
+
errorMessage: string | null = null;
|
|
297
|
+
|
|
242
298
|
constructor(private queryService: QueryService) {}
|
|
243
299
|
|
|
244
300
|
async ngOnInit(): Promise<void> {
|
|
@@ -249,11 +305,20 @@ export class CodeExample {
|
|
|
249
305
|
filters: {{filtersString}},
|
|
250
306
|
highlights: {{highlightsString}},
|
|
251
307
|
}
|
|
252
|
-
|
|
253
|
-
|
|
308
|
+
|
|
309
|
+
try {
|
|
310
|
+
const { data } = await this.queryService.executeQuery(queryProps);
|
|
311
|
+
this.queryResult = data as QueryResultData;
|
|
312
|
+
} catch (error: unknown) {
|
|
313
|
+
if (error instanceof Error) {
|
|
314
|
+
this.errorMessage = error.message;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
254
317
|
}
|
|
255
318
|
}
|
|
256
|
-
|
|
319
|
+
`,
|
|
320
|
+
executePivotQueryTmpl: "Not implemented yet",
|
|
321
|
+
pivotTableWidgetTmpl: "Not implemented yet"
|
|
257
322
|
},
|
|
258
323
|
vue: {
|
|
259
324
|
baseChartTmpl: `<script setup lang="ts">
|
|
@@ -289,7 +354,7 @@ import { WidgetById } from '@sisense/sdk-ui-vue';
|
|
|
289
354
|
executeQueryByWidgetIdTmpl: `<script setup lang="ts">
|
|
290
355
|
import { useExecuteQueryByWidgetId } from '@sisense/sdk-ui-vue';
|
|
291
356
|
|
|
292
|
-
const { data, isLoading, isError } = useExecuteQueryByWidgetId({
|
|
357
|
+
const { data, isLoading, isError, error } = useExecuteQueryByWidgetId({
|
|
293
358
|
widgetOid: "{{widgetOid}}",
|
|
294
359
|
dashboardOid: "{{dashboardOid}}"
|
|
295
360
|
});
|
|
@@ -297,7 +362,7 @@ const { data, isLoading, isError } = useExecuteQueryByWidgetId({
|
|
|
297
362
|
<template>
|
|
298
363
|
<div>
|
|
299
364
|
<div v-if="isLoading">Loading...</div>
|
|
300
|
-
<div v-else-if="isError">Error</div>
|
|
365
|
+
<div v-else-if="isError">Error: {{error.message}}</div>
|
|
301
366
|
<div v-else-if="data">Total Rows: {{data.rows.length}}</div>
|
|
302
367
|
</div>
|
|
303
368
|
</template>
|
|
@@ -314,33 +379,35 @@ const queryProps = {
|
|
|
314
379
|
filters: {{filtersString}},
|
|
315
380
|
highlights: {{highlightsString}},
|
|
316
381
|
}
|
|
317
|
-
const { data, isLoading, isError } = useExecuteQuery(queryProps);
|
|
382
|
+
const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
318
383
|
<\/script>
|
|
319
384
|
<template>
|
|
320
385
|
<div>
|
|
321
386
|
<div v-if="isLoading">Loading...</div>
|
|
322
|
-
<div v-else-if="isError">Error</div>
|
|
387
|
+
<div v-else-if="isError">Error: {{error.message}}</div>
|
|
323
388
|
<div v-else-if="data">Total Rows: {{data.rows.length}}</div>
|
|
324
389
|
</div>
|
|
325
|
-
</template
|
|
390
|
+
</template>`,
|
|
391
|
+
executePivotQueryTmpl: "Not implemented yet",
|
|
392
|
+
pivotTableWidgetTmpl: "Not implemented yet"
|
|
326
393
|
}
|
|
327
|
-
},
|
|
394
|
+
}, j = (e, t) => ae[t][e].replace(
|
|
328
395
|
/{{(.*?)Tmpl}}/g,
|
|
329
|
-
(a, s) =>
|
|
330
|
-
),
|
|
331
|
-
const a =
|
|
332
|
-
return
|
|
333
|
-
},
|
|
334
|
-
`,
|
|
396
|
+
(a, s) => j(`${s}Tmpl`, t)
|
|
397
|
+
), ie = (e, t) => e.replace(/{{(.*?)}}/g, (r, a) => a in t ? t[a] : (console.warn(`Placeholder ${a} not found in data`), r)), b = (e, t, r = "react") => {
|
|
398
|
+
const a = j(e, r);
|
|
399
|
+
return ie(a, t);
|
|
400
|
+
}, y = `
|
|
401
|
+
`, O = "UNKNOWN", se = (e, t) => {
|
|
335
402
|
let r = "";
|
|
336
403
|
return r += `measureFactory.customFormula(
|
|
337
|
-
`, r += " ".repeat(t), r += ` '${
|
|
404
|
+
`, r += " ".repeat(t), r += ` '${h(e.title)}',
|
|
338
405
|
`, r += " ".repeat(t), r += ` '${e.formula}',
|
|
339
406
|
`, r += " ".repeat(t), r += ` {
|
|
340
407
|
`, Object.entries(e.context).forEach(([a, s]) => {
|
|
341
|
-
const i =
|
|
342
|
-
s.table ||
|
|
343
|
-
s.column ||
|
|
408
|
+
const i = W(
|
|
409
|
+
s.table || O,
|
|
410
|
+
s.column || O,
|
|
344
411
|
void 0,
|
|
345
412
|
"DM"
|
|
346
413
|
);
|
|
@@ -348,74 +415,83 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
|
|
|
348
415
|
`;
|
|
349
416
|
}), r += " ".repeat(t), r += ` }
|
|
350
417
|
`, r += " ".repeat(t), r += ")", r;
|
|
351
|
-
},
|
|
418
|
+
}, oe = (e, t) => {
|
|
352
419
|
const { level: r, table: a, column: s, agg: i, sort: o, title: l } = e;
|
|
353
420
|
let n;
|
|
354
|
-
return a && s && (n =
|
|
421
|
+
return a && s && (n = W(a, s, r, "DM")), i && a && s && l && (n = `measureFactory.${z.aggregationFromJAQL(
|
|
355
422
|
i
|
|
356
|
-
)}(${n}, '${
|
|
357
|
-
},
|
|
423
|
+
)}(${n}, '${h(l)}')`), o && (n = `{column: ${n}, sortType: '${I(o)}'}`), n ? `${" ".repeat(t)}${n}` : O;
|
|
424
|
+
}, ne = (e, t) => {
|
|
358
425
|
const r = e.jaql().jaql;
|
|
359
|
-
return "formula" in r ?
|
|
360
|
-
},
|
|
426
|
+
return "formula" in r ? se(r, t) : y + oe(r, t);
|
|
427
|
+
}, p = (e, t = 0, r = !1) => {
|
|
361
428
|
if (!e)
|
|
362
429
|
return "";
|
|
363
430
|
if (typeof e == "string")
|
|
364
|
-
return `'${
|
|
365
|
-
if (e instanceof
|
|
366
|
-
return
|
|
431
|
+
return `'${h(e)}'`;
|
|
432
|
+
if (e instanceof Q)
|
|
433
|
+
return ne(e, t);
|
|
367
434
|
let a = "";
|
|
368
|
-
return Array.isArray(e) ? a += `[${e.map((s) =>
|
|
369
|
-
r && (s = `'${
|
|
435
|
+
return Array.isArray(e) ? a += `[${e.map((s) => p(s, t + 2))}${e.length ? y + " ".repeat(t + 2) : ""}]` : (a += `{${y}`, Object.entries(e).forEach(([s, i]) => {
|
|
436
|
+
r && (s = `'${h(s)}'`), a += " ".repeat(t + 2), Array.isArray(i) ? a += `${s}: [${i.map((o) => p(o, t + 4, r))}${i.length ? y + " ".repeat(t + 2) : ""}]` : typeof i == "object" ? a += `${s}: ${p(i, t + 2, r)}` : ["number", "boolean", "undefined", null].includes(typeof i) ? a += `${s}: ${i}` : a += `${s}: '${h(i)}'`, a += `,${y}`;
|
|
370
437
|
}), a += " ".repeat(t), a += "}"), a;
|
|
371
438
|
};
|
|
372
|
-
function
|
|
373
|
-
return
|
|
439
|
+
function le(e) {
|
|
440
|
+
return p(e, 2);
|
|
374
441
|
}
|
|
375
|
-
function
|
|
442
|
+
function A(e) {
|
|
376
443
|
if (!e)
|
|
377
444
|
throw new u("errors.undefinedDataSource");
|
|
378
445
|
let t;
|
|
379
|
-
return typeof e == "object" && "title" in e ? t = e.title : t = e,
|
|
446
|
+
return typeof e == "object" && "title" in e ? t = e.title : t = e, te(t);
|
|
380
447
|
}
|
|
381
|
-
function
|
|
448
|
+
function F(e) {
|
|
382
449
|
const t = ["measureFactory"];
|
|
383
450
|
return Array.isArray(e) && e.length > 0 && t.push("filterFactory"), `import { ${t.join(", ")} } from '@sisense/sdk-data';`;
|
|
384
451
|
}
|
|
385
|
-
const
|
|
386
|
-
`,
|
|
452
|
+
const M = `
|
|
453
|
+
`, de = (e, t) => {
|
|
387
454
|
if (e.composeCode)
|
|
388
|
-
return `${
|
|
455
|
+
return `${M}${" ".repeat(t)}${e.composeCode}`;
|
|
389
456
|
const r = e.jaql().jaql;
|
|
390
|
-
return `${
|
|
457
|
+
return `${M}${" ".repeat(t)}filterFactory.customFilter(${p(
|
|
391
458
|
r,
|
|
392
459
|
t,
|
|
393
460
|
!0
|
|
394
461
|
)})`;
|
|
395
|
-
},
|
|
462
|
+
}, ue = (e, t = 0) => {
|
|
396
463
|
if (!e)
|
|
397
464
|
return "";
|
|
398
465
|
let r = "";
|
|
399
|
-
return r += `[${e.map((a) =>
|
|
466
|
+
return r += `[${e.map((a) => de(a, t + 2))}${e.length ? `
|
|
400
467
|
` + " ".repeat(t + 2) : ""}]`, r;
|
|
401
|
-
},
|
|
468
|
+
}, ce = (e) => {
|
|
402
469
|
if (!e)
|
|
403
470
|
return "";
|
|
404
471
|
if (Array.isArray(e))
|
|
405
|
-
return
|
|
472
|
+
return ue(e, 2);
|
|
406
473
|
throw new u("errors.filterRelationsNotSupported");
|
|
407
|
-
},
|
|
474
|
+
}, pe = ["executeQueryByWidgetIdTmpl", "widgetByIdTmpl"], me = "chartWidgetTmpl", ge = "pivotTableWidgetTmpl", fe = (e) => e, ye = (e, t, r) => {
|
|
408
475
|
const a = {
|
|
409
476
|
titleString: e.title,
|
|
410
|
-
dataSourceString:
|
|
411
|
-
chartTypeString:
|
|
412
|
-
dataOptionsString:
|
|
413
|
-
filtersString:
|
|
477
|
+
dataSourceString: A(e.dataSource),
|
|
478
|
+
chartTypeString: fe(e.chartType),
|
|
479
|
+
dataOptionsString: le(e.dataOptions),
|
|
480
|
+
filtersString: ce(e.filters),
|
|
414
481
|
componentString: "ChartWidget",
|
|
415
|
-
extraImportsString:
|
|
482
|
+
extraImportsString: F(e.filters || [])
|
|
483
|
+
};
|
|
484
|
+
return b(r, a, t);
|
|
485
|
+
}, he = (e, t, r) => {
|
|
486
|
+
const a = {
|
|
487
|
+
titleString: e.title,
|
|
488
|
+
dataSourceString: A(e.dataSource),
|
|
489
|
+
dataOptionsString: p(e.dataOptions),
|
|
490
|
+
componentString: "PivotTableWidget",
|
|
491
|
+
extraImportsString: F(e.filters || [])
|
|
416
492
|
};
|
|
417
|
-
return
|
|
418
|
-
},
|
|
493
|
+
return b(r, a, t);
|
|
494
|
+
}, Se = ({
|
|
419
495
|
dashboardOid: e,
|
|
420
496
|
widgetOid: t,
|
|
421
497
|
uiFramework: r = "react",
|
|
@@ -423,18 +499,20 @@ const D = `
|
|
|
423
499
|
includeChart: s = !0
|
|
424
500
|
}) => {
|
|
425
501
|
L(a);
|
|
426
|
-
const i = { dashboardOid: e, widgetOid: t }, o =
|
|
427
|
-
return
|
|
428
|
-
},
|
|
502
|
+
const i = { dashboardOid: e, widgetOid: t }, o = pe[Number(s)];
|
|
503
|
+
return b(o, i, r);
|
|
504
|
+
}, Te = ({
|
|
429
505
|
widgetProps: e,
|
|
430
506
|
uiFramework: t = "react"
|
|
431
507
|
}) => {
|
|
432
|
-
if (
|
|
433
|
-
return L(e.chartType),
|
|
508
|
+
if (J(e))
|
|
509
|
+
return L(e.chartType), ye(e, t, me);
|
|
510
|
+
if (V(e))
|
|
511
|
+
return he(e, t, ge);
|
|
434
512
|
throw new u("errors.otherWidgetTypesNotSupported");
|
|
435
|
-
},
|
|
436
|
-
dataOptions: { columns: e.map(
|
|
437
|
-
}),
|
|
513
|
+
}, ve = (e) => ({
|
|
514
|
+
dataOptions: { columns: e.map(P) }
|
|
515
|
+
}), xe = Object.freeze({
|
|
438
516
|
convolution: {
|
|
439
517
|
enabled: !0,
|
|
440
518
|
selectedConvolutionType: "bySlicesCount",
|
|
@@ -458,40 +536,40 @@ const D = `
|
|
|
458
536
|
pie: "pie/donut",
|
|
459
537
|
bar: "bar/stacked",
|
|
460
538
|
column: "column/stackedcolumn"
|
|
461
|
-
}),
|
|
539
|
+
}), Oe = (e, t) => {
|
|
462
540
|
const { axesMapping: r = {}, chartFamily: a } = t, s = e.reduce((o, l) => (o[l.jaql.title] = l, o), {}), i = Object.entries(r).reduce((o, l) => {
|
|
463
|
-
const [n,
|
|
464
|
-
return o[`${n}`] = Array.isArray(
|
|
541
|
+
const [n, m] = l;
|
|
542
|
+
return o[`${n}`] = Array.isArray(m) ? m.map((g) => {
|
|
465
543
|
var S, T;
|
|
466
|
-
const d = s[
|
|
544
|
+
const d = s[g.name];
|
|
467
545
|
if (!d)
|
|
468
|
-
return { column: { type: "", name:
|
|
469
|
-
const c =
|
|
546
|
+
return { column: { type: "", name: g.name } };
|
|
547
|
+
const c = P(d);
|
|
470
548
|
if (d.panel === "measures")
|
|
471
549
|
return {
|
|
472
550
|
column: c,
|
|
473
551
|
sortType: "sortNone"
|
|
474
552
|
};
|
|
475
|
-
if (
|
|
476
|
-
const
|
|
477
|
-
if (
|
|
553
|
+
if (H(c.type)) {
|
|
554
|
+
const v = (T = (S = d.format) == null ? void 0 : S.mask) == null ? void 0 : T[d.jaql.level];
|
|
555
|
+
if (v)
|
|
478
556
|
return {
|
|
479
557
|
column: c,
|
|
480
|
-
dateFormat:
|
|
558
|
+
dateFormat: v
|
|
481
559
|
};
|
|
482
560
|
}
|
|
483
561
|
return c;
|
|
484
|
-
}) :
|
|
562
|
+
}) : m, o;
|
|
485
563
|
}, {});
|
|
486
564
|
switch (a) {
|
|
487
565
|
case "cartesian":
|
|
488
|
-
return
|
|
566
|
+
return f({
|
|
489
567
|
category: [],
|
|
490
568
|
value: [],
|
|
491
569
|
breakBy: []
|
|
492
570
|
}, i);
|
|
493
571
|
case "categorical":
|
|
494
|
-
return
|
|
572
|
+
return f({
|
|
495
573
|
category: [],
|
|
496
574
|
value: []
|
|
497
575
|
}, i);
|
|
@@ -504,7 +582,7 @@ const D = `
|
|
|
504
582
|
o !== "geo" && (i[`${o}`] = i[`${o}`][0]);
|
|
505
583
|
}), i;
|
|
506
584
|
case "table":
|
|
507
|
-
return Object.keys(i).length === 0 ?
|
|
585
|
+
return Object.keys(i).length === 0 ? ve(e).dataOptions : i;
|
|
508
586
|
case "boxplot":
|
|
509
587
|
case "areamap":
|
|
510
588
|
case "indicator":
|
|
@@ -514,11 +592,11 @@ const D = `
|
|
|
514
592
|
}, q = (e, t) => {
|
|
515
593
|
var r, a, s, i;
|
|
516
594
|
return t === "x" ? (a = (r = e.axesMapping.category) != null ? r : e.axesMapping.x) == null ? void 0 : a.map((o) => o.name).join(", ") : (i = (s = e.axesMapping.value) != null ? s : e.axesMapping.y) == null ? void 0 : i.map((o) => o.name).join(", ");
|
|
517
|
-
},
|
|
518
|
-
const a =
|
|
595
|
+
}, be = (e, t, r = !0) => {
|
|
596
|
+
const a = Oe(e, t);
|
|
519
597
|
let s;
|
|
520
|
-
return r && t.chartType in $ ? s =
|
|
521
|
-
|
|
598
|
+
return r && t.chartType in $ ? s = C(
|
|
599
|
+
C(xe, {
|
|
522
600
|
subtype: $[t.chartType]
|
|
523
601
|
}),
|
|
524
602
|
{
|
|
@@ -539,40 +617,40 @@ const D = `
|
|
|
539
617
|
}
|
|
540
618
|
}
|
|
541
619
|
}
|
|
542
|
-
) : s =
|
|
620
|
+
) : s = Z(), {
|
|
543
621
|
dataOptions: a,
|
|
544
622
|
chartStyleOptions: s
|
|
545
623
|
};
|
|
546
|
-
},
|
|
624
|
+
}, Ee = (e) => "chartType" in e ? e : {
|
|
547
625
|
chartType: "table",
|
|
548
626
|
chartFamily: "table",
|
|
549
627
|
axesMapping: {}
|
|
550
|
-
},
|
|
628
|
+
}, we = (e) => e.map((t) => X(t.jaql)), Ce = (e) => e.reduce(
|
|
551
629
|
(t, r) => {
|
|
552
|
-
if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(
|
|
553
|
-
const a =
|
|
630
|
+
if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(D(r)), r.panel !== "scope") {
|
|
631
|
+
const a = D(r);
|
|
554
632
|
delete a.jaql.filter, t.metadataColumns.push(a);
|
|
555
633
|
}
|
|
556
634
|
return t;
|
|
557
635
|
},
|
|
558
636
|
{ metadataColumns: [], metadataFilters: [] }
|
|
559
|
-
),
|
|
560
|
-
if (!
|
|
637
|
+
), De = (e, t) => {
|
|
638
|
+
if (!re(e))
|
|
561
639
|
try {
|
|
562
640
|
const { useCustomizedStyleOptions: r = !1 } = t || {}, { jaql: a, chartRecommendations: s, queryTitle: i } = e, {
|
|
563
641
|
metadata: o,
|
|
564
|
-
datasource: { title: l, id: n, type:
|
|
565
|
-
} = a,
|
|
642
|
+
datasource: { title: l, id: n, type: m = "elasticube" }
|
|
643
|
+
} = a, g = Ee(s), d = g.chartType.toLowerCase(), c = {
|
|
566
644
|
cornerRadius: "Small",
|
|
567
645
|
header: {
|
|
568
646
|
// remove info button and render empty toolbar instead
|
|
569
647
|
renderToolbar: () => null
|
|
570
648
|
}
|
|
571
|
-
}, { metadataColumns: S, metadataFilters: T } =
|
|
649
|
+
}, { metadataColumns: S, metadataFilters: T } = Ce(o), v = we(T), { dataOptions: k, chartStyleOptions: B } = be(
|
|
572
650
|
S,
|
|
573
|
-
|
|
651
|
+
g,
|
|
574
652
|
r
|
|
575
|
-
),
|
|
653
|
+
), N = f(f({}, B), c);
|
|
576
654
|
return {
|
|
577
655
|
widgetType: "chart",
|
|
578
656
|
id: i,
|
|
@@ -581,34 +659,35 @@ const D = `
|
|
|
581
659
|
dataSource: {
|
|
582
660
|
title: l,
|
|
583
661
|
id: n,
|
|
584
|
-
type:
|
|
662
|
+
type: m
|
|
585
663
|
},
|
|
586
|
-
dataOptions:
|
|
587
|
-
filters:
|
|
588
|
-
styleOptions:
|
|
664
|
+
dataOptions: k,
|
|
665
|
+
filters: v,
|
|
666
|
+
styleOptions: N
|
|
589
667
|
};
|
|
590
668
|
} catch (r) {
|
|
591
669
|
console.error(r);
|
|
592
670
|
return;
|
|
593
671
|
}
|
|
594
|
-
},
|
|
672
|
+
}, Me = (e, t) => De(e, t), $e = (e) => ee(e) ? Se(e) : Te(e), Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
595
673
|
__proto__: null,
|
|
596
|
-
toWidgetCode:
|
|
597
|
-
toWidgetProps:
|
|
674
|
+
toWidgetCode: $e,
|
|
675
|
+
toWidgetProps: Me
|
|
598
676
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
599
677
|
export {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
678
|
+
Qe as E,
|
|
679
|
+
A as a,
|
|
680
|
+
p as b,
|
|
681
|
+
Le as c,
|
|
682
|
+
ce as d,
|
|
683
|
+
F as e,
|
|
684
|
+
We as f,
|
|
685
|
+
b as g,
|
|
686
|
+
ee as h,
|
|
687
|
+
Pe as i,
|
|
688
|
+
ie as p,
|
|
689
|
+
je as s,
|
|
690
|
+
Me as t,
|
|
691
|
+
Ae as v,
|
|
692
|
+
Fe as w
|
|
614
693
|
};
|