@sisense/sdk-ui 1.24.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 (65) hide show
  1. package/dist/ai.cjs +54 -52
  2. package/dist/ai.js +997 -844
  3. package/dist/analytics-composer.cjs +45 -45
  4. package/dist/analytics-composer.js +567 -536
  5. package/dist/derive-chart-family-DOmv279l.cjs +271 -0
  6. package/dist/derive-chart-family-ZvvF5lty.js +44444 -0
  7. package/dist/index.cjs +112 -132
  8. package/dist/index.js +8146 -7238
  9. package/dist/packages/sdk-ui/src/ai/api/types.d.ts +6 -1
  10. package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +4 -2
  11. package/dist/packages/sdk-ui/src/ai/icons/close-dialog-icon.d.ts +3 -1
  12. package/dist/packages/sdk-ui/src/ai/icons/sisense-logo.d.ts +2 -4
  13. package/dist/packages/sdk-ui/src/ai/use-chat-session.d.ts +2 -1
  14. package/dist/packages/sdk-ui/src/analytics-composer/common/stringify-props.d.ts +5 -0
  15. package/dist/packages/sdk-ui/src/analytics-composer/common/utils.d.ts +1 -1
  16. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/execute-query-composer.d.ts +15 -0
  17. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/to-execute-query-code.d.ts +3 -0
  18. package/dist/packages/sdk-ui/src/analytics-composer/index.d.ts +5 -0
  19. package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +15 -2
  20. package/dist/packages/sdk-ui/src/analytics-composer/widget/to-widget-code.d.ts +1 -1
  21. package/dist/packages/sdk-ui/src/api/rest-api.d.ts +26 -2
  22. package/dist/packages/sdk-ui/src/api/types/dashboard-dto.d.ts +9 -4
  23. package/dist/packages/sdk-ui/src/chart/helpers/use-synced-data.d.ts +14 -1
  24. package/dist/packages/sdk-ui/src/chart-data-processor/data-table-date-period.d.ts +1 -4
  25. package/dist/packages/sdk-ui/src/common-filters/cascading-utils.d.ts +3 -1
  26. package/dist/packages/sdk-ui/src/common-filters/common-filters-connector.d.ts +4 -3
  27. package/dist/packages/sdk-ui/src/common-filters/types.d.ts +25 -0
  28. package/dist/packages/sdk-ui/src/common-filters/use-common-filters.d.ts +8 -9
  29. package/dist/packages/sdk-ui/src/common-filters/use-convert-filter-relations.d.ts +26 -0
  30. package/dist/packages/sdk-ui/src/dashboard/dashboard-helpers.d.ts +40 -10
  31. package/dist/packages/sdk-ui/src/dashboard/dashboard.d.ts +2 -2
  32. package/dist/packages/sdk-ui/src/dashboard/types.d.ts +5 -5
  33. package/dist/packages/sdk-ui/src/dashboard/use-composed-dashboard.d.ts +4 -4
  34. package/dist/packages/sdk-ui/src/filters/components/filters-panel/filters-panel.d.ts +3 -3
  35. package/dist/packages/sdk-ui/src/filters/components/member-filter-tile/member-list.d.ts +1 -1
  36. package/dist/packages/sdk-ui/src/filters/helpers.d.ts +122 -0
  37. package/dist/packages/sdk-ui/src/filters/index.d.ts +1 -0
  38. package/dist/packages/sdk-ui/src/models/dashboard/dashboard-model.d.ts +2 -2
  39. package/dist/packages/sdk-ui/src/models/dashboard/get-dashboard-model.d.ts +2 -1
  40. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-dto-utils.d.ts +1 -1
  41. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +11 -3
  42. package/dist/packages/sdk-ui/src/models/dashboard/types.d.ts +3 -0
  43. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model-reducer.d.ts +2 -2
  44. package/dist/packages/sdk-ui/src/models/dashboard/use-dashboard-model/use-dashboard-model.d.ts +2 -0
  45. package/dist/packages/sdk-ui/src/query/date-formats/apply-date-format.d.ts +1 -0
  46. package/dist/packages/sdk-ui/src/query-execution/utils.d.ts +3 -0
  47. package/dist/packages/sdk-ui/src/utils/extract-widget-ids.d.ts +2 -0
  48. package/dist/packages/sdk-ui/src/utils/filter-relations.d.ts +64 -0
  49. package/dist/packages/sdk-ui/src/utils/filters-comparator.d.ts +5 -0
  50. package/dist/packages/sdk-ui/src/utils/filters.d.ts +0 -1
  51. package/dist/packages/sdk-ui/src/widget-by-id/translate-dashboard-filters.d.ts +178 -178
  52. package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-filters.d.ts +17 -17
  53. package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +14 -2
  54. package/dist/packages/sdk-ui/src/widget-by-id/use-get-dashboard-model-and-widget-model.d.ts +13 -0
  55. package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +4 -4
  56. package/dist/useQuery-9lk4MNnb.cjs +889 -0
  57. package/dist/useQuery-BtpTzoxI.js +81219 -0
  58. package/dist/widget-composer-DbpSzSub.cjs +298 -0
  59. package/dist/{widget-composer-L8kmRhgX.js → widget-composer-ygehKLLR.js} +232 -163
  60. package/package.json +8 -8
  61. package/dist/useQuery-CIeSzN0Z.js +0 -7945
  62. package/dist/useQuery-LqaaNBLw.cjs +0 -175
  63. package/dist/widget-composer-CvgsMHyb.cjs +0 -237
  64. package/dist/widget-model-translator-CYeCKnTa.js +0 -116687
  65. package/dist/widget-model-translator-_Z-8UaTN.cjs +0 -917
