@sisense/sdk-ui 2.5.0 → 2.7.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 (60) hide show
  1. package/dist/ai.cjs +17 -17
  2. package/dist/ai.js +653 -650
  3. package/dist/analytics-composer.cjs +82 -82
  4. package/dist/analytics-composer.js +1911 -1911
  5. package/dist/derive-chart-family-BCY-GLVZ.cjs +672 -0
  6. package/dist/derive-chart-family-DvYmrG1k.js +93730 -0
  7. package/dist/dimensions-DAISVpEZ.cjs +1 -0
  8. package/dist/dimensions-WmjaZcrG.js +203 -0
  9. package/dist/index.cjs +14 -14
  10. package/dist/index.js +6403 -6271
  11. package/dist/index.umd.js +297 -297
  12. package/dist/packages/sdk-ui/src/ai/api/types.d.ts +1 -0
  13. package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +7 -0
  14. package/dist/packages/sdk-ui/src/ai/use-get-query-recommendations.d.ts +7 -0
  15. package/dist/packages/sdk-ui/src/analytics-composer/query/fix-ranking-filter-jaql.d.ts +8 -0
  16. package/dist/packages/sdk-ui/src/app/client-application.d.ts +2 -2
  17. package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/highchart-options/get-legacy-cartesian-chart-options.d.ts +3 -0
  18. package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/highchart-options/legend.d.ts +2 -0
  19. package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/highchart-options/tooltip.d.ts +4 -0
  20. package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/stackable/bar-chart/{highcharts-options-builder.d.ts → highchart-options/highcharts-options-builder.d.ts} +1 -1
  21. package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/stackable/bar-chart/highchart-options/legend.d.ts +3 -0
  22. package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/highcharts-based-chart-renderer/highcharts-based-chart-renderer.d.ts +4 -0
  23. package/dist/packages/sdk-ui/src/chart-options-processor/{cartesian-chart-options.d.ts → cartesian/cartesian-chart-options.d.ts} +6 -6
  24. package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/axis-configuration.d.ts +41 -0
  25. package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/chart-configuration.d.ts +13 -0
  26. package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/chart-spacing-calculator.d.ts +41 -0
  27. package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/series-processor.d.ts +57 -0
  28. package/dist/packages/sdk-ui/src/chart-options-processor/tooltip.d.ts +3 -29
  29. package/dist/packages/sdk-ui/src/chart-options-processor/translations/scatter-plot-options.d.ts +2 -2
  30. package/dist/packages/sdk-ui/src/chart-options-processor/translations/scatter-tooltip.d.ts +2 -2
  31. package/dist/packages/sdk-ui/src/chart-options-processor/translations/tooltip-utils.d.ts +17 -2
  32. package/dist/packages/sdk-ui/src/chart-options-processor/translations/tooltip.d.ts +3 -3
  33. package/dist/packages/sdk-ui/src/chart-options-processor/translations/translations-to-highcharts.d.ts +7 -0
  34. package/dist/packages/sdk-ui/src/chart-options-processor/translations/treemap/treemap-tooltip.d.ts +3 -4
  35. package/dist/packages/sdk-ui/src/chart-options-processor/translations/value-label-section.d.ts +3 -3
  36. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/utils.d.ts +7 -1
  37. package/dist/packages/sdk-ui/src/dashboard/components/jtd-dashboard.d.ts +2 -1
  38. package/dist/packages/sdk-ui/src/dashboard/hooks/jtd/jtd-filters.d.ts +38 -4
  39. package/dist/packages/sdk-ui/src/dashboard/types.d.ts +26 -19
  40. package/dist/packages/sdk-ui/src/decorators/component-decorators/with-tracking/index.d.ts +1 -1
  41. package/dist/packages/sdk-ui/src/decorators/component-decorators/with-tracking/use-track-component-init.d.ts +4 -1
  42. package/dist/packages/sdk-ui/src/decorators/component-decorators/with-tracking/with-tracking.d.ts +10 -2
  43. package/dist/packages/sdk-ui/src/dynamic-size-container/dynamic-size-container.d.ts +2 -1
  44. package/dist/packages/sdk-ui/src/index.d.ts +1 -0
  45. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +1 -0
  46. package/dist/packages/sdk-ui/src/props.d.ts +10 -0
  47. package/dist/packages/sdk-ui/src/sisense-chart/sisense-chart.d.ts +1 -1
  48. package/dist/packages/sdk-ui/src/sisense-chart/types.d.ts +4 -0
  49. package/dist/packages/sdk-ui/src/types.d.ts +27 -0
  50. package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +27 -1
  51. package/dist/{use-common-filters-Bf8KKBN2.cjs → use-common-filters-CRrL9rOQ.cjs} +67 -67
  52. package/dist/{use-common-filters-BTk7vuUo.js → use-common-filters-CVgB69Xe.js} +1486 -1453
  53. package/dist/{widget-composer-BtqAxkpr.js → widget-composer-B4eAv2pf.js} +232 -193
  54. package/dist/{widget-composer-CJDaEkCY.cjs → widget-composer-D0FZj1tX.cjs} +8 -8
  55. package/package.json +20 -18
  56. package/dist/derive-chart-family-Cjjn5U5S.cjs +0 -669
  57. package/dist/derive-chart-family-ci86jmVk.js +0 -90516
  58. package/dist/dimensions-COtPNdpu.cjs +0 -1
  59. package/dist/dimensions-wzj4u0MX.js +0 -200
  60. package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/get-legacy-cartesian-chart-options.d.ts +0 -3
