@sisense/sdk-ui 1.29.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.
Files changed (85) hide show
  1. package/dist/ai.cjs +53 -51
  2. package/dist/ai.js +1049 -1005
  3. package/dist/analytics-composer.cjs +37 -37
  4. package/dist/analytics-composer.js +460 -461
  5. package/dist/{derive-chart-family-Cy3hlluo.js → derive-chart-family-D3iN--j2.js} +2078 -2028
  6. package/dist/{derive-chart-family-DWCXp57c.cjs → derive-chart-family-Tt7cIUck.cjs} +46 -46
  7. package/dist/index.cjs +120 -97
  8. package/dist/index.js +8073 -7197
  9. package/dist/packages/sdk-ui/src/ai/ai-context-provider.d.ts +2 -1
  10. package/dist/packages/sdk-ui/src/ai/api/chat-api-provider.d.ts +2 -1
  11. package/dist/packages/sdk-ui/src/ai/api/chat-rest-api.d.ts +5 -3
  12. package/dist/packages/sdk-ui/src/ai/api/hooks.d.ts +2 -2
  13. package/dist/packages/sdk-ui/src/ai/api/types.d.ts +11 -1
  14. package/dist/packages/sdk-ui/src/ai/chart/nlq-chart-widget.d.ts +3 -2
  15. package/dist/packages/sdk-ui/src/ai/chat-box.d.ts +3 -1
  16. package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +7 -1
  17. package/dist/packages/sdk-ui/src/ai/chat-id-storage-provider.d.ts +12 -0
  18. package/dist/packages/sdk-ui/src/ai/use-chat-session.d.ts +4 -3
  19. package/dist/packages/sdk-ui/src/ai/use-get-chat.d.ts +6 -0
  20. package/dist/packages/sdk-ui/src/ai/use-get-nlg-insights.d.ts +2 -0
  21. package/dist/packages/sdk-ui/src/ai/use-get-query-recommendations.d.ts +1 -1
  22. package/dist/packages/sdk-ui/src/ai/use-last-nlq-response.d.ts +4 -2
  23. package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +13 -6
  24. package/dist/packages/sdk-ui/src/chart-data/chart-data-service.d.ts +1 -13
  25. package/dist/packages/sdk-ui/src/chart-data-options/coloring/range-coloring.d.ts +12 -0
  26. package/dist/packages/sdk-ui/src/chart-data-options/types.d.ts +5 -1
  27. package/dist/packages/sdk-ui/src/chart-options-processor/advanced-chart-options.d.ts +3 -4
  28. package/dist/packages/sdk-ui/src/common/components/popper.d.ts +9 -0
  29. package/dist/packages/sdk-ui/src/common/components/radio.d.ts +1 -1
  30. package/dist/packages/sdk-ui/src/common/hooks/use-debounced-value.d.ts +5 -0
  31. package/dist/packages/sdk-ui/src/common/hooks/use-was-modified.d.ts +5 -0
  32. package/dist/packages/sdk-ui/src/const.d.ts +3 -0
  33. package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/criteria-filter-operations.d.ts +23 -23
  34. package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +4 -5
  35. package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/index.d.ts +2 -1
  36. package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/types.d.ts +7 -0
  37. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/input.d.ts +9 -3
  38. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/scroll-wrapper.d.ts +13 -0
  39. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/base.d.ts +7 -0
  40. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/multi-select-item.d.ts +2 -0
  41. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/searchable-multi-select.d.ts +5 -0
  42. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/searchable-single-select.d.ts +5 -0
  43. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/single-select-item.d.ts +2 -0
  44. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/single-select.d.ts +2 -0
  45. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/types.d.ts +2 -0
  46. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/selectable-section.d.ts +2 -3
  47. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/small-loader.d.ts +1 -0
  48. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/constants.d.ts +2 -0
  49. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/filter-editor-container.d.ts +5 -0
  50. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/filter-editor-numerical.d.ts +8 -0
  51. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/filter-editor-textual.d.ts +8 -0
  52. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/hooks/use-get-attribute-stats.d.ts +28 -0
  53. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/members-section.d.ts +5 -1
  54. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-condition-section/index.d.ts +1 -0
  55. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-condition-section/numeric-condition-section.d.ts +15 -0
  56. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-condition-section/types.d.ts +16 -0
  57. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-condition-section/utils.d.ts +7 -0
  58. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/numeric-range-section.d.ts +11 -0
  59. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/text-condition-section.d.ts +6 -2
  60. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/utils.d.ts +4 -0
  61. package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/utils.d.ts +1 -0
  62. package/dist/packages/sdk-ui/src/filters/components/icons/equal-icon.d.ts +2 -0
  63. package/dist/packages/sdk-ui/src/filters/components/icons/greater-than-icon.d.ts +2 -0
  64. package/dist/packages/sdk-ui/src/filters/components/icons/greater-than-or-equal-icon.d.ts +2 -0
  65. package/dist/packages/sdk-ui/src/filters/components/icons/index.d.ts +6 -0
  66. package/dist/packages/sdk-ui/src/filters/components/icons/not-equal-icon.d.ts +2 -0
  67. package/dist/packages/sdk-ui/src/filters/components/icons/pencil-icon.d.ts +3 -1
  68. package/dist/packages/sdk-ui/src/filters/components/icons/smaller-than-icon.d.ts +2 -0
  69. package/dist/packages/sdk-ui/src/filters/components/icons/smaller-than-or-equal-icon.d.ts +2 -0
  70. package/dist/packages/sdk-ui/src/filters/hooks/use-get-filter-members.d.ts +21 -1
  71. package/dist/packages/sdk-ui/src/index-typedoc.d.ts +28 -0
  72. package/dist/packages/sdk-ui/src/pivot-table/formatters/data-cell-formatters/data-cell-color-formatter.d.ts +4 -0
  73. package/dist/packages/sdk-ui/src/pivot-table/hooks/use-pivot-builder.d.ts +7 -0
  74. package/dist/packages/sdk-ui/src/query-execution/types.d.ts +10 -1
  75. package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +15 -0
  76. package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +30 -0
  77. package/dist/packages/sdk-ui/src/types.d.ts +10 -0
  78. package/dist/packages/sdk-ui/src/utils/is-numeric-string.d.ts +10 -0
  79. package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +1 -0
  80. package/dist/{useQuery-CdtycPOg.js → use-common-filters-CHBXz5rL.js} +17543 -17520
  81. package/dist/{useQuery-CRu7WcYd.cjs → use-common-filters-Dd-gOMfB.cjs} +170 -170
  82. package/dist/widget-composer-BHf4pbvI.cjs +311 -0
  83. package/dist/{widget-composer-G4mPX-JO.js → widget-composer-BrQ6SrZ6.js} +221 -203
  84. package/package.json +8 -7
  85. package/dist/widget-composer-DyY3yi_b.cjs +0 -300
