@splunk/visualizations 24.2.0 → 24.3.2

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 (216) 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_PureMap_Tooltip_Dark.png +0 -0
  4. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Hover.png +0 -0
  5. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Light.png +0 -0
  6. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_base_map_light.png +0 -0
  7. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
  8. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_dynamic_color.png +0 -0
  9. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_geostats_by.png +0 -0
  10. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_static_color.png +0 -0
  11. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_static_color_with_no_seriesColors.png +0 -0
  12. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_center_seattle.png +0 -0
  13. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_dynamic_color.png +0 -0
  14. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color.png +0 -0
  15. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color_with_no_seriesColors.png +0 -0
  16. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_off.png +0 -0
  17. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_unit_metric.png +0 -0
  18. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_zoom_9.png +0 -0
  19. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_duplicate_entries_from.png +0 -0
  20. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_duplicate_entries_to.png +0 -0
  21. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_discontinuous_ranges.png +0 -0
  22. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_from_equals_to_to.png +0 -0
  23. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_from_is_larger_than_to.png +0 -0
  24. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_missing_entries.png +0 -0
  25. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Orientation_horizontal_width_150_show_placeholder.png +0 -0
  26. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Too_Small_to_Render.png +0 -0
  27. package/.loki/reference/chrome_docker_PureVisualizations_PureSankey_dimensions_less_than_minWidth_300_and_minHeight_200.png +0 -0
  28. package/.loki/reference/chrome_docker_PureVisualizations_PureSankey_invalid_columns_data.png +0 -0
  29. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  30. package/.loki/reference/chrome_docker_Visualizations_Choropleth_Svg_Choropleth_Svg_Missing_Props_Message_When_No_Svg.png +0 -0
  31. package/.loki/reference/chrome_docker_Visualizations_Filler_Gauge_Filler_Gauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
  32. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Basic_Map.png +0 -0
  33. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer.png +0 -0
  34. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET.png +0 -0
  35. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET_Dynamic_Coloring.png +0 -0
  36. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Static_Coloring.png +0 -0
  37. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_Dynamic_Coloring.png +0 -0
  38. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer.png +0 -0
  39. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Dynamic_coloring.png +0 -0
  40. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Result_Limit_Set_To_3.png +0 -0
  41. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_with_geostats_data_No_render.png +0 -0
  42. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
  43. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Markdown_with_number_as_DSL.png +0 -0
  44. package/.loki/reference/chrome_docker_Visualizations_Pie_Pie_Missing_Column.png +0 -0
  45. package/.loki/reference/chrome_docker_Visualizations_Sankey_Sankey_Dimension_Too_Small.png +0 -0
  46. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_By_Type_Custom.png +0 -0
  47. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Default.png +0 -0
  48. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Kitchen_Sink.png +0 -0
  49. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Right.png +0 -0
  50. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Single_Column.png +0 -0
  51. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Color_light_blue.png +0 -0
  52. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_No_Stripe.png +0 -0
  53. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Stripe.png +0 -0
  54. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table.png +0 -0
  55. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table_With_No_Click.png +0 -0
  56. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Cell_Types.png +0 -0
  57. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Gradient.png +0 -0
  58. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Override.png +0 -0
  59. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width.png +0 -0
  60. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Count_2.png +0 -0
  61. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Header_Colors.png +0 -0
  62. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Row_Colors.png +0 -0
  63. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Stripe.png +0 -0
  64. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_No_Stripe.png +0 -0
  65. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_Stripe.png +0 -0
  66. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number.png +0 -0
  67. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number_Adv.png +0 -0
  68. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_fixed.png +0 -0
  69. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_none.png +0 -0
  70. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage.png +0 -0
  71. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage_100_no_paginator.png +0 -0
  72. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Invalid_Background_Color.png +0 -0
  73. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Multi_Value_Field.png +0 -0
  74. package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes.png +0 -0
  75. package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes_Row_Numbers.png +0 -0
  76. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_false.png +0 -0
  77. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_true_default.png +0 -0
  78. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Row_Numbers_true.png +0 -0
  79. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline.png +0 -0
  80. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Custom.png +0 -0
  81. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Width.png +0 -0
  82. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparklines_Adv.png +0 -0
  83. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Formatting.png +0 -0
  84. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Gradient.png +0 -0
  85. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Formatting.png +0 -0
  86. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Height.png +0 -0
  87. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Percentage.png +0 -0
  88. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Px.png +0 -0
  89. package/Area.config.js +15 -15
  90. package/Area.config.js.map +1 -1
  91. package/Area.js +108 -121
  92. package/Area.js.map +1 -1
  93. package/Bar.config.js +15 -15
  94. package/Bar.config.js.map +1 -1
  95. package/Bar.js +101 -114
  96. package/Bar.js.map +1 -1
  97. package/Bubble.config.js +8 -8
  98. package/Bubble.config.js.map +1 -1
  99. package/Bubble.js +94 -107
  100. package/Bubble.js.map +1 -1
  101. package/ChoroplethSvg.config.js +11 -9
  102. package/ChoroplethSvg.config.js.map +1 -1
  103. package/ChoroplethSvg.js +123 -134
  104. package/ChoroplethSvg.js.map +1 -1
  105. package/Column.config.js +15 -15
  106. package/Column.config.js.map +1 -1
  107. package/Column.js +101 -114
  108. package/Column.js.map +1 -1
  109. package/Ellipse.config.js +22 -2
  110. package/Ellipse.config.js.map +1 -1
  111. package/Ellipse.js +109 -102
  112. package/Ellipse.js.map +1 -1
  113. package/FillerGauge.config.js +8 -8
  114. package/FillerGauge.config.js.map +1 -1
  115. package/FillerGauge.js +110 -123
  116. package/FillerGauge.js.map +1 -1
  117. package/Image.js +81 -97
  118. package/Image.js.map +1 -1
  119. package/Line.config.js +8 -8
  120. package/Line.config.js.map +1 -1
  121. package/Line.js +101 -114
  122. package/Line.js.map +1 -1
  123. package/LinkGraph.config.js +4 -4
  124. package/LinkGraph.js +128 -141
  125. package/LinkGraph.js.map +1 -1
  126. package/Map.config.js +740 -0
  127. package/Map.config.js.map +1 -0
  128. package/Map.js +3141 -0
  129. package/Map.js.map +1 -0
  130. package/Markdown.config.js +12 -12
  131. package/Markdown.config.js.map +1 -1
  132. package/Markdown.js +104 -118
  133. package/Markdown.js.map +1 -1
  134. package/MarkerGauge.config.js +6 -6
  135. package/MarkerGauge.config.js.map +1 -1
  136. package/MarkerGauge.js +2953 -3060
  137. package/MarkerGauge.js.map +1 -1
  138. package/ParallelCoordinates.config.js +11 -11
  139. package/ParallelCoordinates.config.js.map +1 -1
  140. package/ParallelCoordinates.js +137 -139
  141. package/ParallelCoordinates.js.map +1 -1
  142. package/Pie.config.js +13 -13
  143. package/Pie.config.js.map +1 -1
  144. package/Pie.js +912 -1019
  145. package/Pie.js.map +1 -1
  146. package/Punchcard.config.js +11 -11
  147. package/Punchcard.config.js.map +1 -1
  148. package/Punchcard.js +153 -155
  149. package/Punchcard.js.map +1 -1
  150. package/README.internal.md +36 -3
  151. package/README.md +7 -9
  152. package/Rectangle.config.js +32 -12
  153. package/Rectangle.config.js.map +1 -1
  154. package/Rectangle.js +189 -185
  155. package/Rectangle.js.map +1 -1
  156. package/Sankey.config.js +35 -25
  157. package/Sankey.config.js.map +1 -1
  158. package/Sankey.js +2963 -3078
  159. package/Sankey.js.map +1 -1
  160. package/Scatter.config.js +11 -11
  161. package/Scatter.config.js.map +1 -1
  162. package/Scatter.js +231 -247
  163. package/Scatter.js.map +1 -1
  164. package/SingleValue.config.js +23 -22
  165. package/SingleValue.config.js.map +1 -1
  166. package/SingleValue.js +425 -441
  167. package/SingleValue.js.map +1 -1
  168. package/SingleValueBasic.js +20 -20
  169. package/SingleValueBasic.js.map +1 -1
  170. package/SingleValueIcon.config.js +33 -34
  171. package/SingleValueIcon.config.js.map +1 -1
  172. package/SingleValueIcon.js +179 -184
  173. package/SingleValueIcon.js.map +1 -1
  174. package/SingleValueRadial.config.js +22 -22
  175. package/SingleValueRadial.config.js.map +1 -1
  176. package/SingleValueRadial.js +391 -407
  177. package/SingleValueRadial.js.map +1 -1
  178. package/Table.config.js +17 -6
  179. package/Table.config.js.map +1 -1
  180. package/Table.js +358 -321
  181. package/Table.js.map +1 -1
  182. package/common/Charting.js +21 -22
  183. package/common/Charting.js.map +1 -1
  184. package/common/ChartingApi.js +2 -2
  185. package/common/ChartingApi.js.map +1 -1
  186. package/common/EventsDoc.js +14 -15
  187. package/common/EventsDoc.js.map +1 -1
  188. package/common/GaugeMajorTicks.js +2 -2
  189. package/common/GaugeMajorTicks.js.map +1 -1
  190. package/common/GaugeValueMarker.js +2 -2
  191. package/common/GaugeValueMarker.js.map +1 -1
  192. package/common/OptionsDoc.js +7 -8
  193. package/common/OptionsDoc.js.map +1 -1
  194. package/common/OverviewDoc.js +22 -22
  195. package/common/OverviewDoc.js.map +1 -1
  196. package/common/SplunkVisualization.js +4 -4
  197. package/common/SplunkVisualization.js.map +1 -1
  198. package/common/SplunkVisualizationApi.js +2 -2
  199. package/common/SplunkVisualizationApi.js.map +1 -1
  200. package/common/ThemesDoc.js +16 -16
  201. package/common/ThemesDoc.js.map +1 -1
  202. package/common/chartingUtils.js +4 -4
  203. package/common/chartingUtils.js.map +1 -1
  204. package/common/docUtils.js +4 -4
  205. package/common/docUtils.js.map +1 -1
  206. package/common/gaugeUtils.js +13 -13
  207. package/common/gaugeUtils.js.map +1 -1
  208. package/common/shapeUtils.js +8 -8
  209. package/common/shapeUtils.js.map +1 -1
  210. package/common/withDashboardViz.js +53 -68
  211. package/common/withDashboardViz.js.map +1 -1
  212. package/loki.config.js +2 -0
  213. package/package.json +19 -15
  214. package/common/version.js +0 -110
  215. package/common/version.js.map +0 -1
  216. package/scripts/generateVersion.js +0 -13
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 = 205);
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.2 - 1cf892b72",
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__(15);
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
- }
273
-
274
- exports.enhanceConfig = enhanceConfig;
320
+ if (hasEventHandlers) {
321
+ computedProps.onClick = onEventTrigger;
322
+ }
275
323
 