@@ -1,19 +1,19 @@
1
- var k = Object.defineProperty;
1
+ var _ = Object.defineProperty;
2
2
  var E = Object.getOwnPropertySymbols;
3
- var z = Object.prototype.hasOwnProperty, U = Object.prototype.propertyIsEnumerable;
4
- var w = (e, t, r) => t in e ? k(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, g = (e, t) => {
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
- z.call(t, r) && w(e, r, t[r]);
6
+ R.call(t, r) && w(e, r, t[r]);
7
7
  if (E)
8
8
  for (var r of E(t))
9
- U.call(t, r) && w(e, r, t[r]);
9
+ K.call(t, r) && w(e, r, t[r]);
10
10
  return e;
11
11
  };
12
- import { dt as K, du as j, M as O, T as u, dv as Y, dw as I, av as J, aD as V, dx as H, dy as X, m as C, dz as Z, dA as G, ao as ee, bN as D } from "./widget-model-translator-CYeCKnTa.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 te = {
26
- text: O.TextAttribute,
27
- numeric: O.NumericAttribute,
28
- datetime: O.DateLevel
25
+ const G = {
26
+ text: x.TextAttribute,
27
+ numeric: x.NumericAttribute,
28
+ datetime: x.DateLevel
29
29
  };
30
- function Q(e) {
30
+ function P(e) {
31
31
  var t;
32
- return new M(e, (t = te[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 Ie = {
34
+ const We = {
35
35
  jaql: { datasource: { title: "" }, metadata: [] },
36
36
  queryTitle: "",
37
37
  chartRecommendations: {}
38
- }, Me = {
38
+ }, Qe = {
39
39
  model: "",
40
40
  metadata: [],
41
41
  chart: {},
42
42
  queryTitle: ""
43
- }, Qe = (e) => "widgetProps" in e, re = (e) => "dashboardOid" in e && "widgetOid" in e;
44
- function ae(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
47
  function Le(e) {
48
48
  return e.charAt(0).toUpperCase() + e.slice(1);
49
49
  }
50
- function Ae(e) {
50
+ function je(e) {
51
51
  const t = /\[(.+?)\s\(Calendar\)\]/;
52
52
  return e.replace(t, "[$1]").trim();
53
53
  }
54
- function Fe(e) {
54
+ function Ae(e) {
55
55
  if (e)
56
56
  if (e.metadata) {
57
57
  if (!e.model)
@@ -62,17 +62,17 @@ function Fe(e) {
62
62
  throw new u("errors.emptyModel");
63
63
  return e;
64
64
  }
65
- function ie(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 (!Y.includes(e))
72
+ if (![...Y, "pivot", "pivot2"].includes(e))
73
73
  throw new u("errors.chartTypeNotSupported", { chartType: e });
74
74
  }
75
- const se = {
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>;
@@ -130,7 +130,7 @@ const CodeExample = () => {
130
130
 
131
131
  export default CodeExample;
132
132
  `,
133
- executeQueryWidgetTmpl: `import { useExecuteQuery } from '@sisense/sdk-ui';
133
+ executeQueryTmpl: `import { useExecuteQuery } from '@sisense/sdk-ui';
134
134
  {{extraImportsString}}
135
135
  import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
136
136
 
@@ -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,24 +248,35 @@ 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
  `,
228
- executeQueryWidgetTmpl: `import { Component } from '@angular/core';
279
+ executeQueryTmpl: `import { Component } from '@angular/core';
229
280
  {{extraImportsString}}
230
281
  import { type QueryResultData } from '@sisense/sdk-data';
231
282
  import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
@@ -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,12 +362,12 @@ 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>
304
369
  `,
305
- executeQueryWidgetTmpl: `<script setup lang="ts">
370
+ executeQueryTmpl: `<script setup lang="ts">
306
371
  import { useExecuteQuery } from '@sisense/sdk-ui-vue';
307
372
  {{extraImportsString}}
308
373
  import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
@@ -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
- }, A = (e, t) => se[t][e].replace(
394
+ }, j = (e, t) => ae[t][e].replace(
328
395
  /{{(.*?)Tmpl}}/g,
329
- (a, s) => A(`${s}Tmpl`, t)
330
- ), oe = (e, t) => e.replace(/{{(.*?)}}/g, (r, a) => a in t ? t[a] : (console.warn(`Placeholder ${a} not found in data`), r)), v = (e, t, r = "react") => {
331
- const a = A(e, r);
332
- return oe(a, t);
333
- }, f = `
334
- `, b = "UNKNOWN", ne = (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 || b,
343
- s.column || b,
408
+ const i = W(
409
+ s.table || O,
410
+ s.column || O,
344
411
  void 0,
345
412
  "DM"
346
413
  );
@@ -348,83 +415,82 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
348
415
  `;
349
416
  }), r += " ".repeat(t), r += ` }
350
417
  `, r += " ".repeat(t), r += ")", r;
351
- }, le = (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.${J.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}` : b;
357
- }, de = (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 ? ne(r, t) : f + le(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 de(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
- }, $ = `
372
- `, ue = (e, t) => {
438
+ };
439
+ function le(e) {
440
+ return p(e, 2);
441
+ }
442
+ function A(e) {
443
+ if (!e)
444
+ throw new u("errors.undefinedDataSource");
445
+ let t;
446
+ return typeof e == "object" && "title" in e ? t = e.title : t = e, te(t);
447
+ }
448
+ function F(e) {
449
+ const t = ["measureFactory"];
450
+ return Array.isArray(e) && e.length > 0 && t.push("filterFactory"), `import { ${t.join(", ")} } from '@sisense/sdk-data';`;
451
+ }
452
+ const M = `
453
+ `, de = (e, t) => {
373
454
  if (e.composeCode)
374
- return `${$}${" ".repeat(t)}${e.composeCode}`;
455
+ return `${M}${" ".repeat(t)}${e.composeCode}`;
375
456
  const r = e.jaql().jaql;
376
- return `${$}${" ".repeat(t)}filterFactory.customFilter(${h(
457
+ return `${M}${" ".repeat(t)}filterFactory.customFilter(${p(
377
458
  r,
378
459
  t,
379
460
  !0
380
461
  )})`;
381
- }, ce = (e, t = 0) => {
462
+ }, ue = (e, t = 0) => {
382
463
  if (!e)
383
464
  return "";
384
465
  let r = "";
385
- return r += `[${e.map((a) => ue(a, t + 2))}${e.length ? `
466
+ return r += `[${e.map((a) => de(a, t + 2))}${e.length ? `
386
467
  ` + " ".repeat(t + 2) : ""}]`, r;
387
- }, F = (e) => {
468
+ }, ce = (e) => {
388
469
  if (!e)
389
470
  return "";
390
471
  if (Array.isArray(e))
391
- return ce(e, 2);
472
+ return ue(e, 2);
392
473
  throw new u("errors.filterRelationsNotSupported");
393
- }, pe = ["executeQueryByWidgetIdTmpl", "widgetByIdTmpl"], me = [
394
- "executeQueryWidgetTmpl",
395
- "chartWidgetTmpl"
396
- ], P = (e) => {
397
- if (!e)
398
- throw new u("errors.undefinedDataSource");
399
- let t;
400
- return typeof e == "object" && "title" in e ? t = e.title : t = e, ae(t);
401
- }, ge = (e) => e, fe = (e) => h(e, 2), B = (e) => {
402
- const t = ["measureFactory"], { filters: r } = e;
403
- return Array.isArray(r) && r.length > 0 && t.push("filterFactory"), `import { ${t.join(", ")} } from '@sisense/sdk-data';`;
404
- }, ye = (e, t, r) => {
474
+ }, pe = ["executeQueryByWidgetIdTmpl", "widgetByIdTmpl"], me = "chartWidgetTmpl", ge = "pivotTableWidgetTmpl", fe = (e) => e, ye = (e, t, r) => {
405
475
  const a = {
406
476
  titleString: e.title,
407
- dataSourceString: P(e.dataSource),
408
- chartTypeString: ge(e.chartType),
409
- dataOptionsString: fe(e.dataOptions),
410
- filtersString: F(e.filters),
477
+ dataSourceString: A(e.dataSource),
478
+ chartTypeString: fe(e.chartType),
479
+ dataOptionsString: le(e.dataOptions),
480
+ filtersString: ce(e.filters),
411
481
  componentString: "ChartWidget",
412
- extraImportsString: B(e)
482
+ extraImportsString: F(e.filters || [])
413
483
  };
414
- return v(r, a, t);
484
+ return b(r, a, t);
415
485
  }, he = (e, t, r) => {
416
- const a = H(e), s = X(a), i = {
417
- dataSourceString: P(s.dataSource),
418
- dimensionsString: "[]",
419
- // TODO
420
- measuresString: "[]",
421
- // TODO
422
- filtersString: F(s.filters),
423
- highlightsString: "[]",
424
- // TODO
425
- extraImportsString: B(e)
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 || [])
426
492
  };
427
- return v(r, i, t);
493
+ return b(r, a, t);
428
494
  }, Se = ({
429
495
  dashboardOid: e,
430
496
  widgetOid: t,
@@ -434,21 +500,19 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
434
500
  }) => {
435
501
  L(a);
436
502
  const i = { dashboardOid: e, widgetOid: t }, o = pe[Number(s)];
437
- return v(o, i, r);
503
+ return b(o, i, r);
438
504
  }, Te = ({
439
505
  widgetProps: e,
440
- uiFramework: t = "react",
441
- includeChart: r = !0
506
+ uiFramework: t = "react"
442
507
  }) => {
443
- if (V(e)) {
444
- L(e.chartType);
445
- const a = me[Number(r)];
446
- return r ? ye(e, t, a) : he(e, t, a);
447
- }
508
+ if (J(e))
509
+ return L(e.chartType), ye(e, t, me);
510
+ if (V(e))
511
+ return he(e, t, ge);
448
512
  throw new u("errors.otherWidgetTypesNotSupported");
449
- }, xe = (e) => ({
450
- dataOptions: { columns: e.map(Q) }
451
- }), Oe = Object.freeze({
513
+ }, ve = (e) => ({
514
+ dataOptions: { columns: e.map(P) }
515
+ }), xe = Object.freeze({
452
516
  convolution: {
453
517
  enabled: !0,
454
518
  selectedConvolutionType: "bySlicesCount",
@@ -467,45 +531,45 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
467
531
  xAxis: {
468
532
  gridLines: !1
469
533
  }
470
- }), q = Object.freeze({
534
+ }), $ = Object.freeze({
471
535
  line: "line/spline",
472
536
  pie: "pie/donut",
473
537
  bar: "bar/stacked",
474
538
  column: "column/stackedcolumn"
475
- }), be = (e, t) => {
539
+ }), Oe = (e, t) => {
476
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) => {
477
- const [n, p] = l;
478
- return o[`${n}`] = Array.isArray(p) ? p.map((m) => {
541
+ const [n, m] = l;
542
+ return o[`${n}`] = Array.isArray(m) ? m.map((g) => {
479
543
  var S, T;
480
- const d = s[m.name];
544
+ const d = s[g.name];
481
545
  if (!d)
482
- return { column: { type: "", name: m.name } };
483
- const c = Q(d);
546
+ return { column: { type: "", name: g.name } };
547
+ const c = P(d);
484
548
  if (d.panel === "measures")
485
549
  return {
486
550
  column: c,
487
551
  sortType: "sortNone"
488
552
  };
489
- if (G(c.type)) {
490
- const x = (T = (S = d.format) == null ? void 0 : S.mask) == null ? void 0 : T[d.jaql.level];
491
- if (x)
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)
492
556
  return {
493
557
  column: c,
494
- dateFormat: x
558
+ dateFormat: v
495
559
  };
496
560
  }
497
561
  return c;
498
- }) : p, o;
562
+ }) : m, o;
499
563
  }, {});
500
564
  switch (a) {
501
565
  case "cartesian":
502
- return g({
566
+ return f({
503
567
  category: [],
504
568
  value: [],
505
569
  breakBy: []
506
570
  }, i);
507
571
  case "categorical":
508
- return g({
572
+ return f({
509
573
  category: [],
510
574
  value: []
511
575
  }, i);
@@ -518,22 +582,22 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
518
582
  o !== "geo" && (i[`${o}`] = i[`${o}`][0]);
519
583
  }), i;
520
584
  case "table":
521
- return Object.keys(i).length === 0 ? xe(e).dataOptions : i;
585
+ return Object.keys(i).length === 0 ? ve(e).dataOptions : i;
522
586
  case "boxplot":
523
587
  case "areamap":
524
588
  case "indicator":
525
589
  default:
526
590
  return i;
527
591
  }
528
- }, W = (e, t) => {
592
+ }, q = (e, t) => {
529
593
  var r, a, s, i;
530
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(", ");
531
- }, ve = (e, t, r = !0) => {
532
- const a = be(e, t);
595
+ }, be = (e, t, r = !0) => {
596
+ const a = Oe(e, t);
533
597
  let s;
534
- return r && t.chartType in q ? s = C(
535
- C(Oe, {
536
- subtype: q[t.chartType]
598
+ return r && t.chartType in $ ? s = C(
599
+ C(xe, {
600
+ subtype: $[t.chartType]
537
601
  }),
538
602
  {
539
603
  legend: {
@@ -543,13 +607,13 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
543
607
  yAxis: {
544
608
  title: {
545
609
  enabled: !0,
546
- text: W(t, "y")
610
+ text: q(t, "y")
547
611
  }
548
612
  },
549
613
  xAxis: {
550
614
  title: {
551
615
  enabled: !0,
552
- text: W(t, "x")
616
+ text: q(t, "x")
553
617
  }
554
618
  }
555
619
  }
@@ -561,7 +625,7 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
561
625
  chartType: "table",
562
626
  chartFamily: "table",
563
627
  axesMapping: {}
564
- }, we = (e) => e.map((t) => ee(t.jaql)), Ce = (e) => e.reduce(
628
+ }, we = (e) => e.map((t) => X(t.jaql)), Ce = (e) => e.reduce(
565
629
  (t, r) => {
566
630
  if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(D(r)), r.panel !== "scope") {
567
631
  const a = D(r);
@@ -571,22 +635,22 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
571
635
  },
572
636
  { metadataColumns: [], metadataFilters: [] }
573
637
  ), De = (e, t) => {
574
- if (!ie(e))
638
+ if (!re(e))
575
639
  try {
576
640
  const { useCustomizedStyleOptions: r = !1 } = t || {}, { jaql: a, chartRecommendations: s, queryTitle: i } = e, {
577
641
  metadata: o,
578
- datasource: { title: l, id: n, type: p = "elasticube" }
579
- } = a, m = Ee(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 = {
580
644
  cornerRadius: "Small",
581
645
  header: {
582
646
  // remove info button and render empty toolbar instead
583
647
  renderToolbar: () => null
584
648
  }
585
- }, { metadataColumns: S, metadataFilters: T } = Ce(o), x = we(T), { dataOptions: N, chartStyleOptions: R } = ve(
649
+ }, { metadataColumns: S, metadataFilters: T } = Ce(o), v = we(T), { dataOptions: k, chartStyleOptions: B } = be(
586
650
  S,
587
- m,
651
+ g,
588
652
  r
589
- ), _ = g(g({}, R), c);
653
+ ), N = f(f({}, B), c);
590
654
  return {
591
655
  widgetType: "chart",
592
656
  id: i,
@@ -595,30 +659,35 @@ const { data, isLoading, isError } = useExecuteQuery(queryProps);
595
659
  dataSource: {
596
660
  title: l,
597
661
  id: n,
598
- type: p
662
+ type: m
599
663
  },
600
- dataOptions: N,
601
- filters: x,
602
- styleOptions: _
664
+ dataOptions: k,
665
+ filters: v,
666
+ styleOptions: N
603
667
  };
604
668
  } catch (r) {
605
669
  console.error(r);
606
670
  return;
607
671
  }
608
- }, $e = (e, t) => De(e, t), qe = (e) => re(e) ? Se(e) : Te(e), Pe = /* @__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({
609
673
  __proto__: null,
610
- toWidgetCode: qe,
611
- toWidgetProps: $e
674
+ toWidgetCode: $e,
675
+ toWidgetProps: Me
612
676
  }, Symbol.toStringTag, { value: "Module" }));
613
677
  export {
614
- Me as E,
615
- Ie as a,
616
- re as b,
678
+ Qe as E,
679
+ A as a,
680
+ p as b,
617
681
  Le as c,
618
- Qe as i,
619
- oe as p,
620
- Ae as s,
621
- $e as t,
622
- Fe as v,
623
- Pe as w
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
624
693
  };