@@ -1,86 +1,90 @@
1
- var Y = Object.defineProperty;
2
- var w = Object.getOwnPropertySymbols;
3
- var U = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
4
- var C = (e, t, r) => t in e ? Y(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, y = (e, t) => {
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
- U.call(t, r) && C(e, r, t[r]);
7
- if (w)
8
- for (var r of w(t))
9
- z.call(t, r) && C(e, r, t[r]);
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 { cF as q, q as P, M as x, T as u, cG as J, cH as S, cI as L, ad as V, Y as H, af as G, p as D, cJ as X, P as Z, F as ee, aT as M } from "./derive-chart-family-Cy3hlluo.js";
13
- class Q extends q {
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 = P(t.jaql.sort) : delete this.sortType, this.skipValidation = !0;
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 te = {
26
- text: x.TextAttribute,
27
- numeric: x.NumericAttribute,
28
- datetime: x.DateLevel
26
+ const oe = {
27
+ text: E.TextAttribute,
28
+ numeric: E.NumericAttribute,
29
+ datetime: E.DateLevel
29
30
  };
30
- function j(e) {
31
+ function A(e) {
31
32
  var t;
32
- return new Q(e, (t = te[e.jaql.datatype]) !== null && t !== void 0 ? t : "numeric");
33
+ return new k(e, (t = oe[e.jaql.datatype]) !== null && t !== void 0 ? t : "numeric");
33
34
  }
34
- const je = {
35
+ const Ne = {
35
36
  jaql: { datasource: { title: "" }, metadata: [] },
36
- widgetProps: void 0,
37
37
  queryTitle: "",
38
38
  chartRecommendations: {}
39
- }, Ae = {
39
+ }, _e = {
40
40
  model: "",
41
41
  metadata: [],
42
42
  chart: {},
43
43
  queryTitle: ""
44
- }, Fe = (e) => "widgetProps" in e, re = (e) => "dashboardOid" in e && "widgetOid" in e;
45
- function ae(e) {
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 ke(e) {
48
+ function ze(e) {
49
49
  return e.charAt(0).toUpperCase() + e.slice(1);
50
50
  }
51
- function Ne(e) {
51
+ function Ue(e) {
52
52
  const t = /\[(.+?)\s\(Calendar\)\]/;
53
53
  return e.replace(t, "[$1]").trim();
54
54
  }
55
- function Be(e) {
55
+ function Ke(e) {
56
56
  if (e)
57
57
  if (e.metadata) {
58
58
  if (!e.model)
59
- throw new u("errors.missingModelTitle");
59
+ throw new m("errors.missingModelTitle");
60
60
  } else
61
- throw new u("errors.missingMetadata");
61
+ throw new m("errors.missingMetadata");
62
62
  else
63
- throw new u("errors.emptyModel");
63
+ throw new m("errors.emptyModel");
64
64
  return e;
65
65
  }
66
- function ie(e) {
66
+ function ue(e) {
67
67
  return !e || !e.jaql.datasource.title || !e.jaql.metadata.length;
68
68
  }
69
- function A(e) {
70
- if (![...J, "pivot", "pivot2"].includes(e))
71
- throw new u("errors.chartTypeNotSupported", { chartType: e });
69
+ function B(e) {
70
+ if (![...ee, "pivot", "pivot2"].includes(e))
71
+ throw new m("errors.chartTypeNotSupported", { chartType: e });
72
72
  }
73
- function se(e) {
73
+ function ce(e) {
74
74
  return "widgetType" in e && e.widgetType === "pivot";
75
75
  }
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
+ }
76
80
  function F(e) {
77
- const t = "measures" in e && m(e.measures) || "values" in e && m(e.values);
78
- return se(e) ? "values" in e.dataOptions && m(e.dataOptions.values) : "chartType" in e ? e.chartType === "scatter" ? "x" in e.dataOptions && "y" in e.dataOptions && (e.dataOptions.x !== void 0 || e.dataOptions.y !== void 0) : e.chartType === "scattermap" ? "geo" in e.dataOptions && m(e.dataOptions.geo) : "value" in e.dataOptions && m(e.dataOptions.value) : t;
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 m(e) {
84
+ function o(e) {
81
85
  return Array.isArray(e) && e.length > 0;
82
86
  }
83
- function oe(e) {
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 ne = {
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);
@@ -201,7 +207,7 @@ const CodeExample = () => {
201
207
  return <div>Error: {error.message}</div>;
202
208
  }
203
209
  if (data) {
204
- return <div>Total Rows: {data.rows.length}</div>;
210
+ return <div>Total Rows: {data.table.rows.length}</div>;
205
211
  }
206
212
 
207
213
  return null;
@@ -219,17 +225,20 @@ 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
  }`
225
232
  },
226
233
  angular: {
227
234
  baseChartTmpl: `import { Component } from '@angular/core';
235
+ import { SdkUiModule, type ChartDataOptions } from '@sisense/sdk-ui-angular';
228
236
  {{extraImportsString}}
229
237
  import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
230
238
 
231
239
  @Component({
232
240
  selector: 'code-example',
241
+ imports: [SdkUiModule],
233
242
  template: \`
234
243
  <csdk-chart-widget
235
244
  chartType='{{chartTypeString}}'
@@ -241,15 +250,17 @@ import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
241
250
  })
242
251
  export class CodeExample {
243
252
  DM = DM;
244
- dataOptions = {{dataOptionsString}};
253
+ dataOptions: ChartDataOptions = {{dataOptionsString}};
245
254
  filters = {{filtersString}};
246
255
  }`,
247
256
  chartTmpl: "{{baseChartTmpl}}",
248
257
  chartWidgetTmpl: "{{baseChartTmpl}}",
249
258
  widgetByIdTmpl: `import { Component } from '@angular/core';
259
+ import { SdkUiModule } from '@sisense/sdk-ui-angular';
250
260
 
251
261
  @Component({
252
262
  selector: 'code-example',
263
+ imports: [SdkUiModule],
253
264
  template: \`
254
265
  <csdk-widget-by-id
255
266
  [widgetOid]="widgetOid"
@@ -265,11 +276,13 @@ export class CodeExample {
265
276
  includeDashboardFilters = true;
266
277
  }`,
267
278
  executeQueryByWidgetIdTmpl: `import { Component } from '@angular/core';
279
+ import { CommonModule } from '@angular/common';
268
280
  import { QueryService } from '@sisense/sdk-ui-angular';
269
281
  import { type QueryResultData } from '@sisense/sdk-data';
270
282
 
271
283
  @Component({
272
284
  selector: 'code-example',
285
+ imports: [CommonModule],
273
286
  template: \`<div>
274
287
  <div *ngIf="errorMessage">Error: {{ errorMessage }}</div>
275
288
  <div *ngIf="!errorMessage">Total Rows: {{ queryResult.rows.length }}</div>
@@ -299,6 +312,7 @@ export class CodeExample {
299
312
  }
300
313
  `,
301
314
  executeQueryTmpl: `import { Component } from '@angular/core';
315
+ import { CommonModule } from '@angular/common';
302
316
  {{extraImportsString}}
303
317
  import { type QueryResultData } from '@sisense/sdk-data';
304
318
  import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
@@ -306,6 +320,7 @@ import { QueryService } from '@sisense/sdk-ui-angular';
306
320
 
307
321
  @Component({
308
322
  selector: 'code-example',
323
+ imports: [CommonModule],
309
324
  template: \`<div>
310
325
  <div *ngIf="errorMessage">Error: {{ errorMessage }}</div>
311
326
  <div *ngIf="!errorMessage">Total Rows: {{ queryResult.rows.length }}</div>
@@ -413,130 +428,131 @@ const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
413
428
  executePivotQueryTmpl: "Not implemented yet",
414
429
  pivotTableWidgetTmpl: "Not implemented yet"
415
430
  }
416
- }, k = (e, t) => ne[t][e].replace(
431
+ }, N = (e, t) => ge[t][e].replace(
417
432
  /{{(.*?)Tmpl}}/g,
418
- (a, s) => k(`${s}Tmpl`, t)
419
- ), le = (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") => {
420
- const a = k(e, r);
421
- return oe(le(a, t));
422
- }, h = `
423
- `, E = "UNKNOWN", de = (e, t) => {
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) => {
424
439
  let r = "";
425
440
  return r += `measureFactory.customFormula(
426
- `, r += " ".repeat(t), r += ` '${S(e.title)}',
441
+ `, r += " ".repeat(t), r += ` '${h(e.title)}',
427
442
  `, r += " ".repeat(t), r += ` '${e.formula}',
428
443
  `, r += " ".repeat(t), r += ` {
429
- `, Object.entries(e.context).forEach(([a, s]) => {
430
- const i = L(
431
- s.table || E,
432
- s.column || E,
444
+ `, Object.entries(e.context).forEach(([a, i]) => {
445
+ const s = j(
446
+ i.table || M,
447
+ i.column || M,
433
448
  void 0,
434
449
  "DM"
435
450
  );
436
- r += " ".repeat(t), r += ` '${a.slice(1, -1)}': ${i},
451
+ r += " ".repeat(t), r += ` '${a.slice(1, -1)}': ${s},
437
452
  `;
438
453
  }), r += " ".repeat(t), r += ` }
439
454
  `, r += " ".repeat(t), r += ")", r;
440
- }, ue = (e, t) => {
441
- const { level: r, table: a, column: s, agg: i, sort: o, title: l } = e;
455
+ }, ye = (e) => {
456
+ const { level: t, table: r, column: a, agg: i, title: s } = e;
442
457
  let n;
443
- return a && s && (n = L(a, s, r, "DM")), i && a && s && l && (n = `measureFactory.${V.aggregationFromJAQL(
458
+ return r && a && (n = j(r, a, t, "DM")), i && r && a && s && (n = `measureFactory.${te.aggregationFromJAQL(
444
459
  i
445
- )}(${n}, '${S(l)}')`), o && (n = `{column: ${n}, sortType: '${P(o)}'}`), n ? `${" ".repeat(t)}${n}` : E;
446
- }, ce = (e, t) => {
447
- const r = e.jaql().jaql;
448
- return "formula" in r ? de(r, t) : h + ue(r, t);
449
- }, p = (e, t = 0, r = !1) => {
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) => {
450
465
  if (!e)
451
466
  return "";
452
467
  if (typeof e == "string")
453
- return `'${S(e)}'`;
454
- if (e instanceof Q)
455
- return ce(e, t);
456
- if (e instanceof q)
468
+ return `'${h(e)}'`;
469
+ if (e instanceof k)
470
+ return he(e, t);
471
+ if (e instanceof $)
457
472
  return e.composeCode || "";
458
473
  let a = "";
459
- return Array.isArray(e) ? a += `[${e.map((s) => p(s, t + 2))}${e.length ? h + " ".repeat(t + 2) : ""}]` : (a += `{${h}`, Object.entries(e).forEach(([s, i]) => {
460
- r && (s = `'${S(s)}'`), a += " ".repeat(t + 2), Array.isArray(i) ? a += `${s}: [${i.map((o) => p(o, t + 4, r))}${i.length ? h + " ".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}: '${S(i)}'`, a += `,${h}`;
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}`;
461
476
  }), a += " ".repeat(t), a += "}"), a;
462
477
  };
463
- function me(e) {
464
- return p(e, 2);
478
+ function Se(e) {
479
+ return f(e, 6);
465
480
  }
466
- function N(e) {
481
+ function _(e) {
467
482
  if (!e)
468
- throw new u("errors.undefinedDataSource");
483
+ throw new m("errors.undefinedDataSource");
469
484
  let t;
470
- return typeof e == "object" && "title" in e ? t = e.title : t = e, ae(t);
485
+ return typeof e == "object" && "title" in e ? t = e.title : t = e, de(t);
471
486
  }
472
- function B(e, t = !0) {
487
+ function R(e, t = !0) {
473
488
  const r = [];
474
- return t && r.push("measureFactory"), m(e) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
489
+ return t && r.push("measureFactory"), o(e) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
475
490
  }
476
- const I = `
477
- `, pe = (e, t) => {
491
+ const P = `
492
+ `, Oe = (e, t) => {
478
493
  if (e.composeCode)
479
- return `${I}${" ".repeat(t)}${e.composeCode}`;
494
+ return `${P}${" ".repeat(t)}${e.composeCode}`;
480
495
  const r = e.jaql().jaql;
481
- return `${I}${" ".repeat(t)}filterFactory.customFilter(${p(
496
+ return `${P}${" ".repeat(t)}filterFactory.customFilter(${f(
482
497
  r,
483
498
  t,
484
499
  !0
485
500
  )})`;
486
- }, ge = (e, t = 0) => {
501
+ }, ve = (e, t = 0) => {
487
502
  if (!e)
488
503
  return "";
489
504
  let r = "";
490
- return r += `[${e.map((a) => pe(a, t + 2))}${e.length ? `
505
+ return r += `[${e.map((a) => Oe(a, t + 2))}${e.length ? `
491
506
  ` + " ".repeat(t + 2) : ""}]`, r;
492
- }, fe = (e) => {
507
+ }, z = (e) => {
493
508
  if (!e)
494
509
  return "";
495
510
  if (Array.isArray(e))
496
- return ge(e, 2);
497
- throw new u("errors.filterRelationsNotSupported");
498
- }, ye = ["executeQueryByWidgetIdTmpl", "widgetByIdTmpl"], he = "chartWidgetTmpl", Se = "pivotTableWidgetTmpl", Te = (e) => e, ve = (e, t, r) => {
499
- const a = F(e), s = {
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 = {
500
515
  titleString: e.title,
501
- dataSourceString: N(e.dataSource),
502
- chartTypeString: Te(e.chartType),
503
- dataOptionsString: me(e.dataOptions),
504
- filtersString: fe(e.filters),
516
+ dataSourceString: _(e.dataSource),
517
+ chartTypeString: Ee(e.chartType),
518
+ dataOptionsString: Se(e.dataOptions),
519
+ filtersString: z(e.filters),
505
520
  componentString: "ChartWidget",
506
- extraImportsString: B(e.filters || [], a)
521
+ extraImportsString: R(e.filters || [], a)
507
522
  };
508
- return b(r, s, t);
509
- }, Oe = (e, t, r) => {
510
- const a = F(e), s = {
523
+ return D(r, i, t);
524
+ }, we = (e, t, r) => {
525
+ const a = F(e), i = {
511
526
  titleString: e.title,
512
- dataSourceString: N(e.dataSource),
513
- dataOptionsString: p(e.dataOptions),
527
+ dataSourceString: _(e.dataSource),
528
+ dataOptionsString: f(e.dataOptions),
529
+ filtersString: z(e.filters),
514
530
  componentString: "PivotTableWidget",
515
- extraImportsString: B(e.filters || [], a)
531
+ extraImportsString: R(e.filters || [], a)
516
532
  };
517
- return b(r, s, t);
518
- }, xe = ({
533
+ return D(r, i, t);
534
+ }, Me = ({
519
535
  dashboardOid: e,
520
536
  widgetOid: t,
521
537
  uiFramework: r = "react",
522
538
  chartType: a = "table",
523
- includeChart: s = !0
539
+ includeChart: i = !0
524
540
  }) => {
525
- A(a);
526
- const i = { dashboardOid: e, widgetOid: t }, o = ye[Number(s)];
527
- return b(o, i, r);
528
- }, Ee = ({
541
+ B(a);
542
+ const s = { dashboardOid: e, widgetOid: t }, n = Te[Number(i)];
543
+ return D(n, s, r);
544
+ }, De = ({
529
545
  widgetProps: e,
530
546
  uiFramework: t = "react"
531
547
  }) => {
532
- if (H(e))
533
- return A(e.chartType), ve(e, t, he);
534
- if (G(e))
535
- return Oe(e, t, Se);
536
- throw new u("errors.otherWidgetTypesNotSupported");
537
- }, be = (e) => ({
538
- dataOptions: { columns: e.map(j) }
539
- }), we = Object.freeze({
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({
540
556
  convolution: {
541
557
  enabled: !0,
542
558
  selectedConvolutionType: "bySlicesCount",
@@ -555,73 +571,74 @@ const I = `
555
571
  xAxis: {
556
572
  gridLines: !1
557
573
  }
558
- }), W = Object.freeze({
574
+ }), L = Object.freeze({
559
575
  line: "line/spline",
560
576
  pie: "pie/donut",
561
577
  bar: "bar/stacked",
562
578
  column: "column/stackedcolumn"
563
- }), Ce = (e, t) => {
564
- const { axesMapping: r = {}, chartFamily: a } = t, s = e.reduce((o, l) => (o[l.jaql.title] = l, o), {}), i = Object.entries(r).reduce((o, l) => {
565
- const [n, g] = l;
566
- return o[`${n}`] = Array.isArray(g) ? g.map((f) => {
567
- var T, v;
568
- const d = s[f.name];
569
- if (!d)
570
- return { column: { type: "", name: f.name } };
571
- const c = j(d);
572
- if (d.panel === "measures")
573
- return {
574
- column: c,
575
- sortType: "sortNone"
576
- };
577
- if (Z(c.type)) {
578
- const O = (v = (T = d.format) == null ? void 0 : T.mask) == null ? void 0 : v[d.jaql.level];
579
- if (O)
580
- return {
581
- column: c,
582
- dateFormat: O
583
- };
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
+ });
584
601
  }
585
- return c;
586
- }) : g, o;
602
+ return T(d({}, l), { column: g });
603
+ }) : y, s;
587
604
  }, {});
588
- switch (a) {
605
+ switch (t) {
589
606
  case "cartesian":
590
- return y({
607
+ return d({
591
608
  category: [],
592
609
  value: [],
593
610
  breakBy: []
594
611
  }, i);
595
612
  case "categorical":
596
- return y({
613
+ return d({
597
614
  category: [],
598
615
  value: []
599
616
  }, i);
600
617
  case "scatter":
601
- return Object.keys(i).forEach((o) => {
602
- i[`${o}`] = i[`${o}`][0];
618
+ return Object.keys(i).forEach((s) => {
619
+ i[`${s}`] = i[`${s}`][0];
603
620
  }), i;
604
621
  case "scattermap":
605
- return Object.keys(i).forEach((o) => {
606
- o !== "geo" && (i[`${o}`] = i[`${o}`][0]);
622
+ return Object.keys(i).forEach((s) => {
623
+ s !== "geo" && (i[`${s}`] = i[`${s}`][0]);
607
624
  }), i;
608
625
  case "table":
609
- return Object.keys(i).length === 0 ? be(e).dataOptions : i;
626
+ return Object.keys(i).length === 0 ? We(e).dataOptions : i;
610
627
  case "boxplot":
611
628
  case "areamap":
612
629
  case "indicator":
613
630
  default:
614
631
  return i;
615
632
  }
616
- }, $ = (e, t) => {
617
- var r, a, s, i;
618
- 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(", ");
619
- }, De = (e, t, r = !0) => {
620
- const a = Ce(e, t);
621
- let s;
622
- return r && t.chartType in W ? s = D(
623
- D(we, {
624
- subtype: W[t.chartType]
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]
625
642
  }),
626
643
  {
627
644
  legend: {
@@ -631,88 +648,89 @@ const I = `
631
648
  yAxis: {
632
649
  title: {
633
650
  enabled: !0,
634
- text: $(t, "y")
651
+ text: Q(t, "y")
635
652
  }
636
653
  },
637
654
  xAxis: {
638
655
  title: {
639
656
  enabled: !0,
640
- text: $(t, "x")
657
+ text: Q(t, "x")
641
658
  }
642
659
  }
643
- }
644
- ) : s = X(), {
645
- dataOptions: a,
646
- chartStyleOptions: s
660
+ },
661
+ s
662
+ ) : u = C(ie(), s), {
663
+ dataOptions: n,
664
+ chartStyleOptions: u
647
665
  };
648
- }, Me = (e) => "chartType" in e ? e : {
666
+ }, Le = (e) => "chartType" in e ? e : {
649
667
  chartType: "table",
650
668
  chartFamily: "table",
651
669
  axesMapping: {}
652
- }, Ie = (e) => e.map((t) => ee(t.jaql)), We = (e) => e.reduce(
670
+ }, Qe = (e) => e.map((t) => ne(t.jaql)), $e = (e) => e.reduce(
653
671
  (t, r) => {
654
- if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(M(r)), r.panel !== "scope") {
655
- const a = M(r);
672
+ if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(q(r)), r.panel !== "scope") {
673
+ const a = q(r);
656
674
  delete a.jaql.filter, t.metadataColumns.push(a);
657
675
  }
658
676
  return t;
659
677
  },
660
678
  { metadataColumns: [], metadataFilters: [] }
661
- ), $e = (e, t) => {
662
- if (!ie(e))
679
+ ), je = (e, t) => {
680
+ if (!ue(e))
663
681
  try {
664
- const { useCustomizedStyleOptions: r = !1 } = t || {}, { jaql: a, chartRecommendations: s, queryTitle: i } = e, {
665
- metadata: o,
666
- datasource: { title: l, id: n, type: g = "elasticube" }
667
- } = a, f = Me(s), d = f.chartType.toLowerCase(), c = {
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 = {
668
686
  cornerRadius: "Small",
669
687
  header: {
670
688
  // remove info button and render empty toolbar instead
671
689
  renderToolbar: () => null
672
690
  }
673
- }, { metadataColumns: T, metadataFilters: v } = We(o), O = Ie(v), { dataOptions: _, chartStyleOptions: R } = De(
674
- T,
675
- f,
691
+ }, { metadataColumns: S, metadataFilters: O } = $e(n), v = Qe(O), { dataOptions: U, chartStyleOptions: K } = Pe(
692
+ S,
693
+ l,
676
694
  r
677
- ), K = y(y({}, R), c);
695
+ ), Y = d(d({}, K), g);
678
696
  return {
679
697
  widgetType: "chart",
680
- id: i,
681
- title: i,
682
- chartType: d,
698
+ id: s,
699
+ title: s,
700
+ chartType: c,
683
701
  dataSource: {
684
- title: l,
685
- id: n,
686
- type: g
702
+ title: u,
703
+ id: y,
704
+ type: b
687
705
  },
688
- dataOptions: _,
689
- filters: O,
690
- styleOptions: K
706
+ dataOptions: U,
707
+ filters: v,
708
+ styleOptions: Y
691
709
  };
692
710
  } catch (r) {
693
711
  console.error(r);
694
712
  return;
695
713
  }
696
- }, qe = (e, t) => $e(e, t), Pe = (e) => re(e) ? xe(e) : Ee(e), _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
714
+ }, ke = (e, t) => je(e, t), Ae = (e) => le(e) ? Me(e) : De(e), Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
697
715
  __proto__: null,
698
- toWidgetCode: Pe,
699
- toWidgetProps: qe
716
+ toWidgetCode: Ae,
717
+ toWidgetProps: ke
700
718
  }, Symbol.toStringTag, { value: "Module" }));
701
719
  export {
702
- Ae as E,
703
- N as a,
704
- p as b,
705
- ke as c,
706
- fe as d,
707
- B as e,
708
- F as f,
709
- b as g,
710
- je as h,
711
- Fe as i,
712
- re as j,
713
- le as p,
714
- Ne as s,
715
- qe as t,
716
- Be as v,
717
- _e as w
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
718
736
  };