@splunk/visualizations 25.0.0 → 25.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_custom_base_layer_tile_server.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_dynamic_color.png +0 -0
  4. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color.png +0 -0
  5. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color_with_no_seriesColors.png +0 -0
  6. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_off.png +0 -0
  7. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_unit_metric.png +0 -0
  8. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Area_Editor.png +0 -0
  9. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bar_Editor.png +0 -0
  10. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bubble_Editor.png +0 -0
  11. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_ChoroplethSvg_Editor.png +0 -0
  12. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Column_Editor.png +0 -0
  13. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Ellipse_Editor.png +0 -0
  14. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_FillerGauge_Editor.png +0 -0
  15. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Image_Editor.png +0 -0
  16. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Line_Editor.png +0 -0
  17. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_LinkGraph_Editor.png +0 -0
  18. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  19. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Markdown_Editor.png +0 -0
  20. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_MarkerGauge_Editor.png +0 -0
  21. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Parallel_Coordinates_Editor.png +0 -0
  22. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Pie_Editor.png +0 -0
  23. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Punchcard_Editor.png +0 -0
  24. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Rectangle_Editor.png +0 -0
  25. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Sankey_Editor.png +0 -0
  26. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Scatter_Editor.png +0 -0
  27. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Editor.png +0 -0
  28. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Icon_Editor.png +0 -0
  29. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Radial_Editor.png +0 -0
  30. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Table_Editor.png +0 -0
  31. package/.loki/reference/chrome_docker_Visualizations_Line_Line_Placeholder_if_datasource_does_not_have_any_data.png +0 -0
  32. package/.loki/reference/chrome_docker_Visualizations_Line_Line_Placeholder_if_viz_does_not_connect_to_datasource.png +0 -0
  33. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Basic_Map.png +0 -0
  34. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer.png +0 -0
  35. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET.png +0 -0
  36. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET_Dynamic_Coloring.png +0 -0
  37. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Internal_Fields.png +0 -0
  38. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Static_Coloring.png +0 -0
  39. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_Dynamic_Coloring.png +0 -0
  40. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer.png +0 -0
  41. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Dynamic_coloring.png +0 -0
  42. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Result_Limit_Set_To_3.png +0 -0
  43. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Restricted_Zoom.png +0 -0
  44. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
  45. package/Area.config.js +166 -152
  46. package/Area.config.js.map +1 -1
  47. package/Area.js +362 -433
  48. package/Area.js.map +1 -1
  49. package/Bar.config.js +168 -148
  50. package/Bar.config.js.map +1 -1
  51. package/Bar.js +364 -429
  52. package/Bar.js.map +1 -1
  53. package/Bubble.config.js +155 -117
  54. package/Bubble.config.js.map +1 -1
  55. package/Bubble.js +353 -400
  56. package/Bubble.js.map +1 -1
  57. package/ChoroplethSvg.config.js +112 -82
  58. package/ChoroplethSvg.config.js.map +1 -1
  59. package/ChoroplethSvg.js +336 -391
  60. package/ChoroplethSvg.js.map +1 -1
  61. package/Column.config.js +164 -146
  62. package/Column.config.js.map +1 -1
  63. package/Column.js +360 -427
  64. package/Column.js.map +1 -1
  65. package/Ellipse.config.js +111 -80
  66. package/Ellipse.config.js.map +1 -1
  67. package/Ellipse.js +317 -371
  68. package/Ellipse.js.map +1 -1
  69. package/FillerGauge.config.js +117 -86
  70. package/FillerGauge.config.js.map +1 -1
  71. package/FillerGauge.js +324 -378
  72. package/FillerGauge.js.map +1 -1
  73. package/Image.config.js +100 -76
  74. package/Image.config.js.map +1 -1
  75. package/Image.js +725 -789
  76. package/Image.js.map +1 -1
  77. package/Line.config.js +164 -137
  78. package/Line.config.js.map +1 -1
  79. package/Line.js +360 -418
  80. package/Line.js.map +1 -1
  81. package/LinkGraph.config.js +137 -112
  82. package/LinkGraph.config.js.map +1 -1
  83. package/LinkGraph.js +351 -410
  84. package/LinkGraph.js.map +1 -1
  85. package/Map.config.js +140 -97
  86. package/Map.config.js.map +1 -1
  87. package/Map.js +517 -523
  88. package/Map.js.map +1 -1
  89. package/Markdown.config.js +138 -115
  90. package/Markdown.config.js.map +1 -1
  91. package/Markdown.js +502 -553
  92. package/Markdown.js.map +1 -1
  93. package/MarkerGauge.config.js +218 -195
  94. package/MarkerGauge.config.js.map +1 -1
  95. package/MarkerGauge.js +2926 -3098
  96. package/MarkerGauge.js.map +1 -1
  97. package/ParallelCoordinates.config.js +158 -133
  98. package/ParallelCoordinates.config.js.map +1 -1
  99. package/ParallelCoordinates.js +319 -377
  100. package/ParallelCoordinates.js.map +1 -1
  101. package/Pie.config.js +160 -136
  102. package/Pie.config.js.map +1 -1
  103. package/Pie.js +1316 -1492
  104. package/Pie.js.map +1 -1
  105. package/Punchcard.config.js +164 -141
  106. package/Punchcard.config.js.map +1 -1
  107. package/Punchcard.js +344 -404
  108. package/Punchcard.js.map +1 -1
  109. package/Rectangle.config.js +280 -248
  110. package/Rectangle.config.js.map +1 -1
  111. package/Rectangle.js +1247 -1303
  112. package/Rectangle.js.map +1 -1
  113. package/Sankey.config.js +175 -143
  114. package/Sankey.config.js.map +1 -1
  115. package/Sankey.js +377 -426
  116. package/Sankey.js.map +1 -1
  117. package/Scatter.config.js +156 -117
  118. package/Scatter.config.js.map +1 -1
  119. package/Scatter.js +550 -601
  120. package/Scatter.js.map +1 -1
  121. package/SingleValue.config.js +147 -115
  122. package/SingleValue.config.js.map +1 -1
  123. package/SingleValue.js +542 -598
  124. package/SingleValue.js.map +1 -1
  125. package/SingleValueBasic.js +19 -19
  126. package/SingleValueBasic.js.map +1 -1
  127. package/SingleValueIcon.config.js +154 -120
  128. package/SingleValueIcon.config.js.map +1 -1
  129. package/SingleValueIcon.js +373 -424
  130. package/SingleValueIcon.js.map +1 -1
  131. package/SingleValueRadial.config.js +143 -111
  132. package/SingleValueRadial.config.js.map +1 -1
  133. package/SingleValueRadial.js +612 -668
  134. package/SingleValueRadial.js.map +1 -1
  135. package/Table.config.js +176 -152
  136. package/Table.config.js.map +1 -1
  137. package/Table.js +740 -797
  138. package/Table.js.map +1 -1
  139. package/common/Charting.js +11 -11
  140. package/common/Charting.js.map +1 -1
  141. package/common/ChartingApi.js +2 -2
  142. package/common/ChartingApi.js.map +1 -1
  143. package/common/EventsDoc.js +12 -12
  144. package/common/EventsDoc.js.map +1 -1
  145. package/common/GaugeMajorTicks.js +8 -8
  146. package/common/GaugeMajorTicks.js.map +1 -1
  147. package/common/GaugeValueMarker.js +8 -8
  148. package/common/GaugeValueMarker.js.map +1 -1
  149. package/common/OptionsDoc.js +51 -327
  150. package/common/OptionsDoc.js.map +1 -1
  151. package/common/OverviewDoc.js +22 -22
  152. package/common/OverviewDoc.js.map +1 -1
  153. package/common/SplunkVisualization.js +4 -4
  154. package/common/SplunkVisualization.js.map +1 -1
  155. package/common/SplunkVisualizationApi.js +2 -2
  156. package/common/SplunkVisualizationApi.js.map +1 -1
  157. package/common/ThemesDoc.js +19 -19
  158. package/common/ThemesDoc.js.map +1 -1
  159. package/common/chartingUtils.js +4 -4
  160. package/common/chartingUtils.js.map +1 -1
  161. package/common/docUtils.js +4 -4
  162. package/common/docUtils.js.map +1 -1
  163. package/common/gaugeUtils.js +13 -13
  164. package/common/gaugeUtils.js.map +1 -1
  165. package/common/shapeUtils.js +8 -8
  166. package/common/shapeUtils.js.map +1 -1
  167. package/common/utils/configUtils.js +42 -18
  168. package/common/utils/configUtils.js.map +1 -1
  169. package/common/utils/hocUtils.js +6 -86
  170. package/common/utils/hocUtils.js.map +1 -1
  171. package/common/utils/{JSONSchemaUtils.js → mapUtils.js} +89 -29
  172. package/common/utils/mapUtils.js.map +1 -0
  173. package/common/utils/singleValueUtils.js +14 -12
  174. package/common/utils/singleValueUtils.js.map +1 -1
  175. package/common/utils/testHelper.js +8 -8
  176. package/common/utils/testHelper.js.map +1 -1
  177. package/common/withDashboardViz.js +120 -207
  178. package/common/withDashboardViz.js.map +1 -1
  179. package/package.json +12 -12
  180. package/.loki/reference/chrome_docker_PureVisualizations_SvgChoroplethDynamic_SVG_Of_Size_Greater_Than_2_MB_Render.png +0 -0
  181. package/common/utils/JSONSchemaUtils.js.map +0 -1
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 = 227);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 230);
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,43 +129,132 @@ 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__(19);
138
+
139
+ var style_1 = __webpack_require__(14);
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": "25.1.0 - 812a9a4d8",
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
+ /***/ 13:
162
221
  /***/ (function(module, exports, __webpack_require__) {
163
222
 
164
223
  "use strict";
165
224
 
166
225
 
167
- var _toConsumableArray = __webpack_require__(9);
226
+ Object.defineProperty(exports, "__esModule", {
227
+ value: true
228
+ });
229
+ exports.extendStaticWrapperProps = void 0;
230
+ /**
231
+ * @method extendStaticWrapperProps
232
+ * @param {Object} props
233
+ * @param {DashboardVizType} props.Wrapper
234
+ * @param {DashboardVizType} props.Visualization
235
+ */
236
+
237
+ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
238
+ var Wrapper = _ref.Wrapper,
239
+ Visualization = _ref.Visualization;
240
+ var extendProperties = ['propTypes', 'defaultProps', 'config'];
241
+ extendProperties.forEach(function (prop) {
242
+ if (Visualization[prop]) {
243
+ // eslint-disable-next-line no-param-reassign
244
+ Wrapper[prop] = Visualization[prop];
245
+ }
246
+ });
247
+ };
248
+
249
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
250
+
251
+ /***/ }),
252
+
253
+ /***/ 136:
254
+ /***/ (function(module, exports, __webpack_require__) {
255
+
256
+ "use strict";
168
257
 
169
- var _defineProperty = __webpack_require__(7);
170
258
 
171
259
  var __rest = this && this.__rest || function (s, e) {
172
260
  var t = {};
@@ -184,118 +272,291 @@ var __rest = this && this.__rest || function (s, e) {
184
272
  Object.defineProperty(exports, "__esModule", {
185
273
  value: true
186
274
  });
187
- exports.insertLayout = exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
188
-
189
- var lodash_1 = __webpack_require__(2);
190
-
191
- var schemaUtils_1 = __webpack_require__(16);
275
+ exports.config = exports.themes = exports.showPlaceHolderIcon = exports.computeVizProps = exports.PieInnerSize = void 0;
192
276
 
193
- var VizBehavior_1 = __webpack_require__(5);
277
+ var lodash_1 = __webpack_require__(3); // Charting imports i18n which needs to be run to instantiate window globals in the
278
+ // eslint-disable-next-line import/order
194
279
 
195
- var dynamicOptionsDSLType = {
196
- type: 'string',
197
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
198
- };
199
- /**
200
- * Helper function to extend an options schema with dynamic options DSL
201
- * @param optionsSchema a visualization's options schema
202
- * @returns an updated options schema that additionally allows strings starting with > for each option
203
- */
204
280
 
205
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
206
- var enhancedOptionsSchema = {};
207
- Object.keys(optionsSchema).forEach(function (key) {
208
- var _a = optionsSchema[key],
209
- title = _a.title,
210
- description = _a.description,
211
- readOnly = _a.readOnly,
212
- writeOnly = _a.writeOnly,
213
- examples = _a.examples,
214
- defaultValue = _a.default,
215
- type = _a.type,
216
- properties = _a.properties,
217
- patternProperties = _a.patternProperties,
218
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
281
+ var Charting_1 = __webpack_require__(55);
219
282
 
220
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
221
- title: title
222
- }), description !== undefined && {
223
- description: description
224
- }), readOnly !== undefined && {
225
- readOnly: readOnly
226
- }), writeOnly !== undefined && {
227
- writeOnly: writeOnly
228
- }), examples !== undefined && {
229
- examples: examples
230
- }), defaultValue !== undefined && {
231
- default: defaultValue
232
- });
283
+ var charting_bundle_1 = __webpack_require__(51);
233
284
 
234
- if (type === 'object') {
235
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
236
- type: type
237
- }), properties && {
238
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
239
- });
285
+ var simpleXMLOptions_1 = __webpack_require__(61);
240
286
 
241
- if (patternProperties) {
242
- var enhancedPatternProperties = {};
243
- Object.keys(patternProperties).forEach(function (opt) {
244
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
245
- });
246
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
247
- }
248
- } else {
249
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
250
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
251
- type: type
252
- }), remainingSchemaEntry), dynamicOptionsDSLType]
253
- });
254
- }
255
- });
256
- return enhancedOptionsSchema;
257
- }
287
+ var config_1 = __webpack_require__(231);
258
288
 
259
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
260
- /**
261
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
262
- * @param vizConfig a Visualization Config
263
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
264
- */
289
+ exports.config = config_1.default;
265
290
 
266
- function enhanceConfig(vizConfig) {
267
- var enhancedConfig = vizConfig;
291
+ var withDashboardViz_1 = __webpack_require__(31);
268
292
 
269
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
270
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
271
- }
293
+ var pieUtils_1 = __webpack_require__(233);
272
294
 
273
- return enhancedConfig;
274
- }
295
+ var chartingUtils_1 = __webpack_require__(50);
275
296
 
276
- exports.enhanceConfig = enhanceConfig;
297
+ var IconPlaceholder_1 = __webpack_require__(27);
277
298
 
278
- function isDynamicOption(option) {
279
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
280
- }
299
+ var validOptions = Object.keys(config_1.default.optionsSchema);
300
+ exports.PieInnerSize = 0.7;
281
301
 