276
- function isDynamicOption(option) {
277
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
278
- }
324
+ return computedProps;
325
+ };
279
326
 
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
282
-
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
- */
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;
291
336
 
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
- */
337
+ /***/ }),
301
338
 
339
+ /***/ 13:
340
+ /***/ (function(module, exports) {
302
341
 
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
- */
342
+ module.exports = require("@splunk/visualizations-shared/style");
317
343
 
344
+ /***/ }),
318
345
 
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
346
+ /***/ 14:
347
+ /***/ (function(module, exports) {
326
348
 
327
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
328
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
329
- });
330
- }
349
+ module.exports = require("@splunk/visualizations-shared/schemaUtils");
331
350
 
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
- */
351
+ /***/ }),
339
352
 
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
- }
353
+ /***/ 15:
354
+ /***/ (function(module, exports) {
348
355
 
349
- exports.generatePrecisionValues = generatePrecisionValues;
356
+ module.exports = require("@babel/runtime/helpers/createClass");
350
357
 
351
358
  /***/ }),
352
- /* 7 */
359
+
360
+ /***/ 16:
353
361
  /***/ (function(module, exports) {
354
362
 
355
- module.exports = require("@babel/runtime/helpers/defineProperty");
363
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
356
364
 
357
365
  /***/ }),
358
- /* 8 */
359
- /***/ (function(module, exports, __webpack_require__) {
360
366
 
361
- "use strict";
367
+ /***/ 18:
368
+ /***/ (function(module, exports) {
362
369
 
370
+ module.exports = require("@splunk/visualizations-shared/propUtils");
363
371
 
364
- var _typeof = __webpack_require__(23);
372
+ /***/ }),
365
373
 
366
- Object.defineProperty(exports, "__esModule", {
367
- value: true
368
- });
369
- exports.deepMergeWithArrayOverrides = exports.extendStaticWrapperProps = void 0;
374
+ /***/ 19:
375
+ /***/ (function(module, exports) {
370
376
 
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
- */
377
+ module.exports = require("@splunk/themes/variables");
378
378
 
379
+ /***/ }),
379
380
 
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
- };
381
+ /***/ 2:
382
+ /***/ (function(module, exports) {
391
383
 
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
- */
384
+ module.exports = require("lodash");
404
385
 
405
- var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial) {
406
- var clone = lodash_1.cloneDeep(initial);
386
+ /***/ }),
407
387
 
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
- }
388
+ /***/ 20:
389
+ /***/ (function(module, exports) {
411
390
 
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
391
+ module.exports = require("@babel/runtime/helpers/typeof");
417
392
 
393
+ /***/ }),
418
394
 
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
- };
395
+ /***/ 21:
396
+ /***/ (function(module, exports) {
426
397
 
427
- exports.deepMergeWithArrayOverrides = deepMergeWithArrayOverrides;
398
+ module.exports = require("@splunk/themes/pick");
428
399
 
429
400
  /***/ }),
430
- /* 9 */
431
- /***/ (function(module, exports) {
432
401
 
433
- module.exports = require("@splunk/visualizations-shared/Message");
402
+ /***/ 217:
403
+ /***/ (function(module, exports, __webpack_require__) {
434
404
 
435
- /***/ }),
436
- /* 10 */
437
- /***/ (function(module, exports) {
405
+ "use strict";
438
406
 
439
- module.exports = require("@babel/runtime/helpers/classCallCheck");
440
407
 
441
- /***/ }),
442
- /* 11 */
443
- /***/ (function(module, exports) {
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
+ });
444
420
 
445
- module.exports = require("@splunk/visualizations-shared/colorUtils");
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
+ };
426
+
427
+ Object.defineProperty(exports, "__esModule", {
428
+ value: true
429
+ });
430
+ exports.default = void 0;
431
+
432
+ __exportStar(__webpack_require__(127), exports);
433
+
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,164 +452,353 @@ 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__(18);
459
+ var schemaUtils_1 = __webpack_require__(14);
463
460
 
464
- var style_1 = __webpack_require__(14);
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 version_1 = __webpack_require__(13);
465
+ var variables_1 = __webpack_require__(19);
469
466
 
470
- var Item = styled_components_1.default.div.attrs(function (_ref) {
471
- var width = _ref.width;
472
- return {
473
- style: {
474
- width: style_1.toPx(width)
475
- }
476
- };
477
- }).withConfig({
478
- displayName: "FixedSizeContainer__Item",
479
- componentId: "sc-1yhgpod-0"
480
- })(["position:relative;background-color:", "};"], function (props) {
481
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
482
- }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
467
+ var VizBehavior_1 = __webpack_require__(5);
483
468
 
484
- var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
485
- var width = _ref2.width,
486
- height = _ref2.height;
487
- return {
488
- style: Object.assign(Object.assign({}, width && {
489
- width: style_1.toPx(width)
490
- }), height && {
491
- height: style_1.toPx(height)
492
- })
493
- };
494
- }).withConfig({
495
- displayName: "FixedSizeContainer__FixSizeItem",
496
- componentId: "sc-1yhgpod-1"
497
- })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
498
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
499
- });
500
- var ItemContent = styled_components_1.default.div.withConfig({
501
- displayName: "FixedSizeContainer__ItemContent",
502
- componentId: "sc-1yhgpod-2"
503
- })(["position:relative;min-height:100px;width:100%;"]);
504
- var FixSizeItemContent = styled_components_1.default.div.withConfig({
505
- displayName: "FixedSizeContainer__FixSizeItemContent",
506
- componentId: "sc-1yhgpod-3"
507
- })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
469
+ var VizCategory_1 = __webpack_require__(26);
508
470
 
