@splunk/visualizations 27.0.0 → 27.1.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 (79) hide show
  1. package/Area.config.js +269 -122
  2. package/Area.config.js.map +4 -4
  3. package/Area.js +1065 -209
  4. package/Area.js.map +4 -4
  5. package/Bar.config.js +266 -82
  6. package/Bar.config.js.map +4 -4
  7. package/Bar.js +1065 -171
  8. package/Bar.js.map +4 -4
  9. package/Bubble.config.js +127 -1
  10. package/Bubble.config.js.map +4 -4
  11. package/Bubble.js +323 -80
  12. package/Bubble.js.map +4 -4
  13. package/ChoroplethSvg.js +60 -30
  14. package/ChoroplethSvg.js.map +4 -4
  15. package/Column.config.js +271 -82
  16. package/Column.config.js.map +4 -4
  17. package/Column.js +1070 -171
  18. package/Column.js.map +4 -4
  19. package/Ellipse.js +44 -14
  20. package/Ellipse.js.map +4 -4
  21. package/Events.js +82 -52
  22. package/Events.js.map +4 -4
  23. package/FillerGauge.js +44 -14
  24. package/FillerGauge.js.map +4 -4
  25. package/Image.js +42 -12
  26. package/Image.js.map +4 -4
  27. package/Line.config.js +271 -119
  28. package/Line.config.js.map +4 -4
  29. package/Line.js +1067 -206
  30. package/Line.js.map +4 -4
  31. package/LinkGraph.js +563 -529
  32. package/LinkGraph.js.map +4 -4
  33. package/Map.js +44 -14
  34. package/Map.js.map +4 -4
  35. package/Markdown.js +46 -16
  36. package/Markdown.js.map +4 -4
  37. package/MarkerGauge.js +42 -12
  38. package/MarkerGauge.js.map +4 -4
  39. package/ParallelCoordinates.js +122 -86
  40. package/ParallelCoordinates.js.map +4 -4
  41. package/Pie.js +198 -81
  42. package/Pie.js.map +4 -4
  43. package/Punchcard.js +54 -24
  44. package/Punchcard.js.map +4 -4
  45. package/Rectangle.js +56 -26
  46. package/Rectangle.js.map +4 -4
  47. package/Sankey.js +68 -38
  48. package/Sankey.js.map +4 -4
  49. package/Scatter.config.js +127 -1
  50. package/Scatter.config.js.map +4 -4
  51. package/Scatter.js +323 -80
  52. package/Scatter.js.map +4 -4
  53. package/SingleValue.config.js +43 -67
  54. package/SingleValue.config.js.map +4 -4
  55. package/SingleValue.js +1419 -1351
  56. package/SingleValue.js.map +4 -4
  57. package/SingleValueBasic.js.map +1 -1
  58. package/SingleValueIcon.config.js +45 -69
  59. package/SingleValueIcon.config.js.map +4 -4
  60. package/SingleValueIcon.js +1307 -1238
  61. package/SingleValueIcon.js.map +4 -4
  62. package/SingleValueRadial.config.js +43 -67
  63. package/SingleValueRadial.config.js.map +4 -4
  64. package/SingleValueRadial.js +1352 -1266
  65. package/SingleValueRadial.js.map +4 -4
  66. package/TRELLIS.md +16 -15
  67. package/Table.js +52 -22
  68. package/Table.js.map +4 -4
  69. package/common/Charting.js +133 -27
  70. package/common/Charting.js.map +4 -4
  71. package/common/OptionsDoc.js +6 -1
  72. package/common/OptionsDoc.js.map +2 -2
  73. package/common/utils/singleValueUtils.js +8 -7
  74. package/common/utils/singleValueUtils.js.map +2 -2
  75. package/common/utils/trellisUtils.js +41 -1
  76. package/common/utils/trellisUtils.js.map +2 -2
  77. package/common/withDashboardViz.js +42 -12
  78. package/common/withDashboardViz.js.map +4 -4
  79. package/package.json +17 -18
@@ -117,23 +117,23 @@ var defaultImport5 = __toESM(require("styled-components"));
117
117
  __reExport(styled_components_exports, require("styled-components"));
118
118
  var styled_components_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
119
119
 