282
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
283
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
302
+ var computeVizProps = function computeVizProps(_a) {
303
+ var dataSources = _a.dataSources,
304
+ onEventTrigger = _a.onEventTrigger,
305
+ label = _a.label,
306
+ value = _a.value,
307
+ showDonutHole = _a.showDonutHole,
308
+ visualizationApiRef = _a.visualizationApiRef,
309
+ otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "label", "value", "showDonutHole", "visualizationApiRef"]); // options to be passed as props
284
310
 
285
- /**
286
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
287
- * 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
288
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
289
- * 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
290
- *
291
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
292
- */
293
311
 
294
- function hasCompatibleContexts(vizContext, presetContext) {
295
- var presetContextKeys = Object.keys(presetContext);
296
- return presetContextKeys.every(function (contextKey) {
297
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
298
- });
312
+ var computedProps = {
313
+ visualizationApiRef: visualizationApiRef
314
+ };
315
+ var labelField = otherOptions.labelField,
316
+ valueField = otherOptions.valueField,
317
+ hasEventHandlers = otherOptions.hasEventHandlers;
318
+ computedProps.options = lodash_1.chain(otherOptions).pick(validOptions).thru(pieUtils_1.convertToPieSCProperties).thru(function (options) {
319
+ return Object.assign(Object.assign({}, simpleXMLOptions_1.getSimpleXMLOptionsForProps(options)), {
320
+ chart: 'pie'
321
+ });
322
+ }).value();
323
+ var truncationLimit = computedProps.options['chart.resultTruncationLimit'];
324
+ var primaryData = Object.assign(Object.assign({}, dataSources.primary.data), {
325
+ columns: [label, value]
326
+ });
327
+ primaryData.fields = [{
328
+ name: labelField
329
+ }, {
330
+ name: valueField
331
+ }];
332
+
333
+ if (!value) {
334
+ primaryData.columns = [label, []];
335
+ }
336
+
337
+ primaryData.columns.forEach(function (column, index) {
338
+ if (column) {
339
+ primaryData.columns[index] = column.map(String);
340
+ }
341
+ });
342
+
343
+ if (truncationLimit) {
344
+ primaryData = chartingUtils_1.truncateData(primaryData, truncationLimit);
345
+ }
346
+
347
+ computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign({}, primaryData));
348
+
349
+ if (showDonutHole) {
350
+ computedProps.options['chart.pieInnerSize'] = exports.PieInnerSize;
351
+ } else {
352
+ computedProps.options['chart.pieInnerSize'] = 0;
353
+ }
354
+
355
+ if (hasEventHandlers) {
356
+ computedProps.onClick = onEventTrigger;
357
+ }
358
+
359
+ return computedProps;
360
+ };
361
+
362
+ exports.computeVizProps = computeVizProps; // Returns true to display the placeholder icon, if invalid datasource condition or invalid data value/labels condition is met
363
+
364
+ var showPlaceHolderIcon = function showPlaceHolderIcon(dataSources, loading, options) {
365
+ return IconPlaceholder_1.shouldShowIconPlaceholder(dataSources, loading) || pieUtils_1.invalidOptionField('value', dataSources, options, config_1.default) || pieUtils_1.invalidOptionField('label', dataSources, options, config_1.default) || pieUtils_1.allInvalidDataValues(dataSources, options, config_1.default);
366
+ };
367
+
368
+ exports.showPlaceHolderIcon = showPlaceHolderIcon;
369
+ var Pie = withDashboardViz_1.default({
370
+ ReactViz: Charting_1.default,
371
+ computeVizProps: exports.computeVizProps,
372
+ useIconPlaceholder: function useIconPlaceholder(dataSources, loading, options) {
373
+ return exports.showPlaceHolderIcon(dataSources, loading, options);
374
+ },
375
+ vizConfig: config_1.default
376
+ });
377
+ var themes = null;
378
+ exports.themes = themes;
379
+ exports.default = Pie;
380
+
381
+ /***/ }),
382
+
383
+ /***/ 14:
384
+ /***/ (function(module, exports) {
385
+
386
+ module.exports = require("@splunk/visualizations-shared/style");
387
+
388
+ /***/ }),
389
+
390
+ /***/ 15:
391
+ /***/ (function(module, exports) {
392
+
393
+ module.exports = require("@splunk/visualizations-shared/schemaUtils");
394
+
395
+ /***/ }),
396
+
397
+ /***/ 16:
398
+ /***/ (function(module, exports, __webpack_require__) {
399
+
400
+ "use strict";
401
+
402
+
403
+ var _toConsumableArray = __webpack_require__(7);
404
+
405
+ var _defineProperty = __webpack_require__(6);
406
+
407
+ var __rest = this && this.__rest || function (s, e) {
408
+ var t = {};
409
+
410
+ for (var p in s) {
411
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
412
+ }
413
+
414
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
415
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
416
+ }
417
+ return t;
418
+ };
419
+
420
+ Object.defineProperty(exports, "__esModule", {
421
+ value: true
422
+ });
423
+ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
424
+
425
+ var lodash_1 = __webpack_require__(3);
426
+
427
+ var schemaUtils_1 = __webpack_require__(15);
428
+
429
+ var VizBehavior_1 = __webpack_require__(5);
430
+
431
+ var dynamicOptionsDSLType = {
432
+ type: 'string',
433
+ pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
434
+ };
435
+ /**
436
+ * Helper function to extend an options schema with dynamic options DSL
437
+ * @param optionsSchema a visualization's options schema
438
+ * @returns an updated options schema that additionally allows strings starting with > for each option
439
+ */
440
+
441
+ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
442
+ var enhancedOptionsSchema = {};
443
+ Object.keys(optionsSchema).forEach(function (key) {
444
+ var _a = optionsSchema[key],
445
+ title = _a.title,
446
+ description = _a.description,
447
+ readOnly = _a.readOnly,
448
+ writeOnly = _a.writeOnly,
449
+ examples = _a.examples,
450
+ defaultValue = _a.default,
451
+ type = _a.type,
452
+ properties = _a.properties,
453
+ patternProperties = _a.patternProperties,
454
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
455
+
456
+ var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
457
+ title: title
458
+ }), description !== undefined && {
459
+ description: description
460
+ }), readOnly !== undefined && {
461
+ readOnly: readOnly
462
+ }), writeOnly !== undefined && {
463
+ writeOnly: writeOnly
464
+ }), examples !== undefined && {
465
+ examples: examples
466
+ }), defaultValue !== undefined && {
467
+ default: defaultValue
468
+ });
469
+
470
+ if (type === 'object') {
471
+ enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
472
+ type: type
473
+ }), properties && {
474
+ properties: enhanceOptionsSchemaWithDynamicOptions(properties)
475
+ });
476
+
477
+ if (patternProperties) {
478
+ var enhancedPatternProperties = {};
479
+ Object.keys(patternProperties).forEach(function (opt) {
480
+ enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
481
+ });
482
+ enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
483
+ }
484
+ } else {
485
+ enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
486
+ anyOf: [Object.assign(Object.assign({}, type !== undefined && {
487
+ type: type
488
+ }), remainingSchemaEntry), dynamicOptionsDSLType]
489
+ });
490
+ }
491
+ });
492
+ return enhancedOptionsSchema;
493
+ }
494
+
495
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
496
+ /**
497
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
498
+ * this function also collapse all editor panels
499
+ * @param vizConfig a Visualization Config
500
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
501
+ * and containing `open: false` for all editor panels in editorConfig
502
+ */
503
+
504
+ function enhanceConfig(vizConfig) {
505
+ var enhancedConfig = vizConfig;
506
+
507
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
508
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
509
+ }
510
+
511
+ enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
512
+ return Object.assign(Object.assign({}, config), {
513
+ open: false
514
+ });
515
+ });
516
+ return enhancedConfig;
517
+ }
518
+
519
+ exports.enhanceConfig = enhanceConfig;
520
+ /**
521
+ * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
522
+ * Created for editor unit tests
523
+ * @param vizConfig a Visualization Config
524
+ * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
525
+ */
526
+
527
+ function uncollapseEditorConfig(vizConfig) {
528
+ var editorPanelUncollapsedConfig = vizConfig;
529
+ editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
530
+ return Object.assign(Object.assign({}, config), {
531
+ open: true
532
+ });
533
+ });
534
+ return editorPanelUncollapsedConfig;
535
+ }
536
+
537
+ exports.uncollapseEditorConfig = uncollapseEditorConfig;
538
+
539
+ function isDynamicOption(option) {
540
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
541
+ }
542
+
543
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
544
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
545
+
546
+ /**
547
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
548
+ * 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
549
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
550
+ * 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
551
+ *
552
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
553
+ */
554
+
555
+ function hasCompatibleContexts(vizContext, presetContext) {
556
+ var presetContextKeys = Object.keys(presetContext);
557
+ return presetContextKeys.every(function (contextKey) {
558
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
559
+ });
299
560
  }
300
561
  /**
301
562
  * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
@@ -369,308 +630,93 @@ var insertLayout = function insertLayout(layout, index) {
369
630
  exports.insertLayout = insertLayout;
370
631
 
371
632
  /***/ }),
372
- /* 7 */
633
+
634
+ /***/ 18:
373
635
  /***/ (function(module, exports) {
374
636
 
375
- module.exports = require("@babel/runtime/helpers/defineProperty");
637
+ module.exports = require("@babel/runtime/helpers/createClass");
376
638
 
377
639
  /***/ }),
378
- /* 8 */
379
- /***/ (function(module, exports, __webpack_require__) {
380
640
 
381
- "use strict";
641
+ /***/ 19:
642
+ /***/ (function(module, exports) {
382
643
 
644
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
383
645
 
384
- var _typeof = __webpack_require__(23);
646
+ /***/ }),
385
647
 
386
- Object.defineProperty(exports, "__esModule", {
387
- value: true
388
- });
389
- exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
648
+ /***/ 2:
649
+ /***/ (function(module, exports) {
390
650
 
391
- var lodash_1 = __webpack_require__(2);
651
+ module.exports = require("@splunk/ui-utils/i18n");
392
652
 
393
- var mapUtils_1 = __webpack_require__(41);
394
- /**
395
- * @method extendStaticWrapperProps
396
- * @param {Object} props
397
- * @param {DashboardVizType} props.Wrapper
398
- * @param {DashboardVizType} props.Visualization
399
- */
653
+ /***/ }),
400
654
 
655
+ /***/ 21:
656
+ /***/ (function(module, exports) {
401
657
 
402
- var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
403
- var Wrapper = _ref.Wrapper,
404
- Visualization = _ref.Visualization;
405
- var extendProperties = ['propTypes', 'defaultProps', 'config'];
406
- extendProperties.forEach(function (prop) {
407
- if (Visualization[prop]) {
408
- // eslint-disable-next-line no-param-reassign
409
- Wrapper[prop] = Visualization[prop];
410
- }
411
- });
412
- };
413
-
414
- exports.extendStaticWrapperProps = extendStaticWrapperProps;
415
- /**
416
- * helper to deeply merge objects while preserving arrays in earlier source objects
417
- * deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays of primitives will be preserved if already present in the resultant merged object
418
- * this prevents default arrays of primitives from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one).
419
- * Array of objects gets merged with the defaults, where the defaults can be an array of objects. Closest matching default object from the defaults list based on key - value pair
420
- * will be used for merging defaults for each object in the array. If no closest match found, first object in default array list used for merging.
421
- *
422
- * @method deepMergeWithArrayPrimitiveOverrides
423
- * @param {Object} initial - target object to merge values into
424
- * @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
425
- *
426
- * @returns {Object}
427
- */
428
-
429
- var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
430
- var clone = lodash_1.cloneDeep(initial);
431
-
432
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
433
- sources[_key - 1] = arguments[_key];
434
- }
435
-
436
- sources.forEach(function (sourceToApply) {
437
- Object.keys(sourceToApply).forEach(function (sourceKey) {
438
- if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
439
- clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
440
- }
441
-
442
- if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
443
- clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
444
- } else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
445
- // If option is an array of objects
446
- for (var i = 0; i < clone[sourceKey].length; i += 1) {
447
- if (_typeof(clone[sourceKey][i]) === 'object') {
448
- var closestMatchIdx = mapUtils_1.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
449
-
450
- if (closestMatchIdx > -1) {
451
- clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
452
- }
453
- }
454
- }
455
- }
456
- });
457
- });
458
- return clone;
459
- };
460
-
461
- exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
658
+ module.exports = require("@splunk/themes/pick");
462
659
 
463
660
  /***/ }),
464
- /* 9 */
465
- /***/ (function(module, exports) {
466
-
467
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
468
661
 
469
- /***/ }),
470
- /* 10 */
662
+ /***/ 22:
471
663
  /***/ (function(module, exports) {
472
664
 
473
- module.exports = require("@splunk/themes/variables");
665
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
474
666
 
475
667
  /***/ }),
476
- /* 11 */
477
- /***/ (function(module, exports) {
478
-
479
- module.exports = require("@splunk/visualizations-shared/Message");
480
668
 
481
- /***/ }),
482
- /* 12 */
669
+ /***/ 23:
483
670
  /***/ (function(module, exports) {
484
671
 
485
- module.exports = require("@babel/runtime/helpers/classCallCheck");
672
+ module.exports = require("@splunk/visualizations-shared/propUtils");
486
673
 
487
674
  /***/ }),
488
- /* 13 */
489
- /***/ (function(module, exports) {
490
-
491
- module.exports = require("@splunk/visualizations-shared/colorUtils");
492
675
 
493
- /***/ }),
494
- /* 14 */
676
+ /***/ 230:
495
677
  /***/ (function(module, exports, __webpack_require__) {
496
678
 
497
679
  "use strict";
498
680
 
499
681
 
500
- Object.defineProperty(exports, "__esModule", {
501
- value: true
502
- });
503
-
504
- var React = __webpack_require__(1);
505
-
506
- var styled_components_1 = __webpack_require__(4);
507
-
508
- var SizeAwareWrapper_1 = __webpack_require__(18);
509
-
510
- var style_1 = __webpack_require__(15);
511
-
512
- var colorUtils_1 = __webpack_require__(13);
513
-
514
- var Item = styled_components_1.default.div.attrs(function (_ref) {
515
- var width = _ref.width;
516
- return {
517
- style: {
518
- width: style_1.toPx(width)
682
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
683
+ if (k2 === undefined) k2 = k;
684
+ Object.defineProperty(o, k2, {
685
+ enumerable: true,
686
+ get: function get() {
687
+ return m[k];
519
688
  }
520
- };
521
- }).withConfig({
522
- displayName: "FixedSizeContainer__Item",
523
- componentId: "sc-1yhgpod-0"
524
- })(["position:relative;background-color:", "};"], function (props) {
525
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
526
- }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
527
-
528
- var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
529
- var width = _ref2.width,
530
- height = _ref2.height;
531
- return {
532
- style: Object.assign(Object.assign({}, width && {
533
- width: style_1.toPx(width)
534
- }), height && {
535
- height: style_1.toPx(height)
536
- })
537
- };
538
- }).withConfig({
539
- displayName: "FixedSizeContainer__FixSizeItem",
540
- componentId: "sc-1yhgpod-1"
541
- })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
542
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
689
+ });
690
+ } : function (o, m, k, k2) {
691
+ if (k2 === undefined) k2 = k;
692
+ o[k2] = m[k];
543
693
  });