509
- var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
510
- var FixedSizeContainer = function FixedSizeContainer(props) {
511
- var width = props.width,
512
- height = props.height,
513
- backgroundColor = props.backgroundColor;
471
+ var configUtils_1 = __webpack_require__(6);
514
472
 
515
- if (!height) {
516
- return React.createElement(Item, {
517
- "data-test": "item",
518
- width: width,
519
- backgroundColor: backgroundColor
520
- }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
521
- }
473
+ var BackgroundColor_1 = __webpack_require__(45);
522
474
 
523
- return React.createElement(FixSizeItem, {
524
- "data-test": "fix-size-item",
525
- "data-splunk-visualization-version": version_1.version,
526
- width: width,
527
- height: height,
528
- backgroundColor: backgroundColor
529
- }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
530
- var newWidth = _ref3.width,
531
- newHeight = _ref3.height;
532
- return React.createElement(Viz, Object.assign({}, props, {
533
- width: newWidth,
534
- height: newHeight
535
- }));
536
- })));
537
- };
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
+ }
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
+ */
538
642
 
539
- FixedSizeContainer.displayName = 'withFixedSizeContainer';
540
- return FixedSizeContainer;
643
+ var config = {
644
+ /**
645
+ * unique viz key
646
+ */
647
+ key: 'splunk.pie',
648
+
649
+ /**
650
+ * viz name
651
+ */
652
+ name: 'Pie',
653
+ category: VizCategory_1.VizCategory.COMPARISONS,
654
+
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
541
671
  };
672
+ exports.default = configUtils_1.enhanceConfig(config);
542
673
 
543
- exports.default = withFixedSizeContainer;
674
+ /***/ }),
675
+
676
+ /***/ 219:
677
+ /***/ (function(module, exports) {
678
+
679
+ module.exports = require("@splunk/react-icons/ChartPie");
544
680
 
545
681
  /***/ }),
546
- /* 13 */
682
+
683
+ /***/ 220:
547
684
  /***/ (function(module, exports, __webpack_require__) {
548
685
 
549
686
  "use strict";
550
687
 
551
688
 
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
+ };
701
+
552
702
  Object.defineProperty(exports, "__esModule", {
553
703
  value: true
554
704
  });
555
- exports.version = void 0;
556
- exports.version = '24.2.0';
705
+ exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
557
706
 
558
- /***/ }),
559
- /* 14 */
560
- /***/ (function(module, exports) {
707
+ var lodash_1 = __webpack_require__(2);
561
708
 
562
- module.exports = require("@splunk/visualizations-shared/style");
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
563
711
 
564
- /***/ }),
565
- /* 15 */
566
- /***/ (function(module, exports) {
567
712
 
568
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
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
+ */
569
726
 
570
- /***/ }),
571
- /* 16 */,
572
- /* 17 */
573
- /***/ (function(module, exports) {
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
+ };
574
734
 
575
- module.exports = require("@babel/runtime/helpers/createClass");
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
+ */
576
742
 
577
- /***/ }),
578
- /* 18 */
579
- /***/ (function(module, exports) {
743
+ var mapLabelDisplay = function mapLabelDisplay(_a) {
744
+ var labelDisplay = _a.labelDisplay,
745
+ options = __rest(_a, ["labelDisplay"]);
580
746
 
581
- module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
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
+ }
582
758
 
583
- /***/ }),
584
- /* 19 */
585
- /***/ (function(module, exports) {
759
+ return convertedOptions;
760
+ };
586
761
 
587
- module.exports = require("@splunk/visualizations-shared/propUtils");
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
+ */
588
770
 
589
- /***/ }),
590
- /* 20 */
591
- /***/ (function(module, exports) {
771
+ var mapToOldKey = function mapToOldKey(options) {
772
+ return lodash_1.mapKeys(options, function (val, key) {
773
+ return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
774
+ });
775
+ };
592
776
 
593
- module.exports = require("@splunk/themes/variables");
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
+ */
594
786
 
595
- /***/ }),
596
- /* 21 */
597
- /***/ (function(module, exports) {
787
+ var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
788
+ return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
789
+ };
598
790
 
599
- module.exports = require("@splunk/themes/pick");
791
+ exports.convertToPieSCProperties = convertToPieSCProperties;
600
792
 
601
793
  /***/ }),
