@splunk/visualizations 24.0.0 → 24.3.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 (238) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureFillerGauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureFillerGauge_Too_Small_to_Render.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Background_Color.png +0 -0
  4. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Field_Order.png +0 -0
  5. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Field_Order_First_And_Last.png +0 -0
  6. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Field_Order_Some.png +0 -0
  7. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Fields_Columns.png +0 -0
  8. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Handles_Large_Data_Set.png +0 -0
  9. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Link_Color.png +0 -0
  10. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Link_Width.png +0 -0
  11. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Color.png +0 -0
  12. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Height.png +0 -0
  13. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Highlight_Color.png +0 -0
  14. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Spacing_X.png +0 -0
  15. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Spacing_Y.png +0 -0
  16. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Node_Width.png +0 -0
  17. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Result_Limit.png +0 -0
  18. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Show_Node_Counts_False.png +0 -0
  19. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Show_Value_Counts_False.png +0 -0
  20. package/.loki/reference/chrome_docker_PureVisualizations_PureLinkGraph_Width_Height.png +0 -0
  21. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Dark.png +0 -0
  22. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Hover.png +0 -0
  23. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Light.png +0 -0
  24. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_base_map_light.png +0 -0
  25. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
  26. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_dynamic_color.png +0 -0
  27. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_geostats_by.png +0 -0
  28. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_static_color.png +0 -0
  29. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_static_color_with_no_seriesColors.png +0 -0
  30. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_center_seattle.png +0 -0
  31. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_dynamic_color.png +0 -0
  32. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color.png +0 -0
  33. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color_with_no_seriesColors.png +0 -0
  34. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_off.png +0 -0
  35. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_unit_metric.png +0 -0
  36. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_zoom_9.png +0 -0
  37. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_duplicate_entries_from.png +0 -0
  38. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_duplicate_entries_to.png +0 -0
  39. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_discontinuous_ranges.png +0 -0
  40. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_from_equals_to_to.png +0 -0
  41. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_from_is_larger_than_to.png +0 -0
  42. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_missing_entries.png +0 -0
  43. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Orientation_horizontal_width_150_show_placeholder.png +0 -0
  44. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Too_Small_to_Render.png +0 -0
  45. package/.loki/reference/chrome_docker_PureVisualizations_PureSankey_dimensions_less_than_minWidth_300_and_minHeight_200.png +0 -0
  46. package/.loki/reference/chrome_docker_PureVisualizations_PureSankey_invalid_columns_data.png +0 -0
  47. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  48. package/.loki/reference/chrome_docker_Visualizations_Choropleth_Svg_Choropleth_Svg_Missing_Props_Message_When_No_Svg.png +0 -0
  49. package/.loki/reference/chrome_docker_Visualizations_Filler_Gauge_Filler_Gauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
  50. package/.loki/reference/chrome_docker_Visualizations_Line_Line_Basic_Line_with_offset_IANA_timezone.png +0 -0
  51. package/.loki/reference/chrome_docker_Visualizations_Line_Line_Basic_Line_with_offset_serialized_timezone.png +0 -0
  52. package/.loki/reference/chrome_docker_Visualizations_Line_Line_Basic_Line_with_offset_utc_timezone.png +0 -0
  53. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Basic_LinkGraph.png +0 -0
  54. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Field_Order_First_and_Last_Fields.png +0 -0
  55. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Field_Order_From_the_First_to_the_Last_Fields.png +0 -0
  56. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Field_Order_From_the_Last_to_the_First_Fields.png +0 -0
  57. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Node_Text_Color.png +0 -0
  58. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Node_Text_Highlight_Color.png +0 -0
  59. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_Result_Limit_3.png +0 -0
  60. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Basic_Map.png +0 -0
  61. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer.png +0 -0
  62. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET.png +0 -0
  63. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET_Dynamic_Coloring.png +0 -0
  64. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Static_Coloring.png +0 -0
  65. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_Dynamic_Coloring.png +0 -0
  66. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer.png +0 -0
  67. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Dynamic_coloring.png +0 -0
  68. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Result_Limit_Set_To_3.png +0 -0
  69. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_with_geostats_data_No_render.png +0 -0
  70. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
  71. package/.loki/reference/chrome_docker_Visualizations_Pie_Pie_Missing_Column.png +0 -0
  72. package/.loki/reference/chrome_docker_Visualizations_Sankey_Sankey_Dimension_Too_Small.png +0 -0
  73. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_By_Type_Custom.png +0 -0
  74. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Default.png +0 -0
  75. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Kitchen_Sink.png +0 -0
  76. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Right.png +0 -0
  77. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Single_Column.png +0 -0
  78. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Color_light_blue.png +0 -0
  79. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_No_Stripe.png +0 -0
  80. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Stripe.png +0 -0
  81. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table.png +0 -0
  82. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table_With_No_Click.png +0 -0
  83. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Cell_Types.png +0 -0
  84. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Gradient.png +0 -0
  85. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Override.png +0 -0
  86. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width.png +0 -0
  87. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Count_2.png +0 -0
  88. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Header_Colors.png +0 -0
  89. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Row_Colors.png +0 -0
  90. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Stripe.png +0 -0
  91. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_No_Stripe.png +0 -0
  92. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_Stripe.png +0 -0
  93. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number.png +0 -0
  94. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number_Adv.png +0 -0
  95. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_fixed.png +0 -0
  96. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_none.png +0 -0
  97. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage.png +0 -0
  98. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage_100_no_paginator.png +0 -0
  99. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Invalid_Background_Color.png +0 -0
  100. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Multi_Value_Field.png +0 -0
  101. package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes.png +0 -0
  102. package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes_Row_Numbers.png +0 -0
  103. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_false.png +0 -0
  104. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_true_default.png +0 -0
  105. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Row_Numbers_true.png +0 -0
  106. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline.png +0 -0
  107. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Custom.png +0 -0
  108. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Width.png +0 -0
  109. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparklines_Adv.png +0 -0
  110. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Formatting.png +0 -0
  111. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Gradient.png +0 -0
  112. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Formatting.png +0 -0
  113. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Height.png +0 -0
  114. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Percentage.png +0 -0
  115. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Px.png +0 -0
  116. package/Area.config.js +19 -15
  117. package/Area.config.js.map +1 -1
  118. package/Area.js +102 -82
  119. package/Area.js.map +1 -1
  120. package/Bar.config.js +15 -15
  121. package/Bar.config.js.map +1 -1
  122. package/Bar.js +91 -75
  123. package/Bar.js.map +1 -1
  124. package/Bubble.config.js +8 -8
  125. package/Bubble.config.js.map +1 -1
  126. package/Bubble.js +82 -66
  127. package/Bubble.js.map +1 -1
  128. package/ChoroplethSvg.config.js +11 -9
  129. package/ChoroplethSvg.config.js.map +1 -1
  130. package/ChoroplethSvg.js +92 -82
  131. package/ChoroplethSvg.js.map +1 -1
  132. package/Column.config.js +15 -15
  133. package/Column.config.js.map +1 -1
  134. package/Column.js +91 -75
  135. package/Column.js.map +1 -1
  136. package/Ellipse.config.js +22 -6
  137. package/Ellipse.config.js.map +1 -1
  138. package/Ellipse.js +80 -56
  139. package/Ellipse.js.map +1 -1
  140. package/FillerGauge.config.js +8 -8
  141. package/FillerGauge.config.js.map +1 -1
  142. package/FillerGauge.js +64 -56
  143. package/FillerGauge.js.map +1 -1
  144. package/Image.js +46 -41
  145. package/Image.js.map +1 -1
  146. package/Line.config.js +8 -8
  147. package/Line.config.js.map +1 -1
  148. package/Line.js +89 -73
  149. package/Line.js.map +1 -1
  150. package/LinkGraph.config.js +52 -5
  151. package/LinkGraph.config.js.map +1 -1
  152. package/LinkGraph.js +161 -90
  153. package/LinkGraph.js.map +1 -1
  154. package/Map.config.js +740 -0
  155. package/Map.config.js.map +1 -0
  156. package/Map.js +3137 -0
  157. package/Map.js.map +1 -0
  158. package/Markdown.config.js +12 -16
  159. package/Markdown.config.js.map +1 -1
  160. package/Markdown.js +57 -56
  161. package/Markdown.js.map +1 -1
  162. package/MarkerGauge.config.js +6 -6
  163. package/MarkerGauge.config.js.map +1 -1
  164. package/MarkerGauge.js +2960 -3046
  165. package/MarkerGauge.js.map +1 -1
  166. package/ParallelCoordinates.config.js +11 -11
  167. package/ParallelCoordinates.config.js.map +1 -1
  168. package/ParallelCoordinates.js +97 -78
  169. package/ParallelCoordinates.js.map +1 -1
  170. package/Pie.config.js +13 -17
  171. package/Pie.config.js.map +1 -1
  172. package/Pie.js +917 -999
  173. package/Pie.js.map +1 -1
  174. package/Punchcard.config.js +11 -11
  175. package/Punchcard.config.js.map +1 -1
  176. package/Punchcard.js +114 -95
  177. package/Punchcard.js.map +1 -1
  178. package/README.internal.md +36 -3
  179. package/README.md +7 -9
  180. package/Rectangle.config.js +32 -16
  181. package/Rectangle.config.js.map +1 -1
  182. package/Rectangle.js +153 -132
  183. package/Rectangle.js.map +1 -1
  184. package/Sankey.config.js +35 -25
  185. package/Sankey.config.js.map +1 -1
  186. package/Sankey.js +2951 -3045
  187. package/Sankey.js.map +1 -1
  188. package/Scatter.config.js +11 -11
  189. package/Scatter.config.js.map +1 -1
  190. package/Scatter.js +301 -286
  191. package/Scatter.js.map +1 -1
  192. package/SingleValue.config.js +23 -22
  193. package/SingleValue.config.js.map +1 -1
  194. package/SingleValue.js +271 -266
  195. package/SingleValue.js.map +1 -1
  196. package/SingleValueBasic.js +14 -14
  197. package/SingleValueBasic.js.map +1 -1
  198. package/SingleValueIcon.config.js +33 -34
  199. package/SingleValueIcon.config.js.map +1 -1
  200. package/SingleValueIcon.js +156 -140
  201. package/SingleValueIcon.js.map +1 -1
  202. package/SingleValueRadial.config.js +22 -22
  203. package/SingleValueRadial.config.js.map +1 -1
  204. package/SingleValueRadial.js +301 -296
  205. package/SingleValueRadial.js.map +1 -1
  206. package/Table.config.js +28 -8
  207. package/Table.config.js.map +1 -1
  208. package/Table.js +427 -259
  209. package/Table.js.map +1 -1
  210. package/common/Charting.js +19 -10
  211. package/common/Charting.js.map +1 -1
  212. package/common/EventsDoc.js +3 -2
  213. package/common/EventsDoc.js.map +1 -1
  214. package/common/GaugeMajorTicks.js +2 -2
  215. package/common/GaugeMajorTicks.js.map +1 -1
  216. package/common/GaugeValueMarker.js +2 -2
  217. package/common/GaugeValueMarker.js.map +1 -1
  218. package/common/OptionsDoc.js +10 -9
  219. package/common/OptionsDoc.js.map +1 -1
  220. package/common/OverviewDoc.js +22 -22
  221. package/common/OverviewDoc.js.map +1 -1
  222. package/common/SplunkVisualizationApi.js +2 -2
  223. package/common/SplunkVisualizationApi.js.map +1 -1
  224. package/common/ThemesDoc.js +2 -2
  225. package/common/ThemesDoc.js.map +1 -1
  226. package/common/chartingUtils.js +2 -2
  227. package/common/chartingUtils.js.map +1 -1
  228. package/common/docUtils.js +4 -4
  229. package/common/docUtils.js.map +1 -1
  230. package/common/gaugeUtils.js +7 -7
  231. package/common/gaugeUtils.js.map +1 -1
  232. package/common/shapeUtils.js +8 -8
  233. package/common/shapeUtils.js.map +1 -1
  234. package/common/withDashboardViz.js +38 -32
  235. package/common/withDashboardViz.js.map +1 -1
  236. package/loki.config.js +2 -0
  237. package/package.json +20 -15
  238. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValueRadial_Trend_Indicator_Position_pushed_below_value_does_not_fit_inside_of_radial.png +0 -0