@@ -1,20 +1,29 @@
1
- var tt = Object.defineProperty, et = Object.defineProperties;
2
- var rt = Object.getOwnPropertyDescriptors;
3
- var W = Object.getOwnPropertySymbols;
4
- var it = Object.prototype.hasOwnProperty, at = Object.prototype.propertyIsEnumerable;
5
- var j = (t, e, r) => e in t ? tt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, o = (t, e) => {
1
+ var at = Object.defineProperty, st = Object.defineProperties;
2
+ var nt = Object.getOwnPropertyDescriptors;
3
+ var E = Object.getOwnPropertySymbols;
4
+ var P = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
5
+ var $ = (t, e, r) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, o = (t, e) => {
6
6
  for (var r in e || (e = {}))
7
- it.call(e, r) && j(t, r, e[r]);
8
- if (W)
9
- for (var r of W(e))
10
- at.call(e, r) && j(t, r, e[r]);
7
+ P.call(e, r) && $(t, r, e[r]);
8
+ if (E)
9
+ for (var r of E(e))
10
+ L.call(e, r) && $(t, r, e[r]);
11
11
  return t;
12
- }, u = (t, e) => et(t, rt(e));
13
- import { dV as N, w as st, d$ as nt, ap as ot, e0 as lt, e1 as dt, m as C, T as S, e2 as ct, aP as _, dH as ut, e3 as O, dX as z, ay as pt, b0 as mt, a$ as gt, aG as M, ao as yt, n as I, e4 as ft, a8 as ht, bI as L, e5 as St } from "./derive-chart-family-ci86jmVk.js";
14
- class J extends N {
12
+ }, c = (t, e) => st(t, nt(e));
13
+ var A = (t, e) => {
14
+ var r = {};
15
+ for (var i in t)
16
+ P.call(t, i) && e.indexOf(i) < 0 && (r[i] = t[i]);
17
+ if (t != null && E)
18
+ for (var i of E(t))
19
+ e.indexOf(i) < 0 && L.call(t, i) && (r[i] = t[i]);
20
+ return r;
21
+ };
22
+ import { eb as ot, ec as lt, ed as dt, ee as ct, e5 as J, w as ut, m as q, T as S, ef as pt, aU as K, dM as mt, eg as O, e7 as U, aD as gt, b5 as yt, b4 as ft, aL as I, at as ht, n as M, eh as St, a8 as Ot, bN as Q, ei as Tt } from "./derive-chart-family-DvYmrG1k.js";
23
+ class Y extends J {
15
24
  constructor(e, r) {
16
25
  var i;
17
- super((i = e.jaql.title) !== null && i !== void 0 ? i : "", r), this.expression = e.jaql.dim || e.jaql.formula, this.metadataItem = e, e.jaql.agg ? this.aggregation = e.jaql.agg : delete this.aggregation, e.jaql.formula ? this.formula = e.jaql.formula : delete this.formula, e.jaql.sort ? this.sortType = st(e.jaql.sort) : delete this.sortType, this.skipValidation = !0;
26
+ super((i = e.jaql.title) !== null && i !== void 0 ? i : "", r), this.__serializable = "JaqlElement", this.expression = e.jaql.dim || e.jaql.formula, this.metadataItem = e, e.jaql.agg ? this.aggregation = e.jaql.agg : delete this.aggregation, e.jaql.formula ? this.formula = e.jaql.formula : delete this.formula, e.jaql.sort ? this.sortType = ut(e.jaql.sort) : delete this.sortType, this.skipValidation = !0;
18
27
  }
19
28
  get id() {
20
29
  return this.expression;
@@ -27,24 +36,24 @@ class J extends N {
27
36
  */
28
37
  serialize() {
29
38
  const e = super.serialize();
30
- return e.__serializable = "JaqlElement", e.metadataItem = this.metadataItem, e.type = this.type, e;
39
+ return e.metadataItem = this.metadataItem, e.type = this.type, e;
31
40
  }
32
41
  }
33
- const Ot = {
34
- text: C.TextAttribute,
35
- numeric: C.NumericAttribute,
36
- datetime: C.DateLevel
37
- };
38
- function Tt(t) {
42
+ const bt = {
43
+ text: q.TextAttribute,
44
+ numeric: q.NumericAttribute,
45
+ datetime: q.DateLevel
46
+ }, le = (t) => t && t.__serializable === "JaqlElement";
47
+ function vt(t) {
39
48
  var e;
40
- return new J(t, (e = Ot[t.jaql.datatype]) !== null && e !== void 0 ? e : "numeric");
49
+ return new Y(t, (e = bt[t.jaql.datatype]) !== null && e !== void 0 ? e : "numeric");
41
50
  }
42
- function K(t) {
51
+ function V(t) {
43
52
  const { jaql: e } = t;
44
53
  if (e.formula)
45
- return nt(e);
46
- const r = ot.translateJaqlToGranularity(e);
47
- return "agg" in e && e.dim && e.datatype ? lt({
54
+ return ot(e);
55
+ const r = lt(e);
56
+ return "agg" in e && e.dim && e.datatype ? dt({
48
57
  expression: e.dim,
49
58
  dataType: e.datatype,
50
59
  agg: e.agg || "",
@@ -53,7 +62,7 @@ function K(t) {
53
62
  sort: e.sort,
54
63
  title: e.title,
55
64
  dataSource: e.datasource
56
- }) : e.dim && e.datatype ? dt({
65
+ }) : e.dim && e.datatype ? ct({
57
66
  expression: e.dim,
58
67
  dataType: e.datatype,
59
68
  granularity: r,
@@ -61,9 +70,9 @@ function K(t) {
61
70
  title: e.title,
62
71
  panel: t.panel,
63
72
  dataSource: e.datasource
64
- }) : Tt(t);
73
+ }) : vt(t);
65
74
  }
66
- const ae = {
75
+ const de = {
67
76
  jaql: {
68
77
  datasource: {
69
78
  title: "",
@@ -73,23 +82,23 @@ const ae = {
73
82
  },
74
83
  queryTitle: "",
75
84
  chartRecommendations: {}
76
- }, se = {
85
+ }, ce = {
77
86
  model: "",
78
87
  metadata: [],
79
88
  chart: {},
80
89
  queryTitle: ""
81
- }, ne = (t) => "widgetProps" in t, bt = (t) => "dashboardOid" in t && "widgetOid" in t, oe = (t) => "dashboardProps" in t, le = (t) => "dashboardOid" in t;
82
- function vt(t) {
90
+ }, ue = (t) => "widgetProps" in t, xt = (t) => "dashboardOid" in t && "widgetOid" in t, pe = (t) => "dashboardProps" in t, me = (t) => "dashboardOid" in t;
91
+ function Et(t) {
83
92
  return t.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
84
93
  }
85
- function de(t) {
94
+ function ge(t) {
86
95
  return t.charAt(0).toUpperCase() + t.slice(1);
87
96
  }
88
- function ce(t) {
97
+ function ye(t) {
89
98
  const e = /\[(.+?)\s\(Calendar\)\]/;
90
99
  return t.replace(e, "[$1]").trim();
91
100
  }
92
- function ue(t) {
101
+ function fe(t) {
93
102
  if (t)
94
103
  if (t.metadata) {
95
104
  if (!t.model)
@@ -100,12 +109,12 @@ function ue(t) {
100
109
  throw new S("errors.emptyModel");
101
110
  return t;
102
111
  }
103
- function xt(t) {
112
+ function Dt(t) {
104
113
  return !t || !t.jaql.datasource.title || !t.jaql.metadata.length;
105
114
  }
106
- function U(t) {
115
+ function H(t) {
107
116
  if (![
108
- ...ct,
117
+ ...pt,
109
118
  "pivot",
110
119
  "pivot2"
111
120
  ].includes(t))
@@ -113,21 +122,21 @@ function U(t) {
113
122
  chartType: t
114
123
  });
115
124
  }
116
- function Et(t) {
125
+ function wt(t) {
117
126
  return "widgetType" in t && t.widgetType === "pivot";
118
127
  }
119
128
  function h(t) {
120
129
  var e;
121
130
  return "column" in t && ((e = t.column) == null ? void 0 : e.expression) && /\(.*\)/.test(t.column.expression);
122
131
  }
123
- function P(t) {
124
- const e = "measures" in t && c(t.measures) || "values" in t && c(t.values);
125
- return Et(t) ? "values" in t.dataOptions && c(t.dataOptions.values) : "chartType" in t ? t.chartType === "indicator" ? "value" in t.dataOptions && c(t.dataOptions.value) || "secondary" in t.dataOptions && c(t.dataOptions.secondary) : t.chartType === "table" ? !("columns" in t.dataOptions) || !c(t.dataOptions.columns) ? !1 : t.dataOptions.columns.some((i) => h(i)) : t.chartType === "boxplot" ? !1 : t.chartType === "scatter" ? "x" in t.dataOptions && t.dataOptions.x !== void 0 && h(t.dataOptions.x) || "y" in t.dataOptions && t.dataOptions.y !== void 0 && h(t.dataOptions.y) || "size" in t.dataOptions && t.dataOptions.size !== void 0 : t.chartType === "scattermap" ? "colorBy" in t.dataOptions && t.dataOptions.colorBy !== void 0 && h(t.dataOptions.colorBy) || "details" in t.dataOptions && t.dataOptions.details !== void 0 && h(t.dataOptions.details) || "size" in t.dataOptions && t.dataOptions.size !== void 0 && h(t.dataOptions.size) : t.chartType === "areamap" ? "geo" in t.dataOptions && c(t.dataOptions.geo) && "color" in t.dataOptions && c(t.dataOptions.color) : "value" in t.dataOptions && c(t.dataOptions.value) : e;
132
+ function k(t) {
133
+ const e = "measures" in t && p(t.measures) || "values" in t && p(t.values);
134
+ return wt(t) ? "values" in t.dataOptions && p(t.dataOptions.values) : "chartType" in t ? t.chartType === "indicator" ? "value" in t.dataOptions && p(t.dataOptions.value) || "secondary" in t.dataOptions && p(t.dataOptions.secondary) : t.chartType === "table" ? !("columns" in t.dataOptions) || !p(t.dataOptions.columns) ? !1 : t.dataOptions.columns.some((i) => h(i)) : t.chartType === "boxplot" ? !1 : t.chartType === "scatter" ? "x" in t.dataOptions && t.dataOptions.x !== void 0 && h(t.dataOptions.x) || "y" in t.dataOptions && t.dataOptions.y !== void 0 && h(t.dataOptions.y) || "size" in t.dataOptions && t.dataOptions.size !== void 0 : t.chartType === "scattermap" ? "colorBy" in t.dataOptions && t.dataOptions.colorBy !== void 0 && h(t.dataOptions.colorBy) || "details" in t.dataOptions && t.dataOptions.details !== void 0 && h(t.dataOptions.details) || "size" in t.dataOptions && t.dataOptions.size !== void 0 && h(t.dataOptions.size) : t.chartType === "areamap" ? "geo" in t.dataOptions && p(t.dataOptions.geo) && "color" in t.dataOptions && p(t.dataOptions.color) : "value" in t.dataOptions && p(t.dataOptions.value) : e;
126
135
  }
127
- function c(t) {
136
+ function p(t) {
128
137
  return Array.isArray(t) && t.length > 0;
129
138
  }
130
- function Dt(t) {
139
+ function Ct(t) {
131
140
  const e = t.split(`
132
141
  `);
133
142
  for (let r = 0; r < e.length - 1; r++)
@@ -141,7 +150,7 @@ function Dt(t) {
141
150
  return e.join(`
142
151
  `);
143
152
  }
144
- function wt(t) {
153
+ function qt(t) {
145
154
  const e = (i) => /^[$A-Z_][0-9A-Z_$]*$/i.test(i);
146
155
  if ("composeCode" in t)
147
156
  return t;
@@ -152,7 +161,7 @@ function wt(t) {
152
161
  }
153
162
  return r;
154
163
  }
155
- const Ct = {
164
+ const Mt = {
156
165
  react: {
157
166
  baseChartTmpl: `import { {{componentString}} } from '@sisense/sdk-ui';
158
167
  {{extraImportsString}}
@@ -611,10 +620,10 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
611
620
  </template>`,
612
621
  dashboardTmpl: "/** COMING SOON */"
613
622
  }
614
- }, Y = (t, e) => Ct[e][t].replace(/{{(.*?)Tmpl}}/g, (i, a) => Y(`${a}Tmpl`, e)), It = (t, e) => t.replace(/{{(.*?)}}/g, (r, i) => i in e ? e[i] : (console.warn(`Placeholder ${i} not found in data`), r)), q = (t, e, r = "react") => {
615
- const i = Y(t, r);
616
- return Dt(It(i, e));
617
- }, Mt = () => Object.values(ut).map((e) => _.aggregationToJAQL(e)).join("|"), V = (t) => {
623
+ }, G = (t, e) => Mt[e][t].replace(/{{(.*?)Tmpl}}/g, (i, a) => G(`${a}Tmpl`, e)), It = (t, e) => t.replace(/{{(.*?)}}/g, (r, i) => i in e ? e[i] : (console.warn(`Placeholder ${i} not found in data`), r)), j = (t, e, r = "react") => {
624
+ const i = G(t, r);
625
+ return Ct(It(i, e));
626
+ }, jt = () => Object.values(mt).map((e) => K.aggregationToJAQL(e)).join("|"), Z = (t) => {
618
627
  const { formula: e, context: r, filter: i } = t;
619
628
  if (!r || !e)
620
629
  return t;
@@ -624,9 +633,9 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
624
633
  const s = a[0];
625
634
  if (typeof s != "string")
626
635
  return t;
627
- const n = r[`${s}`], m = Mt(), l = new RegExp(`^\\s*(${m})\\(\\[\\w+\\]\\)$`), y = e.match(l);
628
- if (y && e.includes(s)) {
629
- const d = y[1];
636
+ const n = r[`${s}`], u = jt(), l = new RegExp(`^\\s*(${u})\\(\\[\\w+\\]\\)$`), g = e.match(l);
637
+ if (g && e.includes(s)) {
638
+ const d = g[1];
630
639
  return o({
631
640
  dim: n.dim,
632
641
  table: n.table,
@@ -639,162 +648,162 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
639
648
  } : {});
640
649
  }
641
650
  return t;
642
- }, D = (t) => {
651
+ }, w = (t) => {
643
652
  let e = t;
644
- if ("formula" in t && (e = V(t)), "context" in e) {
653
+ if ("formula" in t && (e = Z(t)), "context" in e) {
645
654
  const r = o({}, e.context);
646
655
  Object.keys(r).forEach((i) => {
647
- r[`${i}`] = D(r[`${i}`]);
656
+ r[`${i}`] = w(r[`${i}`]);
648
657
  }), e.context = r;
649
658
  }
650
659
  return e;
651
- }, qt = (t) => {
660
+ }, Wt = (t) => {
652
661
  var i;
653
662
  const e = t;
654
663
  if (e.panel !== "scope")
655
664
  return e;
656
665
  const { jaql: r } = e;
657
- return (i = r.filter) != null && i.by && (r.filter.by = V(r.filter.by)), u(o({}, e), {
666
+ return (i = r.filter) != null && i.by && (r.filter.by = Z(r.filter.by)), c(o({}, e), {
658
667
  jaql: r
659
668
  });
660
669
  }, $t = (t) => {
661
670
  let e = t;
662
- e = qt(e);
671
+ e = Wt(e);
663
672
  const { jaql: r, measure: i, by: a } = e;
664
- return o(o(u(o({}, e), {
665
- jaql: D(r)
673
+ return o(o(c(o({}, e), {
674
+ jaql: w(r)
666
675
  }), a ? {
667
- by: D(a)
676
+ by: w(a)
668
677
  } : {}), i ? {
669
- measure: D(i)
678
+ measure: w(i)
670
679
  } : {});
671
- }, w = 6, E = `
672
- `, $ = "UNKNOWN", Wt = (t, e) => {
680
+ }, C = 6, D = `
681
+ `, W = "UNKNOWN", Pt = (t, e) => {
673
682
  let r = "";
674
683
  return r += `measureFactory.customFormula(
675
684
  `, r += " ".repeat(e), r += ` '${O(t.title)}',
676
685
  `, r += " ".repeat(e), r += ` '${t.formula}',
677
686
  `, r += " ".repeat(e), r += ` {
678
687
  `, Object.entries(t.context).forEach(([i, a]) => {
679
- const s = z(a.table || $, a.column || $, void 0, "DM");
688
+ const s = U(a.table || W, a.column || W, void 0, "DM");
680
689
  r += " ".repeat(e), r += ` '${i.slice(1, -1)}': ${s},
681
690
  `;
682
691
  }), r += " ".repeat(e), r += ` }
683
692
  `, r += " ".repeat(e), r += ")", r;
684
- }, jt = (t) => {
693
+ }, Lt = (t) => {
685
694
  const { level: e, table: r, column: i, agg: a, title: s } = t;
686
695
  let n;
687
- return r && i && (n = z(r, i, e, "DM")), a && r && i && s && (n = `measureFactory.${_.aggregationFromJAQL(a)}(${n}, '${O(s)}')`), n || $;
688
- }, Lt = (t, e) => {
696
+ return r && i && (n = U(r, i, e, "DM")), a && r && i && s && (n = `measureFactory.${K.aggregationFromJAQL(a)}(${n}, '${O(s)}')`), n || W;
697
+ }, At = (t, e) => {
689
698
  const r = t.jaql(!1).jaql;
690
- return "formula" in r ? Wt(r, e) : jt(r);
691
- }, p = (t, e = 0, r = !1) => {
699
+ return "formula" in r ? Pt(r, e) : Lt(r);
700
+ }, m = (t, e = 0, r = !1) => {
692
701
  if (!t)
693
702
  return "";
694
703
  if (typeof t == "string")
695
704
  return `'${O(t)}'`;
705
+ if (t instanceof Y)
706
+ return At(t, e);
696
707
  if (t instanceof J)
697
- return Lt(t, e);
698
- if (t instanceof N)
699
708
  return t.composeCode || "";
700
709
  let i = "";
701
- return Array.isArray(t) ? i += `[${t.map((a) => p(a, e + 2))}${t.length ? E + " ".repeat(e + 2) : ""}]` : (i += `{${E}`, Object.entries(t).forEach(([a, s]) => {
710
+ return Array.isArray(t) ? i += `[${t.map((a) => m(a, e + 2))}${t.length ? D + " ".repeat(e + 2) : ""}]` : (i += `{${D}`, Object.entries(t).forEach(([a, s]) => {
702
711
  if (r && typeof a == "string" && (a = `'${O(a)}'`), i += " ".repeat(e + 2), Array.isArray(s))
703
- i += `${a}: [${s.map((n) => p(n, e + 4, r))}${s.length ? E + " ".repeat(e + 2) : ""}]`;
712
+ i += `${a}: [${s.map((n) => m(n, e + 4, r))}${s.length ? D + " ".repeat(e + 2) : ""}]`;
704
713
  else if (typeof s == "object" && s !== null) {
705
- const n = Array.isArray(s) ? s : wt(s);
706
- i += `${a}: ${p(n, e + 2, r)}`;
714
+ const n = Array.isArray(s) ? s : qt(s);
715
+ i += `${a}: ${m(n, e + 2, r)}`;
707
716
  } else
708
717
  [
709
718
  "number",
710
719
  "boolean",
711
720
  "undefined"
712
721
  ].includes(typeof s) || s === null ? i += `${a}: ${s}` : typeof s == "string" ? i += `${a}: '${O(s)}'` : i += `${a}: ${s}`;
713
- i += `,${E}`;
722
+ i += `,${D}`;
714
723
  }), i += " ".repeat(e), i += "}"), i;
715
724
  };
716
- function Pt(t) {
717
- return p(t, w);
725
+ function Qt(t) {
726
+ return m(t, C);
718
727
  }
719
- function A(t, e = "data-source-placeholder") {
728
+ function B(t, e = "data-source-placeholder") {
720
729
  if (!t)
721
730
  return e;
722
731
  const r = typeof t == "object" && "title" in t ? t.title : t;
723
- return vt(r);
732
+ return Et(r);
724
733
  }
725
- function Q(t, e = !0) {
734
+ function F(t, e = !0) {
726
735
  const r = [];
727
- return e && r.push("measureFactory"), c(t) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
736
+ return e && r.push("measureFactory"), p(t) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
728
737
  }
729
- const k = `
730
- `, At = (t, e) => {
738
+ const R = `
739
+ `, kt = (t, e) => {
731
740
  if (t.composeCode)
732
- return `${k}${" ".repeat(e)}${t.composeCode}`;
741
+ return `${R}${" ".repeat(e)}${t.composeCode}`;
733
742
  const r = t.jaql().jaql;
734
- return `${k}${" ".repeat(e)}filterFactory.customFilter(${p(r, e, !0)})`;
735
- }, Qt = (t, e = 0) => {
743
+ return `${R}${" ".repeat(e)}filterFactory.customFilter(${m(r, e, !0)})`;
744
+ }, Bt = (t, e = 0) => {
736
745
  if (!t)
737
746
  return "";
738
747
  let r = "";
739
- return r += `[${t.map((i) => At(i, e + 2))}${t.length ? `
748
+ return r += `[${t.map((i) => kt(i, e + 2))}${t.length ? `
740
749
  ` + " ".repeat(e + 2) : ""}]`, r;
741
- }, B = (t) => t ? Array.isArray(t) ? Qt(t, 6) : "/** Filter relations not supported yet */" : "[]", kt = [
750
+ }, _ = (t) => t ? Array.isArray(t) ? Bt(t, 6) : "/** Filter relations not supported yet */" : "[]", Ft = [
742
751
  "executeQueryByWidgetIdTmpl",
743
752
  "widgetByIdTmpl"
744
- ], Bt = "chartWidgetTmpl", Rt = "pivotTableWidgetTmpl", Ft = (t) => t, Nt = ({ dashboardOid: t, widgetOid: e, uiFramework: r = "react", chartType: i = "table", includeChart: a = !0 }) => {
745
- U(i);
753
+ ], Rt = "chartWidgetTmpl", _t = "pivotTableWidgetTmpl", Nt = (t) => t, zt = ({ dashboardOid: t, widgetOid: e, uiFramework: r = "react", chartType: i = "table", includeChart: a = !0 }) => {
754
+ H(i);
746
755
  const s = {
747
756
  dashboardOid: t,
748
757
  widgetOid: e
749
- }, n = kt[Number(a)];
750
- return q(n, s, r);
751
- }, _t = (t, e, r) => {
752
- if (pt(t)) {
753
- U(t.chartType);
754
- const i = P(t), a = {
758
+ }, n = Ft[Number(a)];
759
+ return j(n, s, r);
760
+ }, Jt = (t, e, r) => {
761
+ if (gt(t)) {
762
+ H(t.chartType);
763
+ const i = k(t), a = {
755
764
  idString: t.id,
756
765
  widgetTypeString: "chart",
757
766
  titleString: t.title,
758
- dataSourceString: A(t.dataSource),
759
- chartTypeString: Ft(t.chartType),
760
- dataOptionsString: Pt(t.dataOptions),
761
- filtersString: B(t.filters),
767
+ dataSourceString: B(t.dataSource),
768
+ chartTypeString: Nt(t.chartType),
769
+ dataOptionsString: Qt(t.dataOptions),
770
+ filtersString: _(t.filters),
762
771
  componentString: "ChartWidget",
763
- extraImportsString: Q(t.filters || [], i),
764
- styleOptionsString: p(t.styleOptions || {}, w),
765
- drilldownOptionsString: p(t.drilldownOptions || {}, w)
772
+ extraImportsString: F(t.filters || [], i),
773
+ styleOptionsString: m(t.styleOptions || {}, C),
774
+ drilldownOptionsString: m(t.drilldownOptions || {}, C)
766
775
  };
767
- return q(r.chart, a, e);
776
+ return j(r.chart, a, e);
768
777
  }
769
- if (mt(t)) {
770
- const i = P(t), a = {
778
+ if (yt(t)) {
779
+ const i = k(t), a = {
771
780
  idString: t.id,
772
781
  widgetTypeString: "pivot",
773
782
  titleString: t.title,
774
- dataSourceString: A(t.dataSource),
775
- dataOptionsString: p(t.dataOptions),
776
- filtersString: B(t.filters),
783
+ dataSourceString: B(t.dataSource),
784
+ dataOptionsString: m(t.dataOptions),
785
+ filtersString: _(t.filters),
777
786
  componentString: "PivotTableWidget",
778
- extraImportsString: Q(t.filters || [], i),
779
- styleOptionsString: p(t.styleOptions || {}, w)
787
+ extraImportsString: F(t.filters || [], i),
788
+ styleOptionsString: m(t.styleOptions || {}, C)
780
789
  };
781
- return q(r.pivot, a, e);
790
+ return j(r.pivot, a, e);
782
791
  }
783
- if (gt(t))
792
+ if (ft(t))
784
793
  return "/** Custom widget code not supported yet */";
785
794
  throw new S("errors.otherWidgetTypesNotSupported");
786
- }, zt = ({ widgetProps: t, uiFramework: e = "react" }) => _t(t, e, {
787
- chart: Bt,
788
- pivot: Rt
789
- }), pe = (t) => "chartType" in t.chartRecommendations ? t.chartRecommendations : {
795
+ }, Kt = ({ widgetProps: t, uiFramework: e = "react" }) => Jt(t, e, {
796
+ chart: Rt,
797
+ pivot: _t
798
+ }), he = (t) => "chartType" in t.chartRecommendations ? t.chartRecommendations : {
790
799
  chartType: "table",
791
800
  chartFamily: "table",
792
801
  axesMapping: {}
793
- }, Jt = (t) => ({
802
+ }, Ut = (t) => ({
794
803
  dataOptions: {
795
- columns: t.map(K)
804
+ columns: t.map(V)
796
805
  }
797
- }), Kt = Object.freeze({
806
+ }), Yt = Object.freeze({
798
807
  convolution: {
799
808
  enabled: !0,
800
809
  selectedConvolutionType: "bySlicesCount",
@@ -815,40 +824,40 @@ const k = `
815
824
  xAxis: {
816
825
  gridLines: !1
817
826
  }
818
- }), R = Object.freeze({
827
+ }), N = Object.freeze({
819
828
  line: "line/spline",
820
829
  pie: "pie/donut",
821
830
  bar: "bar/stacked",
822
831
  column: "column/stackedcolumn"
823
- }), Ut = (t, e, r) => {
832
+ }), Vt = (t, e, r) => {
824
833
  const i = t.reduce((s, n) => (s[n.jaql.title] = n, s), {}), a = Object.entries(r).reduce((s, n) => {
825
- const [m, l] = n;
826
- return s[`${m}`] = Array.isArray(l) ? l.map((y) => {
834
+ const [u, l] = n;
835
+ return s[`${u}`] = Array.isArray(l) ? l.map((g) => {
827
836
  var T, b;
828
- const d = M(y);
837
+ const d = I(g);
829
838
  delete d.enabled;
830
- const g = i[d.column.name];
831
- if (!g)
839
+ const y = i[d.column.name];
840
+ if (!y)
832
841
  return {
833
842
  column: {
834
843
  type: "",
835
844
  name: d.column.name
836
845
  }
837
846
  };
838
- const f = K(g);
839
- if (g.panel === "measures")
840
- return u(o({}, d), {
847
+ const f = V(y);
848
+ if (y.panel === "measures")
849
+ return c(o({}, d), {
841
850
  column: f
842
851
  });
843
- if (yt(f.type)) {
844
- const v = (b = (T = g.format) == null ? void 0 : T.mask) == null ? void 0 : b[g.jaql.level];
852
+ if (ht(f.type)) {
853
+ const v = (b = (T = y.format) == null ? void 0 : T.mask) == null ? void 0 : b[y.jaql.level];
845
854
  if (v)
846
- return u(o({}, d), {
855
+ return c(o({}, d), {
847
856
  column: f,
848
857
  dateFormat: v
849
858
  });
850
859
  }
851
- return u(o({}, d), {
860
+ return c(o({}, d), {
852
861
  column: f
853
862
  });
854
863
  }) : l, s;
@@ -874,20 +883,20 @@ const k = `
874
883
  s !== "geo" && (a[`${s}`] = a[`${s}`][0]);
875
884
  }), a;
876
885
  case "table":
877
- return Object.keys(a).length === 0 ? Jt(t).dataOptions : a;
886
+ return Object.keys(a).length === 0 ? Ut(t).dataOptions : a;
878
887
  case "boxplot":
879
888
  case "areamap":
880
889
  case "indicator":
881
890
  default:
882
891
  return a;
883
892
  }
884
- }, F = (t, e) => {
893
+ }, z = (t, e) => {
885
894
  var r, i, a, s;
886
- return e === "x" ? (i = (r = t.category) != null ? r : t.x) == null ? void 0 : i.map((n) => M(n).column.name).join(", ") : (s = (a = t.value) != null ? a : t.y) == null ? void 0 : s.map((n) => M(n).column.name).join(", ");
887
- }, Yt = (t, e, r, i) => {
895
+ return e === "x" ? (i = (r = t.category) != null ? r : t.x) == null ? void 0 : i.map((n) => I(n).column.name).join(", ") : (s = (a = t.value) != null ? a : t.y) == null ? void 0 : s.map((n) => I(n).column.name).join(", ");
896
+ }, Ht = (t, e, r, i) => {
888
897
  let a;
889
- return i && t in R ? a = I(I(Kt, {
890
- subtype: R[`${t}`]
898
+ return i && t in N ? a = M(M(Yt, {
899
+ subtype: N[`${t}`]
891
900
  }), {
892
901
  legend: {
893
902
  enabled: !0,
@@ -896,95 +905,125 @@ const k = `
896
905
  yAxis: {
897
906
  title: {
898
907
  enabled: !0,
899
- text: F(e, "y")
908
+ text: z(e, "y")
900
909
  }
901
910
  },
902
911
  xAxis: {
903
912
  title: {
904
913
  enabled: !0,
905
- text: F(e, "x")
914
+ text: z(e, "x")
906
915
  }
907
916
  }
908
- }, r) : a = I(ft(), r), a;
909
- }, Vt = (t, e, r = !0) => {
910
- const { chartFamily: i, chartType: a, axesMapping: s = {}, styleOptions: n = {} } = e, m = Ut(t, i, s), l = Yt(a, s, n, r);
917
+ }, r) : a = M(St(), r), a;
918
+ }, Gt = (t, e, r = !0) => {
919
+ const { chartFamily: i, chartType: a, axesMapping: s = {}, styleOptions: n = {} } = e, u = Vt(t, i, s), l = Ht(a, s, n, r);
911
920
  return {
912
- dataOptions: m,
921
+ dataOptions: u,
913
922
  chartStyleOptions: l
914
923
  };
915
- }, Ht = (t) => "chartType" in t ? t : {
924
+ };
925
+ function Zt(t) {
926
+ return !!(t && (t.top !== void 0 || t.bottom !== void 0));
927
+ }
928
+ const Xt = (t) => {
929
+ const e = t.find((r) => r.panel === "rows");
930
+ return e ? t.map((r) => {
931
+ const i = r.jaql.filter;
932
+ if (!(r.panel === "scope" && Zt(i) && i.by === void 0))
933
+ return r;
934
+ const d = r.jaql, { type: s, context: n, formula: u, filter: l } = d, g = A(d, ["type", "context", "formula", "filter"]);
935
+ return c(o({}, r), {
936
+ jaql: o({
937
+ // Copy dimension properties from rows dimension
938
+ dim: e.jaql.dim,
939
+ table: e.jaql.table,
940
+ column: e.jaql.column,
941
+ datatype: e.jaql.datatype,
942
+ // Keep the filter but add the by clause
943
+ filter: c(o({}, l), {
944
+ by: {
945
+ type: s,
946
+ context: n,
947
+ formula: u
948
+ }
949
+ })
950
+ }, g)
951
+ });
952
+ }) : t;
953
+ }, te = (t) => "chartType" in t ? t : {
916
954
  chartType: "table",
917
955
  chartFamily: "table",
918
956
  axesMapping: {}
919
- }, Gt = (t) => t.map((e) => ht(e.jaql)), Zt = (t) => t.reduce((e, r) => {
920
- if ((r.panel === "scope" || r.jaql.filter) && e.metadataFilters.push(L(r)), r.panel !== "scope") {
921
- const i = L(r);
957
+ }, ee = (t) => t.map((e) => Ot(e.jaql)), re = (t) => t.reduce((e, r) => {
958
+ if ((r.panel === "scope" || r.jaql.filter) && e.metadataFilters.push(Q(r)), r.panel !== "scope") {
959
+ const i = Q(r);
922
960
  delete i.jaql.filter, e.metadataColumns.push(i);
923
961
  }
924
962
  return e;
925
963
  }, {
926
964
  metadataColumns: [],
927
965
  metadataFilters: []
928
- }), Xt = (t, e) => {
929
- if (!xt(t))
966
+ }), ie = (t, e) => {
967
+ if (!Dt(t))
930
968
  try {
931
- const { useCustomizedStyleOptions: r = !1 } = e || {}, { jaql: i, chartRecommendations: a, queryTitle: s } = t, { metadata: n, datasource: m } = i, l = u(o({}, m), {
932
- type: m.type || "elasticube"
933
- }), y = St(l), d = n.map((x) => $t(x)).map((x) => u(o({}, x), {
934
- jaql: u(o({}, x.jaql), {
935
- datasource: y
969
+ const { useCustomizedStyleOptions: r = !1 } = e || {}, { jaql: i, chartRecommendations: a, queryTitle: s } = t, { metadata: n, datasource: u } = i, l = c(o({}, u), {
970
+ type: u.type || "elasticube"
971
+ }), g = Tt(l), y = Xt(n).map((x) => $t(x)).map((x) => c(o({}, x), {
972
+ jaql: c(o({}, x.jaql), {
973
+ datasource: g
936
974
  })
937
- })), g = Ht(a), f = g.chartType.toLowerCase(), T = {
975
+ })), f = te(a), T = f.chartType.toLowerCase(), b = {
938
976
  cornerRadius: "Small",
939
977
  header: {
940
978
  // remove info button and render empty toolbar instead
941
979
  renderToolbar: () => null
942
980
  }
943
- }, { metadataColumns: b, metadataFilters: v } = Zt(d), H = Gt(v), { dataOptions: G, chartStyleOptions: Z } = Vt(b, g, r), X = o(o({}, Z), T);
981
+ }, { metadataColumns: v, metadataFilters: X } = re(y), tt = ee(X), { dataOptions: et, chartStyleOptions: rt } = Gt(v, f, r), it = o(o({}, rt), b);
944
982
  return {
945
983
  widgetType: "chart",
946
984
  id: s,
947
985
  title: s,
948
- chartType: f,
986
+ chartType: T,
949
987
  dataSource: l,
950
- dataOptions: G,
951
- filters: H,
952
- styleOptions: X
988
+ dataOptions: et,
989
+ filters: tt,
990
+ styleOptions: it
953
991
  };
954
992
  } catch (r) {
955
993
  console.error(r);
956
994
  return;
957
995
  }
958
- }, te = (t, e) => Xt(t, e), ee = (t) => bt(t) ? Nt(t) : zt(t), me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
996
+ }, ae = (t, e) => ie(t, e), se = (t) => xt(t) ? zt(t) : Kt(t), Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
959
997
  __proto__: null,
960
- toWidgetCode: ee,
961
- toWidgetProps: te
998
+ toWidgetCode: se,
999
+ toWidgetProps: ae
962
1000
  }, Symbol.toStringTag, { value: "Module" }));
963
1001
  export {
964
- w as C,
965
- se as E,
966
- J,
967
- q as a,
968
- P as b,
969
- de as c,
970
- A as d,
971
- B as e,
972
- Q as f,
973
- _t as g,
974
- p as h,
975
- le as i,
976
- ae as j,
977
- ne as k,
978
- bt as l,
979
- oe as m,
980
- $t as n,
981
- pe as o,
1002
+ C,
1003
+ ce as E,
1004
+ Y as J,
1005
+ j as a,
1006
+ k as b,
1007
+ ge as c,
1008
+ B as d,
1009
+ _ as e,
1010
+ F as f,
1011
+ Jt as g,
1012
+ m as h,
1013
+ me as i,
1014
+ le as j,
1015
+ de as k,
1016
+ ue as l,
1017
+ xt as m,
1018
+ pe as n,
1019
+ $t as o,
982
1020
  It as p,
983
- Ut as q,
984
- Yt as r,
985
- ce as s,
986
- te as t,
987
- Vt as u,
988
- ue as v,
989
- me as w
1021
+ he as q,
1022
+ Vt as r,
1023
+ ye as s,
1024
+ ae as t,
1025
+ Ht as u,
1026
+ fe as v,
1027
+ Se as w,
1028
+ Gt as x
990
1029
  };