544
- var ItemContent = styled_components_1.default.div.withConfig({
545
- displayName: "FixedSizeContainer__ItemContent",
546
- componentId: "sc-1yhgpod-2"
547
- })(["position:relative;min-height:100px;width:100%;"]);
548
- var FixSizeItemContent = styled_components_1.default.div.withConfig({
549
- displayName: "FixedSizeContainer__FixSizeItemContent",
550
- componentId: "sc-1yhgpod-3"
551
- })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
552
-
553
- var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
554
- var FixedSizeContainer = function FixedSizeContainer(props) {
555
- var width = props.width,
556
- height = props.height,
557
- backgroundColor = props.backgroundColor;
558
-
559
- if (!height) {
560
- return React.createElement(Item, {
561
- "data-test": "item",
562
- width: width,
563
- backgroundColor: backgroundColor
564
- }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
565
- }
566
-
567
- return React.createElement(FixSizeItem, {
568
- "data-test": "fix-size-item",
569
- "data-splunk-visualization-version": "25.0.0 - 5e0f30e5a",
570
- width: width,
571
- height: height,
572
- backgroundColor: backgroundColor
573
- }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
574
- var newWidth = _ref3.width,
575
- newHeight = _ref3.height;
576
- return React.createElement(Viz, Object.assign({}, props, {
577
- width: newWidth,
578
- height: newHeight
579
- }));
580
- })));
581
- };
582
694
 
583
- FixedSizeContainer.displayName = 'withFixedSizeContainer';
584
- return FixedSizeContainer;
695
+ var __exportStar = this && this.__exportStar || function (m, exports) {
696
+ for (var p in m) {
697
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
698
+ }
585
699
  };
586
700
 
587
- exports.default = withFixedSizeContainer;
588
-
589
- /***/ }),
590
- /* 15 */
591
- /***/ (function(module, exports) {
592
-
593
- module.exports = require("@splunk/visualizations-shared/style");
594
-
595
- /***/ }),
596
- /* 16 */
597
- /***/ (function(module, exports) {
598
-
599
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
600
-
601
- /***/ }),
602
- /* 17 */
603
- /***/ (function(module, exports) {
604
-
605
- module.exports = require("@babel/runtime/helpers/createClass");
606
-
607
- /***/ }),
608
- /* 18 */
609
- /***/ (function(module, exports) {
610
-
611
- module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
612
-
613
- /***/ }),
614
- /* 19 */,
615
- /* 20 */
616
- /***/ (function(module, exports) {
617
-
618
- module.exports = require("@splunk/themes/pick");
619
-
620
- /***/ }),
621
- /* 21 */
622
- /***/ (function(module, exports) {
623
-
624
- module.exports = require("@splunk/visualization-context/TimezoneContext");
625
-
626
- /***/ }),
627
- /* 22 */
628
- /***/ (function(module, exports) {
629
-
630
- module.exports = require("@splunk/visualizations-shared/propUtils");
631
-
632
- /***/ }),
633
- /* 23 */
634
- /***/ (function(module, exports) {
635
-
636
- module.exports = require("@babel/runtime/helpers/typeof");
637
-
638
- /***/ }),
639
- /* 24 */,
640
- /* 25 */
641
- /***/ (function(module, exports, __webpack_require__) {
642
-
643
- "use strict";
644
-
645
-
646
701
  Object.defineProperty(exports, "__esModule", {
647
702
  value: true
648
703
  });
649
- exports.pickFieldFromJSONSchema = void 0;
650
-
651
- var lodash_1 = __webpack_require__(2);
652
-
653
- var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
654
- var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
655
- return Object.keys(optionsSchema).reduce(function (accum, k) {
656
- if (lodash_1.has(optionsSchema[k], fieldName)) {
657
- accum[k] = optionsSchema[k][fieldName];
658
- } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
659
- var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
704
+ exports.default = void 0;
660
705
 
661
- if (!lodash_1.isEmpty(nestedSchema)) {
662
- accum[k] = nestedSchema;
663
- }
664
- }
706
+ __exportStar(__webpack_require__(136), exports);
665
707
 
666
- return accum;
667
- }, {});
668
- };
708
+ var Pie_1 = __webpack_require__(136);
669
709
 
670
- exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
710
+ Object.defineProperty(exports, "default", {
711
+ enumerable: true,
712
+ get: function get() {
713
+ return Pie_1.default;
714
+ }
715
+ });
671
716
 
672
717
  /***/ }),
673
- /* 26 */
718
+
719
+ /***/ 231:
674
720
  /***/ (function(module, exports, __webpack_require__) {
675
721
 
676
722
  "use strict";
@@ -679,251 +725,444 @@ exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
679
725
  Object.defineProperty(exports, "__esModule", {
680
726
  value: true
681
727
  });
682
- exports.shouldShowIconPlaceholder = void 0;
683
-
684
- var React = __webpack_require__(1);
685
728
 
686
- var T = __webpack_require__(0);
729
+ var ChartPie_1 = __webpack_require__(232);
687
730
 
688
- var lodash_1 = __webpack_require__(2);
731
+ var placeholders_1 = __webpack_require__(45);
689
732
 
690
- var i18n_1 = __webpack_require__(3);
733
+ var i18n_1 = __webpack_require__(2);
691
734
 
692
- var Message_1 = __webpack_require__(11);
735
+ var schemaUtils_1 = __webpack_require__(15);
693
736
 
694
- var FixedSizeContainer_1 = __webpack_require__(14);
695
- /**
696
- * @method shouldShowIconPlaceholder
697
- * @param {object} dataSources
698
- * @param {boolean} loading
699
- * @returns {boolean}
700
- */
737
+ var visualization_color_palettes_1 = __webpack_require__(44);
701
738
 
739
+ var pick_1 = __webpack_require__(21);
702
740
 
703
- var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
704
- var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
705
- var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
706
- var noData = data === undefined;
707
- var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
708
- var noFields = fields === undefined;
709
- return loading || noData || noFields;
710
- };
741
+ var variables_1 = __webpack_require__(8);
711
742
 
712
- exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
713
- var propTypes = {
714
- icon: T.func,
715
- width: T.oneOfType([T.string, T.number]),
716
- height: T.oneOfType([T.string, T.number]),
717
- // eslint-disable-next-line react/no-unused-prop-types
718
- backgroundColor: T.string,
719
- iconColor: T.string
720
- };
721
- /**
722
- * @method IconPlaceholder
723
- * @param {IconPlaceholderProps} props
724
- * @returns {React.ReactElement}
725
- */
743
+ var VizBehavior_1 = __webpack_require__(5);
726
744
 
727
- var IconPlaceholder = function IconPlaceholder(props) {
728
- var width = props.width,
729
- height = props.height,
730
- icon = props.icon,
731
- iconColor = props.iconColor;
745
+ var VizCategory_1 = __webpack_require__(30);
732
746
 
733
- if (icon) {
734
- return React.createElement(icon, {
735
- style: {
736
- left: '50%',
737
- top: '50%',
738
- color: iconColor,
739
- opacity: 0.15,
740
- position: 'absolute',
741
- transform: 'translate(-50%, -50%)'
742
- },
743
- width: '50%',
744
- height: '50%'
745
- });
746
- }
747
+ var configUtils_1 = __webpack_require__(16);
747
748
 
748
- return React.createElement(Message_1.default, {
749
- width: width,
750
- height: height,
751
- level: "warning",
752
- message: i18n_1._('No DataSource Connected')
753
- });
754
- };
749
+ var BackgroundColor_1 = __webpack_require__(49);
755
750
 
756
- IconPlaceholder.propTypes = propTypes;
757
- IconPlaceholder.defaultProps = {
758
- width: '100%',
759
- height: 250
751
+ var dataContract = {
752
+ requiredDataSources: [{
753
+ name: 'primary',
754
+ description: 'DataSource that powers the visualization'
755
+ }],
756
+ optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
757
+ // {
758
+ // name: 'annotation',
759
+ // description: 'DataSource that populate event annotations',
760
+ // },
761
+ ],
762
+ initialRequestParams: {
763
+ primary: {
764
+ offset: 0,
765
+ count: 10000
766
+ }
767
+ }
760
768
  };
761
- exports.default = FixedSizeContainer_1.default(IconPlaceholder);
769
+ var size = {
770
+ initialWidth: 300,
771
+ initialHeight: 300
772
+ };
773
+ var defaultContext = {};
774
+ var optionsSchema = {
775
+ backgroundColor: {
776
+ default: '> themes.defaultBackgroundColor',
777
+ 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".',
778
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
779
+ type: 'string'
780
+ },
781
+ collapseLabel: {
782
+ description: 'Specify the label for the consolidated slice.',
783
+ type: 'string',
784
+ default: 'other'
785
+ },
786
+ collapseThreshold: {
787
+ 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.',
788
+ type: 'number',
789
+ default: 0.01
790
+ },
791
+ label: {
792
+ description: 'List of string values to display the pie chart labels.',
793
+ type: 'array',
794
+ items: {
795
+ type: 'string'
796
+ },
797
+ default: '> primary | seriesByIndex(0)'
798
+ },
799
+ labelField: {
800
+ default: '> label | getField()',
801
+ description: 'Specify the field that corresponds to the labels.',
802
+ type: 'string'
803
+ },
804
+ labelDisplay: {
805
+ description: 'Specify whether to display the labels and/or slice percentages.',
806
+ type: 'string',
807
+ pattern: schemaUtils_1.getPattern(['values', 'valuesAndPercentage', 'off']),
808
+ default: 'values'
809
+ },
810
+ resultLimit: {
811
+ default: 50000,
812
+ description: 'Specify the number of data points rendered in a chart.',
813
+ type: 'number'
814
+ },
815
+ seriesColors: {
816
+ default: visualization_color_palettes_1.VIZ_CATEGORICAL,
817
+ description: 'Specify the colors used for a series. For example, ["#FF0000", "#0000FF", "#008000"].',
818
+ type: 'array',
819
+ items: {
820
+ type: 'string'
821
+ }
822
+ },
823
+ seriesColorsByField: {
824
+ description: 'Specify the colors used for specific pie slice labels. For example: {"April": "#008000", "May": "#FFA500"}.',
825
+ type: 'object'
826
+ },
827
+ showDonutHole: {
828
+ default: false,
829
+ description: 'Specify whether the pie should be a donut.',
830
+ type: 'boolean'
831
+ },
832
+ value: {
833
+ description: 'List of numerical values to power the pie chart.',
834
+ type: 'array',
835
+ items: {
836
+ type: 'number'
837
+ },
838
+ default: '> primary | seriesByIndex(1)'
839
+ },
840
+ valueField: {
841
+ default: '> value | getField()',
842
+ description: 'Specify the field that corresponds to the data powering values.',
843
+ type: 'string'
844
+ }
845
+ };
846
+ var themes = {
847
+ defaultBackgroundColor: function defaultBackgroundColor(props) {
848
+ return pick_1.default({
849
+ enterprise: {
850
+ dark: variables_1.default.black(props),
851
+ light: variables_1.default.backgroundColor(props)
852
+ },
853
+ prisma: variables_1.default.backgroundColorSidebar(props)
854
+ })(props);
855
+ }
856
+ };
857
+ var editorConfig = [{
858
+ label: i18n_1._('General'),
859
+ layout: [BackgroundColor_1.default({
860
+ themes: themes
861
+ })]
862
+ }, {
863
+ label: i18n_1._('Appearance'),
864
+ layout: [[{
865
+ label: i18n_1._('Display type'),
866
+ option: 'showDonutHole',
867
+ editor: 'editor.radioBar',
868
+ editorProps: {
869
+ values: [{
870
+ label: i18n_1._('Pie'),
871
+ value: false
872
+ }, {
873
+ label: i18n_1._('Donut'),
874
+ value: true
875
+ }]
876
+ }
877
+ }]]
878
+ }, {
879
+ label: i18n_1._('Labels'),
880
+ layout: [[{
881
+ label: i18n_1._('Label display'),
882
+ option: 'labelDisplay',
883
+ editor: 'editor.radioBar',
884
+ editorProps: {
885
+ values: [{
886
+ label: i18n_1._('Values'),
887
+ value: 'values'
888
+ }, {
889
+ label: i18n_1._('Values & Percent'),
890
+ value: 'valuesAndPercentage'
891
+ }, {
892
+ label: i18n_1._('Off'),
893
+ value: 'off'
894
+ }]
895
+ }
896
+ }]]
897
+ }, {
898
+ label: i18n_1._('Collapse to Summary'),
899
+ layout: [[{
900
+ label: i18n_1._('Collapse Threshold'),
901
+ option: 'collapseThreshold',
902
+ editor: 'editor.number',
903
+ editorProps: {
904
+ min: 0,
905
+ max: 1,
906
+ step: 0.01
907
+ }
908
+ }], [{
909
+ label: i18n_1._('Collapsed Slice Label'),
910
+ option: 'collapseLabel',
911
+ editor: 'editor.text'
912
+ }]]
913
+ }];
914
+ /**
915
+ * visualization configuration
916
+ */
917
+
918
+ var config = {
919
+ /**
920
+ * unique viz key
921
+ */
922
+ key: 'splunk.pie',
923
+
924
+ /**
925
+ * viz name
926
+ */
927
+ name: 'Pie',
928
+ category: VizCategory_1.VizCategory.COMPARISONS,
929
+
930
+ /**
931
+ * viz icon
932
+ */
933
+ icon: ChartPie_1.default,
934
+ placeholderIcon: placeholders_1.Pie,
935
+ dataContract: dataContract,
936
+ size: size,
937
+ defaultContext: defaultContext,
938
+ optionsSchema: optionsSchema,
939
+ editorConfig: editorConfig,
940
+ events: {
941
+ 'point.click': {
942
+ description: 'triggered when user clicks on a point in the pie chart'
943
+ }
944
+ },
945
+ supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
946
+ themes: themes
947
+ };
948
+ exports.default = configUtils_1.enhanceConfig(config);
949
+
950
+ /***/ }),
951
+
952
+ /***/ 232:
953
+ /***/ (function(module, exports) {
954
+
955
+ module.exports = require("@splunk/react-icons/ChartPie");
762
956
 
763
957
  /***/ }),