package/Pie.js CHANGED
@@ -87,41 +87,40 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 203);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 217);
91
91
  /******/ })
92
92
  /************************************************************************/
93
- /******/ ([
94
- /* 0 */
93
+ /******/ ({
94
+
95
+ /***/ 0:
95
96
  /***/ (function(module, exports) {
96
97
 
97
98
  module.exports = require("prop-types");
98
99
 
99
100
  /***/ }),
100
- /* 1 */
101
+
102
+ /***/ 1:
101
103
  /***/ (function(module, exports) {
102
104
 
103
105
  module.exports = require("react");
104
106
 
105
107
  /***/ }),
106
- /* 2 */
107
- /***/ (function(module, exports) {
108
-
109
- module.exports = require("lodash");
110
108
 
111
- /***/ }),
112
- /* 3 */
109
+ /***/ 10:
113
110
  /***/ (function(module, exports) {
114
111
 
115
- module.exports = require("@splunk/ui-utils/i18n");
112
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
116
113
 
117
114
  /***/ }),
118
- /* 4 */
115
+
116
+ /***/ 11:
119
117
  /***/ (function(module, exports) {
120
118
 
121
- module.exports = require("styled-components");
119
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
122
120
 
123
121
  /***/ }),
124
- /* 5 */
122
+
123
+ /***/ 12:
125
124
  /***/ (function(module, exports, __webpack_require__) {
126
125
 
127
126
  "use strict";
@@ -130,42 +129,100 @@ module.exports = require("styled-components");
130
129
  Object.defineProperty(exports, "__esModule", {
131
130
  value: true
132
131
  });
133
- exports.VizBehavior = void 0;
134
- var VizBehavior;
135
132
 
136
- (function (VizBehavior) {
137
- /**
138
- * Dynamic Options Behavior.
139
- * This allows visualization options to be powered by data
140
- *
141
- * **Example**
142
- *
143
- * sparklineValues: ">primary|seriesByIndex(0)"
144
- * would configure sparklineValues with an array of data points
145
- * coming from the first series in the primary datasource
146
- *
147
- */
148
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
149
- VizBehavior["EVENTS"] = "events";
150
- /**
151
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
152
- * missing.
153
- * @type {string}
154
- */
133
+ var React = __webpack_require__(1);
155
134
 
156
- VizBehavior["PLACEHOLDER"] = "placeholder";
157
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
158
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
135
+ var styled_components_1 = __webpack_require__(4);
136
+
137
+ var SizeAwareWrapper_1 = __webpack_require__(16);
138
+
139
+ var style_1 = __webpack_require__(13);
140
+
141
+ var colorUtils_1 = __webpack_require__(11);
142
+
143
+ var Item = styled_components_1.default.div.attrs(function (_ref) {
144
+ var width = _ref.width;
145
+ return {
146
+ style: {
147
+ width: style_1.toPx(width)
148
+ }
149
+ };
150
+ }).withConfig({
151
+ displayName: "FixedSizeContainer__Item",
152
+ componentId: "sc-1yhgpod-0"
153
+ })(["position:relative;background-color:", "};"], function (props) {
154
+ return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
155
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
156
+
157
+ var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
158
+ var width = _ref2.width,
159
+ height = _ref2.height;
160
+ return {
161
+ style: Object.assign(Object.assign({}, width && {
162
+ width: style_1.toPx(width)
163
+ }), height && {
164
+ height: style_1.toPx(height)
165
+ })
166
+ };
167
+ }).withConfig({
168
+ displayName: "FixedSizeContainer__FixSizeItem",
169
+ componentId: "sc-1yhgpod-1"
170
+ })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
171
+ return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
172
+ });
173
+ var ItemContent = styled_components_1.default.div.withConfig({
174
+ displayName: "FixedSizeContainer__ItemContent",
175
+ componentId: "sc-1yhgpod-2"
176
+ })(["position:relative;min-height:100px;width:100%;"]);
177
+ var FixSizeItemContent = styled_components_1.default.div.withConfig({
178
+ displayName: "FixedSizeContainer__FixSizeItemContent",
179
+ componentId: "sc-1yhgpod-3"
180
+ })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
181
+
182
+ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
183
+ var FixedSizeContainer = function FixedSizeContainer(props) {
184
+ var width = props.width,
185
+ height = props.height,
186
+ backgroundColor = props.backgroundColor;
187
+
188
+ if (!height) {
189
+ return React.createElement(Item, {
190
+ "data-test": "item",
191
+ width: width,
192
+ backgroundColor: backgroundColor
193
+ }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
194
+ }
195
+
196
+ return React.createElement(FixSizeItem, {
197
+ "data-test": "fix-size-item",
198
+ "data-splunk-visualization-version": "24.3.0 - 1c1ae4b3c",
199
+ width: width,
200
+ height: height,
201
+ backgroundColor: backgroundColor
202
+ }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
203
+ var newWidth = _ref3.width,
204
+ newHeight = _ref3.height;
205
+ return React.createElement(Viz, Object.assign({}, props, {
206
+ width: newWidth,
207
+ height: newHeight
208
+ }));
209
+ })));
210
+ };
211
+
212
+ FixedSizeContainer.displayName = 'withFixedSizeContainer';
213
+ return FixedSizeContainer;
214
+ };
215
+
216
+ exports.default = withFixedSizeContainer;
159
217
 
160
218
  /***/ }),
161
- /* 6 */
219
+
220
+ /***/ 127:
162
221
  /***/ (function(module, exports, __webpack_require__) {
163
222
 
164
223
  "use strict";
165
224
 
166
225
 
167
- var _defineProperty = __webpack_require__(7);
168
-
169
226
  var __rest = this && this.__rest || function (s, e) {
170
227
  var t = {};
171
228
 
@@ -182,270 +239,210 @@ var __rest = this && this.__rest || function (s, e) {
182
239
  Object.defineProperty(exports, "__esModule", {
183
240
  value: true
184
241
  });
185
- exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
242
+ exports.config = exports.themes = exports.computeVizProps = exports.PieInnerSize = void 0;
186
243
 
187
- var lodash_1 = __webpack_require__(2);
244
+ var lodash_1 = __webpack_require__(2); // Charting imports i18n which needs to be run to instantiate window globals in the
245
+ // eslint-disable-next-line import/order
188
246
 
189
- var schemaUtils_1 = __webpack_require__(14);
190
247
 
191
- var VizBehavior_1 = __webpack_require__(5);
248
+ var Charting_1 = __webpack_require__(51);
192
249
 
193
- var dynamicOptionsDSLType = {
194
- type: 'string',
195
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
196
- };
197
- /**
198
- * Helper function to extend an options schema with dynamic options DSL
199
- * @param optionsSchema a visualization's options schema
200
- * @returns an updated options schema that additionally allows strings starting with > for each option
201
- */
250
+ var charting_bundle_1 = __webpack_require__(47);
202
251
 
203
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
204
- var enhancedOptionsSchema = {};
205
- Object.keys(optionsSchema).forEach(function (key) {
206
- var _a = optionsSchema[key],
207
- title = _a.title,
208
- description = _a.description,
209
- readOnly = _a.readOnly,
210
- writeOnly = _a.writeOnly,
211
- examples = _a.examples,
212
- defaultValue = _a.default,
213
- type = _a.type,
214
- properties = _a.properties,
215
- patternProperties = _a.patternProperties,
216
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
252
+ var simpleXMLOptions_1 = __webpack_require__(58);
217
253
 
218
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
219
- title: title
220
- }), description !== undefined && {
221
- description: description
222
- }), readOnly !== undefined && {
223
- readOnly: readOnly
224
- }), writeOnly !== undefined && {
225
- writeOnly: writeOnly
226
- }), examples !== undefined && {
227
- examples: examples
228
- }), defaultValue !== undefined && {
229
- default: defaultValue
254
+ var config_1 = __webpack_require__(218);
255
+
256
+ exports.config = config_1.default;
257
+
258
+ var withDashboardViz_1 = __webpack_require__(27);
259
+
260
+ var pieUtils_1 = __webpack_require__(220);
261
+
262
+ var chartingUtils_1 = __webpack_require__(46);
263
+
264
+ var validOptions = Object.keys(config_1.default.optionsSchema);
265
+ exports.PieInnerSize = 0.7;
266
+
267
+ var computeVizProps = function computeVizProps(_a) {
268
+ var dataSources = _a.dataSources,
269
+ onEventTrigger = _a.onEventTrigger,
270
+ label = _a.label,
271
+ value = _a.value,
272
+ showDonutHole = _a.showDonutHole,
273
+ visualizationApiRef = _a.visualizationApiRef,
274
+ otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "label", "value", "showDonutHole", "visualizationApiRef"]); // options to be passed as props
275
+
276
+
277
+ var computedProps = {
278
+ visualizationApiRef: visualizationApiRef
279
+ };
280
+ var labelField = otherOptions.labelField,
281
+ valueField = otherOptions.valueField,
282
+ hasEventHandlers = otherOptions.hasEventHandlers;
283
+ computedProps.options = lodash_1.chain(otherOptions).pick(validOptions).thru(pieUtils_1.convertToPieSCProperties).thru(function (options) {
284
+ return Object.assign(Object.assign({}, simpleXMLOptions_1.getSimpleXMLOptionsForProps(options)), {
285
+ chart: 'pie'
230
286
  });
287
+ }).value();
288
+ var truncationLimit = computedProps.options['chart.resultTruncationLimit'];
289
+ var primaryData = Object.assign(Object.assign({}, dataSources.primary.data), {
290
+ columns: [label, value]
291
+ });
292
+ primaryData.fields = [{
293
+ name: labelField
294
+ }, {
295
+ name: valueField
296
+ }];
231
297
 
232
- if (type === 'object') {
233
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
234
- type: type
235
- }), properties && {
236
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
237
- });
298
+ if (!value) {
299
+ primaryData.columns = [label, []];
300
+ }
238
301
 
239
- if (patternProperties) {
240
- var enhancedPatternProperties = {};
241
- Object.keys(patternProperties).forEach(function (opt) {
242
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
243
- });
244
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
245
- }
246
- } else {
247
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
248
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
249
- type: type
250
- }), remainingSchemaEntry), dynamicOptionsDSLType]
251
- });
302
+ primaryData.columns.forEach(function (column, index) {
303
+ if (column) {
304
+ primaryData.columns[index] = column.map(String);
252
305
  }
253
306
  });
254
- return enhancedOptionsSchema;
255
- }
256
307
 
257
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
258
- /**
259
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
260
- * @param vizConfig a Visualization Config
261
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
262
- */
308
+ if (truncationLimit) {
309
+ primaryData = chartingUtils_1.truncateData(primaryData, truncationLimit);
310
+ }
263
311
 
264
- function enhanceConfig(vizConfig) {
265
- var enhancedConfig = vizConfig;
312
+ computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign({}, primaryData));
266
313
 
267
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
268
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
314
+ if (showDonutHole) {
315
+ computedProps.options['chart.pieInnerSize'] = exports.PieInnerSize;
316
+ } else {
317
+ computedProps.options['chart.pieInnerSize'] = 0;
269
318
  }
270
319
 
271
- return enhancedConfig;
272
- }
320
+ if (hasEventHandlers) {
321
+ computedProps.onClick = onEventTrigger;
322
+ }
273
323
 
274
- exports.enhanceConfig = enhanceConfig;
324
+ return computedProps;
325
+ };
275
326
 
276
- function isDynamicOption(option) {
277
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
278
- }
327
+ exports.computeVizProps = computeVizProps;
328
+ var Pie = withDashboardViz_1.default({
329
+ ReactViz: Charting_1.default,
330
+ computeVizProps: exports.computeVizProps,
331
+ vizConfig: config_1.default
332
+ });
333
+ var themes = null;
334
+ exports.themes = themes;
335
+ exports.default = Pie;
279
336
 
