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