602
- /* 22 */,
603
- /* 23 */
604
- /***/ (function(module, exports) {
605
-
606
- module.exports = require("@babel/runtime/helpers/typeof");
607
794
 
608
- /***/ }),
609
- /* 24 */
795
+ /***/ 23:
610
796
  /***/ (function(module, exports, __webpack_require__) {
611
797
 
612
798
  "use strict";
613
799
 
614
800
 
615
- var _defineProperty = __webpack_require__(7);
801
+ var _defineProperty = __webpack_require__(8);
616
802
 
617
803
  Object.defineProperty(exports, "__esModule", {
618
804
  value: true
@@ -623,7 +809,7 @@ var T = __webpack_require__(0);
623
809
 
624
810
  var lodash_1 = __webpack_require__(2);
625
811
 
626
- var DataSource_1 = __webpack_require__(34);
812
+ var DataSource_1 = __webpack_require__(33);
627
813
 
628
814
  exports.SortParamsPropTypes = T.shape({
629
815
  currentSortKey: T.string,
@@ -676,7 +862,8 @@ var getSortingParams = function getSortingParams(_ref) {
676
862
  exports.getSortingParams = getSortingParams;
677
863
 
678
864
  /***/ }),
679
- /* 25 */
865
+
866
+ /***/ 24:
680
867
  /***/ (function(module, exports, __webpack_require__) {
681
868
 
682
869
  "use strict";
@@ -740,7 +927,8 @@ var getPaginationParams = function getPaginationParams(_ref) {
740
927
  exports.getPaginationParams = getPaginationParams;
741
928
 
742
929
  /***/ }),
743
- /* 26 */
930
+
931
+ /***/ 25:
744
932
  /***/ (function(module, exports, __webpack_require__) {
745
933
 
746
934
  "use strict";
@@ -828,7 +1016,8 @@ IconPlaceholder.defaultProps = {
828
1016
  exports.default = FixedSizeContainer_1.default(IconPlaceholder);
829
1017
 
830
1018
  /***/ }),
831
- /* 27 */
1019
+
1020
+ /***/ 26:
832
1021
  /***/ (function(module, exports, __webpack_require__) {
833
1022
 
834
1023
  "use strict";
@@ -856,7 +1045,8 @@ var VizCategory;
856
1045
  })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
857
1046
 
858
1047
  /***/ }),
859
- /* 28 */
1048
+
1049
+ /***/ 27:
860
1050
  /***/ (function(module, exports, __webpack_require__) {
861
1051
 
862
1052
  "use strict";
@@ -870,33 +1060,33 @@ var React = __webpack_require__(1);
870
1060
 
871
1061
  var lodash_1 = __webpack_require__(2);
872
1062
 
873
- var getSettingsFromThemedProps_1 = __webpack_require__(29);
1063
+ var getSettingsFromThemedProps_1 = __webpack_require__(28);
874
1064
 
875
- var Options_1 = __webpack_require__(30);
1065
+ var Options_1 = __webpack_require__(29);
876
1066
 
877
- var SanitizeProps_1 = __webpack_require__(31);
1067
+ var SanitizeProps_1 = __webpack_require__(30);
878
1068
 
879
1069
  var styled_components_1 = __webpack_require__(4);
880
1070
 
881
- var SplunkVisualization_1 = __webpack_require__(32);
1071
+ var SplunkVisualization_1 = __webpack_require__(31);
882
1072
 
883
1073
  var VizBehavior_1 = __webpack_require__(5);
884
1074
 
885
- var getSorting_1 = __webpack_require__(24);
1075
+ var getSorting_1 = __webpack_require__(23);
886
1076
 
887
- var getPagination_1 = __webpack_require__(25);
1077
+ var getPagination_1 = __webpack_require__(24);
888
1078
 
889
- var useDeepMemo_1 = __webpack_require__(35);
1079
+ var useDeepMemo_1 = __webpack_require__(34);
890
1080
 
891
- var JSONSchemaUtils_1 = __webpack_require__(36);
1081
+ var JSONSchemaUtils_1 = __webpack_require__(35);
892
1082
 
893
- var MissingPropsMessage_1 = __webpack_require__(37);
1083
+ var MissingPropsMessage_1 = __webpack_require__(36);
894
1084
 
895
- var withEditModeCover_1 = __webpack_require__(38);
1085
+ var withEditModeCover_1 = __webpack_require__(37);
896
1086
 
897
- var withPlaceholder_1 = __webpack_require__(39);
1087
+ var withPlaceholder_1 = __webpack_require__(38);
898
1088
 
899
- var hocUtils_1 = __webpack_require__(8);
1089
+ var hocUtils_1 = __webpack_require__(7);
900
1090
  /**
901
1091
  * hoc that wraps a pure react visualization in a Dashboard visualization
902
1092
  * @param {DashboardVizOpts} opts
@@ -909,6 +1099,7 @@ var withDashboardViz = function withDashboardViz(opts) {
909
1099
  vizConfig = opts.vizConfig,
910
1100
  _opts$computeVizProps = opts.computeVizProps,
911
1101
  computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
1102
+ disableEditModeCover = opts.disableEditModeCover,
912
1103
  useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
913
1104
 
914
1105
  var SanitizedReactViz = SanitizeProps_1.withSanitizedProps(ReactViz);
@@ -1073,31 +1264,42 @@ var withDashboardViz = function withDashboardViz(opts) {
1073
1264
 
1074
1265
  DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1075
1266
 
1076
- 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));
1077
1268
  };
1078
1269
 
1079
1270
  exports.default = withDashboardViz;
1080
1271
 
1081
1272
  /***/ }),
1082
- /* 29 */
1273
+
1274
+ /***/ 28:
1083
1275
  /***/ (function(module, exports) {
1084
1276
 
1085
1277
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1086
1278
 
1087
1279
  /***/ }),
1088
- /* 30 */
1280
+
1281
+ /***/ 29:
1089
1282
  /***/ (function(module, exports) {
1090
1283
 
1091
1284
  module.exports = require("@splunk/visualization-encoding/Options");
1092
1285
 
1093
1286
  /***/ }),
1094
- /* 31 */
1287
+
1288
+ /***/ 3:
1289
+ /***/ (function(module, exports) {
1290
+
1291
+ module.exports = require("@splunk/ui-utils/i18n");
1292
+
1293
+ /***/ }),
1294
+
1295
+ /***/ 30:
1095
1296
  /***/ (function(module, exports) {
1096
1297
 
1097
1298
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1098
1299
 
1099
1300
  /***/ }),
1100
- /* 32 */
1301
+
1302
+ /***/ 31:
1101
1303
  /***/ (function(module, exports, __webpack_require__) {
1102
1304
 
1103
1305
  "use strict";
@@ -1115,7 +1317,7 @@ var T = __webpack_require__(0);
1115
1317
 
1116
1318
  var lodash_1 = __webpack_require__(2);
1117
1319
 
1118
- var VizActionHandler_1 = __webpack_require__(33); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1320
+ var VizActionHandler_1 = __webpack_require__(32); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1119
1321
 
1120
1322
 
1121
1323
  exports.INITIAL_WIDTH = 250;
@@ -1248,7 +1450,8 @@ SplunkVisualization.defaultProps = {
1248
1450
  exports.default = SplunkVisualization;
1249
1451
 
1250
1452
  /***/ }),
1251
- /* 33 */
1453
+
1454
+ /***/ 32:
1252
1455
  /***/ (function(module, exports, __webpack_require__) {
1253
1456
 
1254
1457
  "use strict";
@@ -1256,7 +1459,7 @@ exports.default = SplunkVisualization;
1256
1459
 
1257
1460
  var _classCallCheck = __webpack_require__(10);
1258
1461
 
1259
- var _createClass = __webpack_require__(17);
1462
+ var _createClass = __webpack_require__(15);
1260
1463
 
1261
1464
  Object.defineProperty(exports, "__esModule", {
1262
1465
  value: true
@@ -1285,7 +1488,8 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
1285
1488
  exports.DefaultVizActionHandler = DefaultVizActionHandler;
1286
1489
 
1287
1490
  /***/ }),
1288
- /* 34 */
1491
+
1492
+ /***/ 33:
1289
1493
  /***/ (function(module, exports, __webpack_require__) {
1290
1494
 
1291
1495
  "use strict";
@@ -1298,7 +1502,8 @@ exports.validSortDirs = void 0;
1298
1502
  exports.validSortDirs = ['asc', 'desc', 'none'];
1299
1503
 
1300
1504
  /***/ }),
1301
- /* 35 */
1505
+
1506
+ /***/ 34:
1302
1507
  /***/ (function(module, exports, __webpack_require__) {
1303
1508
 
1304
1509
  "use strict";
@@ -1343,7 +1548,8 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1343
1548
  exports.useDeepMemo = useDeepMemo;
1344
1549
 
1345
1550
  /***/ }),
1346
- /* 36 */
1551
+
1552
+ /***/ 35:
1347
1553
  /***/ (function(module, exports, __webpack_require__) {
1348
1554
 
1349
1555
  "use strict";
@@ -1376,7 +1582,8 @@ var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
1376
1582
  exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
1377
1583
 
1378
1584
  /***/ }),
1379
- /* 37 */
1585
+
1586
+ /***/ 36:
1380
1587
  /***/ (function(module, exports, __webpack_require__) {
1381
1588
 
1382
1589
  "use strict";
@@ -1456,7 +1663,8 @@ exports.MissingPropsMessage.defaultProps = {
1456
1663
  exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
1457
1664
 
1458
1665
  /***/ }),
1459
- /* 38 */
1666
+
1667
+ /***/ 37:
1460
1668
  /***/ (function(module, exports, __webpack_require__) {
1461
1669
 
1462
1670
  "use strict";
@@ -1470,16 +1678,14 @@ var React = __webpack_require__(1);
1470
1678
 
1471
1679
  var styled_components_1 = __webpack_require__(4);
1472
1680
 
1473
- var hocUtils_1 = __webpack_require__(8);
1474
-
1475
- var version_1 = __webpack_require__(13);
1681
+ var hocUtils_1 = __webpack_require__(7);
1476
1682
 
1477
1683
  var Cover = styled_components_1.default.div.withConfig({
1478
1684
  displayName: "withEditModeCover__Cover",
1479
1685
  componentId: "sc-1gsbnxb-0"
1480
1686
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1481
1687
  var Blocker = styled_components_1.default.div.attrs({
1482
- 'data-splunk-visualization-version': version_1.version
1688
+ 'data-splunk-visualization-version': "24.3.2 - 1cf892b72"
1483
1689
  }).withConfig({
1484
1690
  displayName: "withEditModeCover__Blocker",
1485
1691
  componentId: "sc-1gsbnxb-1"
@@ -1491,10 +1697,11 @@ var Blocker = styled_components_1.default.div.attrs({
1491
1697
  * @returns {ExtendedDashViz} Wrapper
1492
1698
  */
1493
1699
 
1494
- var withEditModeCover = function withEditModeCover(Visualization) {
1700
+ var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
1495
1701
  var Wrapper = function Wrapper(props) {
1496
1702
  var mode = props.mode;
1497
- 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, {
1498
1705
  "data-test": "edit-mode-cover"
1499
1706
  }));
1500
1707
  };
@@ -1509,7 +1716,8 @@ var withEditModeCover = function withEditModeCover(Visualization) {
1509
1716
  exports.default = withEditModeCover;
1510
1717
 
1511
1718
  /***/ }),
1512
- /* 39 */
1719
+
1720
+ /***/ 38:
1513
1721
  /***/ (function(module, exports, __webpack_require__) {
1514
1722
 
1515
1723
  "use strict";
@@ -1523,11 +1731,11 @@ var React = __webpack_require__(1);
1523
1731
 
1524
1732
  var colorUtils_1 = __webpack_require__(11);
1525
1733
 
1526
- var IconPlaceholder_1 = __webpack_require__(26);
1734
+ var IconPlaceholder_1 = __webpack_require__(25);
1527
1735
 
1528
1736
  var VizBehavior_1 = __webpack_require__(5);
1529
1737
 
1530
- var hocUtils_1 = __webpack_require__(8);
1738
+ var hocUtils_1 = __webpack_require__(7);
1531
1739
 
1532
1740
  var withPlaceholder = function withPlaceholder(Visualization) {
1533
1741
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
@@ -1568,23 +1776,29 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1568
1776
  exports.default = withPlaceholder;
1569
1777
 
1570
1778
  /***/ }),
1571
- /* 40 */
1779
+
1780
+ /***/ 39:
1572
1781
  /***/ (function(module, exports) {
1573
1782
 
1574
1783
  module.exports = require("@babel/runtime/helpers/toConsumableArray");
1575
1784
 
1576
1785
  /***/ }),
1577
- /* 41 */,
1578
- /* 42 */
1786
+
1787
+ /***/ 4:
1788
+ /***/ (function(module, exports) {
1789
+
1790
+ module.exports = require("styled-components");
1791
+
1792
+ /***/ }),
1793
+
1794
+ /***/ 41:
1579
1795
  /***/ (function(module, exports) {
1580
1796
 
1581
1797
  module.exports = require("@splunk/visualization-color-palettes");
1582
1798
 
1583
1799
  /***/ }),
1584
- /* 43 */,
1585
- /* 44 */,
1586
- /* 45 */,
1587
- /* 46 */
1800
+
1801
+ /***/ 45:
1588
1802
  /***/ (function(module, exports, __webpack_require__) {
1589
1803
 
1590
1804
  "use strict";
@@ -1614,13 +1828,14 @@ var background = function background(_ref) {
1614
1828
  exports.default = background;
1615
1829
 
1616
1830
  /***/ }),
1617
- /* 47 */
1831
+
1832
+ /***/ 46:
1618
1833
  /***/ (function(module, exports, __webpack_require__) {
1619
1834
 
1620
1835
  "use strict";
1621
1836
 
1622
1837
 
1623
- var _toConsumableArray = __webpack_require__(40);
1838
+ var _toConsumableArray = __webpack_require__(39);
1624
1839
 
1625
1840
  var __rest = this && this.__rest || function (s, e) {
1626
1841
  var t = {};
@@ -1835,15 +2050,53 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
1835
2050
  exports.constructFieldsAndColumns = constructFieldsAndColumns;
1836
2051
 
1837
2052
  /***/ }),
1838
- /* 48 */
2053
+
2054
+ /***/ 47:
1839
2055
  /***/ (function(module, exports) {
1840
2056
 
1841
2057
  module.exports = require("@splunk/charting-bundle");
1842
2058
 
1843
2059
  /***/ }),
1844
- /* 49 */,
1845
- /* 50 */,
1846
- /* 51 */
2060
+
2061
+ /***/ 5:
2062
+ /***/ (function(module, exports, __webpack_require__) {
2063
+
2064
+ "use strict";
2065
+
2066
+
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:
1847
2100
  /***/ (function(module, exports, __webpack_require__) {
1848
2101
 
1849
2102
  "use strict";
@@ -1859,7 +2112,7 @@ var lodash_1 = __webpack_require__(2);
1859
2112
 
1860
2113
  var i18n_1 = __webpack_require__(3);
1861
2114
 
1862
- var visualization_color_palettes_1 = __webpack_require__(42);
2115
+ var visualization_color_palettes_1 = __webpack_require__(41);
1863
2116
 
1864
2117
  var react_1 = __webpack_require__(1);
1865
2118
 
@@ -1872,11 +2125,11 @@ var react_event_listener_1 = __webpack_require__(52);
1872
2125
  __webpack_require__(53); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
1873
2126
 
1874
2127
 
1875
- var charting_bundle_1 = __webpack_require__(48);
2128
+ var charting_bundle_1 = __webpack_require__(47);
1876
2129
 
1877
2130
  var TimezoneContext_1 = __webpack_require__(54);
1878
2131
 
1879
- var style_1 = __webpack_require__(14);
2132
+ var style_1 = __webpack_require__(13);
1880
2133
 
1881
2134
  var styled_components_1 = __webpack_require__(4);
1882
2135
 
@@ -2265,37 +2518,43 @@ var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
2265
2518
  exports.default = withEmptyChartMessage(Charting);
2266
2519
 
2267
2520
  /***/ }),
2268
- /* 52 */
2521
+
2522
+ /***/ 52:
2269
2523
  /***/ (function(module, exports) {
2270
2524
 
2271
2525
  module.exports = require("react-event-listener");
2272
2526
 
2273
2527
  /***/ }),
2274
- /* 53 */
2528
+
2529
+ /***/ 53:
2275
2530
  /***/ (function(module, exports) {
2276
2531
 
2277
2532
  module.exports = require("@splunk/visualizations-shared/i18n");
2278
2533
 
2279
2534
  /***/ }),
2280
- /* 54 */
2535
+
2536
+ /***/ 54:
2281
2537
  /***/ (function(module, exports) {
2282
2538
 
2283
2539
  module.exports = require("@splunk/visualization-context/TimezoneContext");
2284
2540
 
2285
2541
  /***/ }),
2286
- /* 55 */
2542
+
2543
+ /***/ 55:
2287
2544
  /***/ (function(module, exports) {
2288
2545
 
2289
2546
  module.exports = require("@splunk/themes/useSplunkTheme");
2290
2547
 
2291
2548
  /***/ }),
2292
- /* 56 */
2549
+
2550
+ /***/ 56:
2293
2551
  /***/ (function(module, exports) {
2294
2552
 
2295
2553
  module.exports = require("@splunk/visualizations-shared/themeUtils");
2296
2554
 
2297
2555
  /***/ }),
2298
- /* 57 */
2556
+
2557
+ /***/ 57:
2299
2558
  /***/ (function(module, exports, __webpack_require__) {
2300
2559
 
2301
2560
  "use strict";
@@ -2303,7 +2562,7 @@ module.exports = require("@splunk/visualizations-shared/themeUtils");
2303
2562
 
2304
2563
  var _classCallCheck = __webpack_require__(10);
2305
2564
 
2306
- var _createClass = __webpack_require__(17);
2565
+ var _createClass = __webpack_require__(15);
2307
2566
 
2308
2567
  Object.defineProperty(exports, "__esModule", {
2309
2568
  value: true
@@ -2355,666 +2614,300 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
2355
2614
 
2356
2615
  return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
2357
2616
  }
2358
- }]);
2359
-
2360
- return ChartingApiFunctional;
2361
- }();
2362
-
2363
- exports.ChartingApiFunctional = ChartingApiFunctional;
2364
-
2365
- /***/ }),
2366
- /* 58 */
2367
- /***/ (function(module, exports) {
2368
-
2369
- module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
2370
-
2371
- /***/ }),
2372
- /* 59 */,
2373
- /* 60 */,
2374
- /* 61 */,
2375
- /* 62 */,
2376
- /* 63 */,
2377
- /* 64 */,
2378
- /* 65 */,
2379
- /* 66 */,
2380
- /* 67 */,
2381
- /* 68 */,
2382
- /* 69 */,
2383
- /* 70 */,
2384
- /* 71 */,
2385
- /* 72 */,
2386
- /* 73 */,
2387
- /* 74 */,
2388
- /* 75 */,
2389
- /* 76 */,
2390
- /* 77 */,
2391
- /* 78 */,
2392
- /* 79 */,
2393
- /* 80 */,
2394
- /* 81 */,
2395
- /* 82 */,
2396
- /* 83 */,
2397
- /* 84 */,
2398
- /* 85 */,
2399
- /* 86 */,
2400
- /* 87 */,
2401
- /* 88 */,
2402
- /* 89 */,
2403
- /* 90 */,
2404
- /* 91 */,
2405
- /* 92 */,
2406
- /* 93 */,
2407
- /* 94 */,
2408
- /* 95 */,
2409
- /* 96 */,
2410
- /* 97 */,
2411
- /* 98 */,
2412
- /* 99 */,
2413
- /* 100 */,
2414
- /* 101 */,
2415
- /* 102 */,
2416
- /* 103 */,
2417
- /* 104 */,
2418
- /* 105 */,
2419
- /* 106 */,
2420
- /* 107 */,
2421
- /* 108 */,
2422
- /* 109 */,
2423
- /* 110 */,
2424
- /* 111 */,
2425
- /* 112 */,
2426
- /* 113 */,
2427
- /* 114 */,
2428
- /* 115 */,
2429
- /* 116 */,
2430
- /* 117 */,
2431
- /* 118 */,
2432
- /* 119 */,
2433
- /* 120 */,
2434
- /* 121 */,
2435
- /* 122 */,
2436
- /* 123 */,
2437
- /* 124 */,
2438
- /* 125 */,
2439
- /* 126 */
2440
- /***/ (function(module, exports, __webpack_require__) {
2441
-
2442
- "use strict";
2443
-
2444
-
2445
- var __rest = this && this.__rest || function (s, e) {
2446
- var t = {};
2447
-
2448
- for (var p in s) {
2449
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2450
- }
2451
-
2452
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2453
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2454
- }
2455
- return t;
2456
- };
2457
-
2458
- Object.defineProperty(exports, "__esModule", {
2459
- value: true
2460
- });
2461
- exports.config = exports.themes = exports.computeVizProps = exports.PieInnerSize = void 0;
2462
-
2463
- var lodash_1 = __webpack_require__(2); // Charting imports i18n which needs to be run to instantiate window globals in the
2464
- // eslint-disable-next-line import/order
2465
-
2466
-
2467
- var Charting_1 = __webpack_require__(51);
2468
-
2469
- var charting_bundle_1 = __webpack_require__(48);
2470
-
2471
- var simpleXMLOptions_1 = __webpack_require__(58);
2472
-
2473
- var config_1 = __webpack_require__(206);
2474
-
2475
- exports.config = config_1.default;
2476
-
2477
- var withDashboardViz_1 = __webpack_require__(28);
2478
-
2479
- var pieUtils_1 = __webpack_require__(208);
2480
-
2481
- var chartingUtils_1 = __webpack_require__(47);
2482
-
2483
- var validOptions = Object.keys(config_1.default.optionsSchema);
2484
- exports.PieInnerSize = 0.7;
2485
-
2486
- var computeVizProps = function computeVizProps(_a) {
2487
- var dataSources = _a.dataSources,
2488
- onEventTrigger = _a.onEventTrigger,
2489
- label = _a.label,
2490
- value = _a.value,
2491
- showDonutHole = _a.showDonutHole,
2492
- visualizationApiRef = _a.visualizationApiRef,
2493
- otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "label", "value", "showDonutHole", "visualizationApiRef"]); // options to be passed as props
2494
-
2495
-
2496
- var computedProps = {
2497
- visualizationApiRef: visualizationApiRef
2498
- };
2499
- var labelField = otherOptions.labelField,
2500
- valueField = otherOptions.valueField,
2501
- hasEventHandlers = otherOptions.hasEventHandlers;
2502
- computedProps.options = lodash_1.chain(otherOptions).pick(validOptions).thru(pieUtils_1.convertToPieSCProperties).thru(function (options) {
2503
- return Object.assign(Object.assign({}, simpleXMLOptions_1.getSimpleXMLOptionsForProps(options)), {
2504
- chart: 'pie'
2505
- });
2506
- }).value();
2507
- var truncationLimit = computedProps.options['chart.resultTruncationLimit'];
2508
- var primaryData = Object.assign(Object.assign({}, dataSources.primary.data), {
2509
- columns: [label, value]
2510
- });
2511
- primaryData.fields = [{
2512
- name: labelField
2513
- }, {
2514
- name: valueField
2515
- }];
2516
- primaryData.columns.forEach(function (column, index) {
2517
- if (column) {
2518
- primaryData.columns[index] = column.map(String);
2519
- }
2520
- });
2521
-
2522
- if (truncationLimit) {
2523
- primaryData = chartingUtils_1.truncateData(primaryData, truncationLimit);
2524
- }
2525
-
2526
- computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign({}, primaryData));
2527
-
2528
- if (showDonutHole) {
2529
- computedProps.options['chart.pieInnerSize'] = exports.PieInnerSize;
2530
- } else {
2531
- computedProps.options['chart.pieInnerSize'] = 0;
2532
- }
2533
-
2534
- if (hasEventHandlers) {
2535
- computedProps.onClick = onEventTrigger;
2536
- }
2537
-
2538
- return computedProps;
2539
- };
2540
-
2541
- exports.computeVizProps = computeVizProps;
2542
- var Pie = withDashboardViz_1.default({
2543
- ReactViz: Charting_1.default,
2544
- computeVizProps: exports.computeVizProps,
2545
- vizConfig: config_1.default
2546
- });
2547
- var themes = null;
2548
- exports.themes = themes;
2549
- exports.default = Pie;
2550
-
2551
- /***/ }),
2552
- /* 127 */,
2553
- /* 128 */,
2554
- /* 129 */,
2555
- /* 130 */,
2556
- /* 131 */,
2557
- /* 132 */,
2558
- /* 133 */,
2559
- /* 134 */,
2560
- /* 135 */,
2561
- /* 136 */,
2562
- /* 137 */,
2563
- /* 138 */,
2564
- /* 139 */,
2565
- /* 140 */,
2566
- /* 141 */,
2567
- /* 142 */,
2568
- /* 143 */,
2569
- /* 144 */,
2570
- /* 145 */,
2571
- /* 146 */,
2572
- /* 147 */,
2573
- /* 148 */,
2574
- /* 149 */,
2575
- /* 150 */,
2576
- /* 151 */,
2577
- /* 152 */,
2578
- /* 153 */,
2579
- /* 154 */,
2580
- /* 155 */,
2581
- /* 156 */,
2582
- /* 157 */,
2583
- /* 158 */,
2584
- /* 159 */,
2585
- /* 160 */,
2586
- /* 161 */,
2587
- /* 162 */,
2588
- /* 163 */,
2589
- /* 164 */,
2590
- /* 165 */,
2591
- /* 166 */,
2592
- /* 167 */,
2593
- /* 168 */,
2594
- /* 169 */,
2595
- /* 170 */,
2596
- /* 171 */,
2597
- /* 172 */,
2598
- /* 173 */,
2599
- /* 174 */,
2600
- /* 175 */,
2601
- /* 176 */,
2602
- /* 177 */,
2603
- /* 178 */,
2604
- /* 179 */,
2605
- /* 180 */,
2606
- /* 181 */,
2607
- /* 182 */,
2608
- /* 183 */,
2609
- /* 184 */,
2610
- /* 185 */,
2611
- /* 186 */,
2612
- /* 187 */,
2613
- /* 188 */,
2614
- /* 189 */,
2615
- /* 190 */,
2616
- /* 191 */,
2617
- /* 192 */,
2618
- /* 193 */,
2619
- /* 194 */,
2620
- /* 195 */,
2621
- /* 196 */,
2622
- /* 197 */,
2623
- /* 198 */,
2624
- /* 199 */,
2625
- /* 200 */,
2626
- /* 201 */,
2627
- /* 202 */,
2628
- /* 203 */,
2629
- /* 204 */,
2630
- /* 205 */
2631
- /***/ (function(module, exports, __webpack_require__) {
2632
-
2633
- "use strict";
2634
-
2635
-
2636
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
2637
- if (k2 === undefined) k2 = k;
2638
- Object.defineProperty(o, k2, {
2639
- enumerable: true,
2640
- get: function get() {
2641
- return m[k];
2642
- }
2643
- });
2644
- } : function (o, m, k, k2) {
2645
- if (k2 === undefined) k2 = k;
2646
- o[k2] = m[k];
2647
- });
2617
+ }]);
2648
2618
 
2649
- var __exportStar = this && this.__exportStar || function (m, exports) {
2650
- for (var p in m) {
2651
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2652
- }
2653
- };
2619
+ return ChartingApiFunctional;
2620
+ }();
2654
2621
 
2655
- Object.defineProperty(exports, "__esModule", {
2656
- value: true
2657
- });
2658
- exports.default = void 0;
2622
+ exports.ChartingApiFunctional = ChartingApiFunctional;
2659
2623
 
2660
- __exportStar(__webpack_require__(126), exports);
2624
+ /***/ }),
2661
2625
 
2662
- var Pie_1 = __webpack_require__(126);
2626
+ /***/ 58:
2627
+ /***/ (function(module, exports) {
2663
2628
 
2664
- Object.defineProperty(exports, "default", {
2665
- enumerable: true,
2666
- get: function get() {
2667
- return Pie_1.default;
2668
- }
2669
- });
2629
+ module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
2670
2630
 
2671
2631
  /***/ }),
2672
- /* 206 */
2632
+
2633
+ /***/ 6:
2673
2634
  /***/ (function(module, exports, __webpack_require__) {
2674
2635
 
2675
2636
  "use strict";
2676
2637
 
2677
2638
 
2678
- Object.defineProperty(exports, "__esModule", {
2679
- value: true
2680
- });
2639
+ var _defineProperty = __webpack_require__(8);
2681
2640
 
2682
- var ChartPie_1 = __webpack_require__(207);
2641
+ var __rest = this && this.__rest || function (s, e) {
2642
+ var t = {};
2683
2643
 
2684
- var i18n_1 = __webpack_require__(3);
2644
+ for (var p in s) {
2645
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2646
+ }
2685
2647
 
2686
- var schemaUtils_1 = __webpack_require__(15);
2648
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2649
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2650
+ }
2651
+ return t;
2652
+ };
2687
2653
 
2688
- var visualization_color_palettes_1 = __webpack_require__(42);
2654
+ Object.defineProperty(exports, "__esModule", {
2655
+ value: true
2656
+ });
2657
+ exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
2689
2658
 
2690
- var pick_1 = __webpack_require__(21);
2659
+ var lodash_1 = __webpack_require__(2);
2691
2660
 
2692
- var variables_1 = __webpack_require__(20);
2661
+ var schemaUtils_1 = __webpack_require__(14);
2693
2662
 
2694
2663
  var VizBehavior_1 = __webpack_require__(5);
2695
2664
 
2696
- var VizCategory_1 = __webpack_require__(27);
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
+ */
2697
2674
 
2698
- var configUtils_1 = __webpack_require__(6);
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"]);
2699
2689
 
2700
- var BackgroundColor_1 = __webpack_require__(46);
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
+ });
2701
2703
 
2702
- var dataContract = {
2703
- requiredDataSources: [{
2704
- name: 'primary',
2705
- description: 'DataSource that powers the visualization'
2706
- }],
2707
- optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
2708
- // {
2709
- // name: 'annotation',
2710
- // description: 'DataSource that populate event annotations',
2711
- // },
2712
- ],
2713
- initialRequestParams: {
2714
- primary: {
2715
- offset: 0,
2716
- count: 10000
2717
- }
2718
- }
2719
- };
2720
- var size = {
2721
- initialWidth: 300,
2722
- initialHeight: 300
2723
- };
2724
- var defaultContext = {};
2725
- var optionsSchema = {
2726
- backgroundColor: {
2727
- default: '> themes.defaultBackgroundColor',
2728
- 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".',
2729
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN,
2730
- type: 'string'
2731
- },
2732
- collapseLabel: {
2733
- description: 'Specify the label for the consolidated slice.',
2734
- type: 'string',
2735
- default: 'other'
2736
- },
2737
- collapseThreshold: {
2738
- 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.',
2739
- type: 'number',
2740
- default: 0.01
2741
- },
2742
- label: {
2743
- description: 'List of string values to display the pie chart labels.',
2744
- type: 'array',
2745
- items: {
2746
- type: 'string'
2747
- },
2748
- default: '> primary | seriesByIndex(0)'
2749
- },
2750
- labelField: {
2751
- default: '> label | getField()',
2752
- description: 'Specify the field that corresponds to the labels.',
2753
- type: 'string'
2754
- },
2755
- labelDisplay: {
2756
- description: 'Specify whether to display the labels and/or slice percentages.',
2757
- type: 'string',
2758
- pattern: schemaUtils_1.getPattern(['values', 'valuesAndPercentage', 'off']),
2759
- default: 'values'
2760
- },
2761
- resultLimit: {
2762
- default: 50000,
2763
- description: 'Specify the number of data points rendered in a chart.',
2764
- type: 'number'
2765
- },
2766
- seriesColors: {
2767
- default: visualization_color_palettes_1.VIZ_CATEGORICAL,
2768
- description: 'Specify the colors used for a series. For example, ["#FF0000", "#0000FF", "#008000"].',
2769
- type: 'array',
2770
- items: {
2771
- type: 'string'
2772
- }
2773
- },
2774
- seriesColorsByField: {
2775
- description: 'Specify the colors used for specific pie slice labels. For example: {"April": "#008000", "May": "#FFA500"}.',
2776
- type: 'object'
2777
- },
2778
- showDonutHole: {
2779
- default: false,
2780
- description: 'Specify whether the pie should be a donut.',
2781
- type: 'boolean'
2782
- },
2783
- value: {
2784
- description: 'List of numerical values to power the pie chart.',
2785
- type: 'array',
2786
- items: {
2787
- type: 'number'
2788
- },
2789
- default: '> primary | seriesByIndex(1)'
2790
- },
2791
- valueField: {
2792
- default: '> value | getField()',
2793
- description: 'Specify the field that corresponds to the data powering values.',
2794
- type: 'string'
2795
- }
2796
- };
2797
- var themes = {
2798
- defaultBackgroundColor: function defaultBackgroundColor(props) {
2799
- return pick_1.default({
2800
- enterprise: {
2801
- dark: variables_1.default.black(props),
2802
- light: variables_1.default.backgroundColor(props)
2803
- },
2804
- prisma: variables_1.default.backgroundColorSidebar(props)
2805
- })(props);
2806
- }
2807
- };
2808
- var editorConfig = [{
2809
- label: i18n_1._('General'),
2810
- layout: [BackgroundColor_1.default({
2811
- themes: themes
2812
- })]
2813
- }, {
2814
- label: i18n_1._('Appearance'),
2815
- open: true,
2816
- layout: [[{
2817
- label: i18n_1._(''),
2818
- option: 'showDonutHole',
2819
- editor: 'editor.radioBar',
2820
- editorProps: {
2821
- values: [{
2822
- label: i18n_1._('Pie'),
2823
- value: false
2824
- }, {
2825
- label: i18n_1._('Donut'),
2826
- value: true
2827
- }]
2828
- }
2829
- }]]
2830
- }, {
2831
- label: i18n_1._('Labels'),
2832
- layout: [[{
2833
- label: '',
2834
- option: 'labelDisplay',
2835
- editor: 'editor.radioBar',
2836
- editorProps: {
2837
- values: [{
2838
- label: i18n_1._('Values'),
2839
- value: 'values'
2840
- }, {
2841
- label: i18n_1._('Values & Percent'),
2842
- value: 'valuesAndPercentage'
2843
- }, {
2844
- label: i18n_1._('Off'),
2845
- value: 'off'
2846
- }]
2847
- }
2848
- }]]
2849
- }, {
2850
- label: i18n_1._('Collapse to Summary'),
2851
- layout: [[{
2852
- label: i18n_1._('Collapse Threshold'),
2853
- option: 'collapseThreshold',
2854
- editor: 'editor.number',
2855
- editorProps: {
2856
- min: 0,
2857
- max: 1,
2858
- step: 0.01
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
+ });
2710
+
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
+ });
2859
2724
  }
2860
- }], [{
2861
- label: i18n_1._('Collapsed Slice Label'),
2862
- option: 'collapseLabel',
2863
- editor: 'editor.text'
2864
- }]]
2865
- }];
2725
+ });
2726
+ return enhancedOptionsSchema;
2727
+ }
2728
+
2729
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
2866
2730
  /**
2867
- * 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
2868
2734
  */