280
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
281
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
337
+ /***/ }),
282
338
 
283
- /**
284
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
285
- * if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
286
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
287
- * the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
288
- *
289
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
290
- */
339
+ /***/ 13:
340
+ /***/ (function(module, exports) {
291
341
 
292
- function hasCompatibleContexts(vizContext, presetContext) {
293
- var presetContextKeys = Object.keys(presetContext);
294
- return presetContextKeys.every(function (contextKey) {
295
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
296
- });
297
- }
298
- /**
299
- * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
300
- */
342
+ module.exports = require("@splunk/visualizations-shared/style");
301
343
 
344
+ /***/ }),
302
345
 
303
- function hasCompatibleOptions(vizOptions, presetOptions) {
304
- var presetOptionKeys = Object.keys(presetOptions);
305
- return presetOptionKeys.every(function (optionKey) {
306
- return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
307
- });
308
- }
309
- /**
310
- * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
311
- * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
312
- *
313
- * @param {Object} vizContext - the current vizContext definition
314
- * @param {Object} vizOptions - the current vizOptions definition
315
- * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
316
- */
346
+ /***/ 14:
347
+ /***/ (function(module, exports) {
317
348
 
349
+ module.exports = require("@splunk/visualizations-shared/schemaUtils");
318
350
 
319
- function getInitialPreset(vizContext, vizOptions, presets) {
320
- return presets.find(function (preset) {
321
- var presetContext = lodash_1.get(preset, ['value', 'context'], {});
322
- var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
323
- var presetContextKeys = Object.keys(presetContext);
324
- var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
325
- // if not, then the preset is invalid in config.ts
351
+ /***/ }),
326
352
 
327
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
328
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
329
- });
330
- }
353
+ /***/ 15:
354
+ /***/ (function(module, exports) {
331
355
 
332
- exports.getInitialPreset = getInitialPreset;
333
- /**
334
- * generates number precision values for a Select editor
335
- *
336
- * @param {Number} numPrecisionValues - number of integer precision values to generate
337
- * @returns {{ label: string; value; string }[]} array of { label, value } tuples
338
- */
356
+ module.exports = require("@babel/runtime/helpers/createClass");
339
357
 
340
- function generatePrecisionValues(numPrecisionValues) {
341
- return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
342
- return {
343
- label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
344
- value: i
345
- };
346
- });
347
- }
358
+ /***/ }),
348
359
 
349
- exports.generatePrecisionValues = generatePrecisionValues;
360
+ /***/ 16:
361
+ /***/ (function(module, exports) {
362
+
363
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
350
364
 
351
365
  /***/ }),
352
- /* 7 */
366
+
367
+ /***/ 18:
353
368
  /***/ (function(module, exports) {
354
369
 
355
- module.exports = require("@babel/runtime/helpers/defineProperty");
370
+ module.exports = require("@splunk/visualizations-shared/propUtils");
356
371
 
357
372
  /***/ }),
358
- /* 8 */
359
- /***/ (function(module, exports, __webpack_require__) {
360
373
 
361
- "use strict";
374
+ /***/ 19:
375
+ /***/ (function(module, exports) {
362
376
 
377
+ module.exports = require("@splunk/themes/variables");
363
378
 
364
- var _typeof = __webpack_require__(22);
379
+ /***/ }),
365
380
 
366
- Object.defineProperty(exports, "__esModule", {
367
- value: true
368
- });
369
- exports.deepMergeWithArrayOverrides = exports.extendStaticWrapperProps = void 0;
381
+ /***/ 2:
382
+ /***/ (function(module, exports) {
370
383
 
371
- var lodash_1 = __webpack_require__(2);
372
- /**
373
- * @method extendStaticWrapperProps
374
- * @param {Object} props
375
- * @param {DashboardVizType} props.Wrapper
376
- * @param {DashboardVizType} props.Visualization
377
- */
384
+ module.exports = require("lodash");
378
385
 
386
+ /***/ }),
379
387
 
380
- var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
381
- var Wrapper = _ref.Wrapper,
382
- Visualization = _ref.Visualization;
383
- var extendProperties = ['propTypes', 'defaultProps', 'config'];
384
- extendProperties.forEach(function (prop) {
385
- if (Visualization[prop]) {
386
- // eslint-disable-next-line no-param-reassign
387
- Wrapper[prop] = Visualization[prop];
388
- }
389
- });
390
- };
388
+ /***/ 20:
389
+ /***/ (function(module, exports) {
391
390
 
392
- exports.extendStaticWrapperProps = extendStaticWrapperProps;
393
- /**
394
- * helper to deeply merge objects while preserving arrays in earlier source objects
395
- * deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays will be preserved if already present in the resultant merged object
396
- * this prevents default arrays from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one)
397
- *
398
- * @method deepMergeWithArrayOverrides
399
- * @param {Object} initial - target object to merge values into
400
- * @param {Object[]} sources - other default options to be merged into the resultant object if no explicit value is provided, with earlier args taking precedence over later ones
401
- *
402
- * @returns {Object}
403
- */
391
+ module.exports = require("@babel/runtime/helpers/typeof");
404
392
 
405
- var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial) {
406
- var clone = lodash_1.cloneDeep(initial);
393
+ /***/ }),
407
394
 
408
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
409
- sources[_key - 1] = arguments[_key];
410
- }
395
+ /***/ 21:
396
+ /***/ (function(module, exports) {
411
397
 
412
- sources.forEach(function (sourceToApply) {
413
- Object.keys(sourceToApply).forEach(function (sourceKey) {
414
- if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
415
- clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
416
- } // object merging excluding arrays
398
+ module.exports = require("@splunk/themes/pick");
417
399
 
400
+ /***/ }),
418
401
 
419
- if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
420
- clone[sourceKey] = exports.deepMergeWithArrayOverrides(clone[sourceKey], sourceToApply[sourceKey]);
421
- }
422
- });
423
- });
424
- return clone;
425
- };
402
+ /***/ 217:
403
+ /***/ (function(module, exports, __webpack_require__) {
426
404
 
427
- exports.deepMergeWithArrayOverrides = deepMergeWithArrayOverrides;
405
+ "use strict";
428
406
 
429
- /***/ }),
430
- /* 9 */
431
- /***/ (function(module, exports) {
432
407
 
433
- module.exports = require("@splunk/visualizations-shared/Message");
408
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
409
+ if (k2 === undefined) k2 = k;
410
+ Object.defineProperty(o, k2, {
411
+ enumerable: true,
412
+ get: function get() {
413
+ return m[k];
414
+ }
415
+ });
416
+ } : function (o, m, k, k2) {
417
+ if (k2 === undefined) k2 = k;
418
+ o[k2] = m[k];
419
+ });
434
420
 
435
- /***/ }),
436
- /* 10 */
437
- /***/ (function(module, exports) {
421
+ var __exportStar = this && this.__exportStar || function (m, exports) {
422
+ for (var p in m) {
423
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
424
+ }
425
+ };
438
426
 
439
- module.exports = require("@babel/runtime/helpers/classCallCheck");
427
+ Object.defineProperty(exports, "__esModule", {
428
+ value: true
429
+ });
430
+ exports.default = void 0;
440
431
 
441
- /***/ }),
442
- /* 11 */
443
- /***/ (function(module, exports) {
432
+ __exportStar(__webpack_require__(127), exports);
444
433
 
445
- module.exports = require("@splunk/visualizations-shared/colorUtils");
434
+ var Pie_1 = __webpack_require__(127);
435
+
436
+ Object.defineProperty(exports, "default", {
437
+ enumerable: true,
438
+ get: function get() {
439
+ return Pie_1.default;
440
+ }
441
+ });
446
442
 
447
443
  /***/ }),
448
- /* 12 */
444
+
445
+ /***/ 218:
449
446
  /***/ (function(module, exports, __webpack_require__) {
450
447
 
451
448
  "use strict";
@@ -455,155 +452,360 @@ Object.defineProperty(exports, "__esModule", {
455
452
  value: true
456
453
  });
457
454
 
458
- var React = __webpack_require__(1);
455
+ var ChartPie_1 = __webpack_require__(219);
459
456
 
460
- var styled_components_1 = __webpack_require__(4);
457
+ var i18n_1 = __webpack_require__(3);
461
458
 
462
- var SizeAwareWrapper_1 = __webpack_require__(17);
459
+ var schemaUtils_1 = __webpack_require__(14);
463
460
 
464
- var style_1 = __webpack_require__(13);
461
+ var visualization_color_palettes_1 = __webpack_require__(41);
465
462
 
466
- var colorUtils_1 = __webpack_require__(11);
463
+ var pick_1 = __webpack_require__(21);
467
464
 
468
- var Item = styled_components_1.default.div.attrs(function (_ref) {
469
- var width = _ref.width;
470
- return {
471
- style: {
472
- width: style_1.toPx(width)
473
- }
474
- };
475
- }).withConfig({
476
- displayName: "FixedSizeContainer__Item",
477
- componentId: "sc-1yhgpod-0"
478
- })(["position:relative;background-color:", "};"], function (props) {
479
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
480
- }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
465
+ var variables_1 = __webpack_require__(19);
481
466
 
482
- var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
483
- var width = _ref2.width,
484
- height = _ref2.height;
485
- return {
486
- style: Object.assign(Object.assign({}, width && {
487
- width: style_1.toPx(width)
488
- }), height && {
489
- height: style_1.toPx(height)
490
- })
491
- };
492
- }).withConfig({
493
- displayName: "FixedSizeContainer__FixSizeItem",
494
- componentId: "sc-1yhgpod-1"
495
- })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
496
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
497
- });
498
- var ItemContent = styled_components_1.default.div.withConfig({
499
- displayName: "FixedSizeContainer__ItemContent",
500
- componentId: "sc-1yhgpod-2"
501
- })(["position:relative;min-height:100px;width:100%;"]);
502
- var FixSizeItemContent = styled_components_1.default.div.withConfig({
503
- displayName: "FixedSizeContainer__FixSizeItemContent",
504
- componentId: "sc-1yhgpod-3"
505
- })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
467
+ var VizBehavior_1 = __webpack_require__(5);
506
468
 
507
- var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
508
- var FixedSizeContainer = function FixedSizeContainer(props) {
509
- var width = props.width,
510
- height = props.height,
511
- backgroundColor = props.backgroundColor;
469
+ var VizCategory_1 = __webpack_require__(26);
512
470
 
513
- if (!height) {
514
- return React.createElement(Item, {
515
- "data-test": "item",
516
- width: width,
517
- backgroundColor: backgroundColor
518
- }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
519
- }
471
+ var configUtils_1 = __webpack_require__(6);
520
472
 
521
- return React.createElement(FixSizeItem, {
522
- "data-test": "fix-size-item",
523
- width: width,
524
- height: height,
525
- backgroundColor: backgroundColor
526
- }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
527
- var newWidth = _ref3.width,
528
- newHeight = _ref3.height;
529
- return React.createElement(Viz, Object.assign({}, props, {
530
- width: newWidth,
531
- height: newHeight
532
- }));
533
- })));
534
- };
473
+ var BackgroundColor_1 = __webpack_require__(45);
535
474
 
536
- FixedSizeContainer.displayName = 'withFixedSizeContainer';
537
- return FixedSizeContainer;
475
+ var dataContract = {
476
+ requiredDataSources: [{
477
+ name: 'primary',
478
+ description: 'DataSource that powers the visualization'
479
+ }],
480
+ optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
481
+ // {
482
+ // name: 'annotation',
483
+ // description: 'DataSource that populate event annotations',
484
+ // },
485
+ ],
486
+ initialRequestParams: {
487
+ primary: {
488
+ offset: 0,
489
+ count: 10000
490
+ }
491
+ }
538
492
  };