764
- /* 27 */
958
+
959
+ /***/ 233:
765
960
  /***/ (function(module, exports, __webpack_require__) {
766
961
 
767
962
  "use strict";
768
963
 
769
964
 
770
- var _defineProperty = __webpack_require__(7);
965
+ var __rest = this && this.__rest || function (s, e) {
966
+ var t = {};
967
+
968
+ for (var p in s) {
969
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
970
+ }
971
+
972
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
973
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
974
+ }
975
+ return t;
976
+ };
771
977
 
772
978
  Object.defineProperty(exports, "__esModule", {
773
979
  value: true
774
980
  });
775
- exports.getSortingParams = exports.SortParamsPropTypes = void 0;
776
-
777
- var T = __webpack_require__(0);
981
+ exports.allInvalidDataValues = exports.invalidOptionField = exports.getPieOptionFieldIndex = exports.getPieMergedOptions = exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
778
982
 
779
- var lodash_1 = __webpack_require__(2);
983
+ var lodash_1 = __webpack_require__(3);
780
984
 
781
- var DataSource_1 = __webpack_require__(37);
985
+ var propUtils_1 = __webpack_require__(23);
782
986
 
783
- exports.SortParamsPropTypes = T.shape({
784
- currentSortKey: T.string,
785
- currentSortDir: T.oneOf(DataSource_1.validSortDirs),
786
- onSort: T.func
787
- });
987
+ var dsl_1 = __webpack_require__(88);
788
988
 
789
- var getSortingParams = function getSortingParams(_ref) {
790
- var requestParams = _ref.requestParams,
791
- onRequestParamsChange = _ref.onRequestParamsChange;
792
- var currentSortKey;
793
- var currentSortDir;
794
- var nextSortDirMap = {
795
- asc: 'desc',
796
- desc: 'asc',
797
- none: 'asc'
798
- };
799
- var onSort;
989
+ var hocUtils_1 = __webpack_require__(24);
800
990
 
801
- if (lodash_1.isFunction(onRequestParamsChange)) {
802
- if (requestParams && lodash_1.has(requestParams, 'sort')) {
803
- currentSortKey = Object.keys(requestParams.sort).shift();
804
- currentSortDir = requestParams.sort[currentSortKey];
805
- } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
991
+ var JSONSchemaUtils_1 = __webpack_require__(25); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
992
+ // map for key names which are either new or not present in SimpleXML options mapping
806
993
 
807
994
 
808
- onSort = function onSort(e, _ref2) {
809
- var sortKey = _ref2.sortKey,
810
- sortDir = _ref2.sortDir;
995
+ var pieOptionsSCMapping = {
996
+ resultLimit: 'resultTruncationLimit',
997
+ seriesColorsByField: 'fieldColors',
998
+ collapseThreshold: 'chart.sliceCollapsingThreshold',
999
+ collapseLabel: 'chart.sliceCollapsingLabel'
1000
+ };
1001
+ /**
1002
+ * Helper method to convert option which contains object literal values (e.g. arrays, objects)
1003
+ * to strings as SC can only accept their stringified equivalents
1004
+ * @method convertToStringValues
1005
+ * @param {Object} options
1006
+ * @returns {Object}
1007
+ */
811
1008
 
812
- if (typeof sortKey === 'string') {
813
- var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
814
- onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
815
- offset: 0,
816
- sort: _defineProperty({}, sortKey, nextSortDir)
817
- }));
818
- } else {
819
- onRequestParamsChange(requestParams);
820
- }
821
- };
1009
+ var convertToStringValues = function convertToStringValues(options) {
1010
+ var updatedOptions = propUtils_1.convertPropsToString({
1011
+ vizProps: options,
1012
+ propNames: ['seriesColors', 'fieldColors']
1013
+ });
1014
+ return Object.assign(Object.assign({}, options), updatedOptions);
1015
+ };
1016
+
1017
+ exports.convertToStringValues = convertToStringValues;
1018
+ /**
1019
+ * Helper method to map labelDisplay options to jsCharting options
1020
+ * @method mapLabelDisplay
1021
+ * @param {Object} options
1022
+ * @returns {Object}
1023
+ */
1024
+
1025
+ var mapLabelDisplay = function mapLabelDisplay(_a) {
1026
+ var labelDisplay = _a.labelDisplay,
1027
+ options = __rest(_a, ["labelDisplay"]);
1028
+
1029
+ var convertedOptions = Object.assign(Object.assign({}, options), {
1030
+ // default for labelDisplay option is 'values'
1031
+ 'chart.showLabels': true,
1032
+ 'chart.showPercent': false
1033
+ });
1034
+
1035
+ if (labelDisplay === 'valuesAndPercentage') {
1036
+ convertedOptions['chart.showPercent'] = true;
1037
+ } else if (labelDisplay === 'off') {
1038
+ convertedOptions['chart.showLabels'] = false;
822
1039
  }
823
1040
 
824
- return {
825
- currentSortKey: currentSortKey,
826
- currentSortDir: currentSortDir,
827
- onSort: onSort
828
- };
1041
+ return convertedOptions;
829
1042
  };
830
1043
 
831
- exports.getSortingParams = getSortingParams;
1044
+ exports.mapLabelDisplay = mapLabelDisplay;
1045
+ /**
1046
+ * Helper method to update the option names which can be mapped to SimpleXML options or
1047
+ * can be used directly with SC if don't have a 1-1 mapping in SimpleXML
1048
+ * @method mapToOldKey
1049
+ * @param {Object} options
1050
+ * @returns {Object}
1051
+ */
832
1052
 
833
- /***/ }),
834
- /* 28 */
835
- /***/ (function(module, exports, __webpack_require__) {
1053
+ var mapToOldKey = function mapToOldKey(options) {
1054
+ return lodash_1.mapKeys(options, function (val, key) {
1055
+ return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
1056
+ });
1057
+ };
836
1058
 
837
- "use strict";
1059
+ exports.mapToOldKey = mapToOldKey;
1060
+ /**
1061
+ * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
1062
+ * This is for options that has new key name and can not directly be mapped with SimpleXML or
1063
+ * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
1064
+ * @method convertToPieSCProperties
1065
+ * @param {Object} originalOptions
1066
+ * @returns {Object}
1067
+ */
838
1068
 
1069
+ var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
1070
+ return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
1071
+ };
839
1072
 
840
- Object.defineProperty(exports, "__esModule", {
841
- value: true
842
- });
843
- exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1073
+ exports.convertToPieSCProperties = convertToPieSCProperties;
1074
+ /**
1075
+ * Return all merged options (default + config) using vizConfig and options
1076
+ * @param options
1077
+ * @param vizConfig
1078
+ * @returns
1079
+ */
844
1080
 
845
- var T = __webpack_require__(0);
1081
+ var getPieMergedOptions = function getPieMergedOptions(options, vizConfig) {
1082
+ return hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default'));
1083
+ };
846
1084
 
847
- var lodash_1 = __webpack_require__(2);
1085
+ exports.getPieMergedOptions = getPieMergedOptions;
1086
+ /**
1087
+ * Returns option's field index. If not found returns -1
1088
+ * @param optionName
1089
+ * @param dataSources
1090
+ * @param options
1091
+ * @param vizConfig
1092
+ * @returns
1093
+ */
848
1094
 
849
- exports.PaginatorParamsPropTypes = T.shape({
850
- isPaging: T.bool,
851
- current: T.number,
852
- totalPages: T.number,
853
- onChange: T.func
854
- });
1095
+ var getPieOptionFieldIndex = function getPieOptionFieldIndex(optionName, dataSources, options, vizConfig) {
1096
+ var mergedOptions = exports.getPieMergedOptions(options, vizConfig); // find the field name configured for pie "value"
855
1097
 
856
- var getPaginationParams = function getPaginationParams(_ref) {
857
- var requestParams = _ref.requestParams,
858
- meta = _ref.meta,
859
- onRequestParamsChange = _ref.onRequestParamsChange;
860
- var totalCount = meta && meta.totalCount || 0;
861
- var offset = requestParams && requestParams.offset || 0;
862
- var count = requestParams && requestParams.count;
863
- var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
864
- var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
865
- var isPaging = totalPages > 1 && lodash_1.isFunction(onRequestParamsChange);
1098
+ var fieldName = dsl_1.getFieldsFromDSL(mergedOptions[optionName], dataSources)[0];
1099
+ var fields = dataSources.primary.data.fields; // find the field index configured for pie "value"
866
1100
 
867
- var onChangeHandler = function onChangeHandler(e, _ref2) {
868
- var page = _ref2.page,
869
- countArg = _ref2.count;
870
- var newParams = lodash_1.cloneDeep(requestParams);
1101
+ var fieldIndex = fields.findIndex(function (field) {
1102
+ return (typeof field === 'string' ? field : field.name.toString()) === fieldName;
1103
+ });
1104
+ return fieldIndex;
1105
+ };
871
1106
 
872
- if (typeof countArg === 'number') {
873
- newParams.count = countArg;
874
- newParams.offset = 0;
875
- }
1107
+ exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
1108
+ /**
1109
+ * Returns true if columns data has invalid data format for specified option (label or value)
1110
+ * @param optionName
1111
+ * @param dataSources
1112
+ * @param options
1113
+ * @param vizConfig
1114
+ * @returns
1115
+ */
876
1116
 
877
- var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
1117
+ var invalidOptionField = function invalidOptionField(optionName, dataSources, options, vizConfig) {
1118
+ var columns = dataSources.primary.data.columns;
1119
+ var fieldIndex = exports.getPieOptionFieldIndex(optionName, dataSources, options, vizConfig);
878
1120
 
879
- if (typeof page === 'number' && page > 0) {
880
- newParams.count = pageCount;
881
- newParams.offset = (page - 1) * pageCount;
882
- }
1121
+ if (fieldIndex === -1 || !columns[fieldIndex] || !Array.isArray(columns[fieldIndex]) || Array.isArray(columns[fieldIndex]) && !columns[fieldIndex].length) {
1122
+ return true;
1123
+ }
883
1124
 
884
- onRequestParamsChange(newParams);
885
- };
1125
+ return false;
1126
+ };
886
1127
 
887
- return {
888
- isPaging: isPaging,
889
- current: current,
890
- totalPages: totalPages,
891
- onChange: lodash_1.isFunction(onRequestParamsChange) ? onChangeHandler : lodash_1.noop
892
- };
1128
+ exports.invalidOptionField = invalidOptionField;
1129
+ /**
1130
+ * Helper function to evaluate if all data values are invalid (zero or negative)
1131
+ */
1132
+
1133
+ var allInvalidDataValues = function allInvalidDataValues(dataSources, options, vizConfig) {
1134
+ var columns = dataSources.primary.data.columns; // find the field index configured for pie "value"
1135
+
1136
+ var valueFieldIndex = exports.getPieOptionFieldIndex('value', dataSources, options, vizConfig); // check if all values are invalid
1137
+
1138
+ if (Array.isArray(columns) && columns[valueFieldIndex] && Array.isArray(columns[valueFieldIndex])) {
1139
+ return !columns[valueFieldIndex].some(function (value) {
1140
+ return +value > 0;
1141
+ });
1142
+ }
1143
+
1144
+ return false;
893
1145
  };
894
1146
 
895
- exports.getPaginationParams = getPaginationParams;
1147
+ exports.allInvalidDataValues = allInvalidDataValues;
896
1148
 
897
1149
  /***/ }),