2869
2735
 
2870
- var config = {
2871
- /**
2872
- * unique viz key
2873
- */
2874
- key: 'splunk.pie',
2736
+ function enhanceConfig(vizConfig) {
2737
+ var enhancedConfig = vizConfig;
2875
2738
 
2876
- /**
2877
- * viz name
2878
- */
2879
- name: 'Pie',
2880
- category: VizCategory_1.VizCategory.COMPARISONS,
2739
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
2740
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
2741
+ }
2881
2742
 
2882
- /**
2883
- * viz icon
2884
- */
2885
- icon: ChartPie_1.default,
2886
- dataContract: dataContract,
2887
- size: size,
2888
- defaultContext: defaultContext,
2889
- optionsSchema: optionsSchema,
2890
- editorConfig: editorConfig,
2891
- events: {
2892
- 'point.click': {
2893
- description: 'triggered when user clicks on a point in the pie chart'
2894
- }
2895
- },
2896
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
2897
- themes: themes
2898
- };
2899
- exports.default = configUtils_1.enhanceConfig(config);
2743
+ return enhancedConfig;
2744
+ }
2900
2745
 
2901
- /***/ }),
2902
- /* 207 */
2903
- /***/ (function(module, exports) {
2746
+ exports.enhanceConfig = enhanceConfig;
2904
2747
 
2905
- 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;
2906
2822
 
2907
2823
  /***/ }),