493
+ var size = {
494
+ initialWidth: 300,
495
+ initialHeight: 300
496
+ };
497
+ var defaultContext = {};
498
+ var optionsSchema = {
499
+ backgroundColor: {
500
+ default: '> themes.defaultBackgroundColor',
501
+ description: 'Specify the color for the background. You may use a dataSource to apply the color. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
502
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN,
503
+ type: 'string'
504
+ },
505
+ collapseLabel: {
506
+ description: 'Specify the label for the consolidated slice.',
507
+ type: 'string',
508
+ default: 'other'
509
+ },
510
+ collapseThreshold: {
511
+ description: 'Specify the size threshold as a number between 0 and 1 (inclusive), of the whole pie at which slices collapse into one consolidated slice.',
512
+ type: 'number',
513
+ default: 0.01
514
+ },
515
+ label: {
516
+ description: 'List of string values to display the pie chart labels.',
517
+ type: 'array',
518
+ items: {
519
+ type: 'string'
520
+ },
521
+ default: '> primary | seriesByIndex(0)'
522
+ },
523
+ labelField: {
524
+ default: '> label | getField()',
525
+ description: 'Specify the field that corresponds to the labels.',
526
+ type: 'string'
527
+ },
528
+ labelDisplay: {
529
+ description: 'Specify whether to display the labels and/or slice percentages.',
530
+ type: 'string',
531
+ pattern: schemaUtils_1.getPattern(['values', 'valuesAndPercentage', 'off']),
532
+ default: 'values'
533
+ },
534
+ resultLimit: {
535
+ default: 50000,
536
+ description: 'Specify the number of data points rendered in a chart.',
537
+ type: 'number'
538
+ },
539
+ seriesColors: {
540
+ default: visualization_color_palettes_1.VIZ_CATEGORICAL,
541
+ description: 'Specify the colors used for a series. For example, ["#FF0000", "#0000FF", "#008000"].',
542
+ type: 'array',
543
+ items: {
544
+ type: 'string'
545
+ }
546
+ },
547
+ seriesColorsByField: {
548
+ description: 'Specify the colors used for specific pie slice labels. For example: {"April": "#008000", "May": "#FFA500"}.',
549
+ type: 'object'
550
+ },
551
+ showDonutHole: {
552
+ default: false,
553
+ description: 'Specify whether the pie should be a donut.',
554
+ type: 'boolean'
555
+ },
556
+ value: {
557
+ description: 'List of numerical values to power the pie chart.',
558
+ type: 'array',
559
+ items: {
560
+ type: 'number'
561
+ },
562
+ default: '> primary | seriesByIndex(1)'
563
+ },
564
+ valueField: {
565
+ default: '> value | getField()',
566
+ description: 'Specify the field that corresponds to the data powering values.',
567
+ type: 'string'
568
+ }
569
+ };
570
+ var themes = {
571
+ defaultBackgroundColor: function defaultBackgroundColor(props) {
572
+ return pick_1.default({
573
+ enterprise: {
574
+ dark: variables_1.default.black(props),
575
+ light: variables_1.default.backgroundColor(props)
576
+ },
577
+ prisma: variables_1.default.backgroundColorSidebar(props)
578
+ })(props);
579
+ }
580
+ };
581
+ var editorConfig = [{
582
+ label: i18n_1._('General'),
583
+ layout: [BackgroundColor_1.default({
584
+ themes: themes
585
+ })]
586
+ }, {
587
+ label: i18n_1._('Appearance'),
588
+ open: true,
589
+ layout: [[{
590
+ label: i18n_1._(''),
591
+ option: 'showDonutHole',
592
+ editor: 'editor.radioBar',
593
+ editorProps: {
594
+ values: [{
595
+ label: i18n_1._('Pie'),
596
+ value: false
597
+ }, {
598
+ label: i18n_1._('Donut'),
599
+ value: true
600
+ }]
601
+ }
602
+ }]]
603
+ }, {
604
+ label: i18n_1._('Labels'),
605
+ layout: [[{
606
+ label: '',
607
+ option: 'labelDisplay',
608
+ editor: 'editor.radioBar',
609
+ editorProps: {
610
+ values: [{
611
+ label: i18n_1._('Values'),
612
+ value: 'values'
613
+ }, {
614
+ label: i18n_1._('Values & Percent'),
615
+ value: 'valuesAndPercentage'
616
+ }, {
617
+ label: i18n_1._('Off'),
618
+ value: 'off'
619
+ }]
620
+ }
621
+ }]]
622
+ }, {
623
+ label: i18n_1._('Collapse to Summary'),
624
+ layout: [[{
625
+ label: i18n_1._('Collapse Threshold'),
626
+ option: 'collapseThreshold',
627
+ editor: 'editor.number',
628
+ editorProps: {
629
+ min: 0,
630
+ max: 1,
631
+ step: 0.01
632
+ }
633
+ }], [{
634
+ label: i18n_1._('Collapsed Slice Label'),
635
+ option: 'collapseLabel',
636
+ editor: 'editor.text'
637
+ }]]
638
+ }];
639
+ /**
640
+ * visualization configuration
641
+ */
539
642
 
540
- exports.default = withFixedSizeContainer;
541
-
542
- /***/ }),
543
- /* 13 */
544
- /***/ (function(module, exports) {
545
-
546
- module.exports = require("@splunk/visualizations-shared/style");
547
-
548
- /***/ }),
549
- /* 14 */
550
- /***/ (function(module, exports) {
551
-
552
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
553
-
554
- /***/ }),
555
- /* 15 */,
556
- /* 16 */
557
- /***/ (function(module, exports) {
558
-
559
- module.exports = require("@babel/runtime/helpers/createClass");
560
-
561
- /***/ }),
562
- /* 17 */
563
- /***/ (function(module, exports) {
564
-
565
- module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
643
+ var config = {
644
+ /**
645
+ * unique viz key
646
+ */
647
+ key: 'splunk.pie',
566
648
 
567
- /***/ }),
568
- /* 18 */
569
- /***/ (function(module, exports) {
649
+ /**
650
+ * viz name
651
+ */
652
+ name: 'Pie',
653
+ category: VizCategory_1.VizCategory.COMPARISONS,
570
654
 
571
- module.exports = require("@splunk/visualizations-shared/propUtils");
655
+ /**
656
+ * viz icon
657
+ */
658
+ icon: ChartPie_1.default,
659
+ dataContract: dataContract,
660
+ size: size,
661
+ defaultContext: defaultContext,
662
+ optionsSchema: optionsSchema,
663
+ editorConfig: editorConfig,
664
+ events: {
665
+ 'point.click': {
666
+ description: 'triggered when user clicks on a point in the pie chart'
667
+ }
668
+ },
669
+ supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
670
+ themes: themes
671
+ };
672
+ exports.default = configUtils_1.enhanceConfig(config);
572
673
 
573
674
  /***/ }),
574
- /* 19 */
575
- /***/ (function(module, exports) {
576
-
577
- module.exports = require("@splunk/themes/variables");
578
675
 
579
- /***/ }),
580
- /* 20 */
676
+ /***/ 219:
581
677
  /***/ (function(module, exports) {
582
678
 
583
- module.exports = require("@splunk/themes/pick");
679
+ module.exports = require("@splunk/react-icons/ChartPie");
584
680
 
585
681
  /***/ }),
