@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.
Files changed (27) hide show
  1. package/dist/ai.cjs +53 -52
  2. package/dist/ai.js +934 -787
  3. package/dist/analytics-composer.cjs +38 -38
  4. package/dist/analytics-composer.js +475 -464
  5. package/dist/{derive-chart-family-C_c2ZQQd.cjs → derive-chart-family-DOmv279l.cjs} +19 -19
  6. package/dist/{derive-chart-family-BlFbAr2V.js → derive-chart-family-ZvvF5lty.js} +255 -246
  7. package/dist/index.cjs +42 -42
  8. package/dist/index.js +1817 -1767
  9. package/dist/packages/sdk-ui/src/ai/api/types.d.ts +6 -1
  10. package/dist/packages/sdk-ui/src/ai/icons/close-dialog-icon.d.ts +3 -1
  11. package/dist/packages/sdk-ui/src/ai/icons/sisense-logo.d.ts +2 -4
  12. package/dist/packages/sdk-ui/src/ai/use-chat-session.d.ts +2 -1
  13. package/dist/packages/sdk-ui/src/analytics-composer/common/utils.d.ts +1 -1
  14. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/execute-query-composer.d.ts +8 -1
  15. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/to-execute-query-code.d.ts +2 -1
  16. package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +8 -2
  17. package/dist/packages/sdk-ui/src/api/rest-api.d.ts +13 -1
  18. package/dist/packages/sdk-ui/src/chart/helpers/use-synced-data.d.ts +14 -1
  19. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +9 -1
  20. package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +14 -2
  21. package/dist/useQuery-9lk4MNnb.cjs +889 -0
  22. package/dist/{useQuery-P9b5LtGq.js → useQuery-BtpTzoxI.js} +21289 -20599
  23. package/dist/widget-composer-DbpSzSub.cjs +298 -0
  24. package/dist/{widget-composer-DXM5t9rq.js → widget-composer-ygehKLLR.js} +229 -150
  25. package/package.json +7 -7
  26. package/dist/useQuery-BYxzPyc5.cjs +0 -870
  27. package/dist/widget-composer-DPsDPrFM.cjs +0 -237