898
- /* 29 */
899
- /***/ (function(module, exports, __webpack_require__) {
900
1150
 
901
- "use strict";
1151
+ /***/ 24:
1152
+ /***/ (function(module, exports) {
902
1153
 
1154
+ module.exports = require("@splunk/visualizations-shared/hocUtils");
903
1155
 
904
- Object.defineProperty(exports, "__esModule", {
905
- value: true
906
- });
907
- exports.VizCategory = void 0;
908
- var VizCategory;
1156
+ /***/ }),
909
1157
 
910
- (function (VizCategory) {
911
- VizCategory["SINGLE_VALUE"] = "Single Value";
912
- VizCategory["TRENDS"] = "Trends";
913
- VizCategory["COMPARISONS"] = "Comparisons";
914
- VizCategory["TABLE"] = "Table";
915
- VizCategory["GAUGE"] = "Gauge";
916
- VizCategory["DISTRIBUTIONS"] = "Distributions";
917
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
918
- VizCategory["SHAPES"] = "Shapes";
919
- VizCategory["MISC"] = "misc";
920
- VizCategory["FLOW"] = "Flow";
921
- VizCategory["CORRELATION"] = "Correlation";
922
- VizCategory["SPATIAL"] = "Spatial";
923
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
1158
+ /***/ 25:
1159
+ /***/ (function(module, exports) {
1160
+
1161
+ module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
924
1162
 
925
1163
  /***/ }),
926
- /* 30 */
1164
+
1165
+ /***/ 27:
927
1166
  /***/ (function(module, exports, __webpack_require__) {
928
1167
 
929
1168
  "use strict";
@@ -932,46 +1171,310 @@ var VizCategory;
932
1171
  Object.defineProperty(exports, "__esModule", {
933
1172
  value: true
934
1173
  });
1174
+ exports.shouldShowIconPlaceholder = void 0;
935
1175
 
936
1176
  var React = __webpack_require__(1);
937
1177
 
938
- var lodash_1 = __webpack_require__(2);
939
-
940
- var getSettingsFromThemedProps_1 = __webpack_require__(31);
941
-
942
- var Options_1 = __webpack_require__(32);
943
-
944
- var SanitizeProps_1 = __webpack_require__(33);
945
-
946
- var TimezoneContext_1 = __webpack_require__(21);
947
-
948
- var moment_1 = __webpack_require__(34);
949
-
950
- var styled_components_1 = __webpack_require__(4);
951
-
952
- var SplunkVisualization_1 = __webpack_require__(35);
953
-
954
- var VizBehavior_1 = __webpack_require__(5);
955
-
956
- var getSorting_1 = __webpack_require__(27);
1178
+ var T = __webpack_require__(0);
957
1179
 
958
- var getPagination_1 = __webpack_require__(28);
1180
+ var lodash_1 = __webpack_require__(3);
959
1181
 
960
- var useDeepMemo_1 = __webpack_require__(38);
1182
+ var i18n_1 = __webpack_require__(2);
961
1183
 
962
- var JSONSchemaUtils_1 = __webpack_require__(25);
1184
+ var Message_1 = __webpack_require__(9);
963
1185
 
964
- var MissingPropsMessage_1 = __webpack_require__(39);
1186
+ var FixedSizeContainer_1 = __webpack_require__(12);
1187
+ /**
1188
+ * @method shouldShowIconPlaceholder
1189
+ * @param {object} dataSources
1190
+ * @param {boolean} loading
1191
+ * @returns {boolean}
1192
+ */
965
1193
 
966
- var withEditModeCover_1 = __webpack_require__(40);
967
1194
 
968
- var withPlaceholder_1 = __webpack_require__(42);
1195
+ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
1196
+ var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1197
+ var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
1198
+ var noData = data === undefined;
1199
+ var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
1200
+ var noFields = fields === undefined;
1201
+ return loading || noData || noFields;
1202
+ };
969
1203
 
970
- var hocUtils_1 = __webpack_require__(8);
1204
+ exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
1205
+ var propTypes = {
1206
+ icon: T.func,
1207
+ width: T.oneOfType([T.string, T.number]),
1208
+ height: T.oneOfType([T.string, T.number]),
1209
+ // eslint-disable-next-line react/no-unused-prop-types
1210
+ backgroundColor: T.string,
1211
+ iconColor: T.string
1212
+ };
971
1213
  /**
972
- * hoc that wraps a pure react visualization in a Dashboard visualization
973
- * @param {DashboardVizOpts} opts
974
- * @returns {HOC}
1214
+ * @method IconPlaceholder
1215
+ * @param {IconPlaceholderProps} props
1216
+ * @returns {React.ReactElement}
1217
+ */
1218
+
1219
+ var IconPlaceholder = function IconPlaceholder(props) {
1220
+ var width = props.width,
1221
+ height = props.height,
1222
+ icon = props.icon,
1223
+ iconColor = props.iconColor;
1224
+
1225
+ if (icon) {
1226
+ return React.createElement(icon, {
1227
+ style: {
1228
+ left: '50%',
1229
+ top: '50%',
1230
+ color: iconColor,
1231
+ opacity: 0.15,
1232
+ position: 'absolute',
1233
+ transform: 'translate(-50%, -50%)'
1234
+ },
1235
+ width: '50%',
1236
+ height: '50%'
1237
+ });
1238
+ }
1239
+
1240
+ return React.createElement(Message_1.default, {
1241
+ width: width,
1242
+ height: height,
1243
+ level: "warning",
1244
+ message: i18n_1._('No DataSource Connected')
1245
+ });
1246
+ };
1247
+
1248
+ IconPlaceholder.propTypes = propTypes;
1249
+ IconPlaceholder.defaultProps = {
1250
+ width: '100%',
1251
+ height: 250
1252
+ };
1253
+ exports.default = FixedSizeContainer_1.default(IconPlaceholder);
1254
+
1255
+ /***/ }),
1256
+
1257
+ /***/ 28:
1258
+ /***/ (function(module, exports, __webpack_require__) {
1259
+
1260
+ "use strict";
1261
+
1262
+
1263
+ var _defineProperty = __webpack_require__(6);
1264
+
1265
+ Object.defineProperty(exports, "__esModule", {
1266
+ value: true
1267
+ });
1268
+ exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1269
+
1270
+ var T = __webpack_require__(0);
1271
+
1272
+ var lodash_1 = __webpack_require__(3);
1273
+
1274
+ var DataSource_1 = __webpack_require__(38);
1275
+
1276
+ exports.SortParamsPropTypes = T.shape({
1277
+ currentSortKey: T.string,
1278
+ currentSortDir: T.oneOf(DataSource_1.validSortDirs),
1279
+ onSort: T.func
1280
+ });
1281
+
1282
+ var getSortingParams = function getSortingParams(_ref) {
1283
+ var requestParams = _ref.requestParams,
1284
+ onRequestParamsChange = _ref.onRequestParamsChange;
1285
+ var currentSortKey;
1286
+ var currentSortDir;
1287
+ var nextSortDirMap = {
1288
+ asc: 'desc',
1289
+ desc: 'asc',
1290
+ none: 'asc'
1291
+ };
1292
+ var onSort;
1293
+
1294
+ if (lodash_1.isFunction(onRequestParamsChange)) {
1295
+ if (requestParams && lodash_1.has(requestParams, 'sort')) {
1296
+ currentSortKey = Object.keys(requestParams.sort).shift();
1297
+ currentSortDir = requestParams.sort[currentSortKey];
1298
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
1299
+
1300
+
1301
+ onSort = function onSort(e, _ref2) {
1302
+ var sortKey = _ref2.sortKey,
1303
+ sortDir = _ref2.sortDir;
1304
+
1305
+ if (typeof sortKey === 'string') {
1306
+ var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
1307
+ onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
1308
+ offset: 0,
1309
+ sort: _defineProperty({}, sortKey, nextSortDir)
1310
+ }));
1311
+ } else {
1312
+ onRequestParamsChange(requestParams);
1313
+ }
1314
+ };
1315
+ }
1316
+
1317
+ return {
1318
+ currentSortKey: currentSortKey,
1319
+ currentSortDir: currentSortDir,
1320
+ onSort: onSort
1321
+ };
1322
+ };
1323
+
1324
+ exports.getSortingParams = getSortingParams;
1325
+
1326
+ /***/ }),
1327
+
1328
+ /***/ 29:
1329
+ /***/ (function(module, exports, __webpack_require__) {
1330
+
1331
+ "use strict";
1332
+
1333
+
1334
+ Object.defineProperty(exports, "__esModule", {
1335
+ value: true
1336
+ });
1337
+ exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1338
+
1339
+ var T = __webpack_require__(0);
1340
+
1341
+ var lodash_1 = __webpack_require__(3);
1342
+
1343
+ exports.PaginatorParamsPropTypes = T.shape({
1344
+ isPaging: T.bool,
1345
+ current: T.number,
1346
+ totalPages: T.number,
1347
+ onChange: T.func
1348
+ });
1349
+
1350
+ var getPaginationParams = function getPaginationParams(_ref) {
1351
+ var requestParams = _ref.requestParams,
1352
+ meta = _ref.meta,
1353
+ onRequestParamsChange = _ref.onRequestParamsChange;
1354
+ var totalCount = meta && meta.totalCount || 0;
1355
+ var offset = requestParams && requestParams.offset || 0;
1356
+ var count = requestParams && requestParams.count;
1357
+ var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
1358
+ var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
1359
+ var isPaging = totalPages > 1 && lodash_1.isFunction(onRequestParamsChange);
1360
+
1361
+ var onChangeHandler = function onChangeHandler(e, _ref2) {
1362
+ var page = _ref2.page,
1363
+ countArg = _ref2.count;
1364
+ var newParams = lodash_1.cloneDeep(requestParams);
1365
+
1366
+ if (typeof countArg === 'number') {
1367
+ newParams.count = countArg;
1368
+ newParams.offset = 0;
1369
+ }
1370
+
1371
+ var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
1372
+
1373
+ if (typeof page === 'number' && page > 0) {
1374
+ newParams.count = pageCount;
1375
+ newParams.offset = (page - 1) * pageCount;
1376
+ }
1377
+
1378
+ onRequestParamsChange(newParams);
1379
+ };
1380
+
1381
+ return {
1382
+ isPaging: isPaging,
1383
+ current: current,
1384
+ totalPages: totalPages,
1385
+ onChange: lodash_1.isFunction(onRequestParamsChange) ? onChangeHandler : lodash_1.noop
1386
+ };
1387
+ };
1388
+
1389
+ exports.getPaginationParams = getPaginationParams;
1390
+
1391
+ /***/ }),
1392
+
1393
+ /***/ 3:
1394
+ /***/ (function(module, exports) {
1395
+
1396
+ module.exports = require("lodash");
1397
+
1398
+ /***/ }),
1399
+
1400
+ /***/ 30:
1401
+ /***/ (function(module, exports, __webpack_require__) {
1402
+
1403
+ "use strict";
1404
+
1405
+
1406
+ Object.defineProperty(exports, "__esModule", {
1407
+ value: true
1408
+ });
1409
+ exports.VizCategory = void 0;
1410
+ var VizCategory;
1411
+
1412
+ (function (VizCategory) {
1413
+ VizCategory["SINGLE_VALUE"] = "Single Value";
1414
+ VizCategory["TRENDS"] = "Trends";
1415
+ VizCategory["COMPARISONS"] = "Comparisons";
1416
+ VizCategory["TABLE"] = "Table";
1417
+ VizCategory["GAUGE"] = "Gauge";
1418
+ VizCategory["DISTRIBUTIONS"] = "Distributions";
1419
+ VizCategory["CHOROPLETH"] = "Choropleth Maps";
1420
+ VizCategory["SHAPES"] = "Shapes";
1421
+ VizCategory["MISC"] = "misc";
1422
+ VizCategory["FLOW"] = "Flow";
1423
+ VizCategory["CORRELATION"] = "Correlation";
1424
+ VizCategory["SPATIAL"] = "Spatial";
1425
+ })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
1426
+
1427
+ /***/ }),
1428
+
1429
+ /***/ 31:
1430
+ /***/ (function(module, exports, __webpack_require__) {
1431
+
1432
+ "use strict";
1433
+
1434
+
1435
+ Object.defineProperty(exports, "__esModule", {
1436
+ value: true
1437
+ });
1438
+
1439
+ var React = __webpack_require__(1);
1440
+
1441
+ var lodash_1 = __webpack_require__(3);
1442
+
1443
+ var getSettingsFromThemedProps_1 = __webpack_require__(32);
1444
+
1445
+ var Options_1 = __webpack_require__(33);
1446
+
1447
+ var SanitizeProps_1 = __webpack_require__(34);
1448
+
1449
+ var TimezoneContext_1 = __webpack_require__(22);
1450
+
1451
+ var moment_1 = __webpack_require__(35);
1452
+
1453
+ var styled_components_1 = __webpack_require__(4);
1454
+
1455
+ var hocUtils_1 = __webpack_require__(24);
1456
+
1457
+ var JSONSchemaUtils_1 = __webpack_require__(25);
1458
+
1459
+ var SplunkVisualization_1 = __webpack_require__(36);
1460
+
1461
+ var VizBehavior_1 = __webpack_require__(5);
1462
+
1463
+ var getSorting_1 = __webpack_require__(28);
1464
+
1465
+ var getPagination_1 = __webpack_require__(29);
1466
+
1467
+ var useDeepMemo_1 = __webpack_require__(39);
1468
+
1469
+ var MissingPropsMessage_1 = __webpack_require__(40);
1470
+
1471
+ var withEditModeCover_1 = __webpack_require__(41);
1472
+
1473
+ var withPlaceholder_1 = __webpack_require__(42);
1474
+ /**
1475
+ * hoc that wraps a pure react visualization in a Dashboard visualization
1476
+ * @param {DashboardVizOpts} opts
1477
+ * @returns {HOC}
975
1478
  */
976
1479
 
977
1480
 
@@ -1168,37 +1671,42 @@ var withDashboardViz = function withDashboardViz(opts) {
1168
1671
  exports.default = withDashboardViz;
1169
1672
 
1170
1673
  /***/ }),
1171
- /* 31 */
1674
+
1675
+ /***/ 32:
1172
1676
  /***/ (function(module, exports) {
1173
1677
 
1174
1678
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1175
1679
 
1176
1680
  /***/ }),
1177
- /* 32 */
1681
+
1682
+ /***/ 33:
1178
1683
  /***/ (function(module, exports) {
1179
1684
 
1180
1685
  module.exports = require("@splunk/visualization-encoding/Options");
1181
1686
 
1182
1687
  /***/ }),
1183
- /* 33 */
1688
+
1689
+ /***/ 34:
1184
1690
  /***/ (function(module, exports) {
1185
1691
 
1186
1692
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1187
1693
 
1188
1694
  /***/ }),
1189
- /* 34 */
1695
+
1696
+ /***/ 35:
1190
1697
  /***/ (function(module, exports) {
1191
1698
 
1192
1699
  module.exports = require("@splunk/moment");
1193
1700
 
1194
1701
  /***/ }),
1195
- /* 35 */
1702
+
1703
+ /***/ 36:
1196
1704
  /***/ (function(module, exports, __webpack_require__) {
1197
1705
 
1198
1706
  "use strict";
1199
1707
 
1200
1708
 
1201
- var _classCallCheck = __webpack_require__(12);
1709
+ var _classCallCheck = __webpack_require__(10);
1202
1710
 
1203
1711
  Object.defineProperty(exports, "__esModule", {
1204
1712
  value: true
@@ -1208,9 +1716,9 @@ exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1208
1716
 
1209
1717
  var T = __webpack_require__(0);
1210
1718
 
1211
- var lodash_1 = __webpack_require__(2);
1719
+ var lodash_1 = __webpack_require__(3);
1212
1720
 
1213
- var VizActionHandler_1 = __webpack_require__(36); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1721
+ var VizActionHandler_1 = __webpack_require__(37); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1214
1722
 
1215
1723
 
1216
1724
  exports.INITIAL_WIDTH = 250;
@@ -1343,15 +1851,16 @@ SplunkVisualization.defaultProps = {
1343
1851
  exports.default = SplunkVisualization;
1344
1852
 
1345
1853
  /***/ }),
1346
- /* 36 */
1854
+
1855
+ /***/ 37:
1347
1856
  /***/ (function(module, exports, __webpack_require__) {
1348
1857
 
1349
1858
  "use strict";
1350
1859
 
1351
1860
 
1352
- var _classCallCheck = __webpack_require__(12);
1861
+ var _classCallCheck = __webpack_require__(10);
1353
1862
 
1354
- var _createClass = __webpack_require__(17);
1863
+ var _createClass = __webpack_require__(18);
1355
1864
 
1356
1865
  Object.defineProperty(exports, "__esModule", {
1357
1866
  value: true
@@ -1380,7 +1889,8 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
1380
1889
  exports.DefaultVizActionHandler = DefaultVizActionHandler;
1381
1890
 
1382
1891
  /***/ }),
1383
- /* 37 */
1892
+
1893
+ /***/ 38:
1384
1894
  /***/ (function(module, exports, __webpack_require__) {
1385
1895
 
1386
1896
  "use strict";
@@ -1393,7 +1903,8 @@ exports.validSortDirs = void 0;
1393
1903
  exports.validSortDirs = ['asc', 'desc', 'none'];
1394
1904
 
1395
1905
  /***/ }),
1396
- /* 38 */
1906
+
1907
+ /***/ 39:
1397
1908
  /***/ (function(module, exports, __webpack_require__) {
1398
1909
 
1399
1910
  "use strict";
@@ -1406,7 +1917,7 @@ exports.useDeepMemo = void 0;
1406
1917
 
1407
1918
  var react_1 = __webpack_require__(1);
1408
1919
 
1409
- var lodash_1 = __webpack_require__(2);
1920
+ var lodash_1 = __webpack_require__(3);
1410
1921
  /**
1411
1922
  * This hook evaluates and stores the result of a passed function and only
1412
1923
  * re-evaluates the function when passed dependencies change.
@@ -1438,7 +1949,15 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1438
1949
  exports.useDeepMemo = useDeepMemo;
1439
1950
 
1440
1951
  /***/ }),
1441
- /* 39 */
1952
+
1953
+ /***/ 4:
1954
+ /***/ (function(module, exports) {
1955
+
1956
+ module.exports = require("styled-components");
1957
+
1958
+ /***/ }),
1959
+
1960
+ /***/ 40:
1442
1961
  /***/ (function(module, exports, __webpack_require__) {
1443
1962
 
1444
1963
  "use strict";
@@ -1453,11 +1972,11 @@ var React = __webpack_require__(1);
1453
1972
 
1454
1973
  var T = __webpack_require__(0);
1455
1974
 
1456
- var i18n_1 = __webpack_require__(3);
1975
+ var i18n_1 = __webpack_require__(2);
1457
1976
 
1458
- var Message_1 = __webpack_require__(11);
1977
+ var Message_1 = __webpack_require__(9);
1459
1978
 
1460
- var FixedSizeContainer_1 = __webpack_require__(14);
1979
+ var FixedSizeContainer_1 = __webpack_require__(12);
1461
1980
  /**
1462
1981
  * @method isMissing
1463
1982
  * @param {any} v
@@ -1518,7 +2037,8 @@ exports.MissingPropsMessage.defaultProps = {
1518
2037
  exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
1519
2038
 
1520
2039
  /***/ }),
1521
- /* 40 */
2040
+
2041
+ /***/ 41:
1522
2042
  /***/ (function(module, exports, __webpack_require__) {
1523
2043
 
1524
2044
  "use strict";
@@ -1532,14 +2052,14 @@ var React = __webpack_require__(1);
1532
2052
 
1533
2053
  var styled_components_1 = __webpack_require__(4);
1534
2054
 
1535
- var hocUtils_1 = __webpack_require__(8);
2055
+ var hocUtils_1 = __webpack_require__(13);
1536
2056
 
1537
2057
  var Cover = styled_components_1.default.div.withConfig({
1538
2058
  displayName: "withEditModeCover__Cover",
1539
2059
  componentId: "sc-1gsbnxb-0"
1540
2060
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1541
2061
  var Blocker = styled_components_1.default.div.attrs({
1542
- 'data-splunk-visualization-version': "25.0.0 - 5e0f30e5a"
2062
+ 'data-splunk-visualization-version': "25.1.0 - 812a9a4d8"
1543
2063
  }).withConfig({
1544
2064
  displayName: "withEditModeCover__Blocker",
1545
2065
  componentId: "sc-1gsbnxb-1"
@@ -1570,13 +2090,8 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1570
2090
  exports.default = withEditModeCover;
1571
2091
 
1572
2092
  /***/ }),
1573
- /* 41 */
1574
- /***/ (function(module, exports) {
1575
-
1576
- module.exports = require("@splunk/visualizations-shared/mapUtils");
1577
2093
 
1578
- /***/ }),
1579
- /* 42 */
2094
+ /***/ 42:
1580
2095
  /***/ (function(module, exports, __webpack_require__) {
1581
2096
 
1582
2097
  "use strict";
@@ -1588,15 +2103,15 @@ Object.defineProperty(exports, "__esModule", {
1588
2103
 
1589
2104
  var React = __webpack_require__(1);
1590
2105
 
1591
- var colorUtils_1 = __webpack_require__(13);
2106
+ var colorUtils_1 = __webpack_require__(11);
1592
2107
 
1593
- var variables_1 = __webpack_require__(10);
2108
+ var variables_1 = __webpack_require__(8);
1594
2109
 
1595
- var IconPlaceholder_1 = __webpack_require__(26);
2110
+ var IconPlaceholder_1 = __webpack_require__(27);
1596
2111
 
1597
2112
  var VizBehavior_1 = __webpack_require__(5);
1598
2113
 
1599
- var hocUtils_1 = __webpack_require__(8);
2114
+ var hocUtils_1 = __webpack_require__(13);
1600
2115
 
1601
2116
  var withPlaceholder = function withPlaceholder(Visualization) {
1602
2117
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
@@ -1640,23 +2155,22 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1640
2155
  exports.default = withPlaceholder;
1641
2156
 
1642
2157
  /***/ }),
1643
- /* 43 */,
1644
- /* 44 */
2158
+
2159
+ /***/ 44:
1645
2160
  /***/ (function(module, exports) {
1646
2161
 
1647
2162
  module.exports = require("@splunk/visualization-color-palettes");
1648
2163
 
1649
2164
  /***/ }),
1650
- /* 45 */
2165
+
2166
+ /***/ 45:
1651
2167
  /***/ (function(module, exports) {
1652
2168
 
1653
2169
  module.exports = require("@splunk/visualization-icons/placeholders");
1654
2170
 
1655
2171
  /***/ }),
1656
- /* 46 */,
1657
- /* 47 */,
1658
- /* 48 */,
1659
- /* 49 */
2172
+
2173
+ /***/ 49:
1660
2174
  /***/ (function(module, exports, __webpack_require__) {
1661
2175
 
1662
2176
  "use strict";
@@ -1666,7 +2180,7 @@ Object.defineProperty(exports, "__esModule", {
1666
2180
  value: true
1667
2181
  });
1668
2182
 
1669
- var i18n_1 = __webpack_require__(3);
2183
+ var i18n_1 = __webpack_require__(2);
1670
2184
 
1671
2185
  var background = function background(_ref) {
1672
2186
  var label = _ref.label,
@@ -1686,13 +2200,52 @@ var background = function background(_ref) {
1686
2200
  exports.default = background;
1687
2201
 
1688
2202
  /***/ }),
1689
- /* 50 */
2203
+
2204
+ /***/ 5:
1690
2205
  /***/ (function(module, exports, __webpack_require__) {
1691
2206
 
1692
2207
  "use strict";
1693
2208
 
1694
2209
 
1695
- var _toConsumableArray = __webpack_require__(9);
2210
+ Object.defineProperty(exports, "__esModule", {
2211
+ value: true
2212
+ });
2213
+ exports.VizBehavior = void 0;
2214
+ var VizBehavior;
2215
+
2216
+ (function (VizBehavior) {
2217
+ /**
2218
+ * Dynamic Options Behavior.
2219
+ * This allows visualization options to be powered by data
2220
+ *
2221
+ * **Example**
2222
+ *
2223
+ * sparklineValues: ">primary|seriesByIndex(0)"
2224
+ * would configure sparklineValues with an array of data points
2225
+ * coming from the first series in the primary datasource
2226
+ *
2227
+ */
2228
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
2229
+ VizBehavior["EVENTS"] = "events";
2230
+ /**
2231
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
2232
+ * missing.
2233
+ * @type {string}
2234
+ */
2235
+
2236
+ VizBehavior["PLACEHOLDER"] = "placeholder";
2237
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
2238
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
2239
+
2240
+ /***/ }),
2241
+
2242
+ /***/ 50:
2243
+ /***/ (function(module, exports, __webpack_require__) {
2244
+
2245
+ "use strict";
2246
+
2247
+
2248
+ var _toConsumableArray = __webpack_require__(7);
1696
2249
 
1697
2250
  var __rest = this && this.__rest || function (s, e) {
1698
2251
  var t = {};
@@ -1712,7 +2265,7 @@ Object.defineProperty(exports, "__esModule", {
1712
2265
  });
1713
2266
  exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
1714
2267
 
1715
- var lodash_1 = __webpack_require__(2);
2268
+ var lodash_1 = __webpack_require__(3);
1716
2269
  /**
1717
2270
  * Get formatted annotations
1718
2271
  * @method getAnnotations
@@ -1907,16 +2460,15 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
1907
2460
  exports.constructFieldsAndColumns = constructFieldsAndColumns;
1908
2461
 
1909
2462
  /***/ }),
1910
- /* 51 */
2463
+
2464
+ /***/ 51:
1911
2465
  /***/ (function(module, exports) {
1912
2466
 
1913
2467
  module.exports = require("@splunk/charting-bundle");
1914
2468
 
1915
2469
  /***/ }),
1916
- /* 52 */,
1917
- /* 53 */,
1918
- /* 54 */,
1919
- /* 55 */
2470
+
2471
+ /***/ 55:
1920
2472
  /***/ (function(module, exports, __webpack_require__) {
1921
2473
 
1922
2474
  "use strict";
@@ -1928,9 +2480,9 @@ Object.defineProperty(exports, "__esModule", {
1928
2480
  exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
1929
2481
  /* eslint-disable react/no-unused-prop-types */
1930
2482
 
1931
- var lodash_1 = __webpack_require__(2);
2483
+ var lodash_1 = __webpack_require__(3);
1932
2484
 
1933
- var i18n_1 = __webpack_require__(3);
2485
+ var i18n_1 = __webpack_require__(2);
1934
2486
 
1935
2487
  var visualization_color_palettes_1 = __webpack_require__(44);
1936
2488
 
@@ -1947,13 +2499,13 @@ __webpack_require__(57); // fixme, @splunk/charting should be refactor to use lo
1947
2499
 
1948
2500
  var charting_bundle_1 = __webpack_require__(51);
1949
2501
 
1950
- var TimezoneContext_1 = __webpack_require__(21);
2502
+ var TimezoneContext_1 = __webpack_require__(22);
1951
2503
 
1952
- var style_1 = __webpack_require__(15);
2504
+ var style_1 = __webpack_require__(14);
1953
2505
 
1954
2506
  var styled_components_1 = __webpack_require__(4);
1955
2507
 
1956
- var Message_1 = __webpack_require__(11);
2508
+ var Message_1 = __webpack_require__(9);
1957
2509
 
1958
2510
  var useSplunkTheme_1 = __webpack_require__(58);
1959
2511
 
@@ -2328,883 +2880,155 @@ var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
2328
2880
  return React.createElement(Chart, Object.assign({}, props));
2329
2881
  };
2330
2882
 
2331
- Wrapper.displayName = 'ChartingWrapper';
2332
- Wrapper.propTypes = propTypes;
2333
- Wrapper.defaultProps = defaultProps;
2334
- return Wrapper;
2335
- }; // export default Charting;
2336
-
2337
-
2338
- exports.default = withEmptyChartMessage(Charting);
2339
-
2340
- /***/ }),
2341
- /* 56 */
2342
- /***/ (function(module, exports) {
2343
-
2344
- module.exports = require("react-event-listener");
2345
-
2346
- /***/ }),
2347
- /* 57 */
2348
- /***/ (function(module, exports) {
2349
-
2350
- module.exports = require("@splunk/visualizations-shared/i18n");
2351
-
2352
- /***/ }),
2353
- /* 58 */
2354
- /***/ (function(module, exports) {
2355
-
2356
- module.exports = require("@splunk/themes/useSplunkTheme");
2357
-
2358
- /***/ }),
2359
- /* 59 */
2360
- /***/ (function(module, exports) {
2361
-
2362
- module.exports = require("@splunk/visualizations-shared/themeUtils");
2363
-
2364
- /***/ }),
2365
- /* 60 */
2366
- /***/ (function(module, exports, __webpack_require__) {
2367
-
2368
- "use strict";
2369
-
2370
-
2371
- var _classCallCheck = __webpack_require__(12);
2372
-
2373
- var _createClass = __webpack_require__(17);
2374
-
2375
- Object.defineProperty(exports, "__esModule", {
2376
- value: true
2377
- });
2378
- exports.ChartingApiFunctional = void 0;
2379
-
2380
- var ChartingApiFunctional = /*#__PURE__*/function () {
2381
- // eslint-disable-next-line no-useless-constructor
2382
- function ChartingApiFunctional(chartRef) {
2383
- _classCallCheck(this, ChartingApiFunctional);
2384
-
2385
- this.chartRef = chartRef;
2386
- }
2387
- /**
2388
- * Allows users to programmatically highlight a point on the chart
2389
- *
2390
- * @memberof ChartingApiFunctional
2391
- */
2392
-
2393
-
2394
- _createClass(ChartingApiFunctional, [{
2395
- key: "highlight",
2396
- value: function highlight() {
2397
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
2398
- xValue: '',
2399
- seriesName: ''
2400
- },
2401
- xValue = _ref.xValue,
2402
- seriesName = _ref.seriesName;
2403
-
2404
- this.getChart().highlight(xValue, seriesName);
2405
- }
2406
- /**
2407
- * Allows users to programmatically unhighlight all points on the chart
2408
- *
2409
- * @memberof ChartingApiFunctional
2410
- */
2411
-
2412
- }, {
2413
- key: "unHighlight",
2414
- value: function unHighlight() {
2415
- this.getChart().unHighlight();
2416
- } // returns chart object
2417
-
2418
- }, {
2419
- key: "getChart",
2420
- value: function getChart() {
2421
- var _a;
2422
-
2423
- return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
2424
- }
2425
- }]);
2426
-
2427
- return ChartingApiFunctional;
2428
- }();
2429
-
2430
- exports.ChartingApiFunctional = ChartingApiFunctional;
2431
-
2432
- /***/ }),
2433
- /* 61 */
2434
- /***/ (function(module, exports) {
2435
-
2436
- module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
2437
-
2438
- /***/ }),
2439
- /* 62 */,
2440
- /* 63 */,
2441
- /* 64 */,
2442
- /* 65 */,
2443
- /* 66 */,
2444
- /* 67 */,
2445
- /* 68 */,
2446
- /* 69 */,
2447
- /* 70 */,
2448
- /* 71 */,
2449
- /* 72 */,
2450
- /* 73 */,
2451
- /* 74 */,
2452
- /* 75 */,
2453
- /* 76 */,
2454
- /* 77 */,
2455
- /* 78 */,
2456
- /* 79 */,
2457
- /* 80 */,
2458
- /* 81 */,
2459
- /* 82 */,
2460
- /* 83 */,
2461
- /* 84 */,
2462
- /* 85 */,
2463
- /* 86 */,
2464
- /* 87 */,
2465
- /* 88 */,
2466
- /* 89 */,
2467
- /* 90 */,
2468
- /* 91 */,
2469
- /* 92 */,
2470
- /* 93 */,
2471
- /* 94 */,
2472
- /* 95 */,
2473
- /* 96 */,
2474
- /* 97 */,
2475
- /* 98 */,
2476
- /* 99 */,
2477
- /* 100 */,
2478
- /* 101 */,
2479
- /* 102 */,
2480
- /* 103 */,
2481
- /* 104 */,
2482
- /* 105 */
2483
- /***/ (function(module, exports) {
2484
-
2485
- module.exports = require("@splunk/visualization-encoding/utils/dsl");
2486
-
2487
- /***/ }),
2488
- /* 106 */,
2489
- /* 107 */,
2490
- /* 108 */,
2491
- /* 109 */,
2492
- /* 110 */,
2493
- /* 111 */,
2494
- /* 112 */,
2495
- /* 113 */,
2496
- /* 114 */,
2497
- /* 115 */,
2498
- /* 116 */,
2499
- /* 117 */,
2500
- /* 118 */,
2501
- /* 119 */,
2502
- /* 120 */,
2503
- /* 121 */,
2504
- /* 122 */,
2505
- /* 123 */,
2506
- /* 124 */,
2507
- /* 125 */,
2508
- /* 126 */,
2509
- /* 127 */,
2510
- /* 128 */,
2511
- /* 129 */,
2512
- /* 130 */,
2513
- /* 131 */,
2514
- /* 132 */,
2515
- /* 133 */,
2516
- /* 134 */
2517
- /***/ (function(module, exports, __webpack_require__) {
2518
-
2519
- "use strict";
2520
-
2521
-
2522
- var __rest = this && this.__rest || function (s, e) {
2523
- var t = {};
2524
-
2525
- for (var p in s) {
2526
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2527
- }
2528
-
2529
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2530
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2531
- }
2532
- return t;
2533
- };
2534
-
2535
- Object.defineProperty(exports, "__esModule", {
2536
- value: true
2537
- });
2538
- exports.config = exports.themes = exports.showPlaceHolderIcon = exports.computeVizProps = exports.PieInnerSize = void 0;
2539
-
2540
- var lodash_1 = __webpack_require__(2); // Charting imports i18n which needs to be run to instantiate window globals in the
2541
- // eslint-disable-next-line import/order
2542
-
2543
-
2544
- var Charting_1 = __webpack_require__(55);
2545
-
2546
- var charting_bundle_1 = __webpack_require__(51);
2547
-
2548
- var simpleXMLOptions_1 = __webpack_require__(61);
2549
-
2550
- var config_1 = __webpack_require__(228);
2551
-
2552
- exports.config = config_1.default;
2553
-
2554
- var withDashboardViz_1 = __webpack_require__(30);
2555
-
2556
- var pieUtils_1 = __webpack_require__(230);
2557
-
2558
- var chartingUtils_1 = __webpack_require__(50);
2559
-
2560
- var IconPlaceholder_1 = __webpack_require__(26);
2561
-
2562
- var validOptions = Object.keys(config_1.default.optionsSchema);
2563
- exports.PieInnerSize = 0.7;
2564
-
2565
- var computeVizProps = function computeVizProps(_a) {
2566
- var dataSources = _a.dataSources,
2567
- onEventTrigger = _a.onEventTrigger,
2568
- label = _a.label,
2569
- value = _a.value,
2570
- showDonutHole = _a.showDonutHole,
2571
- visualizationApiRef = _a.visualizationApiRef,
2572
- otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "label", "value", "showDonutHole", "visualizationApiRef"]); // options to be passed as props
2573
-
2574
-
2575
- var computedProps = {
2576
- visualizationApiRef: visualizationApiRef
2577
- };
2578
- var labelField = otherOptions.labelField,
2579
- valueField = otherOptions.valueField,
2580
- hasEventHandlers = otherOptions.hasEventHandlers;
2581
- computedProps.options = lodash_1.chain(otherOptions).pick(validOptions).thru(pieUtils_1.convertToPieSCProperties).thru(function (options) {
2582
- return Object.assign(Object.assign({}, simpleXMLOptions_1.getSimpleXMLOptionsForProps(options)), {
2583
- chart: 'pie'
2584
- });
2585
- }).value();
2586
- var truncationLimit = computedProps.options['chart.resultTruncationLimit'];
2587
- var primaryData = Object.assign(Object.assign({}, dataSources.primary.data), {
2588
- columns: [label, value]
2589
- });
2590
- primaryData.fields = [{
2591
- name: labelField
2592
- }, {
2593
- name: valueField
2594
- }];
2595
-
2596
- if (!value) {
2597
- primaryData.columns = [label, []];
2598
- }
2599
-
2600
- primaryData.columns.forEach(function (column, index) {
2601
- if (column) {
2602
- primaryData.columns[index] = column.map(String);
2603
- }
2604
- });
2605
-
2606
- if (truncationLimit) {
2607
- primaryData = chartingUtils_1.truncateData(primaryData, truncationLimit);
2608
- }
2609
-
2610
- computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign({}, primaryData));
2611
-
2612
- if (showDonutHole) {
2613
- computedProps.options['chart.pieInnerSize'] = exports.PieInnerSize;
2614
- } else {
2615
- computedProps.options['chart.pieInnerSize'] = 0;
2616
- }
2617
-
2618
- if (hasEventHandlers) {
2619
- computedProps.onClick = onEventTrigger;
2620
- }
2621
-
2622
- return computedProps;
2623
- };
2624
-
2625
- exports.computeVizProps = computeVizProps; // Returns true to display the placeholder icon, if invalid datasource condition or invalid data value/labels condition is met
2626
-
2627
- var showPlaceHolderIcon = function showPlaceHolderIcon(dataSources, loading, options) {
2628
- return IconPlaceholder_1.shouldShowIconPlaceholder(dataSources, loading) || pieUtils_1.invalidOptionField('value', dataSources, options, config_1.default) || pieUtils_1.invalidOptionField('label', dataSources, options, config_1.default) || pieUtils_1.allInvalidDataValues(dataSources, options, config_1.default);
2629
- };
2630
-
2631
- exports.showPlaceHolderIcon = showPlaceHolderIcon;
2632
- var Pie = withDashboardViz_1.default({
2633
- ReactViz: Charting_1.default,
2634
- computeVizProps: exports.computeVizProps,
2635
- useIconPlaceholder: function useIconPlaceholder(dataSources, loading, options) {
2636
- return exports.showPlaceHolderIcon(dataSources, loading, options);
2637
- },
2638
- vizConfig: config_1.default
2639
- });
2640
- var themes = null;
2641
- exports.themes = themes;
2642
- exports.default = Pie;
2643
-
2644
- /***/ }),
2645
- /* 135 */,
2646
- /* 136 */,
2647
- /* 137 */,
2648
- /* 138 */,
2649
- /* 139 */,
2650
- /* 140 */,
2651
- /* 141 */,
2652
- /* 142 */,
2653
- /* 143 */,
2654
- /* 144 */,
2655
- /* 145 */,
2656
- /* 146 */,
2657
- /* 147 */,
2658
- /* 148 */,
2659
- /* 149 */,
2660
- /* 150 */,
2661
- /* 151 */,
2662
- /* 152 */,
2663
- /* 153 */,
2664
- /* 154 */,
2665
- /* 155 */,
2666
- /* 156 */,
2667
- /* 157 */,
2668
- /* 158 */,
2669
- /* 159 */,
2670
- /* 160 */,
2671
- /* 161 */,
2672
- /* 162 */,
2673
- /* 163 */,
2674
- /* 164 */,
2675
- /* 165 */,
2676
- /* 166 */,
2677
- /* 167 */,
2678
- /* 168 */,
2679
- /* 169 */,
2680
- /* 170 */,
2681
- /* 171 */,
2682
- /* 172 */,
2683
- /* 173 */,
2684
- /* 174 */,
2685
- /* 175 */,
2686
- /* 176 */,
2687
- /* 177 */,
2688
- /* 178 */,
2689
- /* 179 */,
2690
- /* 180 */,
2691
- /* 181 */,
2692
- /* 182 */,
2693
- /* 183 */,
2694
- /* 184 */,
2695
- /* 185 */,
2696
- /* 186 */,
2697
- /* 187 */,
2698
- /* 188 */,
2699
- /* 189 */,
2700
- /* 190 */,
2701
- /* 191 */,
2702
- /* 192 */,
2703
- /* 193 */,
2704
- /* 194 */,
2705
- /* 195 */,
2706
- /* 196 */,
2707
- /* 197 */,
2708
- /* 198 */,
2709
- /* 199 */,
2710
- /* 200 */,
2711
- /* 201 */,
2712
- /* 202 */,
2713
- /* 203 */,
2714
- /* 204 */,
2715
- /* 205 */,
2716
- /* 206 */,
2717
- /* 207 */,
2718
- /* 208 */,
2719
- /* 209 */,
2720
- /* 210 */,
2721
- /* 211 */,
2722
- /* 212 */,
2723
- /* 213 */,
2724
- /* 214 */,
2725
- /* 215 */,
2726
- /* 216 */,
2727
- /* 217 */,
2728
- /* 218 */,
2729
- /* 219 */,
2730
- /* 220 */,
2731
- /* 221 */,
2732
- /* 222 */,
2733
- /* 223 */,
2734
- /* 224 */,
2735
- /* 225 */,
2736
- /* 226 */,
2737
- /* 227 */
2738
- /***/ (function(module, exports, __webpack_require__) {
2739
-
2740
- "use strict";
2741
-
2742
-
2743
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
2744
- if (k2 === undefined) k2 = k;
2745
- Object.defineProperty(o, k2, {
2746
- enumerable: true,
2747
- get: function get() {
2748
- return m[k];
2749
- }
2750
- });
2751
- } : function (o, m, k, k2) {
2752
- if (k2 === undefined) k2 = k;
2753
- o[k2] = m[k];
2754
- });
2755
-
2756
- var __exportStar = this && this.__exportStar || function (m, exports) {
2757
- for (var p in m) {
2758
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2759
- }
2760
- };
2761
-
2762
- Object.defineProperty(exports, "__esModule", {
2763
- value: true
2764
- });
2765
- exports.default = void 0;
2766
-
2767
- __exportStar(__webpack_require__(134), exports);
2768
-
2769
- var Pie_1 = __webpack_require__(134);
2770
-
2771
- Object.defineProperty(exports, "default", {
2772
- enumerable: true,
2773
- get: function get() {
2774
- return Pie_1.default;
2775
- }
2776
- });
2777
-
2778
- /***/ }),
2779
- /* 228 */
2780
- /***/ (function(module, exports, __webpack_require__) {
2781
-
2782
- "use strict";
2783
-
2784
-
2785
- Object.defineProperty(exports, "__esModule", {
2786
- value: true
2787
- });
2788
-
2789
- var ChartPie_1 = __webpack_require__(229);
2790
-
2791
- var placeholders_1 = __webpack_require__(45);
2792
-
2793
- var i18n_1 = __webpack_require__(3);
2794
-
2795
- var schemaUtils_1 = __webpack_require__(16);
2796
-
2797
- var visualization_color_palettes_1 = __webpack_require__(44);
2798
-
2799
- var pick_1 = __webpack_require__(20);
2800
-
2801
- var variables_1 = __webpack_require__(10);
2802
-
2803
- var VizBehavior_1 = __webpack_require__(5);
2804
-
2805
- var VizCategory_1 = __webpack_require__(29);
2806
-
2807
- var configUtils_1 = __webpack_require__(6);
2808
-
2809
- var BackgroundColor_1 = __webpack_require__(49);
2810
-
2811
- var dataContract = {
2812
- requiredDataSources: [{
2813
- name: 'primary',
2814
- description: 'DataSource that powers the visualization'
2815
- }],
2816
- optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
2817
- // {
2818
- // name: 'annotation',
2819
- // description: 'DataSource that populate event annotations',
2820
- // },
2821
- ],
2822
- initialRequestParams: {
2823
- primary: {
2824
- offset: 0,
2825
- count: 10000
2826
- }
2827
- }
2828
- };
2829
- var size = {
2830
- initialWidth: 300,
2831
- initialHeight: 300
2832
- };
2833
- var defaultContext = {};
2834
- var optionsSchema = {
2835
- backgroundColor: {
2836
- default: '> themes.defaultBackgroundColor',
2837
- 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".',
2838
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN,
2839
- type: 'string'
2840
- },
2841
- collapseLabel: {
2842
- description: 'Specify the label for the consolidated slice.',
2843
- type: 'string',
2844
- default: 'other'
2845
- },
2846
- collapseThreshold: {
2847
- 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.',
2848
- type: 'number',
2849
- default: 0.01
2850
- },
2851
- label: {
2852
- description: 'List of string values to display the pie chart labels.',
2853
- type: 'array',
2854
- items: {
2855
- type: 'string'
2856
- },
2857
- default: '> primary | seriesByIndex(0)'
2858
- },
2859
- labelField: {
2860
- default: '> label | getField()',
2861
- description: 'Specify the field that corresponds to the labels.',
2862
- type: 'string'
2863
- },
2864
- labelDisplay: {
2865
- description: 'Specify whether to display the labels and/or slice percentages.',
2866
- type: 'string',
2867
- pattern: schemaUtils_1.getPattern(['values', 'valuesAndPercentage', 'off']),
2868
- default: 'values'
2869
- },
2870
- resultLimit: {
2871
- default: 50000,
2872
- description: 'Specify the number of data points rendered in a chart.',
2873
- type: 'number'
2874
- },
2875
- seriesColors: {
2876
- default: visualization_color_palettes_1.VIZ_CATEGORICAL,
2877
- description: 'Specify the colors used for a series. For example, ["#FF0000", "#0000FF", "#008000"].',
2878
- type: 'array',
2879
- items: {
2880
- type: 'string'
2881
- }
2882
- },
2883
- seriesColorsByField: {
2884
- description: 'Specify the colors used for specific pie slice labels. For example: {"April": "#008000", "May": "#FFA500"}.',
2885
- type: 'object'
2886
- },
2887
- showDonutHole: {
2888
- default: false,
2889
- description: 'Specify whether the pie should be a donut.',
2890
- type: 'boolean'
2891
- },
2892
- value: {
2893
- description: 'List of numerical values to power the pie chart.',
2894
- type: 'array',
2895
- items: {
2896
- type: 'number'
2897
- },
2898
- default: '> primary | seriesByIndex(1)'
2899
- },
2900
- valueField: {
2901
- default: '> value | getField()',
2902
- description: 'Specify the field that corresponds to the data powering values.',
2903
- type: 'string'
2904
- }
2905
- };
2906
- var themes = {
2907
- defaultBackgroundColor: function defaultBackgroundColor(props) {
2908
- return pick_1.default({
2909
- enterprise: {
2910
- dark: variables_1.default.black(props),
2911
- light: variables_1.default.backgroundColor(props)
2912
- },
2913
- prisma: variables_1.default.backgroundColorSidebar(props)
2914
- })(props);
2915
- }
2916
- };
2917
- var editorConfig = [{
2918
- label: i18n_1._('General'),
2919
- layout: [BackgroundColor_1.default({
2920
- themes: themes
2921
- })]
2922
- }, {
2923
- label: i18n_1._('Appearance'),
2924
- open: true,
2925
- layout: [[{
2926
- label: i18n_1._(''),
2927
- option: 'showDonutHole',
2928
- editor: 'editor.radioBar',
2929
- editorProps: {
2930
- values: [{
2931
- label: i18n_1._('Pie'),
2932
- value: false
2933
- }, {
2934
- label: i18n_1._('Donut'),
2935
- value: true
2936
- }]
2937
- }
2938
- }]]
2939
- }, {
2940
- label: i18n_1._('Labels'),
2941
- layout: [[{
2942
- label: '',
2943
- option: 'labelDisplay',
2944
- editor: 'editor.radioBar',
2945
- editorProps: {
2946
- values: [{
2947
- label: i18n_1._('Values'),
2948
- value: 'values'
2949
- }, {
2950
- label: i18n_1._('Values & Percent'),
2951
- value: 'valuesAndPercentage'
2952
- }, {
2953
- label: i18n_1._('Off'),
2954
- value: 'off'
2955
- }]
2956
- }
2957
- }]]
2958
- }, {
2959
- label: i18n_1._('Collapse to Summary'),
2960
- layout: [[{
2961
- label: i18n_1._('Collapse Threshold'),
2962
- option: 'collapseThreshold',
2963
- editor: 'editor.number',
2964
- editorProps: {
2965
- min: 0,
2966
- max: 1,
2967
- step: 0.01
2968
- }
2969
- }], [{
2970
- label: i18n_1._('Collapsed Slice Label'),
2971
- option: 'collapseLabel',
2972
- editor: 'editor.text'
2973
- }]]
2974
- }];
2975
- /**
2976
- * visualization configuration
2977
- */
2978
-
2979
- var config = {
2980
- /**
2981
- * unique viz key
2982
- */
2983
- key: 'splunk.pie',
2883
+ Wrapper.displayName = 'ChartingWrapper';
2884
+ Wrapper.propTypes = propTypes;
2885
+ Wrapper.defaultProps = defaultProps;
2886
+ return Wrapper;
2887
+ }; // export default Charting;
2984
2888
 
2985
- /**
2986
- * viz name
2987
- */
2988
- name: 'Pie',
2989
- category: VizCategory_1.VizCategory.COMPARISONS,
2990
2889
 
2991
- /**
2992
- * viz icon
2993
- */
2994
- icon: ChartPie_1.default,
2995
- placeholderIcon: placeholders_1.Pie,
2996
- dataContract: dataContract,
2997
- size: size,
2998
- defaultContext: defaultContext,
2999
- optionsSchema: optionsSchema,
3000
- editorConfig: editorConfig,
3001
- events: {
3002
- 'point.click': {
3003
- description: 'triggered when user clicks on a point in the pie chart'
3004
- }
3005
- },
3006
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
3007
- themes: themes
3008
- };
3009
- exports.default = configUtils_1.enhanceConfig(config);
2890
+ exports.default = withEmptyChartMessage(Charting);
3010
2891
 
3011
2892
  /***/ }),
3012
- /* 229 */
2893
+
2894
+ /***/ 56:
3013
2895
  /***/ (function(module, exports) {
3014
2896
 
3015
- module.exports = require("@splunk/react-icons/ChartPie");
2897
+ module.exports = require("react-event-listener");
3016
2898
 
3017
2899
  /***/ }),
3018
- /* 230 */
3019
- /***/ (function(module, exports, __webpack_require__) {
3020
2900
 
3021
- "use strict";
2901
+ /***/ 57:
2902
+ /***/ (function(module, exports) {
3022
2903
 
2904
+ module.exports = require("@splunk/visualizations-shared/i18n");
3023
2905
 
3024
- var __rest = this && this.__rest || function (s, e) {
3025
- var t = {};
2906
+ /***/ }),
3026
2907
 
3027
- for (var p in s) {
3028
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
3029
- }
2908
+ /***/ 58:
2909
+ /***/ (function(module, exports) {
3030
2910
 
3031
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3032
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
3033
- }
3034
- return t;
3035
- };
2911
+ module.exports = require("@splunk/themes/useSplunkTheme");
3036
2912
 
3037
- Object.defineProperty(exports, "__esModule", {
3038
- value: true
3039
- });
3040
- exports.allInvalidDataValues = exports.invalidOptionField = exports.getPieOptionFieldIndex = exports.getPieMergedOptions = exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
2913
+ /***/ }),
3041
2914
 
3042
- var lodash_1 = __webpack_require__(2);
2915
+ /***/ 59:
2916
+ /***/ (function(module, exports) {
3043
2917
 
3044
- var propUtils_1 = __webpack_require__(22);
2918
+ module.exports = require("@splunk/visualizations-shared/themeUtils");
3045
2919
 
3046
- var dsl_1 = __webpack_require__(105);
2920
+ /***/ }),
3047
2921
 
3048
- var JSONSchemaUtils_1 = __webpack_require__(25);
2922
+ /***/ 6:
2923
+ /***/ (function(module, exports) {
3049
2924
 
3050
- var hocUtils_1 = __webpack_require__(8); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
3051
- // map for key names which are either new or not present in SimpleXML options mapping
2925
+ module.exports = require("@babel/runtime/helpers/defineProperty");
3052
2926
 
2927
+ /***/ }),
3053
2928
 
3054
- var pieOptionsSCMapping = {
3055
- resultLimit: 'resultTruncationLimit',
3056
- seriesColorsByField: 'fieldColors',
3057
- collapseThreshold: 'chart.sliceCollapsingThreshold',
3058
- collapseLabel: 'chart.sliceCollapsingLabel'
3059
- };
3060
- /**
3061
- * Helper method to convert option which contains object literal values (e.g. arrays, objects)
3062
- * to strings as SC can only accept their stringified equivalents
3063
- * @method convertToStringValues
3064
- * @param {Object} options
3065
- * @returns {Object}
3066
- */
2929
+ /***/ 60:
2930
+ /***/ (function(module, exports, __webpack_require__) {
3067
2931
 
3068
- var convertToStringValues = function convertToStringValues(options) {
3069
- var updatedOptions = propUtils_1.convertPropsToString({
3070
- vizProps: options,
3071
- propNames: ['seriesColors', 'fieldColors']
3072
- });
3073
- return Object.assign(Object.assign({}, options), updatedOptions);
3074
- };
2932
+ "use strict";
3075
2933
 
3076
- exports.convertToStringValues = convertToStringValues;
3077
- /**
3078
- * Helper method to map labelDisplay options to jsCharting options
3079
- * @method mapLabelDisplay
3080
- * @param {Object} options
3081
- * @returns {Object}
3082
- */
3083
2934
 
3084
- var mapLabelDisplay = function mapLabelDisplay(_a) {
3085
- var labelDisplay = _a.labelDisplay,
3086
- options = __rest(_a, ["labelDisplay"]);
2935
+ var _classCallCheck = __webpack_require__(10);
3087
2936
 
3088
- var convertedOptions = Object.assign(Object.assign({}, options), {
3089
- // default for labelDisplay option is 'values'
3090
- 'chart.showLabels': true,
3091
- 'chart.showPercent': false
3092
- });
2937
+ var _createClass = __webpack_require__(18);
3093
2938
 
3094
- if (labelDisplay === 'valuesAndPercentage') {
3095
- convertedOptions['chart.showPercent'] = true;
3096
- } else if (labelDisplay === 'off') {
3097
- convertedOptions['chart.showLabels'] = false;
2939
+ Object.defineProperty(exports, "__esModule", {
2940
+ value: true
2941
+ });
2942
+ exports.ChartingApiFunctional = void 0;
2943
+
2944
+ var ChartingApiFunctional = /*#__PURE__*/function () {
2945
+ // eslint-disable-next-line no-useless-constructor
2946
+ function ChartingApiFunctional(chartRef) {
2947
+ _classCallCheck(this, ChartingApiFunctional);
2948
+
2949
+ this.chartRef = chartRef;
3098
2950
  }
2951
+ /**
2952
+ * Allows users to programmatically highlight a point on the chart
2953
+ *
2954
+ * @memberof ChartingApiFunctional
2955
+ */
3099
2956
 
3100
- return convertedOptions;
3101
- };
3102
2957
 
3103
- exports.mapLabelDisplay = mapLabelDisplay;
3104
- /**
3105
- * Helper method to update the option names which can be mapped to SimpleXML options or
3106
- * can be used directly with SC if don't have a 1-1 mapping in SimpleXML
3107
- * @method mapToOldKey
3108
- * @param {Object} options
3109
- * @returns {Object}
3110
- */
2958
+ _createClass(ChartingApiFunctional, [{
2959
+ key: "highlight",
2960
+ value: function highlight() {
2961
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
2962
+ xValue: '',
2963
+ seriesName: ''
2964
+ },
2965
+ xValue = _ref.xValue,
2966
+ seriesName = _ref.seriesName;
3111
2967
 
3112
- var mapToOldKey = function mapToOldKey(options) {
3113
- return lodash_1.mapKeys(options, function (val, key) {
3114
- return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
3115
- });
3116
- };
2968
+ this.getChart().highlight(xValue, seriesName);
2969
+ }
2970
+ /**
2971
+ * Allows users to programmatically unhighlight all points on the chart
2972
+ *
2973
+ * @memberof ChartingApiFunctional
2974
+ */
3117
2975
 
3118
- exports.mapToOldKey = mapToOldKey;
3119
- /**
3120
- * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
3121
- * This is for options that has new key name and can not directly be mapped with SimpleXML or
3122
- * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
3123
- * @method convertToPieSCProperties
3124
- * @param {Object} originalOptions
3125
- * @returns {Object}
3126
- */
2976
+ }, {
2977
+ key: "unHighlight",
2978
+ value: function unHighlight() {
2979
+ this.getChart().unHighlight();
2980
+ } // returns chart object
3127
2981
 
3128
- var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
3129
- return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
3130
- };
2982
+ }, {
2983
+ key: "getChart",
2984
+ value: function getChart() {
2985
+ var _a;
3131
2986
 
3132
- exports.convertToPieSCProperties = convertToPieSCProperties;
3133
- /**
3134
- * Return all merged options (default + config) using vizConfig and options
3135
- * @param options
3136
- * @param vizConfig
3137
- * @returns
3138
- */
2987
+ return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
2988
+ }
2989
+ }]);
3139
2990
 
3140
- var getPieMergedOptions = function getPieMergedOptions(options, vizConfig) {
3141
- return hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default'));
3142
- };
2991
+ return ChartingApiFunctional;
2992
+ }();
3143
2993
 
3144
- exports.getPieMergedOptions = getPieMergedOptions;
3145
- /**
3146
- * Returns option's field index. If not found returns -1
3147
- * @param optionName
3148
- * @param dataSources
3149
- * @param options
3150
- * @param vizConfig
3151
- * @returns
3152
- */
2994
+ exports.ChartingApiFunctional = ChartingApiFunctional;
3153
2995
 
3154
- var getPieOptionFieldIndex = function getPieOptionFieldIndex(optionName, dataSources, options, vizConfig) {
3155
- var mergedOptions = exports.getPieMergedOptions(options, vizConfig); // find the field name configured for pie "value"
2996
+ /***/ }),
3156
2997
 
3157
- var fieldName = dsl_1.getFieldsFromDSL(mergedOptions[optionName], dataSources)[0];
3158
- var fields = dataSources.primary.data.fields; // find the field index configured for pie "value"
2998
+ /***/ 61:
2999
+ /***/ (function(module, exports) {
3159
3000
 
3160
- var fieldIndex = fields.findIndex(function (field) {
3161
- return (typeof field === 'string' ? field : field.name.toString()) === fieldName;
3162
- });
3163
- return fieldIndex;
3164
- };
3001
+ module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
3165
3002
 
3166
- exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
3167
- /**
3168
- * Returns true if columns data has invalid data format for specified option (label or value)
3169
- * @param optionName
3170
- * @param dataSources
3171
- * @param options
3172
- * @param vizConfig
3173
- * @returns
3174
- */
3003
+ /***/ }),
3175
3004
 
3176
- var invalidOptionField = function invalidOptionField(optionName, dataSources, options, vizConfig) {
3177
- var columns = dataSources.primary.data.columns;
3178
- var fieldIndex = exports.getPieOptionFieldIndex(optionName, dataSources, options, vizConfig);
3005
+ /***/ 7:
3006
+ /***/ (function(module, exports) {
3179
3007
 
3180
- if (fieldIndex === -1 || !columns[fieldIndex] || !Array.isArray(columns[fieldIndex]) || Array.isArray(columns[fieldIndex]) && !columns[fieldIndex].length) {
3181
- return true;
3182
- }
3008
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
3183
3009
 
3184
- return false;
3185
- };
3010
+ /***/ }),
3186
3011
 
3187
- exports.invalidOptionField = invalidOptionField;
3188
- /**
3189
- * Helper function to evaluate if all data values are invalid (zero or negative)
3190
- */
3012
+ /***/ 8:
3013
+ /***/ (function(module, exports) {
3191
3014
 
3192
- var allInvalidDataValues = function allInvalidDataValues(dataSources, options, vizConfig) {
3193
- var columns = dataSources.primary.data.columns; // find the field index configured for pie "value"
3015
+ module.exports = require("@splunk/themes/variables");
3194
3016
 
3195
- var valueFieldIndex = exports.getPieOptionFieldIndex('value', dataSources, options, vizConfig); // check if all values are invalid
3017
+ /***/ }),
3196
3018
 
3197
- if (Array.isArray(columns) && columns[valueFieldIndex] && Array.isArray(columns[valueFieldIndex])) {
3198
- return !columns[valueFieldIndex].some(function (value) {
3199
- return +value > 0;
3200
- });
3201
- }
3019
+ /***/ 88:
3020
+ /***/ (function(module, exports) {
3202
3021
 
3203
- return false;
3204
- };
3022
+ module.exports = require("@splunk/visualization-encoding/utils/dsl");
3205
3023
 
3206
- exports.allInvalidDataValues = allInvalidDataValues;
3024
+ /***/ }),
3025
+
3026
+ /***/ 9:
3027
+ /***/ (function(module, exports) {
3028
+
3029
+ module.exports = require("@splunk/visualizations-shared/Message");
3207
3030
 
3208
3031
  /***/ })
3209
- /******/ ]);
3032
+
3033
+ /******/ });
3210
3034
  //# sourceMappingURL=Pie.js.map