2908
- /* 208 */
2824
+
2825
+ /***/ 7:
2909
2826
  /***/ (function(module, exports, __webpack_require__) {
2910
2827
 
2911
2828
  "use strict";
2912
2829
 
2913
2830
 
2914
- var __rest = this && this.__rest || function (s, e) {
2915
- var t = {};
2916
-
2917
- for (var p in s) {
2918
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2919
- }
2920
-
2921
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2922
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2923
- }
2924
- return t;
2925
- };
2831
+ var _typeof = __webpack_require__(20);
2926
2832
 
2927
2833
  Object.defineProperty(exports, "__esModule", {
2928
2834
  value: true
2929
2835
  });
2930
- exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
2836
+ exports.deepMergeWithArrayOverrides = exports.extendStaticWrapperProps = void 0;
2931
2837
 
2932
2838
  var lodash_1 = __webpack_require__(2);
2933
-
2934
- var propUtils_1 = __webpack_require__(19); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
2935
- // map for key names which are either new or not present in SimpleXML options mapping
2936
-
2937
-
2938
- var pieOptionsSCMapping = {
2939
- resultLimit: 'resultTruncationLimit',
2940
- seriesColorsByField: 'fieldColors',
2941
- collapseThreshold: 'chart.sliceCollapsingThreshold',
2942
- collapseLabel: 'chart.sliceCollapsingLabel'
2943
- };
2944
2839
  /**
2945
- * Helper method to convert option which contains object literal values (e.g. arrays, objects)
2946
- * to strings as SC can only accept their stringified equivalents
2947
- * @method convertToStringValues
2948
- * @param {Object} options
2949
- * @returns {Object}
2840
+ * @method extendStaticWrapperProps
2841
+ * @param {Object} props
2842
+ * @param {DashboardVizType} props.Wrapper
2843
+ * @param {DashboardVizType} props.Visualization
2950
2844
  */
2951
2845
 
2952
- var convertToStringValues = function convertToStringValues(options) {
2953
- var updatedOptions = propUtils_1.convertPropsToString({
2954
- vizProps: options,
2955
- 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
+ }
2956
2856
  });
2957
- return Object.assign(Object.assign({}, options), updatedOptions);
2958
2857
  };