120
- // esm-externals:lodash
121
- var lodash_exports = {};
122
- __export(lodash_exports, {
123
- default: () => lodash_default
120
+ // esm-externals:lodash/pick
121
+ var pick_exports2 = {};
122
+ __export(pick_exports2, {
123
+ default: () => pick_default2
124
124
  });
125
- var defaultImport6 = __toESM(require("lodash"));
126
- __reExport(lodash_exports, require("lodash"));
127
- var lodash_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
125
+ var defaultImport6 = __toESM(require("lodash/pick"));
126
+ __reExport(pick_exports2, require("lodash/pick"));
127
+ var pick_default2 = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
128
128
 
129
- // esm-externals:@splunk/visualization-context/FeatureFlagContext
130
- var FeatureFlagContext_exports = {};
131
- __export(FeatureFlagContext_exports, {
132
- default: () => FeatureFlagContext_default
129
+ // esm-externals:lodash/isEmpty
130
+ var isEmpty_exports = {};
131
+ __export(isEmpty_exports, {
132
+ default: () => isEmpty_default
133
133
  });
134
- var defaultImport7 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
135
- __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
136
- var FeatureFlagContext_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
134
+ var defaultImport7 = __toESM(require("lodash/isEmpty"));
135
+ __reExport(isEmpty_exports, require("lodash/isEmpty"));
136
+ var isEmpty_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
137
137
 
138
138
  // esm-externals:@splunk/visualizations-shared/style
139
139
  var style_exports = {};
@@ -153,15 +153,6 @@ var defaultImport9 = __toESM(require("@splunk/visualizations-shared/SizeAwareWra
153
153
  __reExport(SizeAwareWrapper_exports, require("@splunk/visualizations-shared/SizeAwareWrapper"));
154
154
  var SizeAwareWrapper_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
155
155
 
156
- // esm-externals:@splunk/visualization-schemas
157
- var visualization_schemas_exports = {};
158
- __export(visualization_schemas_exports, {
159
- default: () => visualization_schemas_default
160
- });
161
- var defaultImport10 = __toESM(require("@splunk/visualization-schemas"));
162
- __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
163
- var visualization_schemas_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
164
-
165
156
  // src/common/components/VizStyleWrapper.jsx
166
157
  var VizStyleWrapper = styled_components_default.div.attrs(({ dataTestKey }) => ({
167
158
  "data-test": dataTestKey,
@@ -209,6 +200,15 @@ var TrellisTitle = (props) => {
209
200
  );
210
201
  };
211
202
 
203
+ // esm-externals:lodash
204
+ var lodash_exports = {};
205
+ __export(lodash_exports, {
206
+ default: () => lodash_default
207
+ });
208
+ var defaultImport10 = __toESM(require("lodash"));
209
+ __reExport(lodash_exports, require("lodash"));
210
+ var lodash_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
211
+
212
212
  // esm-externals:@splunk/visualizations-shared/numberUtils
213
213
  var numberUtils_exports = {};
214
214
  __export(numberUtils_exports, {
@@ -605,16 +605,16 @@ var changeColor = (color, ratio) => {
605
605
  };
606
606
  var lighten = (color) => changeColor(color, 1.3);
607
607
  var darken = (color) => changeColor(color, 0.5);
608
- var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled = false, trellisSplityBy = "", trellisKey = "") => {
609
- let payload = {
608
+ var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled = false, trellisSplitBy = "", trellisKey = "") => onValueClick(__spreadProps(__spreadValues({}, ev), {
609
+ payload: __spreadValues({
610
610
  trendValue,
611
611
  value: majorValue,
612
612
  name: majorValueField
613
- };
614
- if (trellisEnabled) {
615
- payload = __spreadProps(__spreadValues({}, payload), { "trellis.name": trellisSplityBy, "trellis.value": trellisKey });
616
- }
617
- return onValueClick(__spreadProps(__spreadValues({}, ev), { payload }));
613
+ }, trellisEnabled && { "trellis.name": trellisSplitBy, "trellis.value": trellisKey })
614
+ }));
615
+ var getTrendColorWithPercent = (options) => {
616
+ const shouldUsePercentTrendColor = options.trendColor === "> trendValue | rangeValue(trendColorEditorConfig)" && options.trendDisplay === "percent";
617
+ return shouldUsePercentTrendColor ? { trendColor: "> trendValuePercent | rangeValue(trendColorEditorConfig)" } : {};
618
618
  };
619
619
 
620
620
  // esm-externals:@splunk/react-icons/enterprise/ArrowUp
@@ -1510,10 +1510,38 @@ RadialContent.propTypes = __spreadProps(__spreadValues({}, SingleValueBasic_defa
1510
1510
  });
1511
1511
  var RadialLayout_default = RadialContent;
1512
1512
 
1513
+ // esm-externals:@splunk/visualization-context/FeatureFlagContext
1514
+ var FeatureFlagContext_exports = {};
1515
+ __export(FeatureFlagContext_exports, {
1516
+ default: () => FeatureFlagContext_default
1517
+ });
1518
+ var defaultImport19 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
1519
+ __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
1520
+ var FeatureFlagContext_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
1521
+
1522
+ // esm-externals:@splunk/visualization-schemas
1523
+ var visualization_schemas_exports = {};
1524
+ __export(visualization_schemas_exports, {
1525
+ default: () => visualization_schemas_default
1526
+ });
1527
+ var defaultImport20 = __toESM(require("@splunk/visualization-schemas"));
1528
+ __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
1529
+ var visualization_schemas_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
1530
+
1531
+ // src/common/hooks/useTrellisEnabled.ts
1532
+ var useTrellisFeatureFlagOn = () => {
1533
+ const context = (0, react_exports.useContext)(FeatureFlagContext_default);
1534
+ return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
1535
+ };
1536
+ var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
1537
+ const trellisFeatureEnabled = useTrellisFeatureFlagOn();
1538
+ return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
1539
+ };
1540
+
1513
1541
  // src/SingleValueRadial/PureSingleValueRadial/SingleValueRadial.jsx
1514
1542
  var Container = styled_components_default.div`
1515
1543
  overflow: hidden;
1516
- ${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
1544
+ ${(props) => (0, style_exports.toDimension)(pick_default2(props, ["width", "height"]))};
1517
1545
  `;
1518
1546
  var SingleValueRadial = (_a) => {
1519
1547
  var props = __objRest(_a, []);
@@ -1566,11 +1594,7 @@ var SingleValueRadial = (_a) => {
1566
1594
  const radialColors = getRadialColors({ backgroundEnabled, backgroundColor });
1567
1595
  const radialBackgroundColor = props.radialBackgroundColor || radialColors.background;
1568
1596
  const radialStrokeColor = props.radialStrokeColor || radialColors.stroke;
1569
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
1570
- const isTrellisFeatureFlagOn = Boolean(
1571
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
1572
- );
1573
- const trellisEnabled = isTrellisFeatureFlagOn && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
1597
+ const trellisEnabled = useTrellisEnabled(splitByLayout);
1574
1598
  const handleValueClick = (0, react_exports.useCallback)(
1575
1599
  (ev) => handleValueClickCallback(
1576
1600
  ev,
@@ -1636,7 +1660,7 @@ var SingleValueRadial = (_a) => {
1636
1660
  shouldAbbreviateMajorValue,
1637
1661
  smallViz: !showRadialGraph
1638
1662
  });
1639
- if (!(0, lodash_exports.isEmpty)(smallVizProps)) {
1663
+ if (!isEmpty_default(smallVizProps)) {
1640
1664
  ({ trendDisplay, unit } = smallVizProps);
1641
1665
  }
1642
1666
  const progress = getRadialProgress(majorValue - minValue, minValue, maxValue);
@@ -1752,81 +1776,81 @@ var getSettingsFromThemedProps_exports = {};
1752
1776
  __export(getSettingsFromThemedProps_exports, {
1753
1777
  default: () => getSettingsFromThemedProps_default
1754
1778
  });
1755
- var defaultImport19 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
1779
+ var defaultImport21 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
1756
1780
  __reExport(getSettingsFromThemedProps_exports, require("@splunk/themes/getSettingsFromThemedProps"));
1757
- var getSettingsFromThemedProps_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
1781
+ var getSettingsFromThemedProps_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
1758
1782
 
1759
1783
  // esm-externals:@splunk/visualization-encoding/Options
1760
1784
  var Options_exports = {};
1761
1785
  __export(Options_exports, {
1762
1786
  default: () => Options_default
1763
1787
  });
1764
- var defaultImport20 = __toESM(require("@splunk/visualization-encoding/Options"));
1788
+ var defaultImport22 = __toESM(require("@splunk/visualization-encoding/Options"));
1765
1789
  __reExport(Options_exports, require("@splunk/visualization-encoding/Options"));
1766
- var Options_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
1790
+ var Options_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
1767
1791
 
1768
1792
  // esm-externals:@splunk/visualizations-shared/SanitizeProps
1769
1793
  var SanitizeProps_exports = {};
1770
1794
  __export(SanitizeProps_exports, {
1771
1795
  default: () => SanitizeProps_default
1772
1796
  });
1773
- var defaultImport21 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
1797
+ var defaultImport23 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
1774
1798
  __reExport(SanitizeProps_exports, require("@splunk/visualizations-shared/SanitizeProps"));
1775
- var SanitizeProps_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
1799
+ var SanitizeProps_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
1776
1800
 
1777
1801
  // esm-externals:@splunk/visualization-context/TimezoneContext
1778
1802
  var TimezoneContext_exports = {};
1779
1803
  __export(TimezoneContext_exports, {
1780
1804
  default: () => TimezoneContext_default
1781
1805
  });
1782
- var defaultImport22 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
1806
+ var defaultImport24 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
1783
1807
  __reExport(TimezoneContext_exports, require("@splunk/visualization-context/TimezoneContext"));
1784
- var TimezoneContext_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
1808
+ var TimezoneContext_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
1785
1809
 
1786
1810
  // esm-externals:@splunk/moment
1787
1811
  var moment_exports = {};
1788
1812
  __export(moment_exports, {
1789
1813
  default: () => moment_default
1790
1814
  });
1791
- var defaultImport23 = __toESM(require("@splunk/moment"));
1815
+ var defaultImport25 = __toESM(require("@splunk/moment"));
1792
1816
  __reExport(moment_exports, require("@splunk/moment"));
1793
- var moment_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
1817
+ var moment_default = "default" in defaultImport25 ? defaultImport25.default : defaultImport25;
1794
1818
 
1795
1819
  // esm-externals:@splunk/visualizations-shared/hocUtils
1796
1820
  var hocUtils_exports = {};
1797
1821
  __export(hocUtils_exports, {
1798
1822
  default: () => hocUtils_default
1799
1823
  });
1800
- var defaultImport24 = __toESM(require("@splunk/visualizations-shared/hocUtils"));
1824
+ var defaultImport26 = __toESM(require("@splunk/visualizations-shared/hocUtils"));
1801
1825
  __reExport(hocUtils_exports, require("@splunk/visualizations-shared/hocUtils"));
1802
- var hocUtils_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
1826
+ var hocUtils_default = "default" in defaultImport26 ? defaultImport26.default : defaultImport26;
1803
1827
 
1804
1828
  // esm-externals:@splunk/visualizations-shared/JSONSchemaUtils
1805
1829
  var JSONSchemaUtils_exports = {};
1806
1830
  __export(JSONSchemaUtils_exports, {
1807
1831
  default: () => JSONSchemaUtils_default
1808
1832
  });
1809
- var defaultImport25 = __toESM(require("@splunk/visualizations-shared/JSONSchemaUtils"));
1833
+ var defaultImport27 = __toESM(require("@splunk/visualizations-shared/JSONSchemaUtils"));
1810
1834
  __reExport(JSONSchemaUtils_exports, require("@splunk/visualizations-shared/JSONSchemaUtils"));
1811
- var JSONSchemaUtils_default = "default" in defaultImport25 ? defaultImport25.default : defaultImport25;
1835
+ var JSONSchemaUtils_default = "default" in defaultImport27 ? defaultImport27.default : defaultImport27;
1812
1836
 
1813
1837
  // esm-externals:@splunk/async-dynamic-options-evaluator
1814
1838
  var async_dynamic_options_evaluator_exports = {};
1815
1839
  __export(async_dynamic_options_evaluator_exports, {
1816
1840
  default: () => async_dynamic_options_evaluator_default
1817
1841
  });
1818
- var defaultImport26 = __toESM(require("@splunk/async-dynamic-options-evaluator"));
1842
+ var defaultImport28 = __toESM(require("@splunk/async-dynamic-options-evaluator"));
1819
1843
  __reExport(async_dynamic_options_evaluator_exports, require("@splunk/async-dynamic-options-evaluator"));
1820
- var async_dynamic_options_evaluator_default = "default" in defaultImport26 ? defaultImport26.default : defaultImport26;
1844
+ var async_dynamic_options_evaluator_default = "default" in defaultImport28 ? defaultImport28.default : defaultImport28;
1821
1845
 
1822
1846
  // esm-externals:@splunk/ui-utils/id
1823
1847
  var id_exports = {};
1824
1848
  __export(id_exports, {
1825
1849
  default: () => id_default
1826
1850
  });
1827
- var defaultImport27 = __toESM(require("@splunk/ui-utils/id"));
1851
+ var defaultImport29 = __toESM(require("@splunk/ui-utils/id"));
1828
1852
  __reExport(id_exports, require("@splunk/ui-utils/id"));
1829
- var id_default = "default" in defaultImport27 ? defaultImport27.default : defaultImport27;
1853
+ var id_default = "default" in defaultImport29 ? defaultImport29.default : defaultImport29;
1830
1854
 
1831
1855
  // src/common/interfaces/VizActionHandler.ts
1832
1856
  var DefaultVizActionHandler = class {
@@ -2034,18 +2058,18 @@ var Message_exports = {};
2034
2058
  __export(Message_exports, {
2035
2059
  default: () => Message_default
2036
2060
  });
2037
- var defaultImport28 = __toESM(require("@splunk/visualizations-shared/Message"));
2061
+ var defaultImport30 = __toESM(require("@splunk/visualizations-shared/Message"));
2038
2062
  __reExport(Message_exports, require("@splunk/visualizations-shared/Message"));
2039
- var Message_default = "default" in defaultImport28 ? defaultImport28.default : defaultImport28;
2063
+ var Message_default = "default" in defaultImport30 ? defaultImport30.default : defaultImport30;
2040
2064
 
2041
2065
  // esm-externals:@splunk/visualizations-shared/colorUtils
2042
2066
  var colorUtils_exports = {};
2043
2067
  __export(colorUtils_exports, {
2044
2068
  default: () => colorUtils_default
2045
2069
  });
2046
- var defaultImport29 = __toESM(require("@splunk/visualizations-shared/colorUtils"));
2070
+ var defaultImport31 = __toESM(require("@splunk/visualizations-shared/colorUtils"));
2047
2071
  __reExport(colorUtils_exports, require("@splunk/visualizations-shared/colorUtils"));
2048
- var colorUtils_default = "default" in defaultImport29 ? defaultImport29.default : defaultImport29;
2072
+ var colorUtils_default = "default" in defaultImport31 ? defaultImport31.default : defaultImport31;
2049
2073
 
2050
2074
  // src/common/hocs/FixedSizeContainer.tsx
2051
2075
  var Item = styled_components_default.div.attrs(({ width }) => ({
@@ -2092,7 +2116,7 @@ var withFixedSizeContainer = (Viz) => {
2092
2116
  FixSizeItem,
2093
2117
  {
2094
2118
  "data-test": "fix-size-item",
2095
- "data-splunk-visualization-version": "27.0.0 - 9bf093b7d",
2119
+ "data-splunk-visualization-version": "27.1.0 - fe8b048df",
2096
2120
  width,
2097
2121
  height,
2098
2122
  backgroundColor
@@ -2158,7 +2182,7 @@ var Cover = styled_components_default.div`
2158
2182
  bottom: 0;
2159
2183
  `;
2160
2184
  var Blocker = styled_components_default.div.attrs({
2161
- "data-splunk-visualization-version": "27.0.0 - 9bf093b7d"
2185
+ "data-splunk-visualization-version": "27.1.0 - fe8b048df"
2162
2186
  })`
2163
2187
  position: relative;
2164
2188
  width: 100%;
@@ -2621,9 +2645,9 @@ var FeatureFlags_exports = {};
2621
2645
  __export(FeatureFlags_exports, {
2622
2646
  default: () => FeatureFlags_default
2623
2647
  });
2624
- var defaultImport30 = __toESM(require("@splunk/visualization-context/FeatureFlags"));
2648
+ var defaultImport32 = __toESM(require("@splunk/visualization-context/FeatureFlags"));
2625
2649
  __reExport(FeatureFlags_exports, require("@splunk/visualization-context/FeatureFlags"));
2626
- var FeatureFlags_default = "default" in defaultImport30 ? defaultImport30.default : defaultImport30;
2650
+ var FeatureFlags_default = "default" in defaultImport32 ? defaultImport32.default : defaultImport32;
2627
2651
 
2628
2652
  // src/common/utils/featureFlagUtils.ts
2629
2653
  var getFeatureFlag = (context, flagName) => {
@@ -2636,1254 +2660,1297 @@ var getFeatureFlag = (context, flagName) => {
2636
2660
  return false;
2637
2661
  };
2638
2662
 
2639
- // src/common/withDashboardViz.tsx
2640
- var withDashboardViz = (opts) => {
2641
- const {
2642
- ReactViz,
2643
- vizConfig,
2644
- computeVizProps: computeVizProps2 = () => {
2645
- },
2646
- disableEditModeCover,
2647
- useIconPlaceholder
2648
- } = opts;
2649
- const SanitizedReactViz = (0, SanitizeProps_exports.withSanitizedProps)(ReactViz);
2650
- const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(vizConfig.optionsSchema, "default");
2651
- const DashboardViz = (props) => {
2652
- var _a;
2653
- const {
2654
- mode,
2655
- hasEventHandlers,
2656
- dataSources,
2657
- // type of { [key: string]: DataSource }
2658
- options,
2659
- context = {},
2660
- width,
2661
- height,
2662
- onComputedProps,
2663
- onEventTrigger,
2664
- theme,
2665
- onRequestParamsChange
2666
- } = props;
2667
- const { serializedTimezone } = react_exports.useContext(TimezoneContext_default);
2668
- if (serializedTimezone) {
2669
- if (!moment_default.getDefaultSplunkTimezone()) {
2670
- moment_default.setDefaultSplunkTimezone(serializedTimezone);
2663
+ // esm-externals:@splunk/visualizations-shared/trellisUtils
2664
+ var trellisUtils_exports = {};
2665
+ __export(trellisUtils_exports, {
2666
+ default: () => trellisUtils_default
2667
+ });
2668
+ var defaultImport33 = __toESM(require("@splunk/visualizations-shared/trellisUtils"));
2669
+ __reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisUtils"));
2670
+ var trellisUtils_default = "default" in defaultImport33 ? defaultImport33.default : defaultImport33;
2671
+
2672
+ // src/common/utils/trellisUtils.ts
2673
+ var AGGREGATIONS = "aggregations";
2674
+ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
2675
+ var _a, _b, _c, _d;
2676
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2677
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2678
+ let splitDataSources = null;
2679
+ let errorCode = null;
2680
+ if (fields && fields.length) {
2681
+ splitDataSources = {};
2682
+ for (let i = 0; i < fields.length; i += 1) {
2683
+ const fieldName = fields[i].name;
2684
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
2685
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
2686
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2687
+ );
2688
+ splitDataSources[fieldName].primary.data.fields = [fields[i]];
2689
+ splitDataSources[fieldName].primary.data.columns = [columns[i]];
2671
2690
  }
2672
2691
  }
2673
- const themeFunc = (themeVar) => {
2674
- var _a2, _b;
2675
- return (_b = (_a2 = vizConfig.themes)[themeVar]) == null ? void 0 : _b.call(_a2, props);
2676
- };
2677
- const bgColorFromTheme = themeFunc("defaultBackgroundColor");
2678
- const {
2679
- family: currentThemeFamily,
2680
- colorScheme: currentThemeColorScheme,
2681
- density: currentThemeDensity
2682
- } = getSettingsFromThemedProps_default({ theme });
2683
- let evaluatedOptions = {};
2684
- const [evaluatedOptionsAsync, setEvaluatedOptionsAsync] = react_exports.useState({});
2685
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
2686
- const [visualizationID] = react_exports.useState(`${vizConfig.name} - ${(0, id_exports.createGUID)()}`);
2687
- const [dataSourcesInState, setDataSourcesInState] = react_exports.useState({});
2688
- const [dataFramesInState, setDataFramesInState] = react_exports.useState();
2689
- const [useAsyncEvaluatedOptions, setUseAsyncEvaluatedOptions] = react_exports.useState(
2690
- Boolean(getFeatureFlag(featureFlagContext, "visualizations_useWebWorkersForDSL"))
2691
- );
2692
- const isDownsamplingEnabledByFeatureFlag = Boolean(
2693
- featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
2694
- );
2695
- const isMounted = react_exports.useRef(true);
2696
- const optionsToEvaluate = react_exports.useMemo(
2697
- () => ({
2698
- context: (0, lodash_exports.defaultsDeep)({}, context, vizConfig.defaultContext),
2699
- options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
2700
- }),
2701
- [options, context]
2702
- );
2703
- const [threshold, setThreshold] = react_exports.useState(Number(width));
2704
- const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
2705
- setThreshold(newThreshold);
2706
- }, []);
2707
- const isDownsamplingEnabled = react_exports.useMemo(() => {
2708
- return isDownsamplingEnabledByFeatureFlag && isDownsamplingEnabledForViz({ vizConfig });
2709
- }, [isDownsamplingEnabledByFeatureFlag]);
2710
- const downsamplingProps = react_exports.useMemo(() => {
2711
- if (!isDownsamplingEnabled) {
2712
- return {};
2713
- }
2714
- return {
2715
- onDownsamplingThresholdChange,
2716
- originalDataSources: dataSources
2717
- };
2718
- }, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
2719
- const downsampledDataSources = useDownsampleDataSources_default({
2720
- options: optionsToEvaluate.options,
2721
- context: optionsToEvaluate.context,
2722
- dataSources,
2723
- threshold,
2724
- isDownsamplingEnabled
2725
- });
2726
- evaluatedOptions = useDeepMemo(() => {
2727
- try {
2728
- if (useAsyncEvaluatedOptions) {
2729
- const asyncDynamicOptionsEvaluatorParams = {
2730
- visualizationID,
2731
- props,
2732
- options: optionsToEvaluate,
2733
- dataSources: downsampledDataSources,
2734
- theme: vizConfig.themes,
2735
- bypassCloneDeepOptionScope: Boolean(
2736
- getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
2737
- ),
2738
- lazyLoadingDataFrame: Boolean(
2739
- getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
2740
- )
2741
- };
2742
- async_dynamic_options_evaluator_default.evaluate(asyncDynamicOptionsEvaluatorParams).then((results) => {
2743
- setEvaluatedOptionsAsync(results.results);
2744
- }).catch(() => {
2745
- if (isMounted.current) {
2746
- setUseAsyncEvaluatedOptions(false);
2747
- }
2748
- });
2749
- } else {
2750
- let dataFrames = dataFramesInState;
2751
- if (downsampledDataSources !== dataSourcesInState) {
2752
- setDataSourcesInState(downsampledDataSources);
2753
- dataFrames = Options_exports.Options.dataFrameFromDataSource(
2754
- downsampledDataSources,
2755
- getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
2756
- );
2757
- setDataFramesInState(dataFrames);
2758
- }
2759
- const result = Options_exports.Options.evaluate(
2760
- optionsToEvaluate,
2761
- downsampledDataSources,
2762
- themeFunc,
2763
- dataFrames,
2764
- getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
2765
- );
2766
- return result;
2692
+ } else {
2693
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2694
+ }
2695
+ return { splitDataSources, errorCode };
2696
+ };
2697
+ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
2698
+ var _a, _b, _c, _d;
2699
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2700
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2701
+ let splitDataSources = null;
2702
+ let splitByFields = [];
2703
+ let errorCode = null;
2704
+ if (typeof fields[0] !== "string") {
2705
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2706
+ }
2707
+ if (splitByFields && splitByFields.length > 0) {
2708
+ splitDataSources = {};
2709
+ splitByFields.forEach((splitByField) => {
2710
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
2711
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2712
+ );
2713
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
2714
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
2715
+ fields.forEach((field, idx) => {
2716
+ const fieldName = field == null ? void 0 : field.name;
2717
+ if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
2718
+ splitDataSources[splitByField].primary.data.fields.push(field);
2719
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
2767
2720
  }
2768
- } catch (e) {
2769
- console.error(`unexpected error evaluating options: ${e.message}`);
2770
- return {};
2771
- }
2772
- return {};
2773
- }, [
2774
- currentThemeFamily,
2775
- currentThemeColorScheme,
2776
- currentThemeDensity,
2777
- optionsToEvaluate,
2778
- downsampledDataSources,
2779
- serializedTimezone,
2780
- useAsyncEvaluatedOptions
2781
- ]);
2782
- const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
2783
- const isTrellisFeatureFlagOn = Boolean(
2784
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
2785
- );
2786
- let clonedEvaluatedOptions = evaluatedOptionsToUse;
2787
- if (isTrellisFeatureFlagOn && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.splitByLayout) === "trellis" /* TRELLIS */) {
2788
- clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
2789
- backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
2790
2721
  });
2791
- }
2792
- react_exports.useEffect(() => {
2793
- onComputedProps(clonedEvaluatedOptions);
2794
2722
  });
2795
- react_exports.useEffect(() => {
2796
- return () => {
2797
- if (useAsyncEvaluatedOptions) {
2798
- isMounted.current = false;
2799
- async_dynamic_options_evaluator_default.reset(visualizationID);
2800
- }
2801
- };
2802
- }, []);
2803
- const { requiredProps = [], supports } = vizConfig;
2804
- const missing = missingKeys(requiredProps, evaluatedOptionsToUse);
2805
- if (missing.length > 0 && supports.includes("placeholder" /* PLACEHOLDER */) && vizConfig.key !== "splunk.singlevalue") {
2806
- return /* @__PURE__ */ react_exports.createElement(
2807
- MissingPropsMessage_default,
2808
- {
2809
- "data-test": "missing-props-message",
2810
- width,
2811
- height,
2812
- missingProps: missing,
2813
- backgroundColor: bgColorFromTheme
2814
- }
2723
+ } else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
2724
+ splitDataSources = {};
2725
+ for (let i = 1; i < fields.length; i += 1) {
2726
+ const fieldName = fields[i].name;
2727
+ if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
2728
+ splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
2729
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2730
+ );
2731
+ splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
2732
+ splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
2733
+ }
2734
+ }
2735
+ } else {
2736
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2737
+ }
2738
+ return { splitDataSources, errorCode };
2739
+ };
2740
+ var dataSourcesSplitByAggregationsStats = (dataSource) => {
2741
+ var _a, _b, _c, _d;
2742
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2743
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2744
+ let splitDataSources = null;
2745
+ let splitByFields = [];
2746
+ let errorCode = null;
2747
+ if (typeof fields[0] !== "string") {
2748
+ splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
2749
+ }
2750
+ if (splitByFields && splitByFields.length > 0) {
2751
+ splitDataSources = {};
2752
+ splitByFields.forEach((splitByField) => {
2753
+ splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
2754
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2815
2755
  );
2756
+ splitDataSources[splitByField].primary.data.fields = [fields[0]];
2757
+ splitDataSources[splitByField].primary.data.columns = [columns[0]];
2758
+ const idx = fields.findIndex((field) => field.name === splitByField);
2759
+ if (idx > 0) {
2760
+ splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
2761
+ splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
2762
+ }
2763
+ });
2764
+ } else {
2765
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2766
+ }
2767
+ return { splitDataSources, errorCode };
2768
+ };
2769
+ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
2770
+ var _a, _b, _c, _d, _e;
2771
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2772
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2773
+ let splitDataSources = null;
2774
+ let splitByFields = [];
2775
+ let errorCode = null;
2776
+ if (typeof fields[0] !== "string") {
2777
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2778
+ }
2779
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2780
+ splitDataSources = {};
2781
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2782
+ const valueKeys = [];
2783
+ for (let i = 1; i < fields.length; i += 1) {
2784
+ if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
2785
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
2786
+ }
2816
2787
  }
2817
- const eventCallbackProps = {};
2818
- if (hasEventHandlers && mode === "view" && vizConfig.supports.indexOf("events" /* EVENTS */) > -1) {
2819
- const supportedEvents = vizConfig.events;
2820
- Object.keys(supportedEvents).forEach((eventName) => {
2821
- const { parentKeys, payloadKeys } = supportedEvents[eventName];
2822
- const eventCallbackPropName = (0, lodash_exports.camelCase)(`on.${eventName}`);
2823
- let payload = {};
2824
- if (Array.isArray(payloadKeys) && payloadKeys.length) {
2825
- payloadKeys.forEach((p) => {
2826
- payload[p] = evaluatedOptionsToUse[p];
2827
- });
2828
- }
2829
- eventCallbackProps[eventCallbackPropName] = (ev) => {
2830
- if (ev && ev.payload) {
2831
- payload = ev.payload;
2832
- }
2833
- return onEventTrigger({ originalEvent: ev, payload, type: eventName });
2834
- };
2835
- if (parentKeys) {
2836
- for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
2837
- const newObject = {};
2838
- newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
2839
- eventCallbackProps[eventCallbackPropName] = newObject;
2788
+ valueKeys.forEach((val) => {
2789
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2790
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2791
+ );
2792
+ splitDataSources[val].primary.data.fields = [
2793
+ { name: fields[0].name },
2794
+ ...dataSourceKeys.map((k) => ({
2795
+ name: k
2796
+ }))
2797
+ ];
2798
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
2799
+ dataSourceKeys.forEach((dsKey) => {
2800
+ fields.forEach((field, idx) => {
2801
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
2802
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
2840
2803
  }
2841
- }
2804
+ });
2842
2805
  });
2806
+ });
2807
+ } else {
2808
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2809
+ }
2810
+ return { splitDataSources, errorCode };
2811
+ };
2812
+ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
2813
+ var _a, _b, _c, _d;
2814
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2815
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2816
+ let splitDataSources = null;
2817
+ let splitByFields = [];
2818
+ let errorCode = null;
2819
+ if (typeof fields[0] !== "string") {
2820
+ splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
2821
+ }
2822
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2823
+ splitDataSources = {};
2824
+ const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
2825
+ const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
2826
+ const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
2827
+ const nonDataSourceAggregations = [];
2828
+ if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
2829
+ for (let i = 1; i < fields.length; i += 1) {
2830
+ nonDataSourceAggregations.push(fields[i].name);
2831
+ }
2843
2832
  }
2844
- const computedVizProps = computeVizProps2(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, props), evaluatedOptionsToUse), eventCallbackProps), {
2845
- themeFunc
2846
- }));
2847
- let dataSourceMetadata = {};
2848
- const OptionKey = "paginateDataSourceKey";
2849
- const paginateDataSourceKey = (0, lodash_exports.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || "primary";
2850
- if (vizConfig.supports.indexOf("page-and-sort" /* PAGE_AND_SORT */) > -1 && (0, lodash_exports.has)(dataSources, paginateDataSourceKey)) {
2851
- const requestParams = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "requestParams"], {});
2852
- const meta = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "meta"], {});
2853
- const handleRequestParamsChange = (payload) => onRequestParamsChange(paginateDataSourceKey, payload);
2854
- const sortParams = getSortingParams({
2855
- requestParams,
2856
- meta,
2857
- onRequestParamsChange: handleRequestParamsChange
2833
+ if (splitByFieldIdx === 0) {
2834
+ const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
2835
+ valueKeys.forEach((val, idx) => {
2836
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2837
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2838
+ );
2839
+ splitDataSources[val].primary.data.fields = [];
2840
+ if (otherSplitBy.length) {
2841
+ splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
2842
+ }
2843
+ if (dataSourceKeys.length) {
2844
+ const columnValues = [[]];
2845
+ splitDataSources[val].primary.data.fields = [
2846
+ ...splitDataSources[val].primary.data.fields,
2847
+ ...dataSourceKeys.map((k) => ({
2848
+ name: k
2849
+ }))
2850
+ ];
2851
+ dataSourceKeys.forEach(() => {
2852
+ columnValues.push([]);
2853
+ });
2854
+ for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
2855
+ columnValues[0].push(
2856
+ fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
2857
+ );
2858
+ dataSourceKeys.forEach((dskey, dsIndx) => {
2859
+ const mul = (fields.length - 1) / dataSourceKeys.length;
2860
+ columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
2861
+ });
2862
+ }
2863
+ splitDataSources[val].primary.data.columns = columnValues;
2864
+ } else if (nonDataSourceAggregations.length) {
2865
+ const columnValues = [];
2866
+ fields.forEach((aggregationField, fieldIdx) => {
2867
+ if (fieldIdx > 0) {
2868
+ splitDataSources[val].primary.data.fields.push(aggregationField);
2869
+ columnValues.push([columns[fieldIdx][idx]]);
2870
+ }
2871
+ });
2872
+ splitDataSources[val].primary.data.columns = columnValues;
2873
+ }
2858
2874
  });
2859
- const paginatorParams = getPaginationParams({
2860
- requestParams,
2861
- meta,
2862
- onRequestParamsChange: handleRequestParamsChange
2875
+ } else {
2876
+ const valueKeys = [];
2877
+ for (let i = 1; i < fields.length; i += 1) {
2878
+ valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
2879
+ }
2880
+ valueKeys.forEach((val) => {
2881
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2882
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2883
+ );
2884
+ splitDataSources[val].primary.data.fields = [
2885
+ { name: otherSplitBy[0] },
2886
+ ...dataSourceKeys.map((k) => ({
2887
+ name: k
2888
+ }))
2889
+ ];
2890
+ splitDataSources[val].primary.data.columns = [[...columns[0]]];
2891
+ dataSourceKeys.forEach((dsKey) => {
2892
+ fields.forEach((field, idx) => {
2893
+ if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
2894
+ splitDataSources[val].primary.data.columns.push([...columns[idx]]);
2895
+ }
2896
+ });
2897
+ });
2863
2898
  });
2864
- dataSourceMetadata = {
2865
- sortParams,
2866
- paginatorParams
2867
- };
2868
- }
2869
- if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
2870
- return null;
2871
2899
  }
2872
- return /* @__PURE__ */ react_exports.createElement(
2873
- SanitizedReactViz,
2874
- __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
2875
- mode,
2876
- width,
2877
- height
2878
- }, downsamplingProps), evaluatedOptionsToUse), computedVizProps), eventCallbackProps), dataSourceMetadata)
2879
- );
2880
- };
2881
- DashboardViz.propTypes = __spreadValues(__spreadValues({}, SplunkVisualization_default.propTypes), ReactViz.propTypes);
2882
- DashboardViz.defaultProps = __spreadProps(__spreadValues(__spreadValues({}, SplunkVisualization_default.defaultProps), ReactViz.defaultProps), {
2883
- // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
2884
- theme: {}
2885
- });
2886
- DashboardViz.config = vizConfig;
2887
- return (0, styled_components_exports.withTheme)(
2888
- withPlaceholder_default(withEditModeCover_default(DashboardViz, disableEditModeCover), useIconPlaceholder)
2889
- );
2900
+ } else {
2901
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2902
+ }
2903
+ return { splitDataSources, errorCode };
2890
2904
  };
2891
- var withDashboardViz_default = withDashboardViz;
2892
-
2893
- // esm-externals:@splunk/visualization-color-palettes/editors/PresetPalettes
2894
- var PresetPalettes_exports = {};
2895
- __export(PresetPalettes_exports, {
2896
- default: () => PresetPalettes_default
2897
- });
2898
- var defaultImport31 = __toESM(require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
2899
- __reExport(PresetPalettes_exports, require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
2900
- var PresetPalettes_default = "default" in defaultImport31 ? defaultImport31.default : defaultImport31;
2901
-
2902
- // esm-externals:@splunk/visualization-icons
2903
- var visualization_icons_exports = {};
2904
- __export(visualization_icons_exports, {
2905
- default: () => visualization_icons_default
2906
- });
2907
- var defaultImport32 = __toESM(require("@splunk/visualization-icons"));
2908
- __reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
2909
- var visualization_icons_default = "default" in defaultImport32 ? defaultImport32.default : defaultImport32;
2910
-
2911
- // esm-externals:@splunk/visualization-icons/placeholders
2912
- var placeholders_exports = {};
2913
- __export(placeholders_exports, {
2914
- default: () => placeholders_default
2915
- });
2916
- var defaultImport33 = __toESM(require("@splunk/visualization-icons/placeholders"));
2917
- __reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
2918
- var placeholders_default = "default" in defaultImport33 ? defaultImport33.default : defaultImport33;
2919
-
2920
- // esm-externals:@splunk/visualizations-shared/configUtils
2921
- var configUtils_exports = {};
2922
- __export(configUtils_exports, {
2923
- default: () => configUtils_default
2924
- });
2925
- var defaultImport34 = __toESM(require("@splunk/visualizations-shared/configUtils"));
2926
- __reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
2927
- var configUtils_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
2928
-
2929
- // src/common/editorConfig/StaticMajorAndTrendLayout.js
2930
- var StaticMajorAndTrendLayout = [
2931
- [
2932
- {
2933
- label: (0, i18n_exports._)("Unit position"),
2934
- // todo: we need a new editor combining unit and position
2935
- option: "unitPosition",
2936
- editor: "editor.select",
2937
- editorProps: {
2938
- values: [
2939
- { label: (0, i18n_exports._)("Before"), value: "before" },
2940
- { label: (0, i18n_exports._)("After"), value: "after" }
2941
- ]
2942
- },
2943
- showEditor: ({ options }) => options.showValue || options.showValue === void 0
2944
- },
2945
- {
2946
- label: (0, i18n_exports._)("Unit label"),
2947
- option: "unit",
2948
- editor: "editor.text",
2949
- showEditor: ({ options }) => options.showValue || options.showValue === void 0
2950
- }
2951
- ],
2952
- [
2953
- {
2954
- label: (0, i18n_exports._)("Precision"),
2955
- option: "numberPrecision",
2956
- editor: "editor.number",
2957
- editorProps: {
2958
- min: 0,
2959
- max: 20
2960
- },
2961
- showEditor: ({ options }) => options.showValue || options.showValue === void 0
2962
- }
2963
- ]
2964
- ];
2965
- var StaticMajorAndTrendLayout_default = StaticMajorAndTrendLayout;
2966
-
2967
- // src/common/utils/configUtils.ts
2968
- function enhanceConfig(vizConfig) {
2969
- const enhancedConfig = __spreadValues({}, vizConfig);
2970
- enhancedConfig.editorConfig = vizConfig.editorConfig.map(
2971
- (config3) => {
2972
- return __spreadProps(__spreadValues({}, config3), { open: config3.open || false });
2973
- }
2974
- );
2975
- return enhancedConfig;
2976
- }
2977
- function hasCompatibleContexts(vizContext, presetContext) {
2978
- const presetContextKeys = Object.keys(presetContext);
2979
- return presetContextKeys.every(
2980
- (contextKey) => presetContext[contextKey] === void 0 && vizContext[contextKey] === void 0 || presetContext[contextKey] !== void 0 && vizContext[contextKey] !== void 0
2981
- );
2982
- }
2983
- function hasCompatibleOptions(vizOptions, presetOptions) {
2984
- const presetOptionKeys = Object.keys(presetOptions);
2985
- return presetOptionKeys.every(
2986
- (optionKey) => (0, configUtils_exports.isDynamicOption)(presetOptions[optionKey]) === (0, configUtils_exports.isDynamicOption)(vizOptions[optionKey])
2987
- );
2988
- }
2989
- function getInitialPreset(vizContext, vizOptions, presets2) {
2990
- return presets2.find((preset) => {
2991
- const presetContext = (0, lodash_exports.get)(preset, ["value", "context"], {});
2992
- const presetOptions = (0, lodash_exports.get)(preset, ["value", "options"], {});
2993
- const presetContextKeys = Object.keys(presetContext);
2994
- const presetOptionKeys = Object.keys(presetOptions);
2995
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
2996
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
2997
- });
2998
- }
2999
-
3000
- // src/common/editorConfig/DynamicMajorColorAndGaugeEditor.js
3001
- var getDynamicMajorColorAndGaugeEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
3002
- label: (0, i18n_exports._)("Major value and gauge"),
3003
- option: "majorColor",
3004
- context: "majorColorEditorConfig",
3005
- editor: "editor.dynamicColor",
3006
- showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.majorColor),
3007
- editorProps: {
3008
- labelPosition: "top",
3009
- flyoutTitle: (0, i18n_exports._)("Dynamic coloring: major value"),
3010
- formatters: [
3011
- {
3012
- label: (0, i18n_exports._)("Ranges"),
3013
- value: "rangeValue",
3014
- defaults: {
3015
- majorValue: defaultContext2.majorColorConfig
3016
- }
3017
- }
3018
- ],
3019
- dataSelectors: [
3020
- {
3021
- label: (0, i18n_exports._)("Major value"),
3022
- value: "majorValue"
3023
- }
3024
- ],
3025
- defaultPalettesConfig: defaultPalettesConfig2
3026
- }
3027
- });
3028
-
3029
- // src/common/editorConfig/DynamicTrendColorEditor.js
3030
- var getDynamicTrendColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
3031
- label: (0, i18n_exports._)("Trend value"),
3032
- option: "trendColor",
3033
- context: "trendColorEditorConfig",
3034
- editor: "editor.dynamicColor",
3035
- showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.trendColor),
3036
- editorProps: {
3037
- labelPosition: "top",
3038
- flyoutTitle: (0, i18n_exports._)("Dynamic coloring: trend value"),
3039
- formatters: [
3040
- {
3041
- label: (0, i18n_exports._)("Ranges"),
3042
- value: "rangeValue",
3043
- defaults: {
3044
- trendValue: defaultContext2.trendColorConfig
3045
- }
3046
- }
3047
- ],
3048
- dataSelectors: [
3049
- {
3050
- label: (0, i18n_exports._)("Trend value"),
3051
- value: "trendValue"
3052
- }
3053
- ],
3054
- defaultPalettesConfig: defaultPalettesConfig2
2905
+ var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
2906
+ var _a, _b, _c, _d, _e, _f;
2907
+ const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
2908
+ const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
2909
+ let splitDataSources = null;
2910
+ let splitByFields = [];
2911
+ let errorCode = null;
2912
+ if (typeof fields[0] !== "string") {
2913
+ splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
3055
2914
  }
3056
- });
3057
-
3058
- // src/common/editorConfig/DynamicBackgroundColorEditor.js
3059
- var getDynamicBackgroundColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
3060
- label: (0, i18n_exports._)("Background color"),
3061
- option: "backgroundColor",
3062
- context: "backgroundColorEditorConfig",
3063
- editor: "editor.dynamicColor",
3064
- showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.backgroundColor),
3065
- editorProps: {
3066
- labelPosition: "top",
3067
- flyoutTitle: (0, i18n_exports._)("Dynamic coloring: background"),
3068
- formatters: [
3069
- {
3070
- label: (0, i18n_exports._)("Ranges"),
3071
- value: "rangeValue",
3072
- defaults: {
3073
- majorValue: defaultContext2.majorColorConfig,
3074
- trendValue: defaultContext2.trendColorConfig
3075
- }
3076
- },
3077
- {
3078
- label: (0, i18n_exports._)("Matches"),
3079
- value: "matchValue",
3080
- defaults: {
3081
- majorValue: defaultContext2.majorColorMatchConfig
3082
- }
3083
- }
3084
- ],
3085
- dataSelectors: [
3086
- {
3087
- label: (0, i18n_exports._)("Major Value"),
3088
- value: "majorValue"
3089
- },
3090
- {
3091
- label: (0, i18n_exports._)("Trend"),
3092
- value: "trendValue"
2915
+ const splitByIndex = fields == null ? void 0 : fields.findIndex(
2916
+ (field) => field === splitBy || field.name === splitBy
2917
+ );
2918
+ if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
2919
+ const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
2920
+ splitDataSources = {};
2921
+ splitByColumn.forEach((val, idx) => {
2922
+ if (!splitDataSources[val]) {
2923
+ splitDataSources[val] = [idx];
2924
+ } else {
2925
+ splitDataSources[val].push(idx);
3093
2926
  }
3094
- ],
3095
- defaultPalettesConfig: defaultPalettesConfig2
3096
- }
3097
- });
3098
-
3099
- // src/common/editorConfig/StaticMajorColorEditor.js
3100
- var StaticMajorColorEditor = {
3101
- label: (0, i18n_exports._)("Major value"),
3102
- option: "majorColor",
3103
- editor: "editor.color",
3104
- showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.majorColor)
3105
- };
3106
- var StaticMajorColorEditor_default = StaticMajorColorEditor;
3107
-
3108
- // src/common/editorConfig/StaticTrendColorEditor.js
3109
- var StaticTrendColorEditor = {
3110
- label: (0, i18n_exports._)("Trend value"),
3111
- option: "trendColor",
3112
- editor: "editor.color",
3113
- showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.trendColor),
3114
- isDisabled: ({ options }) => options.trendDisplay === "off"
3115
- };
3116
- var StaticTrendColorEditor_default = StaticTrendColorEditor;
3117
-
3118
- // src/common/editorConfig/StaticBackgroundColorEditor.js
3119
- var StaticBackgroundColorEditor = {
3120
- label: (0, i18n_exports._)("Background color"),
3121
- option: "backgroundColor",
3122
- editor: "editor.color",
3123
- showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.backgroundColor)
3124
- };
3125
- var StaticBackgroundColorEditor_default = StaticBackgroundColorEditor;
3126
-
3127
- // src/common/editorConfig/RadialBackgroundColor.ts
3128
- var radialBackground = ({ label, themes: themes3, labelPosition }) => [
3129
- {
3130
- label: (0, i18n_exports._)(label || "Radial background"),
3131
- option: "radialBackgroundColor",
3132
- editor: "editor.color",
3133
- editorProps: {
3134
- labelPosition: labelPosition || "top",
3135
- themes: themes3
3136
- }
3137
- }
3138
- ];
3139
- var RadialBackgroundColor_default = radialBackground;
3140
-
3141
- // src/common/editorConfig/TrellisEditors.ts
3142
- var TrellisEditorConfig = [
3143
- [
3144
- {
3145
- label: (0, i18n_exports._)("Trellis layout"),
3146
- option: "splitByLayout",
3147
- editor: "editor.toggle",
3148
- showEditor: () => {
3149
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3150
- const isTrellisFeatureFlagOn = Boolean(
3151
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
3152
- );
3153
- return isTrellisFeatureFlagOn;
3154
- }
3155
- }
3156
- ],
3157
- [
3158
- {
3159
- label: (0, i18n_exports._)("Split by"),
3160
- option: "trellisSplitBy",
3161
- editor: "editor.trellisSplitBy",
3162
- editorProps: {
3163
- dataSourceKey: "primary"
3164
- },
3165
- showEditor: ({ options }) => {
3166
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3167
- const isTrellisFeatureFlagOn = Boolean(
3168
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
3169
- );
3170
- return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
3171
- }
3172
- }
3173
- ],
3174
- [
3175
- {
3176
- label: (0, i18n_exports._)("Number of columns"),
3177
- option: "trellisColumns",
3178
- editor: "editor.number",
3179
- editorProps: {
3180
- min: 1
3181
- },
3182
- placeholder: (0, i18n_exports._)("Auto"),
3183
- showEditor: ({ options }) => {
3184
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3185
- const isTrellisFeatureFlagOn = Boolean(
3186
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
3187
- );
3188
- return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
3189
- }
3190
- }
3191
- ],
3192
- [
3193
- {
3194
- label: (0, i18n_exports._)("Min column width"),
3195
- option: "trellisMinColumnWidth",
3196
- editor: "editor.number",
3197
- editorProps: {
3198
- min: 1
3199
- },
3200
- showEditor: ({ options }) => {
3201
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3202
- const isTrellisFeatureFlagOn = Boolean(
3203
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
3204
- );
3205
- return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
3206
- }
3207
- },
3208
- {
3209
- label: (0, i18n_exports._)("Row height"),
3210
- option: "trellisRowHeight",
3211
- editor: "editor.number",
3212
- editorProps: {
3213
- min: 1
3214
- },
3215
- showEditor: ({ options }) => {
3216
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3217
- const isTrellisFeatureFlagOn = Boolean(
3218
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
3219
- );
3220
- return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
3221
- }
3222
- }
3223
- ],
3224
- [
3225
- {
3226
- label: (0, i18n_exports._)("Max number of components per page"),
3227
- option: "trellisPageCount",
3228
- editor: "editor.number",
3229
- editorProps: {
3230
- min: 1
3231
- },
3232
- showEditor: ({ options }) => {
3233
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3234
- const isTrellisFeatureFlagOn = Boolean(
3235
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
3236
- );
3237
- return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
3238
- }
3239
- }
3240
- ]
3241
- ];
3242
- var TrellisBackgroundColorEditor = {
3243
- label: (0, i18n_exports._)("Trellis background"),
3244
- option: "trellisBackgroundColor",
3245
- editor: "editor.color",
3246
- showEditor: ({ options }) => {
3247
- const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3248
- const isTrellisFeatureFlagOn = Boolean(
3249
- featureFlagContext && featureFlagContext.visualizations_enableTrellis
3250
- );
3251
- return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
3252
- }
3253
- };
3254
-
3255
- // src/SingleValueRadial/config.ts
3256
- var dataContract = {
3257
- requiredDataSources: [
3258
- {
3259
- name: "primary",
3260
- description: "DataSource that powers the visualization"
3261
- }
3262
- ],
3263
- optionalDataSources: [],
3264
- initialRequestParams: {
3265
- primary: { offset: 0, count: 1e4 }
3266
- }
3267
- };
3268
- var size = {
3269
- initialWidth: 250,
3270
- initialHeight: 250
3271
- };
3272
- var defaultContext = {
3273
- majorColorConfig: [
3274
- { to: 20, value: "#D41F1F" },
3275
- { from: 20, to: 40, value: "#D94E17" },
3276
- { from: 40, to: 60, value: "#CBA700" },
3277
- { from: 60, to: 80, value: "#669922" },
3278
- { from: 80, value: "#118832" }
3279
- ],
3280
- majorColorMatchConfig: [{ match: "", value: "#5C33FF" }],
3281
- trendColorConfig: [
3282
- {
3283
- to: 0,
3284
- value: "#9E2520"
3285
- },
3286
- {
3287
- from: 0,
3288
- value: "#1C6B2D"
3289
- }
3290
- ]
3291
- };
3292
- var basePresetContext = {
3293
- majorColorEditorConfig: void 0,
3294
- trendColorEditorConfig: void 0,
3295
- backgroundColorEditorConfig: void 0
3296
- };
3297
- var basePresetOptions = {
3298
- majorColor: void 0,
3299
- trendColor: void 0,
3300
- backgroundColor: void 0
3301
- };
3302
- var presets = [
3303
- {
3304
- // dummy context variables to allow for resetting of unused context states
3305
- label: (0, i18n_exports._)("None"),
3306
- name: "singleValueRadial.none",
3307
- value: {
3308
- context: __spreadValues({}, basePresetContext),
3309
- options: __spreadValues({}, basePresetOptions)
3310
- }
3311
- },
3312
- {
3313
- label: (0, i18n_exports._)("Major value and gauge"),
3314
- name: "singleValueRadial.majorValue",
3315
- value: {
3316
- context: __spreadProps(__spreadValues({}, basePresetContext), {
3317
- majorColorEditorConfig: defaultContext.majorColorConfig
3318
- }),
3319
- options: __spreadProps(__spreadValues({}, basePresetOptions), {
3320
- majorColor: "> majorValue | rangeValue(majorColorEditorConfig)"
3321
- })
3322
- }
3323
- },
3324
- {
3325
- label: (0, i18n_exports._)("Major value, trend value, and gauge"),
3326
- name: "singleValueRadial.majorValueAndTrend",
3327
- value: {
3328
- context: __spreadProps(__spreadValues({}, basePresetContext), {
3329
- majorColorEditorConfig: defaultContext.majorColorConfig,
3330
- trendColorEditorConfig: defaultContext.trendColorConfig
3331
- }),
3332
- options: __spreadProps(__spreadValues({}, basePresetOptions), {
3333
- majorColor: "> majorValue | rangeValue(majorColorEditorConfig)",
3334
- trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
3335
- })
3336
- }
3337
- },
3338
- {
3339
- label: (0, i18n_exports._)("Trend value"),
3340
- name: "singleValueRadial.trend",
3341
- value: {
3342
- context: __spreadProps(__spreadValues({}, basePresetContext), {
3343
- trendColorEditorConfig: defaultContext.trendColorConfig
3344
- }),
3345
- options: __spreadProps(__spreadValues({}, basePresetOptions), {
3346
- trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
3347
- })
3348
- }
3349
- },
3350
- {
3351
- label: (0, i18n_exports._)("Background"),
3352
- name: "singleValueRadial.background",
3353
- value: {
3354
- context: __spreadProps(__spreadValues({}, basePresetContext), {
3355
- backgroundColorEditorConfig: defaultContext.majorColorConfig
3356
- }),
3357
- options: __spreadProps(__spreadValues({}, basePresetOptions), {
3358
- backgroundColor: "> majorValue | rangeValue(backgroundColorEditorConfig)"
3359
- })
3360
- }
3361
- }
3362
- ];
3363
- var themes = {
3364
- defaultFontColor: (props) => pick_default({
3365
- enterprise: {
3366
- dark: variables_default.white(props),
3367
- light: variables_default.black(props)
3368
- },
3369
- prisma: variables_default.contentColorActive(props)
3370
- })(props),
3371
- defaultBackgroundColor: (props) => pick_default({
3372
- enterprise: {
3373
- dark: variables_default.black(props),
3374
- light: variables_default.white(props)
3375
- },
3376
- prisma: variables_default.backgroundColorSidebar(props)
3377
- })(props),
3378
- defaultRadialBackgroundColor: (props) => pick_default({
3379
- enterprise: {
3380
- dark: "rgba(255, 255, 255, 0.15)",
3381
- light: "rgba(0, 0, 0, 0.1)"
3382
- },
3383
- prisma: variables_default.interactiveColorBackgroundDisabled(props)
3384
- })(props)
3385
- };
3386
- var editorConfig = [
3387
- {
3388
- label: (0, i18n_exports._)("Data configurations"),
3389
- layout: [
3390
- [
3391
- {
3392
- label: (0, i18n_exports._)("Value"),
3393
- editor: "editor.columnSelector",
3394
- option: "majorValue",
3395
- context: "valuesContext",
3396
- editorProps: {
3397
- dataSourceKey: "primary",
3398
- prepareValue: (definition) => {
3399
- const {
3400
- options: { majorValue: baseSPL }
3401
- } = definition;
3402
- return {
3403
- context: {},
3404
- options: {
3405
- majorValue: `${baseSPL} | lastPoint()`,
3406
- trendValue: `${baseSPL} | delta(-2)`
3407
- }
3408
- };
3409
- }
3410
- },
3411
- isDisabled: ({ options }) => options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis
3412
- }
3413
- ]
3414
- ]
3415
- },
3416
- {
3417
- label: (0, i18n_exports._)("Data display"),
3418
- layout: [
3419
- ...StaticMajorAndTrendLayout_default,
3420
- [
3421
- {
3422
- label: (0, i18n_exports._)("Trend display"),
3423
- option: "trendDisplay",
3424
- editor: "editor.select",
3425
- editorProps: {
3426
- values: [
3427
- { label: (0, i18n_exports._)("Percent"), value: "percent" },
3428
- { label: (0, i18n_exports._)("Absolute"), value: "absolute" },
3429
- { label: (0, i18n_exports._)("Off"), value: "off" }
3430
- ]
3431
- },
3432
- showEditor: ({ options }) => options.showValue || options.showValue === void 0
3433
- }
3434
- ],
3435
- [
3436
- {
3437
- label: (0, i18n_exports._)("Min"),
3438
- option: "minValue",
3439
- editor: "editor.number"
3440
- },
3441
- {
3442
- label: (0, i18n_exports._)("Max"),
3443
- option: "maxValue",
3444
- editor: "editor.number"
3445
- }
3446
- ],
3447
- ...TrellisEditorConfig
3448
- ]
3449
- },
3450
- {
3451
- label: (0, i18n_exports._)("Color and style"),
3452
- layout: [
3453
- [
3454
- {
3455
- label: (0, i18n_exports._)("Dynamic elements"),
3456
- key: "presetSelector",
3457
- editor: "editor.presetSelector",
3458
- editorProps: {
3459
- presets,
3460
- value: ({ context, options }) => {
3461
- const initialPreset = getInitialPreset(context, options, presets);
3462
- return initialPreset && initialPreset.label || null;
3463
- }
3464
- }
2927
+ });
2928
+ const cloneFields = (0, lodash_exports.cloneDeep)(fields);
2929
+ cloneFields.splice(splitByIndex, 1);
2930
+ const valueKeys = Object.keys(splitDataSources);
2931
+ valueKeys.forEach((val) => {
2932
+ const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
2933
+ splitDataSources[val] = (0, lodash_exports.cloneDeep)(
2934
+ (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
2935
+ );
2936
+ splitDataSources[val].primary.data.fields = cloneFields;
2937
+ splitDataSources[val].primary.data.columns = [];
2938
+ columns.forEach((col, idx) => {
2939
+ if (idx !== splitByIndex) {
2940
+ const newCol = valIndices.map((valIdx) => col[valIdx]);
2941
+ splitDataSources[val].primary.data.columns.push(newCol);
3465
2942
  }
3466
- ],
3467
- [
3468
- __spreadProps(__spreadValues({}, StaticMajorColorEditor_default), {
3469
- editorProps: {
3470
- themes
2943
+ });
2944
+ });
2945
+ } else {
2946
+ errorCode = "INVALID_SPLIT_BY_FIELD";
2947
+ }
2948
+ return { splitDataSources, errorCode };
2949
+ };
2950
+ var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
2951
+ let result = null;
2952
+ try {
2953
+ if (splitMode === trellisUtils_exports.TIMECHART) {
2954
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
2955
+ } else if (splitMode === trellisUtils_exports.STATS) {
2956
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
2957
+ } else if (splitMode === trellisUtils_exports.CHART) {
2958
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
2959
+ } else if (splitMode === trellisUtils_exports.UNKNOWN) {
2960
+ result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
2961
+ }
2962
+ } catch (ex) {
2963
+ console.error("getTrellisDataSourcesBySplitMode ", ex);
2964
+ result = { splitDataSources: null, errorCode: "UNKNOWN" };
2965
+ }
2966
+ return result;
2967
+ };
2968
+ var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
2969
+ if (isTrellisOn && !options.legendDisplay) {
2970
+ return {
2971
+ legendDisplay: "off"
2972
+ };
2973
+ }
2974
+ return {};
2975
+ };
2976
+ var calculateSharedMinMax = (splitData) => {
2977
+ let max = -Infinity;
2978
+ let min = Infinity;
2979
+ Object.keys(splitData).forEach((splitByKey) => {
2980
+ const datasources = splitData[splitByKey];
2981
+ Object.keys(datasources).forEach((datasourceName) => {
2982
+ const dataColumns = datasources[datasourceName].data.columns;
2983
+ dataColumns.forEach((column) => {
2984
+ column.forEach((point) => {
2985
+ const pointNumber = Number(point);
2986
+ if (pointNumber > max) {
2987
+ max = pointNumber;
3471
2988
  }
3472
- })
3473
- ],
3474
- [getDynamicMajorColorAndGaugeEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
3475
- [
3476
- __spreadProps(__spreadValues({}, StaticTrendColorEditor_default), {
3477
- editorProps: {
3478
- themes
2989
+ if (pointNumber < min) {
2990
+ min = pointNumber;
3479
2991
  }
3480
- })
3481
- ],
3482
- [getDynamicTrendColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
3483
- [
3484
- {
3485
- label: (0, i18n_exports._)("Major value abbreviation"),
3486
- option: "shouldAbbreviateMajorValue",
3487
- editor: "editor.checkbox"
2992
+ });
2993
+ });
2994
+ });
2995
+ });
2996
+ return [min, max];
2997
+ };
2998
+ var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
2999
+ if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
3000
+ return [yAxisMin, yAxisMax];
3001
+ const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
3002
+ const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
3003
+ const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
3004
+ return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
3005
+ };
3006
+
3007
+ // src/common/withDashboardViz.tsx
3008
+ var withDashboardViz = (opts) => {
3009
+ const {
3010
+ ReactViz,
3011
+ vizConfig,
3012
+ computeVizProps: computeVizProps2 = () => {
3013
+ },
3014
+ computeVizPropsBeforeEval: computeVizPropsBeforeEval2 = () => {
3015
+ },
3016
+ disableEditModeCover,
3017
+ useIconPlaceholder
3018
+ } = opts;
3019
+ const SanitizedReactViz = (0, SanitizeProps_exports.withSanitizedProps)(ReactViz);
3020
+ const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(vizConfig.optionsSchema, "default");
3021
+ const DashboardViz = (props) => {
3022
+ var _a;
3023
+ const {
3024
+ mode,
3025
+ hasEventHandlers,
3026
+ dataSources,
3027
+ // type of { [key: string]: DataSource }
3028
+ options,
3029
+ context = {},
3030
+ width,
3031
+ height,
3032
+ onComputedProps,
3033
+ onEventTrigger,
3034
+ theme,
3035
+ onRequestParamsChange
3036
+ } = props;
3037
+ const { serializedTimezone } = react_exports.useContext(TimezoneContext_default);
3038
+ if (serializedTimezone) {
3039
+ if (!moment_default.getDefaultSplunkTimezone()) {
3040
+ moment_default.setDefaultSplunkTimezone(serializedTimezone);
3041
+ }
3042
+ }
3043
+ const themeFunc = (themeVar) => {
3044
+ var _a2, _b;
3045
+ return (_b = (_a2 = vizConfig.themes)[themeVar]) == null ? void 0 : _b.call(_a2, props);
3046
+ };
3047
+ const bgColorFromTheme = themeFunc("defaultBackgroundColor");
3048
+ const {
3049
+ family: currentThemeFamily,
3050
+ colorScheme: currentThemeColorScheme,
3051
+ density: currentThemeDensity
3052
+ } = getSettingsFromThemedProps_default({ theme });
3053
+ let evaluatedOptions = {};
3054
+ const [evaluatedOptionsAsync, setEvaluatedOptionsAsync] = react_exports.useState({});
3055
+ const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
3056
+ const [visualizationID] = react_exports.useState(`${vizConfig.name} - ${(0, id_exports.createGUID)()}`);
3057
+ const [dataSourcesInState, setDataSourcesInState] = react_exports.useState({});
3058
+ const [dataFramesInState, setDataFramesInState] = react_exports.useState();
3059
+ const [useAsyncEvaluatedOptions, setUseAsyncEvaluatedOptions] = react_exports.useState(
3060
+ Boolean(getFeatureFlag(featureFlagContext, "visualizations_useWebWorkersForDSL"))
3061
+ );
3062
+ const isDownsamplingEnabledByFeatureFlag = Boolean(
3063
+ featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
3064
+ );
3065
+ const isTrellisFeatureFlagOn2 = Boolean(
3066
+ featureFlagContext && featureFlagContext.visualizations_enableTrellis
3067
+ );
3068
+ const isTrellisOn = isTrellisFeatureFlagOn2 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
3069
+ const isMounted = react_exports.useRef(true);
3070
+ const optionsToEvaluate = react_exports.useMemo(() => {
3071
+ var _a2;
3072
+ const legendDisplay = turnOffLegendDisplayWhenTrellisIsOn(isTrellisOn, options);
3073
+ const computedOptions = (_a2 = computeVizPropsBeforeEval2(options)) != null ? _a2 : {};
3074
+ return {
3075
+ context: (0, lodash_exports.defaultsDeep)({}, context, vizConfig.defaultContext),
3076
+ options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)(
3077
+ {},
3078
+ legendDisplay,
3079
+ computedOptions,
3080
+ options,
3081
+ defaultOptions
3082
+ )
3083
+ };
3084
+ }, [isTrellisOn, options, context]);
3085
+ const [threshold, setThreshold] = react_exports.useState(Number(width));
3086
+ const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
3087
+ setThreshold(newThreshold);
3088
+ }, []);
3089
+ const isDownsamplingEnabled = react_exports.useMemo(() => {
3090
+ return isDownsamplingEnabledByFeatureFlag && isDownsamplingEnabledForViz({ vizConfig });
3091
+ }, [isDownsamplingEnabledByFeatureFlag]);
3092
+ const downsamplingProps = react_exports.useMemo(() => {
3093
+ if (!isDownsamplingEnabled) {
3094
+ return {};
3095
+ }
3096
+ return {
3097
+ onDownsamplingThresholdChange,
3098
+ originalDataSources: dataSources
3099
+ };
3100
+ }, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
3101
+ const downsampledDataSources = useDownsampleDataSources_default({
3102
+ options: optionsToEvaluate.options,
3103
+ context: optionsToEvaluate.context,
3104
+ dataSources,
3105
+ threshold,
3106
+ isDownsamplingEnabled
3107
+ });
3108
+ evaluatedOptions = useDeepMemo(() => {
3109
+ try {
3110
+ if (useAsyncEvaluatedOptions) {
3111
+ const asyncDynamicOptionsEvaluatorParams = {
3112
+ visualizationID,
3113
+ props,
3114
+ options: optionsToEvaluate,
3115
+ dataSources: downsampledDataSources,
3116
+ theme: vizConfig.themes,
3117
+ bypassCloneDeepOptionScope: Boolean(
3118
+ getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
3119
+ ),
3120
+ lazyLoadingDataFrame: Boolean(
3121
+ getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
3122
+ )
3123
+ };
3124
+ async_dynamic_options_evaluator_default.evaluate(asyncDynamicOptionsEvaluatorParams).then((results) => {
3125
+ setEvaluatedOptionsAsync(results.results);
3126
+ }).catch(() => {
3127
+ if (isMounted.current) {
3128
+ setUseAsyncEvaluatedOptions(false);
3129
+ }
3130
+ });
3131
+ } else {
3132
+ let dataFrames = dataFramesInState;
3133
+ if (downsampledDataSources !== dataSourcesInState) {
3134
+ setDataSourcesInState(downsampledDataSources);
3135
+ dataFrames = Options_exports.Options.dataFrameFromDataSource(
3136
+ downsampledDataSources,
3137
+ getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
3138
+ );
3139
+ setDataFramesInState(dataFrames);
3140
+ }
3141
+ const result = Options_exports.Options.evaluate(
3142
+ optionsToEvaluate,
3143
+ downsampledDataSources,
3144
+ themeFunc,
3145
+ dataFrames,
3146
+ getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
3147
+ );
3148
+ return result;
3488
3149
  }
3489
- ],
3490
- [
3150
+ } catch (e) {
3151
+ console.error(`unexpected error evaluating options: ${e.message}`);
3152
+ return {};
3153
+ }
3154
+ return {};
3155
+ }, [
3156
+ currentThemeFamily,
3157
+ currentThemeColorScheme,
3158
+ currentThemeDensity,
3159
+ optionsToEvaluate,
3160
+ downsampledDataSources,
3161
+ serializedTimezone,
3162
+ useAsyncEvaluatedOptions
3163
+ ]);
3164
+ const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
3165
+ let clonedEvaluatedOptions = evaluatedOptionsToUse;
3166
+ if (isTrellisOn) {
3167
+ clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
3168
+ backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
3169
+ });
3170
+ }
3171
+ react_exports.useEffect(() => {
3172
+ onComputedProps(clonedEvaluatedOptions);
3173
+ });
3174
+ react_exports.useEffect(() => {
3175
+ return () => {
3176
+ if (useAsyncEvaluatedOptions) {
3177
+ isMounted.current = false;
3178
+ async_dynamic_options_evaluator_default.reset(visualizationID);
3179
+ }
3180
+ };
3181
+ }, []);
3182
+ const { requiredProps = [], supports } = vizConfig;
3183
+ const missing = missingKeys(requiredProps, evaluatedOptionsToUse);
3184
+ if (missing.length > 0 && supports.includes("placeholder" /* PLACEHOLDER */) && vizConfig.key !== "splunk.singlevalue") {
3185
+ return /* @__PURE__ */ react_exports.createElement(
3186
+ MissingPropsMessage_default,
3491
3187
  {
3492
- label: (0, i18n_exports._)("Trend value abbreviation"),
3493
- option: "shouldAbbreviateTrendValue",
3494
- editor: "editor.checkbox"
3188
+ "data-test": "missing-props-message",
3189
+ width,
3190
+ height,
3191
+ missingProps: missing,
3192
+ backgroundColor: bgColorFromTheme
3495
3193
  }
3496
- ],
3497
- RadialBackgroundColor_default({ themes }),
3498
- [
3499
- __spreadProps(__spreadValues({}, StaticBackgroundColorEditor_default), {
3500
- editorProps: {
3501
- themes
3194
+ );
3195
+ }
3196
+ const eventCallbackProps = {};
3197
+ if (hasEventHandlers && mode === "view" && vizConfig.supports.indexOf("events" /* EVENTS */) > -1) {
3198
+ const supportedEvents = vizConfig.events;
3199
+ Object.keys(supportedEvents).forEach((eventName) => {
3200
+ const { parentKeys, payloadKeys } = supportedEvents[eventName];
3201
+ const eventCallbackPropName = (0, lodash_exports.camelCase)(`on.${eventName}`);
3202
+ let payload = {};
3203
+ if (Array.isArray(payloadKeys) && payloadKeys.length) {
3204
+ payloadKeys.forEach((p) => {
3205
+ payload[p] = evaluatedOptionsToUse[p];
3206
+ });
3207
+ }
3208
+ eventCallbackProps[eventCallbackPropName] = (ev) => {
3209
+ if (ev && ev.payload) {
3210
+ payload = ev.payload;
3502
3211
  }
3503
- })
3504
- ],
3505
- [
3506
- __spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
3507
- editorProps: {
3508
- themes
3212
+ return onEventTrigger({ originalEvent: ev, payload, type: eventName });
3213
+ };
3214
+ if (parentKeys) {
3215
+ for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
3216
+ const newObject = {};
3217
+ newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
3218
+ eventCallbackProps[eventCallbackPropName] = newObject;
3509
3219
  }
3510
- })
3511
- ],
3512
- [getDynamicBackgroundColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
3513
- [
3514
- {
3515
- label: (0, i18n_exports._)("Show gauge ranges"),
3516
- option: "isGaugeOn",
3517
- editor: "editor.toggle",
3518
- showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.majorColor)
3519
3220
  }
3520
- ]
3521
- ]
3522
- }
3523
- ];
3524
- var config = {
3525
- /**
3526
- * unique viz key
3527
- */
3528
- key: "splunk.singlevalueradial",
3529
- /**
3530
- * viz name
3531
- */
3532
- name: (0, i18n_exports._)("Single value radial"),
3533
- category: "Single Value" /* SINGLE_VALUE */,
3534
- /**
3535
- * viz icon
3536
- */
3537
- icon: visualization_icons_exports.SingleValueRadial,
3538
- placeholderIcon: placeholders_exports.SingleValueRadial,
3539
- dataContract,
3540
- size,
3541
- defaultContext,
3542
- optionsSchema: visualization_schemas_exports.singleValueRadialOptionsSchema,
3543
- editorConfig,
3544
- events: {
3545
- "value.click": {
3546
- description: "trigger when user clicks major value",
3547
- payloadKeys: ["majorValue", "trendValue"]
3221
+ });
3548
3222
  }
3549
- },
3550
- supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "events" /* EVENTS */, "placeholder" /* PLACEHOLDER */, "trellis" /* TRELLIS */],
3551
- themes
3223
+ const computedVizProps = computeVizProps2(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, props), evaluatedOptionsToUse), eventCallbackProps), {
3224
+ themeFunc
3225
+ }));
3226
+ let dataSourceMetadata = {};
3227
+ const OptionKey = "paginateDataSourceKey";
3228
+ const paginateDataSourceKey = (0, lodash_exports.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || "primary";
3229
+ if (vizConfig.supports.indexOf("page-and-sort" /* PAGE_AND_SORT */) > -1 && (0, lodash_exports.has)(dataSources, paginateDataSourceKey)) {
3230
+ const requestParams = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "requestParams"], {});
3231
+ const meta = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "meta"], {});
3232
+ const handleRequestParamsChange = (payload) => onRequestParamsChange(paginateDataSourceKey, payload);
3233
+ const sortParams = getSortingParams({
3234
+ requestParams,
3235
+ meta,
3236
+ onRequestParamsChange: handleRequestParamsChange
3237
+ });
3238
+ const paginatorParams = getPaginationParams({
3239
+ requestParams,
3240
+ meta,
3241
+ onRequestParamsChange: handleRequestParamsChange
3242
+ });
3243
+ dataSourceMetadata = {
3244
+ sortParams,
3245
+ paginatorParams
3246
+ };
3247
+ }
3248
+ if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
3249
+ return null;
3250
+ }
3251
+ return /* @__PURE__ */ react_exports.createElement(
3252
+ SanitizedReactViz,
3253
+ __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
3254
+ mode,
3255
+ width,
3256
+ height
3257
+ }, downsamplingProps), evaluatedOptionsToUse), computedVizProps), eventCallbackProps), dataSourceMetadata)
3258
+ );
3259
+ };
3260
+ DashboardViz.propTypes = __spreadValues(__spreadValues({}, SplunkVisualization_default.propTypes), ReactViz.propTypes);
3261
+ DashboardViz.defaultProps = __spreadProps(__spreadValues(__spreadValues({}, SplunkVisualization_default.defaultProps), ReactViz.defaultProps), {
3262
+ // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
3263
+ theme: {}
3264
+ });
3265
+ DashboardViz.config = vizConfig;
3266
+ return (0, styled_components_exports.withTheme)(
3267
+ withPlaceholder_default(withEditModeCover_default(DashboardViz, disableEditModeCover), useIconPlaceholder)
3268
+ );
3552
3269
  };
3553
- var config_default = enhanceConfig(config);
3270
+ var withDashboardViz_default = withDashboardViz;
3554
3271
 
3555
- // esm-externals:@splunk/react-ui/Paginator
3556
- var Paginator_exports = {};
3557
- __export(Paginator_exports, {
3558
- default: () => Paginator_default
3272
+ // esm-externals:@splunk/visualization-color-palettes/editors/PresetPalettes
3273
+ var PresetPalettes_exports = {};
3274
+ __export(PresetPalettes_exports, {
3275
+ default: () => PresetPalettes_default
3276
+ });
3277
+ var defaultImport34 = __toESM(require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
3278
+ __reExport(PresetPalettes_exports, require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
3279
+ var PresetPalettes_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
3280
+
3281
+ // esm-externals:@splunk/visualization-icons
3282
+ var visualization_icons_exports = {};
3283
+ __export(visualization_icons_exports, {
3284
+ default: () => visualization_icons_default
3285
+ });
3286
+ var defaultImport35 = __toESM(require("@splunk/visualization-icons"));
3287
+ __reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
3288
+ var visualization_icons_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
3289
+
3290
+ // esm-externals:@splunk/visualization-icons/placeholders
3291
+ var placeholders_exports = {};
3292
+ __export(placeholders_exports, {
3293
+ default: () => placeholders_default
3294
+ });
3295
+ var defaultImport36 = __toESM(require("@splunk/visualization-icons/placeholders"));
3296
+ __reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
3297
+ var placeholders_default = "default" in defaultImport36 ? defaultImport36.default : defaultImport36;
3298
+
3299
+ // esm-externals:@splunk/visualizations-shared/configUtils
3300
+ var configUtils_exports = {};
3301
+ __export(configUtils_exports, {
3302
+ default: () => configUtils_default
3303
+ });
3304
+ var defaultImport37 = __toESM(require("@splunk/visualizations-shared/configUtils"));
3305
+ __reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
3306
+ var configUtils_default = "default" in defaultImport37 ? defaultImport37.default : defaultImport37;
3307
+
3308
+ // src/common/editorConfig/StaticMajorAndTrendLayout.js
3309
+ var StaticMajorAndTrendLayout = [
3310
+ [
3311
+ {
3312
+ label: (0, i18n_exports._)("Unit position"),
3313
+ // todo: we need a new editor combining unit and position
3314
+ option: "unitPosition",
3315
+ editor: "editor.select",
3316
+ editorProps: {
3317
+ values: [
3318
+ { label: (0, i18n_exports._)("Before"), value: "before" },
3319
+ { label: (0, i18n_exports._)("After"), value: "after" }
3320
+ ]
3321
+ },
3322
+ showEditor: ({ options }) => options.showValue || options.showValue === void 0
3323
+ },
3324
+ {
3325
+ label: (0, i18n_exports._)("Unit label"),
3326
+ option: "unit",
3327
+ editor: "editor.text",
3328
+ showEditor: ({ options }) => options.showValue || options.showValue === void 0
3329
+ }
3330
+ ],
3331
+ [
3332
+ {
3333
+ label: (0, i18n_exports._)("Precision"),
3334
+ option: "numberPrecision",
3335
+ editor: "editor.number",
3336
+ editorProps: {
3337
+ min: 0,
3338
+ max: 20
3339
+ },
3340
+ showEditor: ({ options }) => options.showValue || options.showValue === void 0
3341
+ }
3342
+ ]
3343
+ ];
3344
+ var StaticMajorAndTrendLayout_default = StaticMajorAndTrendLayout;
3345
+
3346
+ // src/common/utils/configUtils.ts
3347
+ function enhanceConfig(vizConfig) {
3348
+ const enhancedConfig = __spreadValues({}, vizConfig);
3349
+ enhancedConfig.editorConfig = vizConfig.editorConfig.map(
3350
+ (config3) => {
3351
+ return __spreadProps(__spreadValues({}, config3), { open: config3.open || false });
3352
+ }
3353
+ );
3354
+ return enhancedConfig;
3355
+ }
3356
+ function hasCompatibleContexts(vizContext, presetContext) {
3357
+ const presetContextKeys = Object.keys(presetContext);
3358
+ return presetContextKeys.every(
3359
+ (contextKey) => presetContext[contextKey] === void 0 && vizContext[contextKey] === void 0 || presetContext[contextKey] !== void 0 && vizContext[contextKey] !== void 0
3360
+ );
3361
+ }
3362
+ function hasCompatibleOptions(vizOptions, presetOptions) {
3363
+ const presetOptionKeys = Object.keys(presetOptions);
3364
+ return presetOptionKeys.every(
3365
+ (optionKey) => (0, configUtils_exports.isDynamicOption)(presetOptions[optionKey]) === (0, configUtils_exports.isDynamicOption)(vizOptions[optionKey])
3366
+ );
3367
+ }
3368
+ function getInitialPreset(vizContext, vizOptions, presets2) {
3369
+ return presets2.find((preset) => {
3370
+ const presetContext = (0, lodash_exports.get)(preset, ["value", "context"], {});
3371
+ const presetOptions = (0, lodash_exports.get)(preset, ["value", "options"], {});
3372
+ const presetContextKeys = Object.keys(presetContext);
3373
+ const presetOptionKeys = Object.keys(presetOptions);
3374
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
3375
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
3376
+ });
3377
+ }
3378
+
3379
+ // src/common/editorConfig/DynamicMajorColorAndGaugeEditor.js
3380
+ var getDynamicMajorColorAndGaugeEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
3381
+ label: (0, i18n_exports._)("Major value and gauge"),
3382
+ option: "majorColor",
3383
+ context: "majorColorEditorConfig",
3384
+ editor: "editor.dynamicColor",
3385
+ showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.majorColor),
3386
+ editorProps: {
3387
+ labelPosition: "top",
3388
+ flyoutTitle: (0, i18n_exports._)("Dynamic coloring: major value"),
3389
+ formatters: [
3390
+ {
3391
+ label: (0, i18n_exports._)("Ranges"),
3392
+ value: "rangeValue",
3393
+ defaults: {
3394
+ majorValue: defaultContext2.majorColorConfig
3395
+ }
3396
+ }
3397
+ ],
3398
+ dataSelectors: [
3399
+ {
3400
+ label: (0, i18n_exports._)("Major value"),
3401
+ value: "majorValue"
3402
+ }
3403
+ ],
3404
+ defaultPalettesConfig: defaultPalettesConfig2
3405
+ }
3406
+ });
3407
+
3408
+ // src/common/editorConfig/DynamicTrendColorEditor.js
3409
+ var getDynamicTrendColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
3410
+ label: (0, i18n_exports._)("Trend value"),
3411
+ option: "trendColor",
3412
+ context: "trendColorEditorConfig",
3413
+ editor: "editor.dynamicColor",
3414
+ showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.trendColor),
3415
+ editorProps: {
3416
+ labelPosition: "top",
3417
+ flyoutTitle: (0, i18n_exports._)("Dynamic coloring: trend value"),
3418
+ formatters: [
3419
+ {
3420
+ label: (0, i18n_exports._)("Ranges"),
3421
+ value: "rangeValue",
3422
+ defaults: {
3423
+ trendValue: defaultContext2.trendColorConfig
3424
+ }
3425
+ }
3426
+ ],
3427
+ dataSelectors: [
3428
+ {
3429
+ label: (0, i18n_exports._)("Trend value"),
3430
+ value: "trendValue"
3431
+ }
3432
+ ],
3433
+ defaultPalettesConfig: defaultPalettesConfig2
3434
+ }
3559
3435
  });
3560
- var defaultImport35 = __toESM(require("@splunk/react-ui/Paginator"));
3561
- __reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
3562
- var Paginator_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
3563
3436
 
3564
- // esm-externals:@splunk/themes
3565
- var themes_exports = {};
3566
- __export(themes_exports, {
3567
- default: () => themes_default
3437
+ // src/common/editorConfig/DynamicBackgroundColorEditor.js
3438
+ var getDynamicBackgroundColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
3439
+ label: (0, i18n_exports._)("Background color"),
3440
+ option: "backgroundColor",
3441
+ context: "backgroundColorEditorConfig",
3442
+ editor: "editor.dynamicColor",
3443
+ showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.backgroundColor),
3444
+ editorProps: {
3445
+ labelPosition: "top",
3446
+ flyoutTitle: (0, i18n_exports._)("Dynamic coloring: background"),
3447
+ formatters: [
3448
+ {
3449
+ label: (0, i18n_exports._)("Ranges"),
3450
+ value: "rangeValue",
3451
+ defaults: {
3452
+ majorValue: defaultContext2.majorColorConfig,
3453
+ trendValue: defaultContext2.trendColorConfig
3454
+ }
3455
+ },
3456
+ {
3457
+ label: (0, i18n_exports._)("Matches"),
3458
+ value: "matchValue",
3459
+ defaults: {
3460
+ majorValue: defaultContext2.majorColorMatchConfig
3461
+ }
3462
+ }
3463
+ ],
3464
+ dataSelectors: [
3465
+ {
3466
+ label: (0, i18n_exports._)("Major Value"),
3467
+ value: "majorValue"
3468
+ },
3469
+ {
3470
+ label: (0, i18n_exports._)("Trend"),
3471
+ value: "trendValue"
3472
+ }
3473
+ ],
3474
+ defaultPalettesConfig: defaultPalettesConfig2
3475
+ }
3568
3476
  });
3569
- var defaultImport36 = __toESM(require("@splunk/themes"));
3570
- __reExport(themes_exports, require("@splunk/themes"));
3571
- var themes_default = "default" in defaultImport36 ? defaultImport36.default : defaultImport36;
3572
3477
 
3573
- // esm-externals:@splunk/themes/useSplunkTheme
3574
- var useSplunkTheme_exports = {};
3575
- __export(useSplunkTheme_exports, {
3576
- default: () => useSplunkTheme_default
3577
- });
3578
- var defaultImport37 = __toESM(require("@splunk/themes/useSplunkTheme"));
3579
- __reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
3580
- var useSplunkTheme_default = "default" in defaultImport37 ? defaultImport37.default : defaultImport37;
3478
+ // src/common/editorConfig/StaticMajorColorEditor.js
3479
+ var StaticMajorColorEditor = {
3480
+ label: (0, i18n_exports._)("Major value"),
3481
+ option: "majorColor",
3482
+ editor: "editor.color",
3483
+ showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.majorColor)
3484
+ };
3485
+ var StaticMajorColorEditor_default = StaticMajorColorEditor;
3581
3486
 
3582
- // esm-externals:@splunk/visualizations-shared/trellisUtils
3583
- var trellisUtils_exports = {};
3584
- __export(trellisUtils_exports, {
3585
- default: () => trellisUtils_default
3586
- });
3587
- var defaultImport38 = __toESM(require("@splunk/visualizations-shared/trellisUtils"));
3588
- __reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisUtils"));
3589
- var trellisUtils_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
3487
+ // src/common/editorConfig/StaticTrendColorEditor.js
3488
+ var StaticTrendColorEditor = {
3489
+ label: (0, i18n_exports._)("Trend value"),
3490
+ option: "trendColor",
3491
+ editor: "editor.color",
3492
+ showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.trendColor),
3493
+ isDisabled: ({ options }) => options.trendDisplay === "off"
3494
+ };
3495
+ var StaticTrendColorEditor_default = StaticTrendColorEditor;
3590
3496
 
3591
- // src/common/utils/trellisUtils.ts
3592
- var AGGREGATIONS = "aggregations";
3593
- var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
3594
- var _a, _b, _c, _d;
3595
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3596
- const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3597
- let splitDataSources = null;
3598
- let errorCode = null;
3599
- if (fields && fields.length) {
3600
- splitDataSources = {};
3601
- for (let i = 0; i < fields.length; i += 1) {
3602
- const fieldName = fields[i].name;
3603
- if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
3604
- splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
3605
- (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3606
- );
3607
- splitDataSources[fieldName].primary.data.fields = [fields[i]];
3608
- splitDataSources[fieldName].primary.data.columns = [columns[i]];
3609
- }
3497
+ // src/common/editorConfig/StaticBackgroundColorEditor.js
3498
+ var StaticBackgroundColorEditor = {
3499
+ label: (0, i18n_exports._)("Background color"),
3500
+ option: "backgroundColor",
3501
+ editor: "editor.color",
3502
+ showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.backgroundColor)
3503
+ };
3504
+ var StaticBackgroundColorEditor_default = StaticBackgroundColorEditor;
3505
+
3506
+ // src/common/editorConfig/RadialBackgroundColor.ts
3507
+ var radialBackground = ({ label, themes: themes3, labelPosition }) => [
3508
+ {
3509
+ label: (0, i18n_exports._)(label || "Radial background"),
3510
+ option: "radialBackgroundColor",
3511
+ editor: "editor.color",
3512
+ editorProps: {
3513
+ labelPosition: labelPosition || "top",
3514
+ themes: themes3
3610
3515
  }
3611
- } else {
3612
- errorCode = "INVALID_SPLIT_BY_FIELD";
3613
3516
  }
3614
- return { splitDataSources, errorCode };
3517
+ ];
3518
+ var RadialBackgroundColor_default = radialBackground;
3519
+
3520
+ // src/common/editorConfig/TrellisEditors.ts
3521
+ var isTrellisFeatureFlagOn = ({ featureFlags }) => {
3522
+ return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
3615
3523
  };
3616
- var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
3617
- var _a, _b, _c, _d;
3618
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3619
- const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3620
- let splitDataSources = null;
3621
- let splitByFields = [];
3622
- let errorCode = null;
3623
- if (typeof fields[0] !== "string") {
3624
- splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3625
- }
3626
- if (splitByFields && splitByFields.length > 0) {
3627
- splitDataSources = {};
3628
- splitByFields.forEach((splitByField) => {
3629
- splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
3630
- (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3631
- );
3632
- splitDataSources[splitByField].primary.data.fields = [fields[0]];
3633
- splitDataSources[splitByField].primary.data.columns = [columns[0]];
3634
- fields.forEach((field, idx) => {
3635
- const fieldName = field == null ? void 0 : field.name;
3636
- if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
3637
- splitDataSources[splitByField].primary.data.fields.push(field);
3638
- splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
3639
- }
3640
- });
3641
- });
3642
- } else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
3643
- splitDataSources = {};
3644
- for (let i = 1; i < fields.length; i += 1) {
3645
- const fieldName = fields[i].name;
3646
- if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
3647
- splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
3648
- (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3649
- );
3650
- splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
3651
- splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
3524
+ var isTrellisEnabled = ({ options, featureFlags }) => {
3525
+ const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
3526
+ return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
3527
+ };
3528
+ var TrellisEditorConfig = [
3529
+ [
3530
+ {
3531
+ label: (0, i18n_exports._)("Trellis layout"),
3532
+ option: "splitByLayout",
3533
+ editor: "editor.toggle",
3534
+ showEditor: isTrellisFeatureFlagOn
3535
+ }
3536
+ ],
3537
+ [
3538
+ {
3539
+ label: (0, i18n_exports._)("Split by"),
3540
+ option: "trellisSplitBy",
3541
+ editor: "editor.trellisSplitBy",
3542
+ editorProps: {
3543
+ dataSourceKey: "primary"
3544
+ },
3545
+ showEditor: isTrellisEnabled
3546
+ }
3547
+ ],
3548
+ [
3549
+ {
3550
+ label: (0, i18n_exports._)("Number of columns"),
3551
+ option: "trellisColumns",
3552
+ editor: "editor.number",
3553
+ editorProps: {
3554
+ min: 1
3555
+ },
3556
+ placeholder: (0, i18n_exports._)("Auto"),
3557
+ showEditor: isTrellisEnabled
3558
+ }
3559
+ ],
3560
+ [
3561
+ {
3562
+ label: (0, i18n_exports._)("Min column width"),
3563
+ option: "trellisMinColumnWidth",
3564
+ editor: "editor.number",
3565
+ editorProps: {
3566
+ min: 1
3567
+ },
3568
+ showEditor: isTrellisEnabled
3569
+ },
3570
+ {
3571
+ label: (0, i18n_exports._)("Row height"),
3572
+ option: "trellisRowHeight",
3573
+ editor: "editor.number",
3574
+ editorProps: {
3575
+ min: 1
3576
+ },
3577
+ showEditor: isTrellisEnabled
3578
+ }
3579
+ ],
3580
+ [
3581
+ {
3582
+ label: (0, i18n_exports._)("Max number of components per page"),
3583
+ option: "trellisPageCount",
3584
+ editor: "editor.number",
3585
+ editorProps: {
3586
+ min: 1
3587
+ },
3588
+ showEditor: isTrellisEnabled
3589
+ }
3590
+ ]
3591
+ ];
3592
+ var TimechartTrellisEditorConfig = [
3593
+ [
3594
+ {
3595
+ label: (0, i18n_exports._)("Trellis layout"),
3596
+ option: "splitByLayout",
3597
+ editor: "editor.toggle",
3598
+ showEditor: isTrellisFeatureFlagOn,
3599
+ // add help text for timecharts
3600
+ editorProps: {
3601
+ help: (0, i18n_exports._)(
3602
+ "Y2-axis and overlay field configurations are not supported when trellis is enabled."
3603
+ ),
3604
+ helpFormat: "under"
3652
3605
  }
3653
3606
  }
3654
- } else {
3655
- errorCode = "INVALID_SPLIT_BY_FIELD";
3656
- }
3657
- return { splitDataSources, errorCode };
3607
+ ],
3608
+ ...TrellisEditorConfig.slice(1),
3609
+ [
3610
+ {
3611
+ label: (0, i18n_exports._)("Shared y-axis scale"),
3612
+ option: "trellisSharedScale",
3613
+ editor: "editor.checkbox",
3614
+ showEditor: isTrellisEnabled
3615
+ }
3616
+ ]
3617
+ ];
3618
+ var TrellisBackgroundColorEditor = {
3619
+ label: (0, i18n_exports._)("Trellis background"),
3620
+ option: "trellisBackgroundColor",
3621
+ editor: "editor.color",
3622
+ showEditor: isTrellisEnabled
3623
+ };
3624
+
3625
+ // src/SingleValueRadial/config.ts
3626
+ var dataContract = {
3627
+ requiredDataSources: [
3628
+ {
3629
+ name: "primary",
3630
+ description: "DataSource that powers the visualization"
3631
+ }
3632
+ ],
3633
+ optionalDataSources: [],
3634
+ initialRequestParams: {
3635
+ primary: { offset: 0, count: 1e4 }
3636
+ }
3637
+ };
3638
+ var size = {
3639
+ initialWidth: 250,
3640
+ initialHeight: 250
3641
+ };
3642
+ var defaultContext = {
3643
+ majorColorConfig: [
3644
+ { to: 20, value: "#D41F1F" },
3645
+ { from: 20, to: 40, value: "#D94E17" },
3646
+ { from: 40, to: 60, value: "#CBA700" },
3647
+ { from: 60, to: 80, value: "#669922" },
3648
+ { from: 80, value: "#118832" }
3649
+ ],
3650
+ majorColorMatchConfig: [{ match: "", value: "#5C33FF" }],
3651
+ trendColorConfig: [
3652
+ {
3653
+ to: 0,
3654
+ value: "#9E2520"
3655
+ },
3656
+ {
3657
+ from: 0,
3658
+ value: "#1C6B2D"
3659
+ }
3660
+ ],
3661
+ trendValueCopy: "> trendValue",
3662
+ divisor: "> majorValue | subtract(trendValueCopy) | divideBy(100)",
3663
+ trendValuePercent: "> trendValue | divideBy(divisor)"
3658
3664
  };
3659
- var dataSourcesSplitByAggregationsStats = (dataSource) => {
3660
- var _a, _b, _c, _d;
3661
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3662
- const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3663
- let splitDataSources = null;
3664
- let splitByFields = [];
3665
- let errorCode = null;
3666
- if (typeof fields[0] !== "string") {
3667
- splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
3668
- }
3669
- if (splitByFields && splitByFields.length > 0) {
3670
- splitDataSources = {};
3671
- splitByFields.forEach((splitByField) => {
3672
- splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
3673
- (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3674
- );
3675
- splitDataSources[splitByField].primary.data.fields = [fields[0]];
3676
- splitDataSources[splitByField].primary.data.columns = [columns[0]];
3677
- const idx = fields.findIndex((field) => field.name === splitByField);
3678
- if (idx > 0) {
3679
- splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
3680
- splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
3681
- }
3682
- });
3683
- } else {
3684
- errorCode = "INVALID_SPLIT_BY_FIELD";
3685
- }
3686
- return { splitDataSources, errorCode };
3665
+ var basePresetContext = {
3666
+ majorColorEditorConfig: void 0,
3667
+ trendColorEditorConfig: void 0,
3668
+ backgroundColorEditorConfig: void 0
3687
3669
  };
3688
- var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
3689
- var _a, _b, _c, _d, _e;
3690
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3691
- const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3692
- let splitDataSources = null;
3693
- let splitByFields = [];
3694
- let errorCode = null;
3695
- if (typeof fields[0] !== "string") {
3696
- splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3697
- }
3698
- if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3699
- splitDataSources = {};
3700
- const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3701
- const valueKeys = [];
3702
- for (let i = 1; i < fields.length; i += 1) {
3703
- if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
3704
- valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
3705
- }
3670
+ var basePresetOptions = {
3671
+ majorColor: void 0,
3672
+ trendColor: void 0,
3673
+ backgroundColor: void 0
3674
+ };
3675
+ var presets = [
3676
+ {
3677
+ // dummy context variables to allow for resetting of unused context states
3678
+ label: (0, i18n_exports._)("None"),
3679
+ name: "singleValueRadial.none",
3680
+ value: {
3681
+ context: __spreadValues({}, basePresetContext),
3682
+ options: __spreadValues({}, basePresetOptions)
3683
+ }
3684
+ },
3685
+ {
3686
+ label: (0, i18n_exports._)("Major value and gauge"),
3687
+ name: "singleValueRadial.majorValue",
3688
+ value: {
3689
+ context: __spreadProps(__spreadValues({}, basePresetContext), {
3690
+ majorColorEditorConfig: defaultContext.majorColorConfig
3691
+ }),
3692
+ options: __spreadProps(__spreadValues({}, basePresetOptions), {
3693
+ majorColor: "> majorValue | rangeValue(majorColorEditorConfig)"
3694
+ })
3695
+ }
3696
+ },
3697
+ {
3698
+ label: (0, i18n_exports._)("Major value, trend value, and gauge"),
3699
+ name: "singleValueRadial.majorValueAndTrend",
3700
+ value: {
3701
+ context: __spreadProps(__spreadValues({}, basePresetContext), {
3702
+ majorColorEditorConfig: defaultContext.majorColorConfig,
3703
+ trendColorEditorConfig: defaultContext.trendColorConfig
3704
+ }),
3705
+ options: __spreadProps(__spreadValues({}, basePresetOptions), {
3706
+ majorColor: "> majorValue | rangeValue(majorColorEditorConfig)",
3707
+ trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
3708
+ })
3709
+ }
3710
+ },
3711
+ {
3712
+ label: (0, i18n_exports._)("Trend value"),
3713
+ name: "singleValueRadial.trend",
3714
+ value: {
3715
+ context: __spreadProps(__spreadValues({}, basePresetContext), {
3716
+ trendColorEditorConfig: defaultContext.trendColorConfig
3717
+ }),
3718
+ options: __spreadProps(__spreadValues({}, basePresetOptions), {
3719
+ trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
3720
+ })
3721
+ }
3722
+ },
3723
+ {
3724
+ label: (0, i18n_exports._)("Background"),
3725
+ name: "singleValueRadial.background",
3726
+ value: {
3727
+ context: __spreadProps(__spreadValues({}, basePresetContext), {
3728
+ backgroundColorEditorConfig: defaultContext.majorColorConfig
3729
+ }),
3730
+ options: __spreadProps(__spreadValues({}, basePresetOptions), {
3731
+ backgroundColor: "> majorValue | rangeValue(backgroundColorEditorConfig)"
3732
+ })
3706
3733
  }
3707
- valueKeys.forEach((val) => {
3708
- splitDataSources[val] = (0, lodash_exports.cloneDeep)(
3709
- (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3710
- );
3711
- splitDataSources[val].primary.data.fields = [
3712
- { name: fields[0].name },
3713
- ...dataSourceKeys.map((k) => ({
3714
- name: k
3715
- }))
3716
- ];
3717
- splitDataSources[val].primary.data.columns = [[...columns[0]]];
3718
- dataSourceKeys.forEach((dsKey) => {
3719
- fields.forEach((field, idx) => {
3720
- if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
3721
- splitDataSources[val].primary.data.columns.push([...columns[idx]]);
3722
- }
3723
- });
3724
- });
3725
- });
3726
- } else {
3727
- errorCode = "INVALID_SPLIT_BY_FIELD";
3728
3734
  }
3729
- return { splitDataSources, errorCode };
3735
+ ];
3736
+ var themes = {
3737
+ defaultFontColor: (props) => pick_default({
3738
+ enterprise: {
3739
+ dark: variables_default.white(props),
3740
+ light: variables_default.black(props)
3741
+ },
3742
+ prisma: variables_default.contentColorActive(props)
3743
+ })(props),
3744
+ defaultBackgroundColor: (props) => pick_default({
3745
+ enterprise: {
3746
+ dark: variables_default.black(props),
3747
+ light: variables_default.white(props)
3748
+ },
3749
+ prisma: variables_default.backgroundColorSidebar(props)
3750
+ })(props),
3751
+ defaultRadialBackgroundColor: (props) => pick_default({
3752
+ enterprise: {
3753
+ dark: "rgba(255, 255, 255, 0.15)",
3754
+ light: "rgba(0, 0, 0, 0.1)"
3755
+ },
3756
+ prisma: variables_default.interactiveColorBackgroundDisabled(props)
3757
+ })(props)
3730
3758
  };
3731
- var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
3732
- var _a, _b, _c, _d;
3733
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3734
- const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3735
- let splitDataSources = null;
3736
- let splitByFields = [];
3737
- let errorCode = null;
3738
- if (typeof fields[0] !== "string") {
3739
- splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
3740
- }
3741
- if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3742
- splitDataSources = {};
3743
- const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
3744
- const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
3745
- const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
3746
- const nonDataSourceAggregations = [];
3747
- if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
3748
- for (let i = 1; i < fields.length; i += 1) {
3749
- nonDataSourceAggregations.push(fields[i].name);
3750
- }
3751
- }
3752
- if (splitByFieldIdx === 0) {
3753
- const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
3754
- valueKeys.forEach((val, idx) => {
3755
- splitDataSources[val] = (0, lodash_exports.cloneDeep)(
3756
- (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3757
- );
3758
- splitDataSources[val].primary.data.fields = [];
3759
- if (otherSplitBy.length) {
3760
- splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
3761
- }
3762
- if (dataSourceKeys.length) {
3763
- const columnValues = [[]];
3764
- splitDataSources[val].primary.data.fields = [
3765
- ...splitDataSources[val].primary.data.fields,
3766
- ...dataSourceKeys.map((k) => ({
3767
- name: k
3768
- }))
3769
- ];
3770
- dataSourceKeys.forEach(() => {
3771
- columnValues.push([]);
3772
- });
3773
- for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
3774
- columnValues[0].push(
3775
- fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
3776
- );
3777
- dataSourceKeys.forEach((dskey, dsIndx) => {
3778
- const mul = (fields.length - 1) / dataSourceKeys.length;
3779
- columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
3780
- });
3781
- }
3782
- splitDataSources[val].primary.data.columns = columnValues;
3783
- } else if (nonDataSourceAggregations.length) {
3784
- const columnValues = [];
3785
- fields.forEach((aggregationField, fieldIdx) => {
3786
- if (fieldIdx > 0) {
3787
- splitDataSources[val].primary.data.fields.push(aggregationField);
3788
- columnValues.push([columns[fieldIdx][idx]]);
3759
+ var editorConfig = [
3760
+ {
3761
+ label: (0, i18n_exports._)("Data configurations"),
3762
+ layout: [
3763
+ [
3764
+ {
3765
+ label: (0, i18n_exports._)("Value"),
3766
+ editor: "editor.columnSelector",
3767
+ option: "majorValue",
3768
+ context: "valuesContext",
3769
+ editorProps: {
3770
+ dataSourceKey: "primary",
3771
+ prepareValue: (definition) => {
3772
+ const {
3773
+ options: { majorValue: baseSPL }
3774
+ } = definition;
3775
+ return {
3776
+ context: {},
3777
+ options: {
3778
+ majorValue: `${baseSPL} | lastPoint()`,
3779
+ trendValue: `${baseSPL} | delta(-2)`
3780
+ }
3781
+ };
3789
3782
  }
3790
- });
3791
- splitDataSources[val].primary.data.columns = columnValues;
3783
+ },
3784
+ isDisabled: ({ options }) => options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis
3792
3785
  }
3793
- });
3794
- } else {
3795
- const valueKeys = [];
3796
- for (let i = 1; i < fields.length; i += 1) {
3797
- valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
3798
- }
3799
- valueKeys.forEach((val) => {
3800
- splitDataSources[val] = (0, lodash_exports.cloneDeep)(
3801
- (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3802
- );
3803
- splitDataSources[val].primary.data.fields = [
3804
- { name: otherSplitBy[0] },
3805
- ...dataSourceKeys.map((k) => ({
3806
- name: k
3807
- }))
3808
- ];
3809
- splitDataSources[val].primary.data.columns = [[...columns[0]]];
3810
- dataSourceKeys.forEach((dsKey) => {
3811
- fields.forEach((field, idx) => {
3812
- if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
3813
- splitDataSources[val].primary.data.columns.push([...columns[idx]]);
3786
+ ]
3787
+ ]
3788
+ },
3789
+ {
3790
+ label: (0, i18n_exports._)("Data display"),
3791
+ layout: [
3792
+ ...StaticMajorAndTrendLayout_default,
3793
+ [
3794
+ {
3795
+ label: (0, i18n_exports._)("Trend display"),
3796
+ option: "trendDisplay",
3797
+ editor: "editor.select",
3798
+ editorProps: {
3799
+ values: [
3800
+ { label: (0, i18n_exports._)("Percent"), value: "percent" },
3801
+ { label: (0, i18n_exports._)("Absolute"), value: "absolute" },
3802
+ { label: (0, i18n_exports._)("Off"), value: "off" }
3803
+ ]
3804
+ },
3805
+ showEditor: ({ options }) => options.showValue || options.showValue === void 0
3806
+ }
3807
+ ],
3808
+ [
3809
+ {
3810
+ label: (0, i18n_exports._)("Min"),
3811
+ option: "minValue",
3812
+ editor: "editor.number"
3813
+ },
3814
+ {
3815
+ label: (0, i18n_exports._)("Max"),
3816
+ option: "maxValue",
3817
+ editor: "editor.number"
3818
+ }
3819
+ ],
3820
+ ...TrellisEditorConfig
3821
+ ]
3822
+ },
3823
+ {
3824
+ label: (0, i18n_exports._)("Color and style"),
3825
+ layout: [
3826
+ [
3827
+ {
3828
+ label: (0, i18n_exports._)("Dynamic elements"),
3829
+ key: "presetSelector",
3830
+ editor: "editor.presetSelector",
3831
+ editorProps: {
3832
+ presets,
3833
+ value: ({ context, options }) => {
3834
+ const initialPreset = getInitialPreset(context, options, presets);
3835
+ return initialPreset && initialPreset.label || null;
3814
3836
  }
3815
- });
3816
- });
3817
- });
3818
- }
3819
- } else {
3820
- errorCode = "INVALID_SPLIT_BY_FIELD";
3821
- }
3822
- return { splitDataSources, errorCode };
3823
- };
3824
- var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
3825
- var _a, _b, _c, _d, _e, _f;
3826
- const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
3827
- const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
3828
- let splitDataSources = null;
3829
- let splitByFields = [];
3830
- let errorCode = null;
3831
- if (typeof fields[0] !== "string") {
3832
- splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
3833
- }
3834
- const splitByIndex = fields == null ? void 0 : fields.findIndex(
3835
- (field) => field === splitBy || field.name === splitBy
3836
- );
3837
- if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
3838
- const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
3839
- splitDataSources = {};
3840
- splitByColumn.forEach((val, idx) => {
3841
- if (!splitDataSources[val]) {
3842
- splitDataSources[val] = [idx];
3843
- } else {
3844
- splitDataSources[val].push(idx);
3845
- }
3846
- });
3847
- const cloneFields = (0, lodash_exports.cloneDeep)(fields);
3848
- cloneFields.splice(splitByIndex, 1);
3849
- const valueKeys = Object.keys(splitDataSources);
3850
- valueKeys.forEach((val) => {
3851
- const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
3852
- splitDataSources[val] = (0, lodash_exports.cloneDeep)(
3853
- (0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
3854
- );
3855
- splitDataSources[val].primary.data.fields = cloneFields;
3856
- splitDataSources[val].primary.data.columns = [];
3857
- columns.forEach((col, idx) => {
3858
- if (idx !== splitByIndex) {
3859
- const newCol = valIndices.map((valIdx) => col[valIdx]);
3860
- splitDataSources[val].primary.data.columns.push(newCol);
3837
+ }
3861
3838
  }
3862
- });
3863
- });
3864
- } else {
3865
- errorCode = "INVALID_SPLIT_BY_FIELD";
3839
+ ],
3840
+ [
3841
+ __spreadProps(__spreadValues({}, StaticMajorColorEditor_default), {
3842
+ editorProps: {
3843
+ themes
3844
+ }
3845
+ })
3846
+ ],
3847
+ [getDynamicMajorColorAndGaugeEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
3848
+ [
3849
+ __spreadProps(__spreadValues({}, StaticTrendColorEditor_default), {
3850
+ editorProps: {
3851
+ themes
3852
+ }
3853
+ })
3854
+ ],
3855
+ [getDynamicTrendColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
3856
+ [
3857
+ {
3858
+ label: (0, i18n_exports._)("Major value abbreviation"),
3859
+ option: "shouldAbbreviateMajorValue",
3860
+ editor: "editor.checkbox"
3861
+ }
3862
+ ],
3863
+ [
3864
+ {
3865
+ label: (0, i18n_exports._)("Trend value abbreviation"),
3866
+ option: "shouldAbbreviateTrendValue",
3867
+ editor: "editor.checkbox"
3868
+ }
3869
+ ],
3870
+ RadialBackgroundColor_default({ themes }),
3871
+ [
3872
+ __spreadProps(__spreadValues({}, StaticBackgroundColorEditor_default), {
3873
+ editorProps: {
3874
+ themes
3875
+ }
3876
+ })
3877
+ ],
3878
+ [
3879
+ __spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
3880
+ editorProps: {
3881
+ themes
3882
+ }
3883
+ })
3884
+ ],
3885
+ [getDynamicBackgroundColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
3886
+ [
3887
+ {
3888
+ label: (0, i18n_exports._)("Show gauge ranges"),
3889
+ option: "isGaugeOn",
3890
+ editor: "editor.toggle",
3891
+ showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.majorColor)
3892
+ }
3893
+ ]
3894
+ ]
3866
3895
  }
3867
- return { splitDataSources, errorCode };
3868
- };
3869
- var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
3870
- let result = null;
3871
- try {
3872
- if (splitMode === trellisUtils_exports.TIMECHART) {
3873
- result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
3874
- } else if (splitMode === trellisUtils_exports.STATS) {
3875
- result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
3876
- } else if (splitMode === trellisUtils_exports.CHART) {
3877
- result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
3878
- } else if (splitMode === trellisUtils_exports.UNKNOWN) {
3879
- result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
3896
+ ];
3897
+ var config = {
3898
+ /**
3899
+ * unique viz key
3900
+ */
3901
+ key: "splunk.singlevalueradial",
3902
+ /**
3903
+ * viz name
3904
+ */
3905
+ name: (0, i18n_exports._)("Single value radial"),
3906
+ category: "Single Value" /* SINGLE_VALUE */,
3907
+ /**
3908
+ * viz icon
3909
+ */
3910
+ icon: visualization_icons_exports.SingleValueRadial,
3911
+ placeholderIcon: placeholders_exports.SingleValueRadial,
3912
+ dataContract,
3913
+ size,
3914
+ defaultContext,
3915
+ optionsSchema: visualization_schemas_exports.singleValueRadialOptionsSchema,
3916
+ editorConfig,
3917
+ events: {
3918
+ "value.click": {
3919
+ description: "trigger when user clicks major value",
3920
+ payloadKeys: ["majorValue", "trendValue"]
3880
3921
  }
3881
- } catch (ex) {
3882
- console.error("getTrellisDataSourcesBySplitMode ", ex);
3883
- result = { splitDataSources: null, errorCode: "UNKNOWN" };
3884
- }
3885
- return result;
3922
+ },
3923
+ supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "events" /* EVENTS */, "placeholder" /* PLACEHOLDER */, "trellis" /* TRELLIS */],
3924
+ themes
3886
3925
  };
3926
+ var config_default = enhanceConfig(config);
3927
+
3928
+ // esm-externals:@splunk/react-ui/Paginator
3929
+ var Paginator_exports = {};
3930
+ __export(Paginator_exports, {
3931
+ default: () => Paginator_default
3932
+ });
3933
+ var defaultImport38 = __toESM(require("@splunk/react-ui/Paginator"));
3934
+ __reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
3935
+ var Paginator_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
3936
+
3937
+ // esm-externals:@splunk/themes
3938
+ var themes_exports = {};
3939
+ __export(themes_exports, {
3940
+ default: () => themes_default
3941
+ });
3942
+ var defaultImport39 = __toESM(require("@splunk/themes"));
3943
+ __reExport(themes_exports, require("@splunk/themes"));
3944
+ var themes_default = "default" in defaultImport39 ? defaultImport39.default : defaultImport39;
3945
+
3946
+ // esm-externals:@splunk/themes/useSplunkTheme
3947
+ var useSplunkTheme_exports = {};
3948
+ __export(useSplunkTheme_exports, {
3949
+ default: () => useSplunkTheme_default
3950
+ });
3951
+ var defaultImport40 = __toESM(require("@splunk/themes/useSplunkTheme"));
3952
+ __reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
3953
+ var useSplunkTheme_default = "default" in defaultImport40 ? defaultImport40.default : defaultImport40;
3887
3954
 
3888
3955
  // src/common/hocs/withTrellis.tsx
3889
3956
  var TrellisContainer = styled_components_default.div`
@@ -3947,7 +4014,11 @@ var withTrellis = (Viz) => {
3947
4014
  trellisMinColumnWidth,
3948
4015
  trellisRowHeight,
3949
4016
  splitByLayout,
3950
- trellisSplitBy
4017
+ trellisSplitBy,
4018
+ trellisSharedScale,
4019
+ stackMode,
4020
+ yAxisMin,
4021
+ yAxisMax
3951
4022
  } = mergedOptions;
3952
4023
  const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
3953
4024
  const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
@@ -4018,10 +4089,10 @@ var withTrellis = (Viz) => {
4018
4089
  [pageNum, pagedData]
4019
4090
  );
4020
4091
  const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
4021
- const isTrellisFeatureFlagOn = Boolean(
4092
+ const isTrellisFeatureFlagOn2 = Boolean(
4022
4093
  featureFlagContext && featureFlagContext.visualizations_enableTrellis
4023
4094
  );
4024
- if (!isTrellisFeatureFlagOn || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
4095
+ if (!isTrellisFeatureFlagOn2 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
4025
4096
  return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
4026
4097
  }
4027
4098
  if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
@@ -4050,6 +4121,13 @@ var withTrellis = (Viz) => {
4050
4121
  splitByKeys = splitByKeysModified;
4051
4122
  totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
4052
4123
  }
4124
+ const [calculatedMin, calculatedMax] = determineMinMax(
4125
+ modifiedDataSourceBySplitBy,
4126
+ trellisSharedScale,
4127
+ yAxisMin,
4128
+ yAxisMax,
4129
+ stackMode
4130
+ );
4053
4131
  return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
4054
4132
  TrellisContainerGrid,
4055
4133
  {
@@ -4058,7 +4136,7 @@ var withTrellis = (Viz) => {
4058
4136
  colMinWidth,
4059
4137
  rowHeight
4060
4138
  },
4061
- pagedData && pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
4139
+ pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
4062
4140
  "div",
4063
4141
  {
4064
4142
  className: "child",
@@ -4079,7 +4157,10 @@ var withTrellis = (Viz) => {
4079
4157
  trellisKey: splitByKey,
4080
4158
  trellisSplitBy: currTrellisSplitBy,
4081
4159
  dataSources: modifiedDataSourceBySplitBy[splitByKey],
4082
- options,
4160
+ options: __spreadProps(__spreadValues({}, options), {
4161
+ yAxisMin: calculatedMin,
4162
+ yAxisMax: calculatedMax
4163
+ }),
4083
4164
  key: `viz-${idx.toString()}`,
4084
4165
  height: containerHeight,
4085
4166
  width: containerWidth
@@ -4113,11 +4194,16 @@ var computeVizProps = (_a) => {
4113
4194
  var _b = _a, { trellisKey } = _b, props = __objRest(_b, ["trellisKey"]);
4114
4195
  return __spreadValues({ trellisKey }, props);
4115
4196
  };
4197
+ var computeVizPropsBeforeEval = (options) => {
4198
+ const trendColor = getTrendColorWithPercent(options);
4199
+ return __spreadValues({}, trendColor);
4200
+ };
4116
4201
  var viz = withTrellis_default(
4117
4202
  withDashboardViz_default({
4118
4203
  ReactViz: SingleValueRadial_default,
4119
4204
  vizConfig: config_default,
4120
- computeVizProps
4205
+ computeVizProps,
4206
+ computeVizPropsBeforeEval
4121
4207
  })
4122
4208
  );
4123
4209
  var { themes: themes2 } = config_default;