586
- /* 21 */,
587
- /* 22 */
588
- /***/ (function(module, exports) {
589
-
590
- module.exports = require("@babel/runtime/helpers/typeof");
591
682
 
592
- /***/ }),
593
- /* 23 */
683
+ /***/ 220:
594
684
  /***/ (function(module, exports, __webpack_require__) {
595
685
 
596
686
  "use strict";
597
687
 
598
688
 
599
- var _defineProperty = __webpack_require__(7);
689
+ var __rest = this && this.__rest || function (s, e) {
690
+ var t = {};
691
+
692
+ for (var p in s) {
693
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
694
+ }
695
+
696
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
697
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
698
+ }
699
+ return t;
700
+ };
600
701
 
601
702
  Object.defineProperty(exports, "__esModule", {
602
703
  value: true
603
704
  });
604
- exports.getSortingParams = exports.SortParamsPropTypes = void 0;
605
-
606
- var T = __webpack_require__(0);
705
+ exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
706
+
707
+ var lodash_1 = __webpack_require__(2);
708
+
709
+ var propUtils_1 = __webpack_require__(18); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
710
+ // map for key names which are either new or not present in SimpleXML options mapping
711
+
712
+
713
+ var pieOptionsSCMapping = {
714
+ resultLimit: 'resultTruncationLimit',
715
+ seriesColorsByField: 'fieldColors',
716
+ collapseThreshold: 'chart.sliceCollapsingThreshold',
717
+ collapseLabel: 'chart.sliceCollapsingLabel'
718
+ };
719
+ /**
720
+ * Helper method to convert option which contains object literal values (e.g. arrays, objects)
721
+ * to strings as SC can only accept their stringified equivalents
722
+ * @method convertToStringValues
723
+ * @param {Object} options
724
+ * @returns {Object}
725
+ */
726
+
727
+ var convertToStringValues = function convertToStringValues(options) {
728
+ var updatedOptions = propUtils_1.convertPropsToString({
729
+ vizProps: options,
730
+ propNames: ['seriesColors', 'fieldColors']
731
+ });
732
+ return Object.assign(Object.assign({}, options), updatedOptions);
733
+ };
734
+
735
+ exports.convertToStringValues = convertToStringValues;
736
+ /**
737
+ * Helper method to map labelDisplay options to jsCharting options
738
+ * @method mapLabelDisplay
739
+ * @param {Object} options
740
+ * @returns {Object}
741
+ */
742
+
743
+ var mapLabelDisplay = function mapLabelDisplay(_a) {
744
+ var labelDisplay = _a.labelDisplay,
745
+ options = __rest(_a, ["labelDisplay"]);
746
+
747
+ var convertedOptions = Object.assign(Object.assign({}, options), {
748
+ // default for labelDisplay option is 'values'
749
+ 'chart.showLabels': true,
750
+ 'chart.showPercent': false
751
+ });
752
+
753
+ if (labelDisplay === 'valuesAndPercentage') {
754
+ convertedOptions['chart.showPercent'] = true;
755
+ } else if (labelDisplay === 'off') {
756
+ convertedOptions['chart.showLabels'] = false;
757
+ }
758
+
759
+ return convertedOptions;
760
+ };
761
+
762
+ exports.mapLabelDisplay = mapLabelDisplay;
763
+ /**
764
+ * Helper method to update the option names which can be mapped to SimpleXML options or
765
+ * can be used directly with SC if don't have a 1-1 mapping in SimpleXML
766
+ * @method mapToOldKey
767
+ * @param {Object} options
768
+ * @returns {Object}
769
+ */
770
+
771
+ var mapToOldKey = function mapToOldKey(options) {
772
+ return lodash_1.mapKeys(options, function (val, key) {
773
+ return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
774
+ });
775
+ };
776
+
777
+ exports.mapToOldKey = mapToOldKey;
778
+ /**
779
+ * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
780
+ * This is for options that has new key name and can not directly be mapped with SimpleXML or
781
+ * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
782
+ * @method convertToPieSCProperties
783
+ * @param {Object} originalOptions
784
+ * @returns {Object}
785
+ */
786
+
787
+ var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
788
+ return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
789
+ };
790
+
791
+ exports.convertToPieSCProperties = convertToPieSCProperties;
792
+
793
+ /***/ }),
794
+
795
+ /***/ 23:
796
+ /***/ (function(module, exports, __webpack_require__) {
797
+
798
+ "use strict";
799
+
800
+
801
+ var _defineProperty = __webpack_require__(8);
802
+
803
+ Object.defineProperty(exports, "__esModule", {
804
+ value: true
805
+ });
806
+ exports.getSortingParams = exports.SortParamsPropTypes = void 0;
807
+
808
+ var T = __webpack_require__(0);
607
809
 
608
810
  var lodash_1 = __webpack_require__(2);
609
811
 
@@ -660,7 +862,8 @@ var getSortingParams = function getSortingParams(_ref) {
660
862
  exports.getSortingParams = getSortingParams;
661
863
 
662
864
  /***/ }),
663
- /* 24 */
865
+
866
+ /***/ 24:
664
867
  /***/ (function(module, exports, __webpack_require__) {
665
868
 
666
869
  "use strict";
@@ -724,7 +927,8 @@ var getPaginationParams = function getPaginationParams(_ref) {
724
927
  exports.getPaginationParams = getPaginationParams;
725
928
 
726
929
  /***/ }),
727
- /* 25 */
930
+
931
+ /***/ 25:
728
932
  /***/ (function(module, exports, __webpack_require__) {
729
933
 
730
934
  "use strict";
@@ -812,7 +1016,8 @@ IconPlaceholder.defaultProps = {
812
1016
  exports.default = FixedSizeContainer_1.default(IconPlaceholder);
813
1017
 
814
1018
  /***/ }),
815
- /* 26 */
1019
+
1020
+ /***/ 26:
816
1021
  /***/ (function(module, exports, __webpack_require__) {
817
1022
 
818
1023
  "use strict";
@@ -840,7 +1045,8 @@ var VizCategory;
840
1045
  })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
841
1046
 
842
1047
  /***/ }),
843
- /* 27 */
1048
+
1049
+ /***/ 27:
844
1050
  /***/ (function(module, exports, __webpack_require__) {
845
1051
 
846
1052
  "use strict";
@@ -880,7 +1086,7 @@ var withEditModeCover_1 = __webpack_require__(37);
880
1086
 
881
1087
  var withPlaceholder_1 = __webpack_require__(38);
882
1088
 
883
- var hocUtils_1 = __webpack_require__(8);
1089
+ var hocUtils_1 = __webpack_require__(7);
884
1090
  /**
885
1091
  * hoc that wraps a pure react visualization in a Dashboard visualization
886
1092
  * @param {DashboardVizOpts} opts
@@ -893,6 +1099,7 @@ var withDashboardViz = function withDashboardViz(opts) {
893
1099
  vizConfig = opts.vizConfig,
894
1100
  _opts$computeVizProps = opts.computeVizProps,
895
1101
  computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
1102
+ disableEditModeCover = opts.disableEditModeCover,
896
1103
  useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
897
1104
 
898
1105
  var SanitizedReactViz = SanitizeProps_1.withSanitizedProps(ReactViz);
@@ -1057,31 +1264,42 @@ var withDashboardViz = function withDashboardViz(opts) {
1057
1264
 
1058
1265
  DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1059
1266
 
1060
- return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz), useIconPlaceholder));
1267
+ return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
1061
1268
  };
1062
1269
 
1063
1270
  exports.default = withDashboardViz;
1064
1271
 
1065
1272
  /***/ }),
1066
- /* 28 */
1273
+
1274
+ /***/ 28:
1067
1275
  /***/ (function(module, exports) {
1068
1276
 
1069
1277
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1070
1278
 
1071
1279
  /***/ }),
1072
- /* 29 */
1280
+
1281
+ /***/ 29:
1073
1282
  /***/ (function(module, exports) {
1074
1283
 
1075
1284
  module.exports = require("@splunk/visualization-encoding/Options");
1076
1285
 
1077
1286
  /***/ }),
1078
- /* 30 */
1287
+
1288
+ /***/ 3:
1289
+ /***/ (function(module, exports) {
1290
+
1291
+ module.exports = require("@splunk/ui-utils/i18n");
1292
+
1293
+ /***/ }),
1294
+
1295
+ /***/ 30:
1079
1296
  /***/ (function(module, exports) {
1080
1297
 
1081
1298
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1082
1299
 
1083
1300
  /***/ }),
1084
- /* 31 */
1301
+
1302
+ /***/ 31:
1085
1303
  /***/ (function(module, exports, __webpack_require__) {
1086
1304
 
1087
1305
  "use strict";
@@ -1232,7 +1450,8 @@ SplunkVisualization.defaultProps = {
1232
1450
  exports.default = SplunkVisualization;
1233
1451
 
1234
1452
  /***/ }),
1235
- /* 32 */
1453
+
1454
+ /***/ 32:
1236
1455
  /***/ (function(module, exports, __webpack_require__) {
1237
1456
 
1238
1457
  "use strict";
@@ -1240,7 +1459,7 @@ exports.default = SplunkVisualization;
1240
1459
 
1241
1460
  var _classCallCheck = __webpack_require__(10);
1242
1461
 
1243
- var _createClass = __webpack_require__(16);
1462
+ var _createClass = __webpack_require__(15);
1244
1463
 
1245
1464
  Object.defineProperty(exports, "__esModule", {
1246
1465
  value: true
@@ -1269,7 +1488,8 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
1269
1488
  exports.DefaultVizActionHandler = DefaultVizActionHandler;
1270
1489
 
1271
1490
  /***/ }),
1272
- /* 33 */
1491
+
1492
+ /***/ 33:
1273
1493
  /***/ (function(module, exports, __webpack_require__) {
1274
1494
 
1275
1495
  "use strict";
@@ -1282,7 +1502,8 @@ exports.validSortDirs = void 0;
1282
1502
  exports.validSortDirs = ['asc', 'desc', 'none'];
1283
1503
 
1284
1504
  /***/ }),
1285
- /* 34 */
1505
+
1506
+ /***/ 34:
1286
1507
  /***/ (function(module, exports, __webpack_require__) {
1287
1508
 
1288
1509
  "use strict";
@@ -1327,7 +1548,8 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1327
1548
  exports.useDeepMemo = useDeepMemo;
1328
1549
 
1329
1550
  /***/ }),
1330
- /* 35 */
1551
+
1552
+ /***/ 35:
1331
1553
  /***/ (function(module, exports, __webpack_require__) {
1332
1554
 
1333
1555
  "use strict";
@@ -1360,7 +1582,8 @@ var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
1360
1582
  exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
1361
1583
 
1362
1584
  /***/ }),
1363
- /* 36 */
1585
+
1586
+ /***/ 36:
1364
1587
  /***/ (function(module, exports, __webpack_require__) {
1365
1588
 
1366
1589
  "use strict";
@@ -1440,7 +1663,8 @@ exports.MissingPropsMessage.defaultProps = {
1440
1663
  exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
1441
1664
 
1442
1665
  /***/ }),
1443
- /* 37 */
1666
+
1667
+ /***/ 37:
1444
1668
  /***/ (function(module, exports, __webpack_require__) {
1445
1669
 
1446
1670
  "use strict";
@@ -1454,13 +1678,15 @@ var React = __webpack_require__(1);
1454
1678
 
1455
1679
  var styled_components_1 = __webpack_require__(4);
1456
1680
 
1457
- var hocUtils_1 = __webpack_require__(8);
1681
+ var hocUtils_1 = __webpack_require__(7);
1458
1682
 
1459
1683
  var Cover = styled_components_1.default.div.withConfig({
1460
1684
  displayName: "withEditModeCover__Cover",
1461
1685
  componentId: "sc-1gsbnxb-0"
1462
1686
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1463
- var Blocker = styled_components_1.default.div.withConfig({
1687
+ var Blocker = styled_components_1.default.div.attrs({
1688
+ 'data-splunk-visualization-version': "24.3.0 - 1c1ae4b3c"
1689
+ }).withConfig({
1464
1690
  displayName: "withEditModeCover__Blocker",
1465
1691
  componentId: "sc-1gsbnxb-1"
1466
1692
  })(["position:relative;width:100%;height:100%;"]);
@@ -1471,10 +1697,11 @@ var Blocker = styled_components_1.default.div.withConfig({
1471
1697
  * @returns {ExtendedDashViz} Wrapper
1472
1698
  */
1473
1699
 
1474
- var withEditModeCover = function withEditModeCover(Visualization) {
1700
+ var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
1475
1701
  var Wrapper = function Wrapper(props) {
1476
1702
  var mode = props.mode;
1477
- return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), mode === 'edit' && React.createElement(Cover, {
1703
+ var showEditCover = mode === 'edit' && !disableEditModeCover;
1704
+ return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
1478
1705
  "data-test": "edit-mode-cover"
1479
1706
  }));
1480
1707
  };
@@ -1489,7 +1716,8 @@ var withEditModeCover = function withEditModeCover(Visualization) {
1489
1716
  exports.default = withEditModeCover;
1490
1717
 
1491
1718
  /***/ }),
1492
- /* 38 */
1719
+
1720
+ /***/ 38:
1493
1721
  /***/ (function(module, exports, __webpack_require__) {
1494
1722
 
1495
1723
  "use strict";
@@ -1507,7 +1735,7 @@ var IconPlaceholder_1 = __webpack_require__(25);
1507
1735
 
1508
1736
  var VizBehavior_1 = __webpack_require__(5);
1509
1737
 
1510
- var hocUtils_1 = __webpack_require__(8);
1738
+ var hocUtils_1 = __webpack_require__(7);
1511
1739
 
1512
1740
  var withPlaceholder = function withPlaceholder(Visualization) {
1513
1741
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
@@ -1548,23 +1776,29 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1548
1776
  exports.default = withPlaceholder;
1549
1777
 
1550
1778
  /***/ }),
1551
- /* 39 */
1779
+
1780
+ /***/ 39:
1552
1781
  /***/ (function(module, exports) {
1553
1782
 
1554
1783
  module.exports = require("@babel/runtime/helpers/toConsumableArray");
1555
1784
 
1556
1785
  /***/ }),
1557
- /* 40 */,
1558
- /* 41 */
1786
+
1787
+ /***/ 4:
1788
+ /***/ (function(module, exports) {
1789
+
1790
+ module.exports = require("styled-components");
1791
+
1792
+ /***/ }),
1793
+
1794
+ /***/ 41:
1559
1795
  /***/ (function(module, exports) {
1560
1796
 
1561
1797
  module.exports = require("@splunk/visualization-color-palettes");
1562
1798
 
1563
1799
  /***/ }),
1564
- /* 42 */,
1565
- /* 43 */,
1566
- /* 44 */,
1567
- /* 45 */
1800
+
1801
+ /***/ 45:
1568
1802
  /***/ (function(module, exports, __webpack_require__) {
1569
1803
 
1570
1804
  "use strict";
@@ -1594,7 +1828,8 @@ var background = function background(_ref) {
1594
1828
  exports.default = background;
1595
1829
 
1596
1830
  /***/ }),
1597
- /* 46 */
1831
+
1832
+ /***/ 46:
1598
1833
  /***/ (function(module, exports, __webpack_require__) {
1599
1834
 
1600
1835
  "use strict";
@@ -1815,21 +2050,57 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
1815
2050
  exports.constructFieldsAndColumns = constructFieldsAndColumns;
1816
2051
 
1817
2052
  /***/ }),
1818
- /* 47 */
2053
+
2054
+ /***/ 47:
1819
2055
  /***/ (function(module, exports) {
1820
2056
 
1821
2057
  module.exports = require("@splunk/charting-bundle");
1822
2058
 
1823
2059
  /***/ }),
1824
- /* 48 */,
1825
- /* 49 */,
1826
- /* 50 */
2060
+
2061
+ /***/ 5:
1827
2062
  /***/ (function(module, exports, __webpack_require__) {
1828
2063
 
1829
2064
  "use strict";
1830
2065
 
1831
2066
 
1832
- var _this = this;
2067
+ Object.defineProperty(exports, "__esModule", {
2068
+ value: true
2069
+ });
2070
+ exports.VizBehavior = void 0;
2071
+ var VizBehavior;
2072
+
2073
+ (function (VizBehavior) {
2074
+ /**
2075
+ * Dynamic Options Behavior.
2076
+ * This allows visualization options to be powered by data
2077
+ *
2078
+ * **Example**
2079
+ *
2080
+ * sparklineValues: ">primary|seriesByIndex(0)"
2081
+ * would configure sparklineValues with an array of data points
2082
+ * coming from the first series in the primary datasource
2083
+ *
2084
+ */
2085
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
2086
+ VizBehavior["EVENTS"] = "events";
2087
+ /**
2088
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
2089
+ * missing.
2090
+ * @type {string}
2091
+ */
2092
+
2093
+ VizBehavior["PLACEHOLDER"] = "placeholder";
2094
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
2095
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
2096
+
2097
+ /***/ }),
2098
+
2099
+ /***/ 51:
2100
+ /***/ (function(module, exports, __webpack_require__) {
2101
+
2102
+ "use strict";
2103
+
1833
2104
 
1834
2105
  Object.defineProperty(exports, "__esModule", {
1835
2106
  value: true
@@ -1849,24 +2120,26 @@ var React = __webpack_require__(1);
1849
2120
 
1850
2121
  var T = __webpack_require__(0);
1851
2122
 
1852
- var react_event_listener_1 = __webpack_require__(51);
2123
+ var react_event_listener_1 = __webpack_require__(52);
1853
2124
 
1854
- __webpack_require__(52); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
2125
+ __webpack_require__(53); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
1855
2126
 
1856
2127
 
1857
2128
  var charting_bundle_1 = __webpack_require__(47);
1858
2129
 
2130
+ var TimezoneContext_1 = __webpack_require__(54);
2131
+
1859
2132
  var style_1 = __webpack_require__(13);
1860
2133
 
1861
2134
  var styled_components_1 = __webpack_require__(4);
1862
2135
 
1863
2136
  var Message_1 = __webpack_require__(9);
1864
2137
 
1865
- var useSplunkTheme_1 = __webpack_require__(53);
2138
+ var useSplunkTheme_1 = __webpack_require__(55);
1866
2139
 
1867
- var themeUtils_1 = __webpack_require__(54);
2140
+ var themeUtils_1 = __webpack_require__(56);
1868
2141
 
1869
- var ChartingApi_1 = __webpack_require__(55);
2142
+ var ChartingApi_1 = __webpack_require__(57);
1870
2143
 
1871
2144
  exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
1872
2145
 
@@ -1962,6 +2235,7 @@ var Charting = function Charting(props) {
1962
2235
  var chart = react_1.useRef();
1963
2236
  var needsRedraw = react_1.useRef(true);
1964
2237
  var api = react_1.useRef(new ChartingApi_1.ChartingApiFunctional(chart));
2238
+ var timezone = react_1.useContext(TimezoneContext_1.default);
1965
2239
 
1966
2240
  var computeChartingSize = function computeChartingSize() {
1967
2241
  if (container.current) {
@@ -1991,6 +2265,7 @@ var Charting = function Charting(props) {
1991
2265
  onPointMouseOver = props.onPointMouseOver,
1992
2266
  onEventTrigger = props.onEventTrigger;
1993
2267
  var prevOptions = usePrevious(options);
2268
+ var prevTimezone = usePrevious(timezone);
1994
2269
 
1995
2270
  var handleClick = function handleClick(chartEvent, type) {
1996
2271
  var payload = lodash_1.pick(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
@@ -2074,9 +2349,9 @@ var Charting = function Charting(props) {
2074
2349
  var computedChartSize = computeChartingSize();
2075
2350
  var computedWidth = computedChartSize.width;
2076
2351
  var computedHeight = computedChartSize.height;
2077
- var serializedTimezone = lodash_1.get(_this, ['context', 'serializedTimezone']);
2078
- var ianaTimezone = lodash_1.get(_this, ['context', 'ianaTimezone']);
2079
- var utcOffset = lodash_1.get(_this, ['context', 'utcOffset']);
2352
+ var serializedTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone;
2353
+ var ianaTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone;
2354
+ var utcOffset = timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset;
2080
2355
 
2081
2356
  if (!computedWidth || !computedHeight) {
2082
2357
  return;
@@ -2172,7 +2447,8 @@ var Charting = function Charting(props) {
2172
2447
  react_1.useEffect(function () {
2173
2448
  // TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme
2174
2449
  // seems like redraw doesn't suffice to update the background colors
2175
- if (!chart.current || !exports.canUpdateInPlace(prevOptions, options) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
2450
+ if (!chart.current || !exports.canUpdateInPlace(prevOptions, options) || // timezone is a simple object so this comparison should be fast
2451
+ JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
2176
2452
  needsInit.current = true;
2177
2453
  }
2178
2454
 
@@ -2180,7 +2456,7 @@ var Charting = function Charting(props) {
2180
2456
  // otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
2181
2457
 
2182
2458
  drawChart();
2183
- }, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), themeKey, onClick]);
2459
+ }, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone, timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset, timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone, themeKey, onClick]);
2184
2460
  return React.createElement(ChartingContainer, {
2185
2461
  style: style,
2186
2462
  ref: onContainerMount,
@@ -2242,31 +2518,43 @@ var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
2242
2518
  exports.default = withEmptyChartMessage(Charting);
2243
2519
 
2244
2520
  /***/ }),
2245
- /* 51 */
2521
+
2522
+ /***/ 52:
2246
2523
  /***/ (function(module, exports) {
2247
2524
 
2248
2525
  module.exports = require("react-event-listener");
2249
2526
 
2250
2527
  /***/ }),
2251
- /* 52 */
2528
+
2529
+ /***/ 53:
2252
2530
  /***/ (function(module, exports) {
2253
2531
 
2254
2532
  module.exports = require("@splunk/visualizations-shared/i18n");
2255
2533
 
2256
2534
  /***/ }),
2257
- /* 53 */
2535
+
2536
+ /***/ 54:
2537
+ /***/ (function(module, exports) {
2538
+
2539
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
2540
+
2541
+ /***/ }),
2542
+
2543
+ /***/ 55:
2258
2544
  /***/ (function(module, exports) {
2259
2545
 
2260
2546
  module.exports = require("@splunk/themes/useSplunkTheme");
2261
2547
 
2262
2548
  /***/ }),
2263
- /* 54 */
2549
+
2550
+ /***/ 56:
2264
2551
  /***/ (function(module, exports) {
2265
2552
 
2266
2553
  module.exports = require("@splunk/visualizations-shared/themeUtils");
2267
2554
 
2268
2555
  /***/ }),
2269
- /* 55 */
2556
+
2557
+ /***/ 57:
2270
2558
  /***/ (function(module, exports, __webpack_require__) {
2271
2559
 
2272
2560
  "use strict";
@@ -2274,7 +2562,7 @@ module.exports = require("@splunk/visualizations-shared/themeUtils");
2274
2562
 
2275
2563
  var _classCallCheck = __webpack_require__(10);
2276
2564
 
2277
- var _createClass = __webpack_require__(16);
2565
+ var _createClass = __webpack_require__(15);
2278
2566
 
2279
2567
  Object.defineProperty(exports, "__esModule", {
2280
2568
  value: true
@@ -2334,85 +2622,22 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
2334
2622
  exports.ChartingApiFunctional = ChartingApiFunctional;
2335
2623
 
2336
2624
  /***/ }),
2337
- /* 56 */
2625
+
2626
+ /***/ 58:
2338
2627
  /***/ (function(module, exports) {
2339
2628
 
2340
2629
  module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
2341
2630
 
2342
2631
  /***/ }),
2343
- /* 57 */,
2344
- /* 58 */,
2345
- /* 59 */,
2346
- /* 60 */,
2347
- /* 61 */,
2348
- /* 62 */,
2349
- /* 63 */,
2350
- /* 64 */,
2351
- /* 65 */,
2352
- /* 66 */,
2353
- /* 67 */,
2354
- /* 68 */,
2355
- /* 69 */,
2356
- /* 70 */,
2357
- /* 71 */,
2358
- /* 72 */,
2359
- /* 73 */,
2360
- /* 74 */,
2361
- /* 75 */,
2362
- /* 76 */,
2363
- /* 77 */,
2364
- /* 78 */,
2365
- /* 79 */,
2366
- /* 80 */,
2367
- /* 81 */,
2368
- /* 82 */,
2369
- /* 83 */,
2370
- /* 84 */,
2371
- /* 85 */,
2372
- /* 86 */,
2373
- /* 87 */,
2374
- /* 88 */,
2375
- /* 89 */,
2376
- /* 90 */,
2377
- /* 91 */,
2378
- /* 92 */,
2379
- /* 93 */,
2380
- /* 94 */,
2381
- /* 95 */,
2382
- /* 96 */,
2383
- /* 97 */,
2384
- /* 98 */,
2385
- /* 99 */,
2386
- /* 100 */,
2387
- /* 101 */,
2388
- /* 102 */,
2389
- /* 103 */,
2390
- /* 104 */,
2391
- /* 105 */,
2392
- /* 106 */,
2393
- /* 107 */,
2394
- /* 108 */,
2395
- /* 109 */,
2396
- /* 110 */,
2397
- /* 111 */,
2398
- /* 112 */,
2399
- /* 113 */,
2400
- /* 114 */,
2401
- /* 115 */,
2402
- /* 116 */,
2403
- /* 117 */,
2404
- /* 118 */,
2405
- /* 119 */,
2406
- /* 120 */,
2407
- /* 121 */,
2408
- /* 122 */,
2409
- /* 123 */,
2410
- /* 124 */
2632
+
2633
+ /***/ 6:
2411
2634
  /***/ (function(module, exports, __webpack_require__) {
2412
2635
 
2413
2636
  "use strict";
2414
2637
 
2415
2638
 
2639
+ var _defineProperty = __webpack_require__(8);
2640
+
2416
2641
  var __rest = this && this.__rest || function (s, e) {
2417
2642
  var t = {};
2418
2643
 
@@ -2429,567 +2654,260 @@ var __rest = this && this.__rest || function (s, e) {
2429
2654
  Object.defineProperty(exports, "__esModule", {
2430
2655
  value: true
2431
2656
  });
2432
- exports.config = exports.themes = exports.computeVizProps = exports.PieInnerSize = void 0;
2433
-
2434
- var lodash_1 = __webpack_require__(2); // Charting imports i18n which needs to be run to instantiate window globals in the
2435
- // eslint-disable-next-line import/order
2436
-
2437
-
2438
- var Charting_1 = __webpack_require__(50);
2439
-
2440
- var charting_bundle_1 = __webpack_require__(47);
2441
-
2442
- var simpleXMLOptions_1 = __webpack_require__(56);
2443
-
2444
- var config_1 = __webpack_require__(204);
2657
+ exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
2445
2658
 
2446
- exports.config = config_1.default;
2659
+ var lodash_1 = __webpack_require__(2);
2447
2660
 
2448
- var withDashboardViz_1 = __webpack_require__(27);
2661
+ var schemaUtils_1 = __webpack_require__(14);
2449
2662
 
2450
- var pieUtils_1 = __webpack_require__(206);
2663
+ var VizBehavior_1 = __webpack_require__(5);
2451
2664
 
2452
- var chartingUtils_1 = __webpack_require__(46);
2665
+ var dynamicOptionsDSLType = {
2666
+ type: 'string',
2667
+ pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
2668
+ };
2669
+ /**
2670
+ * Helper function to extend an options schema with dynamic options DSL
2671
+ * @param optionsSchema a visualization's options schema
2672
+ * @returns an updated options schema that additionally allows strings starting with > for each option
2673
+ */
2453
2674
 
2454
- var validOptions = Object.keys(config_1.default.optionsSchema);
2455
- exports.PieInnerSize = 0.7;
2675
+ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
2676
+ var enhancedOptionsSchema = {};
2677
+ Object.keys(optionsSchema).forEach(function (key) {
2678
+ var _a = optionsSchema[key],
2679
+ title = _a.title,
2680
+ description = _a.description,
2681
+ readOnly = _a.readOnly,
2682
+ writeOnly = _a.writeOnly,
2683
+ examples = _a.examples,
2684
+ defaultValue = _a.default,
2685
+ type = _a.type,
2686
+ properties = _a.properties,
2687
+ patternProperties = _a.patternProperties,
2688
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
2456
2689
 
2457
- var computeVizProps = function computeVizProps(_a) {
2458
- var dataSources = _a.dataSources,
2459
- onEventTrigger = _a.onEventTrigger,
2460
- label = _a.label,
2461
- value = _a.value,
2462
- showDonutHole = _a.showDonutHole,
2463
- visualizationApiRef = _a.visualizationApiRef,
2464
- otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "label", "value", "showDonutHole", "visualizationApiRef"]); // options to be passed as props
2690
+ var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
2691
+ title: title
2692
+ }), description !== undefined && {
2693
+ description: description
2694
+ }), readOnly !== undefined && {
2695
+ readOnly: readOnly
2696
+ }), writeOnly !== undefined && {
2697
+ writeOnly: writeOnly
2698
+ }), examples !== undefined && {
2699
+ examples: examples
2700
+ }), defaultValue !== undefined && {
2701
+ default: defaultValue
2702
+ });
2465
2703
 
2704
+ if (type === 'object') {
2705
+ enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
2706
+ type: type
2707
+ }), properties && {
2708
+ properties: enhanceOptionsSchemaWithDynamicOptions(properties)
2709
+ });
2466
2710
 
2467
- var computedProps = {
2468
- visualizationApiRef: visualizationApiRef
2469
- };
2470
- var labelField = otherOptions.labelField,
2471
- valueField = otherOptions.valueField,
2472
- hasEventHandlers = otherOptions.hasEventHandlers;
2473
- computedProps.options = lodash_1.chain(otherOptions).pick(validOptions).thru(pieUtils_1.convertToPieSCProperties).thru(function (options) {
2474
- return Object.assign(Object.assign({}, simpleXMLOptions_1.getSimpleXMLOptionsForProps(options)), {
2475
- chart: 'pie'
2476
- });
2477
- }).value();
2478
- var truncationLimit = computedProps.options['chart.resultTruncationLimit'];
2479
- var primaryData = Object.assign(Object.assign({}, dataSources.primary.data), {
2480
- columns: [label, value]
2481
- });
2482
- primaryData.fields = [{
2483
- name: labelField
2484
- }, {
2485
- name: valueField
2486
- }];
2487
- primaryData.columns.forEach(function (column, index) {
2488
- if (column) {
2489
- primaryData.columns[index] = column.map(String);
2490
- }
2491
- });
2492
-
2493
- if (truncationLimit) {
2494
- primaryData = chartingUtils_1.truncateData(primaryData, truncationLimit);
2495
- }
2496
-
2497
- computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign({}, primaryData));
2498
-
2499
- if (showDonutHole) {
2500
- computedProps.options['chart.pieInnerSize'] = exports.PieInnerSize;
2501
- } else {
2502
- computedProps.options['chart.pieInnerSize'] = 0;
2503
- }
2504
-
2505
- if (hasEventHandlers) {
2506
- computedProps.onClick = onEventTrigger;
2507
- }
2508
-
2509
- return computedProps;
2510
- };
2511
-
2512
- exports.computeVizProps = computeVizProps;
2513
- var Pie = withDashboardViz_1.default({
2514
- ReactViz: Charting_1.default,
2515
- computeVizProps: exports.computeVizProps,
2516
- vizConfig: config_1.default
2517
- });
2518
- var themes = null;
2519
- exports.themes = themes;
2520
- exports.default = Pie;
2521
-
2522
- /***/ }),
2523
- /* 125 */,
2524
- /* 126 */,
2525
- /* 127 */,
2526
- /* 128 */,
2527
- /* 129 */,
2528
- /* 130 */,
2529
- /* 131 */,
2530
- /* 132 */,
2531
- /* 133 */,
2532
- /* 134 */,
2533
- /* 135 */,
2534
- /* 136 */,
2535
- /* 137 */,
2536
- /* 138 */,
2537
- /* 139 */,
2538
- /* 140 */,
2539
- /* 141 */,
2540
- /* 142 */,
2541
- /* 143 */,
2542
- /* 144 */,
2543
- /* 145 */,
2544
- /* 146 */,
2545
- /* 147 */,
2546
- /* 148 */,
2547
- /* 149 */,
2548
- /* 150 */,
2549
- /* 151 */,
2550
- /* 152 */,
2551
- /* 153 */,
2552
- /* 154 */,
2553
- /* 155 */,
2554
- /* 156 */,
2555
- /* 157 */,
2556
- /* 158 */,
2557
- /* 159 */,
2558
- /* 160 */,
2559
- /* 161 */,
2560
- /* 162 */,
2561
- /* 163 */,
2562
- /* 164 */,
2563
- /* 165 */,
2564
- /* 166 */,
2565
- /* 167 */,
2566
- /* 168 */,
2567
- /* 169 */,
2568
- /* 170 */,
2569
- /* 171 */,
2570
- /* 172 */,
2571
- /* 173 */,
2572
- /* 174 */,
2573
- /* 175 */,
2574
- /* 176 */,
2575
- /* 177 */,
2576
- /* 178 */,
2577
- /* 179 */,
2578
- /* 180 */,
2579
- /* 181 */,
2580
- /* 182 */,
2581
- /* 183 */,
2582
- /* 184 */,
2583
- /* 185 */,
2584
- /* 186 */,
2585
- /* 187 */,
2586
- /* 188 */,
2587
- /* 189 */,
2588
- /* 190 */,
2589
- /* 191 */,
2590
- /* 192 */,
2591
- /* 193 */,
2592
- /* 194 */,
2593
- /* 195 */,
2594
- /* 196 */,
2595
- /* 197 */,
2596
- /* 198 */,
2597
- /* 199 */,
2598
- /* 200 */,
2599
- /* 201 */,
2600
- /* 202 */,
2601
- /* 203 */
2602
- /***/ (function(module, exports, __webpack_require__) {
2603
-
2604
- "use strict";
2605
-
2606
-
2607
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
2608
- if (k2 === undefined) k2 = k;
2609
- Object.defineProperty(o, k2, {
2610
- enumerable: true,
2611
- get: function get() {
2612
- return m[k];
2613
- }
2614
- });
2615
- } : function (o, m, k, k2) {
2616
- if (k2 === undefined) k2 = k;
2617
- o[k2] = m[k];
2618
- });
2619
-
2620
- var __exportStar = this && this.__exportStar || function (m, exports) {
2621
- for (var p in m) {
2622
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2623
- }
2624
- };
2625
-
2626
- Object.defineProperty(exports, "__esModule", {
2627
- value: true
2628
- });
2629
- exports.default = void 0;
2630
-
2631
- __exportStar(__webpack_require__(124), exports);
2632
-
2633
- var Pie_1 = __webpack_require__(124);
2634
-
2635
- Object.defineProperty(exports, "default", {
2636
- enumerable: true,
2637
- get: function get() {
2638
- return Pie_1.default;
2639
- }
2640
- });
2641
-
2642
- /***/ }),
2643
- /* 204 */
2644
- /***/ (function(module, exports, __webpack_require__) {
2645
-
2646
- "use strict";
2647
-
2648
-
2649
- Object.defineProperty(exports, "__esModule", {
2650
- value: true
2651
- });
2652
-
2653
- var ChartPie_1 = __webpack_require__(205);
2654
-
2655
- var i18n_1 = __webpack_require__(3);
2656
-
2657
- var schemaUtils_1 = __webpack_require__(14);
2658
-
2659
- var visualization_color_palettes_1 = __webpack_require__(41);
2660
-
2661
- var pick_1 = __webpack_require__(20);
2662
-
2663
- var variables_1 = __webpack_require__(19);
2664
-
2665
- var VizBehavior_1 = __webpack_require__(5);
2666
-
2667
- var VizCategory_1 = __webpack_require__(26);
2668
-
2669
- var configUtils_1 = __webpack_require__(6);
2670
-
2671
- var BackgroundColor_1 = __webpack_require__(45);
2672
-
2673
- var dataContract = {
2674
- requiredDataSources: [{
2675
- name: 'primary',
2676
- description: 'DataSource that powers the visualization'
2677
- }],
2678
- optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
2679
- // {
2680
- // name: 'annotation',
2681
- // description: 'DataSource that populate event annotations',
2682
- // },
2683
- ],
2684
- initialRequestParams: {
2685
- primary: {
2686
- offset: 0,
2687
- count: 10000
2688
- },
2689
- annotation: {
2690
- offset: 0,
2691
- count: 10000
2692
- }
2693
- }
2694
- };
2695
- var size = {
2696
- initialWidth: 300,
2697
- initialHeight: 300
2698
- };
2699
- var defaultContext = {};
2700
- var optionsSchema = {
2701
- backgroundColor: {
2702
- default: '> themes.defaultBackgroundColor',
2703
- description: 'Specify the color for the background. You may use a dataSource to apply the color. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
2704
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN,
2705
- type: 'string'
2706
- },
2707
- collapseLabel: {
2708
- description: 'Specify the label for the consolidated slice.',
2709
- type: 'string',
2710
- default: 'other'
2711
- },
2712
- collapseThreshold: {
2713
- description: 'Specify the size threshold as a number between 0 and 1 (inclusive), of the whole pie at which slices collapse into one consolidated slice.',
2714
- type: 'number',
2715
- default: 0.01
2716
- },
2717
- label: {
2718
- description: 'List of string values to display the pie chart labels.',
2719
- type: 'array',
2720
- items: {
2721
- type: 'string'
2722
- },
2723
- default: '> primary | seriesByIndex(0)'
2724
- },
2725
- labelField: {
2726
- default: '> label | getField()',
2727
- description: 'Specify the field that corresponds to the labels.',
2728
- type: 'string'
2729
- },
2730
- labelDisplay: {
2731
- description: 'Specify whether to display the labels and/or slice percentages.',
2732
- type: 'string',
2733
- pattern: schemaUtils_1.getPattern(['values', 'valuesAndPercentage', 'off']),
2734
- default: 'values'
2735
- },
2736
- resultLimit: {
2737
- default: 50000,
2738
- description: 'Specify the number of data points rendered in a chart.',
2739
- type: 'number'
2740
- },
2741
- seriesColors: {
2742
- default: visualization_color_palettes_1.VIZ_CATEGORICAL,
2743
- description: 'Specify the colors used for a series. For example, ["#FF0000", "#0000FF", "#008000"].',
2744
- type: 'array',
2745
- items: {
2746
- type: 'string'
2747
- }
2748
- },
2749
- seriesColorsByField: {
2750
- description: 'Specify the colors used for specific pie slice labels. For example: {"April": "#008000", "May": "#FFA500"}.',
2751
- type: 'object'
2752
- },
2753
- showDonutHole: {
2754
- default: false,
2755
- description: 'Specify whether the pie should be a donut.',
2756
- type: 'boolean'
2757
- },
2758
- value: {
2759
- description: 'List of numerical values to power the pie chart.',
2760
- type: 'array',
2761
- items: {
2762
- type: 'number'
2763
- },
2764
- default: '> primary | seriesByIndex(1)'
2765
- },
2766
- valueField: {
2767
- default: '> value | getField()',
2768
- description: 'Specify the field that corresponds to the data powering values.',
2769
- type: 'string'
2770
- }
2771
- };
2772
- var themes = {
2773
- defaultBackgroundColor: function defaultBackgroundColor(props) {
2774
- return pick_1.default({
2775
- enterprise: {
2776
- dark: variables_1.default.black(props),
2777
- light: variables_1.default.backgroundColor(props)
2778
- },
2779
- prisma: variables_1.default.backgroundColorSidebar(props)
2780
- })(props);
2781
- }
2782
- };
2783
- var editorConfig = [{
2784
- label: i18n_1._('General'),
2785
- layout: [BackgroundColor_1.default({
2786
- themes: themes
2787
- })]
2788
- }, {
2789
- label: i18n_1._('Appearance'),
2790
- open: true,
2791
- layout: [[{
2792
- label: i18n_1._(''),
2793
- option: 'showDonutHole',
2794
- editor: 'editor.radioBar',
2795
- editorProps: {
2796
- values: [{
2797
- label: i18n_1._('Pie'),
2798
- value: false
2799
- }, {
2800
- label: i18n_1._('Donut'),
2801
- value: true
2802
- }]
2803
- }
2804
- }]]
2805
- }, {
2806
- label: i18n_1._('Labels'),
2807
- layout: [[{
2808
- label: '',
2809
- option: 'labelDisplay',
2810
- editor: 'editor.radioBar',
2811
- editorProps: {
2812
- values: [{
2813
- label: i18n_1._('Values'),
2814
- value: 'values'
2815
- }, {
2816
- label: i18n_1._('Values & Percent'),
2817
- value: 'valuesAndPercentage'
2818
- }, {
2819
- label: i18n_1._('Off'),
2820
- value: 'off'
2821
- }]
2822
- }
2823
- }]]
2824
- }, {
2825
- label: i18n_1._('Collapse to Summary'),
2826
- layout: [[{
2827
- label: i18n_1._('Collapse Threshold'),
2828
- option: 'collapseThreshold',
2829
- editor: 'editor.number',
2830
- editorProps: {
2831
- min: 0,
2832
- max: 1,
2833
- step: 0.01
2711
+ if (patternProperties) {
2712
+ var enhancedPatternProperties = {};
2713
+ Object.keys(patternProperties).forEach(function (opt) {
2714
+ enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
2715
+ });
2716
+ enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
2717
+ }
2718
+ } else {
2719
+ enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
2720
+ anyOf: [Object.assign(Object.assign({}, type !== undefined && {
2721
+ type: type
2722
+ }), remainingSchemaEntry), dynamicOptionsDSLType]
2723
+ });
2834
2724
  }
2835
- }], [{
2836
- label: i18n_1._('Collapsed Slice Label'),
2837
- option: 'collapseLabel',
2838
- editor: 'editor.text'
2839
- }]]
2840
- }];
2725
+ });
2726
+ return enhancedOptionsSchema;
2727
+ }
2728
+
2729
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
2841
2730
  /**
2842
- * visualization configuration
2731
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
2732
+ * @param vizConfig a Visualization Config
2733
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
2843
2734
  */
2844
2735
 
2845
- var config = {
2846
- /**
2847
- * unique viz key
2848
- */
2849
- key: 'splunk.pie',
2736
+ function enhanceConfig(vizConfig) {
2737
+ var enhancedConfig = vizConfig;
2850
2738
 
2851
- /**
2852
- * viz name
2853
- */
2854
- name: 'Pie',
2855
- category: VizCategory_1.VizCategory.COMPARISONS,
2739
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
2740
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
2741
+ }
2856
2742
 
2857
- /**
2858
- * viz icon
2859
- */
2860
- icon: ChartPie_1.default,
2861
- dataContract: dataContract,
2862
- size: size,
2863
- defaultContext: defaultContext,
2864
- optionsSchema: optionsSchema,
2865
- editorConfig: editorConfig,
2866
- events: {
2867
- 'point.click': {
2868
- description: 'triggered when user clicks on a point in the pie chart'
2869
- }
2870
- },
2871
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
2872
- themes: themes
2873
- };
2874
- exports.default = configUtils_1.enhanceConfig(config);
2743
+ return enhancedConfig;
2744
+ }
2875
2745
 
2876
- /***/ }),
2877
- /* 205 */
2878
- /***/ (function(module, exports) {
2746
+ exports.enhanceConfig = enhanceConfig;
2879
2747
 
2880
- module.exports = require("@splunk/react-icons/ChartPie");
2748
+ function isDynamicOption(option) {
2749
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
2750
+ }
2751
+
2752
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
2753
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
2754
+
2755
+ /**
2756
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
2757
+ * if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
2758
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
2759
+ * the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
2760
+ *
2761
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
2762
+ */
2763
+
2764
+ function hasCompatibleContexts(vizContext, presetContext) {
2765
+ var presetContextKeys = Object.keys(presetContext);
2766
+ return presetContextKeys.every(function (contextKey) {
2767
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
2768
+ });
2769
+ }
2770
+ /**
2771
+ * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
2772
+ */
2773
+
2774
+
2775
+ function hasCompatibleOptions(vizOptions, presetOptions) {
2776
+ var presetOptionKeys = Object.keys(presetOptions);
2777
+ return presetOptionKeys.every(function (optionKey) {
2778
+ return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
2779
+ });
2780
+ }
2781
+ /**
2782
+ * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
2783
+ * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
2784
+ *
2785
+ * @param {Object} vizContext - the current vizContext definition
2786
+ * @param {Object} vizOptions - the current vizOptions definition
2787
+ * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
2788
+ */
2789
+
2790
+
2791
+ function getInitialPreset(vizContext, vizOptions, presets) {
2792
+ return presets.find(function (preset) {
2793
+ var presetContext = lodash_1.get(preset, ['value', 'context'], {});
2794
+ var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
2795
+ var presetContextKeys = Object.keys(presetContext);
2796
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
2797
+ // if not, then the preset is invalid in config.ts
2798
+
2799
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
2800
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
2801
+ });
2802
+ }
2803
+
2804
+ exports.getInitialPreset = getInitialPreset;
2805
+ /**
2806
+ * generates number precision values for a Select editor
2807
+ *
2808
+ * @param {Number} numPrecisionValues - number of integer precision values to generate
2809
+ * @returns {{ label: string; value; string }[]} array of { label, value } tuples
2810
+ */
2811
+
2812
+ function generatePrecisionValues(numPrecisionValues) {
2813
+ return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
2814
+ return {
2815
+ label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
2816
+ value: i
2817
+ };
2818
+ });
2819
+ }
2820
+
2821
+ exports.generatePrecisionValues = generatePrecisionValues;
2881
2822
 
2882
2823
  /***/ }),
2883
- /* 206 */
2824
+
2825
+ /***/ 7:
2884
2826
  /***/ (function(module, exports, __webpack_require__) {
2885
2827
 
2886
2828
  "use strict";
2887
2829
 
2888
2830
 
2889
- var __rest = this && this.__rest || function (s, e) {
2890
- var t = {};
2891
-
2892
- for (var p in s) {
2893
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2894
- }
2895
-
2896
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2897
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2898
- }
2899
- return t;
2900
- };
2831
+ var _typeof = __webpack_require__(20);
2901
2832
 
2902
2833
  Object.defineProperty(exports, "__esModule", {
2903
2834
  value: true
2904
2835
  });
2905
- exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
2836
+ exports.deepMergeWithArrayOverrides = exports.extendStaticWrapperProps = void 0;
2906
2837
 
2907
2838
  var lodash_1 = __webpack_require__(2);
2908
-
2909
- var propUtils_1 = __webpack_require__(18); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
2910
- // map for key names which are either new or not present in SimpleXML options mapping
2911
-
2912
-
2913
- var pieOptionsSCMapping = {
2914
- resultLimit: 'resultTruncationLimit',
2915
- seriesColorsByField: 'fieldColors',
2916
- collapseThreshold: 'chart.sliceCollapsingThreshold',
2917
- collapseLabel: 'chart.sliceCollapsingLabel'
2918
- };
2919
2839
  /**
2920
- * Helper method to convert option which contains object literal values (e.g. arrays, objects)
2921
- * to strings as SC can only accept their stringified equivalents
2922
- * @method convertToStringValues
2923
- * @param {Object} options
2924
- * @returns {Object}
2840
+ * @method extendStaticWrapperProps
2841
+ * @param {Object} props
2842
+ * @param {DashboardVizType} props.Wrapper
2843
+ * @param {DashboardVizType} props.Visualization
2925
2844
  */
2926
2845
 
2927
- var convertToStringValues = function convertToStringValues(options) {
2928
- var updatedOptions = propUtils_1.convertPropsToString({
2929
- vizProps: options,
2930
- propNames: ['seriesColors', 'fieldColors']
2846
+
2847
+ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
2848
+ var Wrapper = _ref.Wrapper,
2849
+ Visualization = _ref.Visualization;
2850
+ var extendProperties = ['propTypes', 'defaultProps', 'config'];
2851
+ extendProperties.forEach(function (prop) {
2852
+ if (Visualization[prop]) {
2853
+ // eslint-disable-next-line no-param-reassign
2854
+ Wrapper[prop] = Visualization[prop];
2855
+ }
2931
2856
  });
2932
- return Object.assign(Object.assign({}, options), updatedOptions);
2933
2857
  };
2934
2858
 
2935
- exports.convertToStringValues = convertToStringValues;
2859
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
2936
2860
  /**
2937
- * Helper method to map labelDisplay options to jsCharting options
2938
- * @method mapLabelDisplay
2939
- * @param {Object} options
2861
+ * helper to deeply merge objects while preserving arrays in earlier source objects
2862
+ * deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays will be preserved if already present in the resultant merged object
2863
+ * this prevents default arrays from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one)
2864
+ *
2865
+ * @method deepMergeWithArrayOverrides
2866
+ * @param {Object} initial - target object to merge values into
2867
+ * @param {Object[]} sources - other default options to be merged into the resultant object if no explicit value is provided, with earlier args taking precedence over later ones
2868
+ *
2940
2869
  * @returns {Object}
2941
2870
  */
2942
2871
 
2943
- var mapLabelDisplay = function mapLabelDisplay(_a) {
2944
- var labelDisplay = _a.labelDisplay,
2945
- options = __rest(_a, ["labelDisplay"]);
2946
-
2947
- var convertedOptions = Object.assign(Object.assign({}, options), {
2948
- // default for labelDisplay option is 'values'
2949
- 'chart.showLabels': true,
2950
- 'chart.showPercent': false
2951
- });
2872
+ var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial) {
2873
+ var clone = lodash_1.cloneDeep(initial);
2952
2874
 
2953
- if (labelDisplay === 'valuesAndPercentage') {
2954
- convertedOptions['chart.showPercent'] = true;
2955
- } else if (labelDisplay === 'off') {
2956
- convertedOptions['chart.showLabels'] = false;
2875
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2876
+ sources[_key - 1] = arguments[_key];
2957
2877
  }
2958
2878
 
2959
- return convertedOptions;
2960
- };
2879
+ sources.forEach(function (sourceToApply) {
2880
+ Object.keys(sourceToApply).forEach(function (sourceKey) {
2881
+ if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
2882
+ clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
2883
+ } // object merging excluding arrays
2961
2884
 
2962
- exports.mapLabelDisplay = mapLabelDisplay;
2963
- /**
2964
- * Helper method to update the option names which can be mapped to SimpleXML options or
2965
- * can be used directly with SC if don't have a 1-1 mapping in SimpleXML
2966
- * @method mapToOldKey
2967
- * @param {Object} options
2968
- * @returns {Object}
2969
- */
2970
2885
 
2971
- var mapToOldKey = function mapToOldKey(options) {
2972
- return lodash_1.mapKeys(options, function (val, key) {
2973
- return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
2886
+ if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
2887
+ clone[sourceKey] = exports.deepMergeWithArrayOverrides(clone[sourceKey], sourceToApply[sourceKey]);
2888
+ }
2889
+ });
2974
2890
  });
2891
+ return clone;
2975
2892
  };
2976
2893
 
2977
- exports.mapToOldKey = mapToOldKey;
2978
- /**
2979
- * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
2980
- * This is for options that has new key name and can not directly be mapped with SimpleXML or
2981
- * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
2982
- * @method convertToPieSCProperties
2983
- * @param {Object} originalOptions
2984
- * @returns {Object}
2985
- */
2894
+ exports.deepMergeWithArrayOverrides = deepMergeWithArrayOverrides;
2986
2895
 
2987
- var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
2988
- return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
2989
- };
2896
+ /***/ }),
2990
2897
 
2991
- exports.convertToPieSCProperties = convertToPieSCProperties;
2898
+ /***/ 8:
2899
+ /***/ (function(module, exports) {
2900
+
2901
+ module.exports = require("@babel/runtime/helpers/defineProperty");
2902
+
2903
+ /***/ }),
2904
+
2905
+ /***/ 9:
2906
+ /***/ (function(module, exports) {
2907
+
2908
+ module.exports = require("@splunk/visualizations-shared/Message");
2992
2909
 
2993
2910
  /***/ })
2994
- /******/ ]);
2911
+
2912
+ /******/ });
2995
2913
  //# sourceMappingURL=Pie.js.map