2959
2858
 
2960
- exports.convertToStringValues = convertToStringValues;
2859
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
2961
2860
  /**
2962
- * Helper method to map labelDisplay options to jsCharting options
2963
- * @method mapLabelDisplay
2964
- * @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
+ *
2965
2869
  * @returns {Object}
2966
2870
  */
2967
2871
 
2968
- var mapLabelDisplay = function mapLabelDisplay(_a) {
2969
- var labelDisplay = _a.labelDisplay,
2970
- options = __rest(_a, ["labelDisplay"]);
2971
-
2972
- var convertedOptions = Object.assign(Object.assign({}, options), {
2973
- // default for labelDisplay option is 'values'
2974
- 'chart.showLabels': true,
2975
- 'chart.showPercent': false
2976
- });
2872
+ var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial) {
2873
+ var clone = lodash_1.cloneDeep(initial);
2977
2874
 
2978
- if (labelDisplay === 'valuesAndPercentage') {
2979
- convertedOptions['chart.showPercent'] = true;
2980
- } else if (labelDisplay === 'off') {
2981
- 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];
2982
2877
  }
2983
2878
 
2984
- return convertedOptions;
2985
- };
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
2986
2884
 
2987
- exports.mapLabelDisplay = mapLabelDisplay;
2988
- /**
2989
- * Helper method to update the option names which can be mapped to SimpleXML options or
2990
- * can be used directly with SC if don't have a 1-1 mapping in SimpleXML
2991
- * @method mapToOldKey
2992
- * @param {Object} options
2993
- * @returns {Object}
2994
- */
2995
2885
 
2996
- var mapToOldKey = function mapToOldKey(options) {
2997
- return lodash_1.mapKeys(options, function (val, key) {
2998
- 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
+ });
2999
2890
  });
2891
+ return clone;
3000
2892
  };
3001
2893
 
3002
- exports.mapToOldKey = mapToOldKey;
3003
- /**
3004
- * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
3005
- * This is for options that has new key name and can not directly be mapped with SimpleXML or
3006
- * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
3007
- * @method convertToPieSCProperties
3008
- * @param {Object} originalOptions
3009
- * @returns {Object}
3010
- */
2894
+ exports.deepMergeWithArrayOverrides = deepMergeWithArrayOverrides;
3011
2895
 
3012
- var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
3013
- return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
3014
- };
2896
+ /***/ }),
3015
2897
 
3016
- 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");
3017
2909
 
3018
2910
  /***/ })
3019
- /******/ ]);
2911
+
2912
+ /******/ });
3020
2913
  //# sourceMappingURL=Pie.js.map