@@ -1,19 +1,19 @@
1
- var R = Object.defineProperty;
2
- var v = Object.getOwnPropertySymbols;
3
- var _ = Object.prototype.hasOwnProperty, N = Object.prototype.propertyIsEnumerable;
4
- var E = (e, t, r) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, g = (e, t) => {
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
- _.call(t, r) && E(e, r, t[r]);
7
- if (v)
8
- for (var r of v(t))
9
- N.call(t, r) && E(e, r, t[r]);
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 { cX as k, h as j, M as b, T as u, cY as U, cZ as I, a7 as z, ae as K, m as w, c_ as Y, B as J, G as V, aR as C } from "./derive-chart-family-BlFbAr2V.js";
13
- class M extends k {
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 = j(t.jaql.sort) : delete this.sortType, this.skipValidation = !0;
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 X = {
26
- text: b.TextAttribute,
27
- numeric: b.NumericAttribute,
28
- datetime: b.DateLevel
25
+ const G = {
26
+ text: x.TextAttribute,
27
+ numeric: x.NumericAttribute,
28
+ datetime: x.DateLevel
29
29
  };
30
- function W(e) {
30
+ function P(e) {
31
31
  var t;
32
- return new M(e, (t = X[e.jaql.datatype]) !== null && t !== void 0 ? t : "numeric");
32
+ return new Q(e, (t = G[e.jaql.datatype]) !== null && t !== void 0 ? t : "numeric");
33
33
  }
34
- const qe = {
34
+ const We = {
35
35
  jaql: { datasource: { title: "" }, metadata: [] },
36
36
  queryTitle: "",
37
37
  chartRecommendations: {}
38
- }, je = {
38
+ }, Qe = {
39
39
  model: "",
40
40
  metadata: [],
41
41
  chart: {},
42
42
  queryTitle: ""
43
- }, Ie = (e) => "widgetProps" in e, Z = (e) => "dashboardOid" in e && "widgetOid" in e;
44
- function G(e) {
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 Me(e) {
47
+ function Le(e) {
48
48
  return e.charAt(0).toUpperCase() + e.slice(1);
49
49
  }
50
- function We(e) {
50
+ function je(e) {
51
51
  const t = /\[(.+?)\s\(Calendar\)\]/;
52
52
  return e.replace(t, "[$1]").trim();
53
53
  }
54
- function Le(e) {
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 H(e) {
65
+ function re(e) {
66
66
  return !e || !e.jaql.datasource.title || !e.jaql.metadata.length;
67
67
  }
68
- function y(e) {
68
+ function h(e) {
69
69
  return e && e.replace(new RegExp("(?<!\\\\)'", "g"), "\\'");
70
70
  }
71
71
  function L(e) {
72
- if (!U.includes(e))
72
+ if (![...Y, "pivot", "pivot2"].includes(e))
73
73
  throw new u("errors.chartTypeNotSupported", { chartType: e });
74
74
  }
75
- const ee = {
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: '<div>Total Rows: {{ queryResult.rows.length }}</div>',
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
- const { data } = await this.queryService.executeQueryByWidgetId({
221
- widgetOid: "{{widgetOid}}",
222
- dashboardOid: "{{dashboardOid}}",
223
- });
224
- this.queryResult = data as QueryResultData;
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: '<div>Total Rows: {{ queryResult.rows.length }}</div>',
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
- const { data } = await this.queryService.executeQuery(queryProps);
253
- this.queryResult = data as QueryResultData;
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
- }, Q = (e, t) => ee[t][e].replace(
394
+ }, j = (e, t) => ae[t][e].replace(
328
395
  /{{(.*?)Tmpl}}/g,
329
- (a, s) => Q(`${s}Tmpl`, t)
330
- ), te = (e, t) => e.replace(/{{(.*?)}}/g, (r, a) => a in t ? t[a] : (console.warn(`Placeholder ${a} not found in data`), r)), F = (e, t, r = "react") => {
331
- const a = Q(e, r);
332
- return te(a, t);
333
- }, f = `
334
- `, x = "UNKNOWN", re = (e, t) => {
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 += ` '${y(e.title)}',
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 = I(
342
- s.table || x,
343
- s.column || x,
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
- }, ae = (e, t) => {
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 = I(a, s, r, "DM")), i && a && s && l && (n = `measureFactory.${z.aggregationFromJAQL(
421
+ return a && s && (n = W(a, s, r, "DM")), i && a && s && l && (n = `measureFactory.${z.aggregationFromJAQL(
355
422
  i
356
- )}(${n}, '${y(l)}')`), o && (n = `{column: ${n}, sortType: '${j(o)}'}`), n ? `${" ".repeat(t)}${n}` : x;
357
- }, ie = (e, t) => {
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 ? re(r, t) : f + ae(r, t);
360
- }, h = (e, t = 0, r = !1) => {
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 `'${y(e)}'`;
365
- if (e instanceof M)
366
- return ie(e, t);
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) => h(s, t + 2))}${e.length ? f + " ".repeat(t + 2) : ""}]` : (a += `{${f}`, Object.entries(e).forEach(([s, i]) => {
369
- r && (s = `'${y(s)}'`), a += " ".repeat(t + 2), Array.isArray(i) ? a += `${s}: [${i.map((o) => h(o, t + 4, r))}${i.length ? f + " ".repeat(t + 2) : ""}]` : typeof i == "object" ? a += `${s}: ${h(i, t + 2, r)}` : ["number", "boolean", "undefined", null].includes(typeof i) ? a += `${s}: ${i}` : a += `${s}: '${y(i)}'`, a += `,${f}`;
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 se(e) {
373
- return h(e, 2);
439
+ function le(e) {
440
+ return p(e, 2);
374
441
  }
375
- function oe(e) {
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, G(t);
446
+ return typeof e == "object" && "title" in e ? t = e.title : t = e, te(t);
380
447
  }
381
- function ne(e) {
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 D = `
386
- `, le = (e, t) => {
452
+ const M = `
453
+ `, de = (e, t) => {
387
454
  if (e.composeCode)
388
- return `${D}${" ".repeat(t)}${e.composeCode}`;
455
+ return `${M}${" ".repeat(t)}${e.composeCode}`;
389
456
  const r = e.jaql().jaql;
390
- return `${D}${" ".repeat(t)}filterFactory.customFilter(${h(
457
+ return `${M}${" ".repeat(t)}filterFactory.customFilter(${p(
391
458
  r,
392
459
  t,
393
460
  !0
394
461
  )})`;
395
- }, de = (e, t = 0) => {
462
+ }, ue = (e, t = 0) => {
396
463
  if (!e)
397
464
  return "";
398
465
  let r = "";
399
- return r += `[${e.map((a) => le(a, t + 2))}${e.length ? `
466
+ return r += `[${e.map((a) => de(a, t + 2))}${e.length ? `
400
467
  ` + " ".repeat(t + 2) : ""}]`, r;
401
- }, ue = (e) => {
468
+ }, ce = (e) => {
402
469
  if (!e)
403
470
  return "";
404
471
  if (Array.isArray(e))
405
- return de(e, 2);
472
+ return ue(e, 2);
406
473
  throw new u("errors.filterRelationsNotSupported");
407
- }, ce = ["executeQueryByWidgetIdTmpl", "widgetByIdTmpl"], pe = "chartWidgetTmpl", me = (e) => e, ge = (e, t, r) => {
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: oe(e.dataSource),
411
- chartTypeString: me(e.chartType),
412
- dataOptionsString: se(e.dataOptions),
413
- filtersString: ue(e.filters),
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: ne(e.filters || [])
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 F(r, a, t);
418
- }, fe = ({
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 = ce[Number(s)];
427
- return F(o, i, r);
428
- }, ye = ({
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 (K(e))
433
- return L(e.chartType), ge(e, t, pe);
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
- }, he = (e) => ({
436
- dataOptions: { columns: e.map(W) }
437
- }), Se = Object.freeze({
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
- }), Te = (e, t) => {
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, p] = l;
464
- return o[`${n}`] = Array.isArray(p) ? p.map((m) => {
541
+ const [n, m] = l;
542
+ return o[`${n}`] = Array.isArray(m) ? m.map((g) => {
465
543
  var S, T;
466
- const d = s[m.name];
544
+ const d = s[g.name];
467
545
  if (!d)
468
- return { column: { type: "", name: m.name } };
469
- const c = W(d);
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 (J(c.type)) {
476
- const O = (T = (S = d.format) == null ? void 0 : S.mask) == null ? void 0 : T[d.jaql.level];
477
- if (O)
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: O
558
+ dateFormat: v
481
559
  };
482
560
  }
483
561
  return c;
484
- }) : p, o;
562
+ }) : m, o;
485
563
  }, {});
486
564
  switch (a) {
487
565
  case "cartesian":
488
- return g({
566
+ return f({
489
567
  category: [],
490
568
  value: [],
491
569
  breakBy: []
492
570
  }, i);
493
571
  case "categorical":
494
- return g({
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 ? he(e).dataOptions : i;
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
- }, Oe = (e, t, r = !0) => {
518
- const a = Te(e, t);
595
+ }, be = (e, t, r = !0) => {
596
+ const a = Oe(e, t);
519
597
  let s;
520
- return r && t.chartType in $ ? s = w(
521
- w(Se, {
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 = Y(), {
620
+ ) : s = Z(), {
543
621
  dataOptions: a,
544
622
  chartStyleOptions: s
545
623
  };
546
- }, be = (e) => "chartType" in e ? e : {
624
+ }, Ee = (e) => "chartType" in e ? e : {
547
625
  chartType: "table",
548
626
  chartFamily: "table",
549
627
  axesMapping: {}
550
- }, xe = (e) => e.map((t) => V(t.jaql)), ve = (e) => e.reduce(
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(C(r)), r.panel !== "scope") {
553
- const a = C(r);
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
- ), Ee = (e, t) => {
560
- if (!H(e))
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: p = "elasticube" }
565
- } = a, m = be(s), d = m.chartType.toLowerCase(), c = {
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 } = ve(o), O = xe(T), { dataOptions: A, chartStyleOptions: B } = Oe(
649
+ }, { metadataColumns: S, metadataFilters: T } = Ce(o), v = we(T), { dataOptions: k, chartStyleOptions: B } = be(
572
650
  S,
573
- m,
651
+ g,
574
652
  r
575
- ), P = g(g({}, B), c);
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: p
662
+ type: m
585
663
  },
586
- dataOptions: A,
587
- filters: O,
588
- styleOptions: P
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
- }, we = (e, t) => Ee(e, t), Ce = (e) => Z(e) ? fe(e) : ye(e), Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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: Ce,
597
- toWidgetProps: we
674
+ toWidgetCode: $e,
675
+ toWidgetProps: Me
598
676
  }, Symbol.toStringTag, { value: "Module" }));
599
677
  export {
600
- je as E,
601
- oe as a,
602
- ue as b,
603
- Me as c,
604
- ne as d,
605
- qe as e,
606
- Z as f,
607
- F as g,
608
- Ie as i,
609
- te as p,
610
- We as s,
611
- we as t,
612
- Le as v,
613
- Qe as w
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
  };