@splunk/visualizations 25.0.1 → 25.2.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 (200) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_Background_Color_Red.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_Basic.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_FieldSummaryTooltip_Actions_Simulated_Instance.png +0 -0
  4. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_FieldSummaryTooltip_Actions_for_Numeric_Field_Simulated_Instance.png +0 -0
  5. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_FieldSummaryTooltip_Dark.png +0 -0
  6. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_FieldSummaryTooltip_Light.png +0 -0
  7. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_custom_base_layer_tile_server.png +0 -0
  8. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValueIcon_Background_color_cyan.png +0 -0
  9. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValueIcon_Unit_specified_Unit_Position_after_default.png +0 -0
  10. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValueIcon_Unit_specified_Unit_Position_before.png +0 -0
  11. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValue_Background_Color_white_Under_Label_and_Unit_specified.png +0 -0
  12. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValue_Major_Value_is_null.png +0 -0
  13. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValue_Unit_specified_Unit_Position_after_default.png +0 -0
  14. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValue_Unit_specified_Unit_Position_before.png +0 -0
  15. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Area_Editor.png +0 -0
  16. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bar_Editor.png +0 -0
  17. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bubble_Editor.png +0 -0
  18. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_ChoroplethSvg_Editor.png +0 -0
  19. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Column_Editor.png +0 -0
  20. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Ellipse_Editor.png +0 -0
  21. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Events_Editor.png +0 -0
  22. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_FillerGauge_Editor.png +0 -0
  23. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Image_Editor.png +0 -0
  24. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Line_Editor.png +0 -0
  25. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_LinkGraph_Editor.png +0 -0
  26. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  27. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Markdown_Editor.png +0 -0
  28. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_MarkerGauge_Editor.png +0 -0
  29. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Parallel_Coordinates_Editor.png +0 -0
  30. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Pie_Editor.png +0 -0
  31. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Punchcard_Editor.png +0 -0
  32. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Rectangle_Editor.png +0 -0
  33. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Sankey_Editor.png +0 -0
  34. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Scatter_Editor.png +0 -0
  35. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Editor.png +0 -0
  36. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Icon_Editor.png +0 -0
  37. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Radial_Editor.png +0 -0
  38. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Table_Editor.png +0 -0
  39. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Background_Color_Light_Blue.png +0 -0
  40. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Basic_Events.png +0 -0
  41. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Event_Actions.png +0 -0
  42. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Actions.png +0 -0
  43. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Summary.png +0 -0
  44. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Summary_Simulated_Instance.png +0 -0
  45. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Footer_Fields.png +0 -0
  46. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Footer_Fields_with_Highlight.png +0 -0
  47. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Show_Placeholder.png +0 -0
  48. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Width_Height.png +0 -0
  49. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Width_Percentage_50.png +0 -0
  50. package/.loki/reference/chrome_docker_Visualizations_Events_Events_With_Options.png +0 -0
  51. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_ES.png +0 -0
  52. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Set_Unit_value_after.png +0 -0
  53. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Set_Unit_value_before.png +0 -0
  54. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Set_The_Unit_After.png +0 -0
  55. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Set_The_Unit_Before.png +0 -0
  56. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_Unit_Value_After.png +0 -0
  57. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_Unit_Value_Before.png +0 -0
  58. package/Area.config.js +146 -157
  59. package/Area.config.js.map +1 -1
  60. package/Area.js +459 -545
  61. package/Area.js.map +1 -1
  62. package/Bar.config.js +148 -153
  63. package/Bar.config.js.map +1 -1
  64. package/Bar.js +468 -548
  65. package/Bar.js.map +1 -1
  66. package/Bubble.config.js +143 -123
  67. package/Bubble.config.js.map +1 -1
  68. package/Bubble.js +475 -530
  69. package/Bubble.js.map +1 -1
  70. package/ChoroplethSvg.config.js +87 -81
  71. package/ChoroplethSvg.config.js.map +1 -1
  72. package/ChoroplethSvg.js +352 -422
  73. package/ChoroplethSvg.js.map +1 -1
  74. package/Column.config.js +144 -151
  75. package/Column.config.js.map +1 -1
  76. package/Column.js +463 -546
  77. package/Column.js.map +1 -1
  78. package/Ellipse.config.js +86 -80
  79. package/Ellipse.config.js.map +1 -1
  80. package/Ellipse.js +319 -389
  81. package/Ellipse.js.map +1 -1
  82. package/Events.config.js +668 -0
  83. package/Events.config.js.map +1 -0
  84. package/Events.js +3116 -0
  85. package/Events.js.map +1 -0
  86. package/FillerGauge.config.js +94 -87
  87. package/FillerGauge.config.js.map +1 -1
  88. package/FillerGauge.js +352 -415
  89. package/FillerGauge.js.map +1 -1
  90. package/Image.config.js +74 -74
  91. package/Image.config.js.map +1 -1
  92. package/Image.js +713 -801
  93. package/Image.js.map +1 -1
  94. package/Line.config.js +145 -142
  95. package/Line.config.js.map +1 -1
  96. package/Line.js +471 -538
  97. package/Line.js.map +1 -1
  98. package/LinkGraph.config.js +120 -113
  99. package/LinkGraph.config.js.map +1 -1
  100. package/LinkGraph.js +24563 -717
  101. package/LinkGraph.js.map +1 -1
  102. package/Map.config.js +107 -100
  103. package/Map.config.js.map +1 -1
  104. package/Map.js +2358 -2465
  105. package/Map.js.map +1 -1
  106. package/Markdown.config.js +112 -112
  107. package/Markdown.config.js.map +1 -1
  108. package/Markdown.js +844 -918
  109. package/Markdown.js.map +1 -1
  110. package/MarkerGauge.config.js +185 -186
  111. package/MarkerGauge.config.js.map +1 -1
  112. package/MarkerGauge.js +1274 -1363
  113. package/MarkerGauge.js.map +1 -1
  114. package/ParallelCoordinates.config.js +137 -137
  115. package/ParallelCoordinates.config.js.map +1 -1
  116. package/ParallelCoordinates.js +732 -923
  117. package/ParallelCoordinates.js.map +1 -1
  118. package/Pie.config.js +132 -132
  119. package/Pie.config.js.map +1 -1
  120. package/Pie.js +1193 -1281
  121. package/Pie.js.map +1 -1
  122. package/Punchcard.config.js +138 -138
  123. package/Punchcard.config.js.map +1 -1
  124. package/Punchcard.js +2723 -2923
  125. package/Punchcard.js.map +1 -1
  126. package/Rectangle.config.js +267 -260
  127. package/Rectangle.config.js.map +1 -1
  128. package/Rectangle.js +1107 -1188
  129. package/Rectangle.js.map +1 -1
  130. package/Sankey.config.js +149 -142
  131. package/Sankey.config.js.map +1 -1
  132. package/Sankey.js +2613 -2808
  133. package/Sankey.js.map +1 -1
  134. package/Scatter.config.js +144 -123
  135. package/Scatter.config.js.map +1 -1
  136. package/Scatter.js +1820 -1889
  137. package/Scatter.js.map +1 -1
  138. package/SingleValue.config.js +121 -114
  139. package/SingleValue.config.js.map +1 -1
  140. package/SingleValue.js +2554 -2635
  141. package/SingleValue.js.map +1 -1
  142. package/SingleValueBasic.js +34 -34
  143. package/SingleValueBasic.js.map +1 -1
  144. package/SingleValueIcon.config.js +129 -120
  145. package/SingleValueIcon.config.js.map +1 -1
  146. package/SingleValueIcon.js +994 -1212
  147. package/SingleValueIcon.js.map +1 -1
  148. package/SingleValueRadial.config.js +216 -178
  149. package/SingleValueRadial.config.js.map +1 -1
  150. package/SingleValueRadial.js +2235 -2316
  151. package/SingleValueRadial.js.map +1 -1
  152. package/Table.config.js +150 -151
  153. package/Table.config.js.map +1 -1
  154. package/Table.js +2446 -2525
  155. package/Table.js.map +1 -1
  156. package/common/Charting.js +11 -11
  157. package/common/Charting.js.map +1 -1
  158. package/common/ChartingApi.js +2 -2
  159. package/common/ChartingApi.js.map +1 -1
  160. package/common/EventsDoc.js +25 -18
  161. package/common/EventsDoc.js.map +1 -1
  162. package/common/GaugeMajorTicks.js +10 -10
  163. package/common/GaugeMajorTicks.js.map +1 -1
  164. package/common/GaugeValueMarker.js +10 -10
  165. package/common/GaugeValueMarker.js.map +1 -1
  166. package/common/OptionsDoc.js +57 -357
  167. package/common/OptionsDoc.js.map +1 -1
  168. package/common/OverviewDoc.js +22 -22
  169. package/common/OverviewDoc.js.map +1 -1
  170. package/common/SplunkVisualization.js +4 -4
  171. package/common/SplunkVisualization.js.map +1 -1
  172. package/common/SplunkVisualizationApi.js +2 -2
  173. package/common/SplunkVisualizationApi.js.map +1 -1
  174. package/common/ThemesDoc.js +21 -21
  175. package/common/ThemesDoc.js.map +1 -1
  176. package/common/chartingUtils.js +4 -4
  177. package/common/chartingUtils.js.map +1 -1
  178. package/common/docUtils.js +4 -4
  179. package/common/docUtils.js.map +1 -1
  180. package/common/gaugeUtils.js +13 -13
  181. package/common/gaugeUtils.js.map +1 -1
  182. package/common/shapeUtils.js +8 -8
  183. package/common/shapeUtils.js.map +1 -1
  184. package/common/utils/configUtils.js +17 -18
  185. package/common/utils/configUtils.js.map +1 -1
  186. package/common/utils/{JSONSchemaUtils.js → dataUtils.js} +24 -25
  187. package/common/utils/dataUtils.js.map +1 -0
  188. package/common/utils/hocUtils.js +5 -85
  189. package/common/utils/hocUtils.js.map +1 -1
  190. package/common/utils/mapUtils.js +198 -0
  191. package/common/utils/mapUtils.js.map +1 -0
  192. package/common/utils/singleValueUtils.js +15 -12
  193. package/common/utils/singleValueUtils.js.map +1 -1
  194. package/common/utils/testHelper.js +8 -8
  195. package/common/utils/testHelper.js.map +1 -1
  196. package/common/withDashboardViz.js +120 -207
  197. package/common/withDashboardViz.js.map +1 -1
  198. package/package.json +16 -14
  199. package/.loki/reference/chrome_docker_PureVisualizations_SvgChoroplethDynamic_SVG_Of_Size_Greater_Than_2_MB_Render.png +0 -0
  200. package/common/utils/JSONSchemaUtils.js.map +0 -1
package/Pie.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 228);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 413);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -109,39 +109,155 @@ module.exports = require("react");
109
109
  /***/ 10:
110
110
  /***/ (function(module, exports) {
111
111
 
112
- module.exports = require("@splunk/themes/variables");
112
+ module.exports = require("@splunk/visualizations-shared/Message");
113
113
 
114
114
  /***/ }),
115
115
 
116
- /***/ 106:
116
+ /***/ 11:
117
117
  /***/ (function(module, exports) {
118
118
 
119
- module.exports = require("@splunk/visualization-encoding/utils/dsl");
119
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
120
120
 
121
121
  /***/ }),
122
122
 
123
- /***/ 11:
123
+ /***/ 12:
124
124
  /***/ (function(module, exports) {
125
125
 
126
- module.exports = require("@splunk/visualizations-shared/Message");
126
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
127
127
 
128
128
  /***/ }),
129
129
 
130
- /***/ 12:
131
- /***/ (function(module, exports) {
130
+ /***/ 13:
131
+ /***/ (function(module, exports, __webpack_require__) {
132
132
 
133
- module.exports = require("@babel/runtime/helpers/classCallCheck");
133
+ "use strict";
134
+
135
+
136
+ Object.defineProperty(exports, "__esModule", {
137
+ value: true
138
+ });
139
+
140
+ var React = __webpack_require__(1);
141
+
142
+ var styled_components_1 = __webpack_require__(4);
143
+
144
+ var SizeAwareWrapper_1 = __webpack_require__(20);
145
+
146
+ var style_1 = __webpack_require__(15);
147
+
148
+ var colorUtils_1 = __webpack_require__(12);
149
+
150
+ var Item = styled_components_1.default.div.attrs(function (_ref) {
151
+ var width = _ref.width;
152
+ return {
153
+ style: {
154
+ width: style_1.toPx(width)
155
+ }
156
+ };
157
+ }).withConfig({
158
+ displayName: "FixedSizeContainer__Item",
159
+ componentId: "sc-1yhgpod-0"
160
+ })(["position:relative;background-color:", "};"], function (props) {
161
+ return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
162
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
163
+
164
+ var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
165
+ var width = _ref2.width,
166
+ height = _ref2.height;
167
+ return {
168
+ style: Object.assign(Object.assign({}, width && {
169
+ width: style_1.toPx(width)
170
+ }), height && {
171
+ height: style_1.toPx(height)
172
+ })
173
+ };
174
+ }).withConfig({
175
+ displayName: "FixedSizeContainer__FixSizeItem",
176
+ componentId: "sc-1yhgpod-1"
177
+ })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
178
+ return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
179
+ });
180
+ var ItemContent = styled_components_1.default.div.withConfig({
181
+ displayName: "FixedSizeContainer__ItemContent",
182
+ componentId: "sc-1yhgpod-2"
183
+ })(["position:relative;min-height:100px;width:100%;"]);
184
+ var FixSizeItemContent = styled_components_1.default.div.withConfig({
185
+ displayName: "FixedSizeContainer__FixSizeItemContent",
186
+ componentId: "sc-1yhgpod-3"
187
+ })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
188
+
189
+ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
190
+ var FixedSizeContainer = function FixedSizeContainer(props) {
191
+ var width = props.width,
192
+ height = props.height,
193
+ backgroundColor = props.backgroundColor;
194
+
195
+ if (!height) {
196
+ return React.createElement(Item, {
197
+ "data-test": "item",
198
+ width: width,
199
+ backgroundColor: backgroundColor
200
+ }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
201
+ }
202
+
203
+ return React.createElement(FixSizeItem, {
204
+ "data-test": "fix-size-item",
205
+ "data-splunk-visualization-version": "25.2.0 - 4373c5a66",
206
+ width: width,
207
+ height: height,
208
+ backgroundColor: backgroundColor
209
+ }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
210
+ var newWidth = _ref3.width,
211
+ newHeight = _ref3.height;
212
+ return React.createElement(Viz, Object.assign({}, props, {
213
+ width: newWidth,
214
+ height: newHeight
215
+ }));
216
+ })));
217
+ };
218
+
219
+ FixedSizeContainer.displayName = 'withFixedSizeContainer';
220
+ return FixedSizeContainer;
221
+ };
222
+
223
+ exports.default = withFixedSizeContainer;
134
224
 
135
225
  /***/ }),
136
226
 
137
- /***/ 13:
138
- /***/ (function(module, exports) {
227
+ /***/ 14:
228
+ /***/ (function(module, exports, __webpack_require__) {
139
229
 
140
- module.exports = require("@splunk/visualizations-shared/colorUtils");
230
+ "use strict";
231
+
232
+
233
+ Object.defineProperty(exports, "__esModule", {
234
+ value: true
235
+ });
236
+ exports.extendStaticWrapperProps = void 0;
237
+ /**
238
+ * @method extendStaticWrapperProps
239
+ * @param {Object} props
240
+ * @param {DashboardVizType} props.Wrapper
241
+ * @param {DashboardVizType} props.Visualization
242
+ */
243
+
244
+ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
245
+ var Wrapper = _ref.Wrapper,
246
+ Visualization = _ref.Visualization;
247
+ var extendProperties = ['propTypes', 'defaultProps', 'config'];
248
+ extendProperties.forEach(function (prop) {
249
+ if (Visualization[prop]) {
250
+ // eslint-disable-next-line no-param-reassign
251
+ Wrapper[prop] = Visualization[prop];
252
+ }
253
+ });
254
+ };
255
+
256
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
141
257
 
142
258
  /***/ }),
143
259
 
144
- /***/ 135:
260
+ /***/ 146:
145
261
  /***/ (function(module, exports, __webpack_require__) {
146
262
 
147
263
  "use strict";
@@ -165,27 +281,27 @@ Object.defineProperty(exports, "__esModule", {
165
281
  });
166
282
  exports.config = exports.themes = exports.showPlaceHolderIcon = exports.computeVizProps = exports.PieInnerSize = void 0;
167
283
 
168
- var lodash_1 = __webpack_require__(2); // Charting imports i18n which needs to be run to instantiate window globals in the
284
+ var lodash_1 = __webpack_require__(3); // Charting imports i18n which needs to be run to instantiate window globals in the
169
285
  // eslint-disable-next-line import/order
170
286
 
171
287
 
172
- var Charting_1 = __webpack_require__(55);
288
+ var Charting_1 = __webpack_require__(56);
173
289
 
174
- var charting_bundle_1 = __webpack_require__(51);
290
+ var charting_bundle_1 = __webpack_require__(53);
175
291
 
176
- var simpleXMLOptions_1 = __webpack_require__(61);
292
+ var simpleXMLOptions_1 = __webpack_require__(62);
177
293
 
178
- var config_1 = __webpack_require__(229);
294
+ var config_1 = __webpack_require__(414);
179
295
 
180
296
  exports.config = config_1.default;
181
297
 
182
- var withDashboardViz_1 = __webpack_require__(30);
298
+ var withDashboardViz_1 = __webpack_require__(32);
183
299
 
184
- var pieUtils_1 = __webpack_require__(231);
300
+ var pieUtils_1 = __webpack_require__(416);
185
301
 
186
- var chartingUtils_1 = __webpack_require__(50);
302
+ var chartingUtils_1 = __webpack_require__(52);
187
303
 
188
- var IconPlaceholder_1 = __webpack_require__(26);
304
+ var IconPlaceholder_1 = __webpack_require__(27);
189
305
 
190
306
  var validOptions = Object.keys(config_1.default.optionsSchema);
191
307
  exports.PieInnerSize = 0.7;
@@ -271,103 +387,6 @@ exports.default = Pie;
271
387
 
272
388
  /***/ }),
273
389
 
274
- /***/ 14:
275
- /***/ (function(module, exports, __webpack_require__) {
276
-
277
- "use strict";
278
-
279
-
280
- Object.defineProperty(exports, "__esModule", {
281
- value: true
282
- });
283
-
284
- var React = __webpack_require__(1);
285
-
286
- var styled_components_1 = __webpack_require__(4);
287
-
288
- var SizeAwareWrapper_1 = __webpack_require__(18);
289
-
290
- var style_1 = __webpack_require__(15);
291
-
292
- var colorUtils_1 = __webpack_require__(13);
293
-
294
- var Item = styled_components_1.default.div.attrs(function (_ref) {
295
- var width = _ref.width;
296
- return {
297
- style: {
298
- width: style_1.toPx(width)
299
- }
300
- };
301
- }).withConfig({
302
- displayName: "FixedSizeContainer__Item",
303
- componentId: "sc-1yhgpod-0"
304
- })(["position:relative;background-color:", "};"], function (props) {
305
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
306
- }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
307
-
308
- var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
309
- var width = _ref2.width,
310
- height = _ref2.height;
311
- return {
312
- style: Object.assign(Object.assign({}, width && {
313
- width: style_1.toPx(width)
314
- }), height && {
315
- height: style_1.toPx(height)
316
- })
317
- };
318
- }).withConfig({
319
- displayName: "FixedSizeContainer__FixSizeItem",
320
- componentId: "sc-1yhgpod-1"
321
- })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
322
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
323
- });
324
- var ItemContent = styled_components_1.default.div.withConfig({
325
- displayName: "FixedSizeContainer__ItemContent",
326
- componentId: "sc-1yhgpod-2"
327
- })(["position:relative;min-height:100px;width:100%;"]);
328
- var FixSizeItemContent = styled_components_1.default.div.withConfig({
329
- displayName: "FixedSizeContainer__FixSizeItemContent",
330
- componentId: "sc-1yhgpod-3"
331
- })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
332
-
333
- var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
334
- var FixedSizeContainer = function FixedSizeContainer(props) {
335
- var width = props.width,
336
- height = props.height,
337
- backgroundColor = props.backgroundColor;
338
-
339
- if (!height) {
340
- return React.createElement(Item, {
341
- "data-test": "item",
342
- width: width,
343
- backgroundColor: backgroundColor
344
- }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
345
- }
346
-
347
- return React.createElement(FixSizeItem, {
348
- "data-test": "fix-size-item",
349
- "data-splunk-visualization-version": "25.0.1 - de10ad954",
350
- width: width,
351
- height: height,
352
- backgroundColor: backgroundColor
353
- }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
354
- var newWidth = _ref3.width,
355
- newHeight = _ref3.height;
356
- return React.createElement(Viz, Object.assign({}, props, {
357
- width: newWidth,
358
- height: newHeight
359
- }));
360
- })));
361
- };
362
-
363
- FixedSizeContainer.displayName = 'withFixedSizeContainer';
364
- return FixedSizeContainer;
365
- };
366
-
367
- exports.default = withFixedSizeContainer;
368
-
369
- /***/ }),
370
-
371
390
  /***/ 15:
372
391
  /***/ (function(module, exports) {
373
392
 
@@ -383,611 +402,346 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
383
402
  /***/ }),
384
403
 
385
404
  /***/ 17:
386
- /***/ (function(module, exports) {
405
+ /***/ (function(module, exports, __webpack_require__) {
387
406
 
388
- module.exports = require("@babel/runtime/helpers/createClass");
407
+ "use strict";
389
408
 
390
- /***/ }),
391
409
 
392
- /***/ 18:
393
- /***/ (function(module, exports) {
410
+ var _toConsumableArray = __webpack_require__(8);
394
411
 
395
- module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
412
+ var _defineProperty = __webpack_require__(7);
396
413
 
397
- /***/ }),
414
+ var __rest = this && this.__rest || function (s, e) {
415
+ var t = {};
398
416
 
399
- /***/ 2:
400
- /***/ (function(module, exports) {
417
+ for (var p in s) {
418
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
419
+ }
401
420
 
402
- module.exports = require("lodash");
421
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
422
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
423
+ }
424
+ return t;
425
+ };
403
426
 
404
- /***/ }),
427
+ Object.defineProperty(exports, "__esModule", {
428
+ value: true
429
+ });
430
+ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
405
431
 
406
- /***/ 20:
407
- /***/ (function(module, exports) {
432
+ var lodash_1 = __webpack_require__(3);
408
433
 
409
- module.exports = require("@splunk/themes/pick");
434
+ var schemaUtils_1 = __webpack_require__(16);
410
435
 
411
- /***/ }),
436
+ var VizBehavior_1 = __webpack_require__(6);
412
437
 
413
- /***/ 21:
414
- /***/ (function(module, exports) {
438
+ var dynamicOptionsDSLType = {
439
+ type: 'string',
440
+ pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
441
+ };
442
+ /**
443
+ * Helper function to extend an options schema with dynamic options DSL
444
+ * @param optionsSchema a visualization's options schema
445
+ * @returns an updated options schema that additionally allows strings starting with > for each option
446
+ */
415
447
 
416
- module.exports = require("@splunk/visualization-context/TimezoneContext");
448
+ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
449
+ var enhancedOptionsSchema = {};
450
+ Object.keys(optionsSchema).forEach(function (key) {
451
+ var _a = optionsSchema[key],
452
+ title = _a.title,
453
+ description = _a.description,
454
+ readOnly = _a.readOnly,
455
+ writeOnly = _a.writeOnly,
456
+ examples = _a.examples,
457
+ defaultValue = _a.default,
458
+ type = _a.type,
459
+ properties = _a.properties,
460
+ patternProperties = _a.patternProperties,
461
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
417
462
 
418
- /***/ }),
463
+ var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
464
+ title: title
465
+ }), description !== undefined && {
466
+ description: description
467
+ }), readOnly !== undefined && {
468
+ readOnly: readOnly
469
+ }), writeOnly !== undefined && {
470
+ writeOnly: writeOnly
471
+ }), examples !== undefined && {
472
+ examples: examples
473
+ }), defaultValue !== undefined && {
474
+ default: defaultValue
475
+ });
419
476
 
420
- /***/ 22:
421
- /***/ (function(module, exports) {
477
+ if (type === 'object') {
478
+ enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
479
+ type: type
480
+ }), properties && {
481
+ properties: enhanceOptionsSchemaWithDynamicOptions(properties)
482
+ });
422
483
 
423
- module.exports = require("@splunk/visualizations-shared/propUtils");
484
+ if (patternProperties) {
485
+ var enhancedPatternProperties = {};
486
+ Object.keys(patternProperties).forEach(function (opt) {
487
+ enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
488
+ });
489
+ enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
490
+ }
491
+ } else {
492
+ enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
493
+ anyOf: [Object.assign(Object.assign({}, type !== undefined && {
494
+ type: type
495
+ }), remainingSchemaEntry), dynamicOptionsDSLType]
496
+ });
497
+ }
498
+ });
499
+ return enhancedOptionsSchema;
500
+ }
424
501
 
425
- /***/ }),
502
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
503
+ /**
504
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
505
+ * this function also collapse all editor panels
506
+ * @param vizConfig a Visualization Config
507
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
508
+ * and containing `open: false` for all editor panels in editorConfig
509
+ */
426
510
 
427
- /***/ 228:
428
- /***/ (function(module, exports, __webpack_require__) {
511
+ function enhanceConfig(vizConfig) {
512
+ var enhancedConfig = vizConfig;
429
513
 
430
- "use strict";
514
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
515
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
516
+ }
431
517
 
518
+ enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
519
+ return Object.assign(Object.assign({}, config), {
520
+ open: false
521
+ });
522
+ });
523
+ return enhancedConfig;
524
+ }
432
525
 
433
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
434
- if (k2 === undefined) k2 = k;
435
- Object.defineProperty(o, k2, {
436
- enumerable: true,
437
- get: function get() {
438
- return m[k];
439
- }
526
+ exports.enhanceConfig = enhanceConfig;
527
+ /**
528
+ * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
529
+ * Created for editor unit tests
530
+ * @param vizConfig a Visualization Config
531
+ * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
532
+ */
533
+
534
+ function uncollapseEditorConfig(vizConfig) {
535
+ var editorPanelUncollapsedConfig = vizConfig;
536
+ editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
537
+ return Object.assign(Object.assign({}, config), {
538
+ open: true
539
+ });
440
540
  });
441
- } : function (o, m, k, k2) {
442
- if (k2 === undefined) k2 = k;
443
- o[k2] = m[k];
444
- });
541
+ return editorPanelUncollapsedConfig;
542
+ }
445
543
 
446
- var __exportStar = this && this.__exportStar || function (m, exports) {
447
- for (var p in m) {
448
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
544
+ exports.uncollapseEditorConfig = uncollapseEditorConfig;
545
+
546
+ function isDynamicOption(option) {
547
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
548
+ }
549
+
550
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
551
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
552
+
553
+ /**
554
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
555
+ * 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
556
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
557
+ * 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
558
+ *
559
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
560
+ */
561
+
562
+ function hasCompatibleContexts(vizContext, presetContext) {
563
+ var presetContextKeys = Object.keys(presetContext);
564
+ return presetContextKeys.every(function (contextKey) {
565
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
566
+ });
567
+ }
568
+ /**
569
+ * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
570
+ */
571
+
572
+
573
+ function hasCompatibleOptions(vizOptions, presetOptions) {
574
+ var presetOptionKeys = Object.keys(presetOptions);
575
+ return presetOptionKeys.every(function (optionKey) {
576
+ return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
577
+ });
578
+ }
579
+ /**
580
+ * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
581
+ * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
582
+ *
583
+ * @param {Object} vizContext - the current vizContext definition
584
+ * @param {Object} vizOptions - the current vizOptions definition
585
+ * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
586
+ */
587
+
588
+
589
+ function getInitialPreset(vizContext, vizOptions, presets) {
590
+ return presets.find(function (preset) {
591
+ var presetContext = lodash_1.get(preset, ['value', 'context'], {});
592
+ var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
593
+ var presetContextKeys = Object.keys(presetContext);
594
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
595
+ // if not, then the preset is invalid in config.ts
596
+
597
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
598
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
599
+ });
600
+ }
601
+
602
+ exports.getInitialPreset = getInitialPreset;
603
+ /**
604
+ * generates number precision values for a Select editor
605
+ *
606
+ * @param {Number} numPrecisionValues - number of integer precision values to generate
607
+ * @returns {{ label: string; value; string }[]} array of { label, value } tuples
608
+ */
609
+
610
+ function generatePrecisionValues(numPrecisionValues) {
611
+ return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
612
+ return {
613
+ label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
614
+ value: i
615
+ };
616
+ });
617
+ }
618
+
619
+ exports.generatePrecisionValues = generatePrecisionValues;
620
+ /**
621
+ * insert layout in layout array, return a new layout array instead of updating the original
622
+ *
623
+ * @param {EditorLayoutConfig[][]} layout - editor layout
624
+ * @param {Number} index - the index to insert layout item(s)
625
+ * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
626
+ * @returns {EditorLayoutConfig[][]} new editor layout with insertion
627
+ */
628
+
629
+ var insertLayout = function insertLayout(layout, index) {
630
+ for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
631
+ layoutItems[_key - 2] = arguments[_key];
449
632
  }
633
+
634
+ return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
450
635
  };
451
636
 
452
- Object.defineProperty(exports, "__esModule", {
453
- value: true
454
- });
455
- exports.default = void 0;
637
+ exports.insertLayout = insertLayout;
456
638
 
457
- __exportStar(__webpack_require__(135), exports);
639
+ /***/ }),
458
640
 
459
- var Pie_1 = __webpack_require__(135);
641
+ /***/ 19:
642
+ /***/ (function(module, exports) {
460
643
 
461
- Object.defineProperty(exports, "default", {
462
- enumerable: true,
463
- get: function get() {
464
- return Pie_1.default;
465
- }
466
- });
644
+ module.exports = require("@babel/runtime/helpers/createClass");
467
645
 
468
646
  /***/ }),
469
647
 
470
- /***/ 229:
471
- /***/ (function(module, exports, __webpack_require__) {
648
+ /***/ 2:
649
+ /***/ (function(module, exports) {
472
650
 
473
- "use strict";
651
+ module.exports = require("@splunk/ui-utils/i18n");
474
652
 
653
+ /***/ }),
475
654
 
476
- Object.defineProperty(exports, "__esModule", {
477
- value: true
478
- });
655
+ /***/ 20:
656
+ /***/ (function(module, exports) {
479
657
 
480
- var ChartPie_1 = __webpack_require__(230);
658
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
481
659
 
482
- var placeholders_1 = __webpack_require__(45);
660
+ /***/ }),
483
661
 
484
- var i18n_1 = __webpack_require__(3);
662
+ /***/ 21:
663
+ /***/ (function(module, exports) {
485
664
 
486
- var schemaUtils_1 = __webpack_require__(16);
665
+ module.exports = require("@splunk/themes/pick");
487
666
 
488
- var visualization_color_palettes_1 = __webpack_require__(44);
667
+ /***/ }),
489
668
 
490
- var pick_1 = __webpack_require__(20);
669
+ /***/ 23:
670
+ /***/ (function(module, exports) {
491
671
 
492
- var variables_1 = __webpack_require__(10);
672
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
493
673
 
494
- var VizBehavior_1 = __webpack_require__(5);
674
+ /***/ }),
495
675
 
496
- var VizCategory_1 = __webpack_require__(29);
676
+ /***/ 24:
677
+ /***/ (function(module, exports) {
497
678
 
498
- var configUtils_1 = __webpack_require__(6);
679
+ module.exports = require("@splunk/visualizations-shared/propUtils");
499
680
 
500
- var BackgroundColor_1 = __webpack_require__(49);
681
+ /***/ }),
501
682
 
502
- var dataContract = {
503
- requiredDataSources: [{
504
- name: 'primary',
505
- description: 'DataSource that powers the visualization'
506
- }],
507
- optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
508
- // {
509
- // name: 'annotation',
510
- // description: 'DataSource that populate event annotations',
511
- // },
512
- ],
513
- initialRequestParams: {
514
- primary: {
515
- offset: 0,
516
- count: 10000
517
- }
518
- }
519
- };
520
- var size = {
521
- initialWidth: 300,
522
- initialHeight: 300
523
- };
524
- var defaultContext = {};
525
- var optionsSchema = {
526
- backgroundColor: {
527
- default: '> themes.defaultBackgroundColor',
528
- 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".',
529
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN,
530
- type: 'string'
531
- },
532
- collapseLabel: {
533
- description: 'Specify the label for the consolidated slice.',
534
- type: 'string',
535
- default: 'other'
536
- },
537
- collapseThreshold: {
538
- 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.',
539
- type: 'number',
540
- default: 0.01
541
- },
542
- label: {
543
- description: 'List of string values to display the pie chart labels.',
544
- type: 'array',
545
- items: {
546
- type: 'string'
547
- },
548
- default: '> primary | seriesByIndex(0)'
549
- },
550
- labelField: {
551
- default: '> label | getField()',
552
- description: 'Specify the field that corresponds to the labels.',
553
- type: 'string'
554
- },
555
- labelDisplay: {
556
- description: 'Specify whether to display the labels and/or slice percentages.',
557
- type: 'string',
558
- pattern: schemaUtils_1.getPattern(['values', 'valuesAndPercentage', 'off']),
559
- default: 'values'
560
- },
561
- resultLimit: {
562
- default: 50000,
563
- description: 'Specify the number of data points rendered in a chart.',
564
- type: 'number'
565
- },
566
- seriesColors: {
567
- default: visualization_color_palettes_1.VIZ_CATEGORICAL,
568
- description: 'Specify the colors used for a series. For example, ["#FF0000", "#0000FF", "#008000"].',
569
- type: 'array',
570
- items: {
571
- type: 'string'
572
- }
573
- },
574
- seriesColorsByField: {
575
- description: 'Specify the colors used for specific pie slice labels. For example: {"April": "#008000", "May": "#FFA500"}.',
576
- type: 'object'
577
- },
578
- showDonutHole: {
579
- default: false,
580
- description: 'Specify whether the pie should be a donut.',
581
- type: 'boolean'
582
- },
583
- value: {
584
- description: 'List of numerical values to power the pie chart.',
585
- type: 'array',
586
- items: {
587
- type: 'number'
588
- },
589
- default: '> primary | seriesByIndex(1)'
590
- },
591
- valueField: {
592
- default: '> value | getField()',
593
- description: 'Specify the field that corresponds to the data powering values.',
594
- type: 'string'
595
- }
596
- };
597
- var themes = {
598
- defaultBackgroundColor: function defaultBackgroundColor(props) {
599
- return pick_1.default({
600
- enterprise: {
601
- dark: variables_1.default.black(props),
602
- light: variables_1.default.backgroundColor(props)
603
- },
604
- prisma: variables_1.default.backgroundColorSidebar(props)
605
- })(props);
606
- }
607
- };
608
- var editorConfig = [{
609
- label: i18n_1._('General'),
610
- layout: [BackgroundColor_1.default({
611
- themes: themes
612
- })]
613
- }, {
614
- label: i18n_1._('Appearance'),
615
- layout: [[{
616
- label: i18n_1._('Display type'),
617
- option: 'showDonutHole',
618
- editor: 'editor.radioBar',
619
- editorProps: {
620
- values: [{
621
- label: i18n_1._('Pie'),
622
- value: false
623
- }, {
624
- label: i18n_1._('Donut'),
625
- value: true
626
- }]
627
- }
628
- }]]
629
- }, {
630
- label: i18n_1._('Labels'),
631
- layout: [[{
632
- label: i18n_1._('Label display'),
633
- option: 'labelDisplay',
634
- editor: 'editor.radioBar',
635
- editorProps: {
636
- values: [{
637
- label: i18n_1._('Values'),
638
- value: 'values'
639
- }, {
640
- label: i18n_1._('Values & Percent'),
641
- value: 'valuesAndPercentage'
642
- }, {
643
- label: i18n_1._('Off'),
644
- value: 'off'
645
- }]
646
- }
647
- }]]
648
- }, {
649
- label: i18n_1._('Collapse to Summary'),
650
- layout: [[{
651
- label: i18n_1._('Collapse Threshold'),
652
- option: 'collapseThreshold',
653
- editor: 'editor.number',
654
- editorProps: {
655
- min: 0,
656
- max: 1,
657
- step: 0.01
658
- }
659
- }], [{
660
- label: i18n_1._('Collapsed Slice Label'),
661
- option: 'collapseLabel',
662
- editor: 'editor.text'
663
- }]]
664
- }];
665
- /**
666
- * visualization configuration
667
- */
668
-
669
- var config = {
670
- /**
671
- * unique viz key
672
- */
673
- key: 'splunk.pie',
674
-
675
- /**
676
- * viz name
677
- */
678
- name: 'Pie',
679
- category: VizCategory_1.VizCategory.COMPARISONS,
683
+ /***/ 25:
684
+ /***/ (function(module, exports) {
680
685
 
681
- /**
682
- * viz icon
683
- */
684
- icon: ChartPie_1.default,
685
- placeholderIcon: placeholders_1.Pie,
686
- dataContract: dataContract,
687
- size: size,
688
- defaultContext: defaultContext,
689
- optionsSchema: optionsSchema,
690
- editorConfig: editorConfig,
691
- events: {
692
- 'point.click': {
693
- description: 'triggered when user clicks on a point in the pie chart'
694
- }
695
- },
696
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
697
- themes: themes
698
- };
699
- exports.default = configUtils_1.enhanceConfig(config);
686
+ module.exports = require("@splunk/visualizations-shared/hocUtils");
700
687
 
701
688
  /***/ }),
702
689
 
703
- /***/ 230:
690
+ /***/ 26:
704
691
  /***/ (function(module, exports) {
705
692
 
706
- module.exports = require("@splunk/react-icons/ChartPie");
693
+ module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
707
694
 
708
695
  /***/ }),
709
696
 
710
- /***/ 231:
697
+ /***/ 27:
711
698
  /***/ (function(module, exports, __webpack_require__) {
712
699
 
713
700
  "use strict";
714
701
 
715
702
 
716
- var __rest = this && this.__rest || function (s, e) {
717
- var t = {};
718
-
719
- for (var p in s) {
720
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
721
- }
722
-
723
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
724
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
725
- }
726
- return t;
727
- };
728
-
729
703
  Object.defineProperty(exports, "__esModule", {
730
704
  value: true
731
705
  });
732
- exports.allInvalidDataValues = exports.invalidOptionField = exports.getPieOptionFieldIndex = exports.getPieMergedOptions = exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
733
-
734
- var lodash_1 = __webpack_require__(2);
706
+ exports.shouldShowIconPlaceholder = void 0;
735
707
 
736
- var propUtils_1 = __webpack_require__(22);
708
+ var React = __webpack_require__(1);
737
709
 
738
- var dsl_1 = __webpack_require__(106);
710
+ var T = __webpack_require__(0);
739
711
 
740
- var JSONSchemaUtils_1 = __webpack_require__(24);
712
+ var lodash_1 = __webpack_require__(3);
741
713
 
742
- var hocUtils_1 = __webpack_require__(8); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
743
- // map for key names which are either new or not present in SimpleXML options mapping
714
+ var i18n_1 = __webpack_require__(2);
744
715
 
716
+ var Message_1 = __webpack_require__(10);
745
717
 
746
- var pieOptionsSCMapping = {
747
- resultLimit: 'resultTruncationLimit',
748
- seriesColorsByField: 'fieldColors',
749
- collapseThreshold: 'chart.sliceCollapsingThreshold',
750
- collapseLabel: 'chart.sliceCollapsingLabel'
751
- };
718
+ var FixedSizeContainer_1 = __webpack_require__(13);
752
719
  /**
753
- * Helper method to convert option which contains object literal values (e.g. arrays, objects)
754
- * to strings as SC can only accept their stringified equivalents
755
- * @method convertToStringValues
756
- * @param {Object} options
757
- * @returns {Object}
720
+ * @method shouldShowIconPlaceholder
721
+ * @param {object} dataSources
722
+ * @param {boolean} loading
723
+ * @returns {boolean}
758
724
  */
759
725
 
760
- var convertToStringValues = function convertToStringValues(options) {
761
- var updatedOptions = propUtils_1.convertPropsToString({
762
- vizProps: options,
763
- propNames: ['seriesColors', 'fieldColors']
764
- });
765
- return Object.assign(Object.assign({}, options), updatedOptions);
726
+
727
+ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
728
+ var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
729
+ var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
730
+ var noData = data === undefined;
731
+ var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
732
+ var noFields = fields === undefined;
733
+ return loading || noData || noFields;
766
734
  };
767
735
 
768
- exports.convertToStringValues = convertToStringValues;
769
- /**
770
- * Helper method to map labelDisplay options to jsCharting options
771
- * @method mapLabelDisplay
772
- * @param {Object} options
773
- * @returns {Object}
774
- */
775
-
776
- var mapLabelDisplay = function mapLabelDisplay(_a) {
777
- var labelDisplay = _a.labelDisplay,
778
- options = __rest(_a, ["labelDisplay"]);
779
-
780
- var convertedOptions = Object.assign(Object.assign({}, options), {
781
- // default for labelDisplay option is 'values'
782
- 'chart.showLabels': true,
783
- 'chart.showPercent': false
784
- });
785
-
786
- if (labelDisplay === 'valuesAndPercentage') {
787
- convertedOptions['chart.showPercent'] = true;
788
- } else if (labelDisplay === 'off') {
789
- convertedOptions['chart.showLabels'] = false;
790
- }
791
-
792
- return convertedOptions;
793
- };
794
-
795
- exports.mapLabelDisplay = mapLabelDisplay;
796
- /**
797
- * Helper method to update the option names which can be mapped to SimpleXML options or
798
- * can be used directly with SC if don't have a 1-1 mapping in SimpleXML
799
- * @method mapToOldKey
800
- * @param {Object} options
801
- * @returns {Object}
802
- */
803
-
804
- var mapToOldKey = function mapToOldKey(options) {
805
- return lodash_1.mapKeys(options, function (val, key) {
806
- return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
807
- });
808
- };
809
-
810
- exports.mapToOldKey = mapToOldKey;
811
- /**
812
- * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
813
- * This is for options that has new key name and can not directly be mapped with SimpleXML or
814
- * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
815
- * @method convertToPieSCProperties
816
- * @param {Object} originalOptions
817
- * @returns {Object}
818
- */
819
-
820
- var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
821
- return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
822
- };
823
-
824
- exports.convertToPieSCProperties = convertToPieSCProperties;
825
- /**
826
- * Return all merged options (default + config) using vizConfig and options
827
- * @param options
828
- * @param vizConfig
829
- * @returns
830
- */
831
-
832
- var getPieMergedOptions = function getPieMergedOptions(options, vizConfig) {
833
- return hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default'));
834
- };
835
-
836
- exports.getPieMergedOptions = getPieMergedOptions;
837
- /**
838
- * Returns option's field index. If not found returns -1
839
- * @param optionName
840
- * @param dataSources
841
- * @param options
842
- * @param vizConfig
843
- * @returns
844
- */
845
-
846
- var getPieOptionFieldIndex = function getPieOptionFieldIndex(optionName, dataSources, options, vizConfig) {
847
- var mergedOptions = exports.getPieMergedOptions(options, vizConfig); // find the field name configured for pie "value"
848
-
849
- var fieldName = dsl_1.getFieldsFromDSL(mergedOptions[optionName], dataSources)[0];
850
- var fields = dataSources.primary.data.fields; // find the field index configured for pie "value"
851
-
852
- var fieldIndex = fields.findIndex(function (field) {
853
- return (typeof field === 'string' ? field : field.name.toString()) === fieldName;
854
- });
855
- return fieldIndex;
856
- };
857
-
858
- exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
859
- /**
860
- * Returns true if columns data has invalid data format for specified option (label or value)
861
- * @param optionName
862
- * @param dataSources
863
- * @param options
864
- * @param vizConfig
865
- * @returns
866
- */
867
-
868
- var invalidOptionField = function invalidOptionField(optionName, dataSources, options, vizConfig) {
869
- var columns = dataSources.primary.data.columns;
870
- var fieldIndex = exports.getPieOptionFieldIndex(optionName, dataSources, options, vizConfig);
871
-
872
- if (fieldIndex === -1 || !columns[fieldIndex] || !Array.isArray(columns[fieldIndex]) || Array.isArray(columns[fieldIndex]) && !columns[fieldIndex].length) {
873
- return true;
874
- }
875
-
876
- return false;
877
- };
878
-
879
- exports.invalidOptionField = invalidOptionField;
880
- /**
881
- * Helper function to evaluate if all data values are invalid (zero or negative)
882
- */
883
-
884
- var allInvalidDataValues = function allInvalidDataValues(dataSources, options, vizConfig) {
885
- var columns = dataSources.primary.data.columns; // find the field index configured for pie "value"
886
-
887
- var valueFieldIndex = exports.getPieOptionFieldIndex('value', dataSources, options, vizConfig); // check if all values are invalid
888
-
889
- if (Array.isArray(columns) && columns[valueFieldIndex] && Array.isArray(columns[valueFieldIndex])) {
890
- return !columns[valueFieldIndex].some(function (value) {
891
- return +value > 0;
892
- });
893
- }
894
-
895
- return false;
896
- };
897
-
898
- exports.allInvalidDataValues = allInvalidDataValues;
899
-
900
- /***/ }),
901
-
902
- /***/ 24:
903
- /***/ (function(module, exports, __webpack_require__) {
904
-
905
- "use strict";
906
-
907
-
908
- Object.defineProperty(exports, "__esModule", {
909
- value: true
910
- });
911
- exports.pickFieldFromJSONSchema = void 0;
912
-
913
- var lodash_1 = __webpack_require__(2);
914
-
915
- var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
916
- var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
917
- return Object.keys(optionsSchema).reduce(function (accum, k) {
918
- if (lodash_1.has(optionsSchema[k], fieldName)) {
919
- accum[k] = optionsSchema[k][fieldName];
920
- } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
921
- var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
922
-
923
- if (!lodash_1.isEmpty(nestedSchema)) {
924
- accum[k] = nestedSchema;
925
- }
926
- }
927
-
928
- return accum;
929
- }, {});
930
- };
931
-
932
- exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
933
-
934
- /***/ }),
935
-
936
- /***/ 25:
937
- /***/ (function(module, exports) {
938
-
939
- module.exports = require("@babel/runtime/helpers/typeof");
940
-
941
- /***/ }),
942
-
943
- /***/ 26:
944
- /***/ (function(module, exports, __webpack_require__) {
945
-
946
- "use strict";
947
-
948
-
949
- Object.defineProperty(exports, "__esModule", {
950
- value: true
951
- });
952
- exports.shouldShowIconPlaceholder = void 0;
953
-
954
- var React = __webpack_require__(1);
955
-
956
- var T = __webpack_require__(0);
957
-
958
- var lodash_1 = __webpack_require__(2);
959
-
960
- var i18n_1 = __webpack_require__(3);
961
-
962
- var Message_1 = __webpack_require__(11);
963
-
964
- var FixedSizeContainer_1 = __webpack_require__(14);
965
- /**
966
- * @method shouldShowIconPlaceholder
967
- * @param {object} dataSources
968
- * @param {boolean} loading
969
- * @returns {boolean}
970
- */
971
-
972
-
973
- var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
974
- var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
975
- var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
976
- var noData = data === undefined;
977
- var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
978
- var noFields = fields === undefined;
979
- return loading || noData || noFields;
980
- };
981
-
982
- exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
983
- var propTypes = {
984
- icon: T.func,
985
- width: T.oneOfType([T.string, T.number]),
986
- height: T.oneOfType([T.string, T.number]),
987
- // eslint-disable-next-line react/no-unused-prop-types
988
- backgroundColor: T.string,
989
- iconColor: T.string
990
- };
736
+ exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
737
+ var propTypes = {
738
+ icon: T.func,
739
+ width: T.oneOfType([T.string, T.number]),
740
+ height: T.oneOfType([T.string, T.number]),
741
+ // eslint-disable-next-line react/no-unused-prop-types
742
+ backgroundColor: T.string,
743
+ iconColor: T.string
744
+ };
991
745
  /**
992
746
  * @method IconPlaceholder
993
747
  * @param {IconPlaceholderProps} props
@@ -1032,7 +786,7 @@ exports.default = FixedSizeContainer_1.default(IconPlaceholder);
1032
786
 
1033
787
  /***/ }),
1034
788
 
1035
- /***/ 27:
789
+ /***/ 28:
1036
790
  /***/ (function(module, exports, __webpack_require__) {
1037
791
 
1038
792
  "use strict";
@@ -1047,9 +801,9 @@ exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1047
801
 
1048
802
  var T = __webpack_require__(0);
1049
803
 
1050
- var lodash_1 = __webpack_require__(2);
804
+ var lodash_1 = __webpack_require__(3);
1051
805
 
1052
- var DataSource_1 = __webpack_require__(37);
806
+ var DataSource_1 = __webpack_require__(39);
1053
807
 
1054
808
  exports.SortParamsPropTypes = T.shape({
1055
809
  currentSortKey: T.string,
@@ -1103,7 +857,7 @@ exports.getSortingParams = getSortingParams;
1103
857
 
1104
858
  /***/ }),
1105
859
 
1106
- /***/ 28:
860
+ /***/ 29:
1107
861
  /***/ (function(module, exports, __webpack_require__) {
1108
862
 
1109
863
  "use strict";
@@ -1116,7 +870,7 @@ exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1116
870
 
1117
871
  var T = __webpack_require__(0);
1118
872
 
1119
- var lodash_1 = __webpack_require__(2);
873
+ var lodash_1 = __webpack_require__(3);
1120
874
 
1121
875
  exports.PaginatorParamsPropTypes = T.shape({
1122
876
  isPaging: T.bool,
@@ -1168,7 +922,14 @@ exports.getPaginationParams = getPaginationParams;
1168
922
 
1169
923
  /***/ }),
1170
924
 
1171
- /***/ 29:
925
+ /***/ 3:
926
+ /***/ (function(module, exports) {
927
+
928
+ module.exports = require("lodash");
929
+
930
+ /***/ }),
931
+
932
+ /***/ 31:
1172
933
  /***/ (function(module, exports, __webpack_require__) {
1173
934
 
1174
935
  "use strict";
@@ -1197,14 +958,7 @@ var VizCategory;
1197
958
 
1198
959
  /***/ }),
1199
960
 
1200
- /***/ 3:
1201
- /***/ (function(module, exports) {
1202
-
1203
- module.exports = require("@splunk/ui-utils/i18n");
1204
-
1205
- /***/ }),
1206
-
1207
- /***/ 30:
961
+ /***/ 32:
1208
962
  /***/ (function(module, exports, __webpack_require__) {
1209
963
 
1210
964
  "use strict";
@@ -1216,39 +970,39 @@ Object.defineProperty(exports, "__esModule", {
1216
970
 
1217
971
  var React = __webpack_require__(1);
1218
972
 
1219
- var lodash_1 = __webpack_require__(2);
973
+ var lodash_1 = __webpack_require__(3);
1220
974
 
1221
- var getSettingsFromThemedProps_1 = __webpack_require__(31);
975
+ var getSettingsFromThemedProps_1 = __webpack_require__(33);
1222
976
 
1223
- var Options_1 = __webpack_require__(32);
977
+ var Options_1 = __webpack_require__(34);
1224
978
 
1225
- var SanitizeProps_1 = __webpack_require__(33);
979
+ var SanitizeProps_1 = __webpack_require__(35);
1226
980
 
1227
- var TimezoneContext_1 = __webpack_require__(21);
981
+ var TimezoneContext_1 = __webpack_require__(23);
1228
982
 
1229
- var moment_1 = __webpack_require__(34);
983
+ var moment_1 = __webpack_require__(36);
1230
984
 
1231
985
  var styled_components_1 = __webpack_require__(4);
1232
986
 
1233
- var SplunkVisualization_1 = __webpack_require__(35);
987
+ var hocUtils_1 = __webpack_require__(25);
1234
988
 
1235
- var VizBehavior_1 = __webpack_require__(5);
989
+ var JSONSchemaUtils_1 = __webpack_require__(26);
1236
990
 
1237
- var getSorting_1 = __webpack_require__(27);
991
+ var SplunkVisualization_1 = __webpack_require__(37);
1238
992
 
1239
- var getPagination_1 = __webpack_require__(28);
993
+ var VizBehavior_1 = __webpack_require__(6);
1240
994
 
1241
- var useDeepMemo_1 = __webpack_require__(38);
995
+ var getSorting_1 = __webpack_require__(28);
1242
996
 
1243
- var JSONSchemaUtils_1 = __webpack_require__(24);
997
+ var getPagination_1 = __webpack_require__(29);
1244
998
 
1245
- var MissingPropsMessage_1 = __webpack_require__(39);
999
+ var useDeepMemo_1 = __webpack_require__(40);
1246
1000
 
1247
- var withEditModeCover_1 = __webpack_require__(40);
1001
+ var MissingPropsMessage_1 = __webpack_require__(41);
1248
1002
 
1249
- var withPlaceholder_1 = __webpack_require__(42);
1003
+ var withEditModeCover_1 = __webpack_require__(42);
1250
1004
 
1251
- var hocUtils_1 = __webpack_require__(8);
1005
+ var withPlaceholder_1 = __webpack_require__(43);
1252
1006
  /**
1253
1007
  * hoc that wraps a pure react visualization in a Dashboard visualization
1254
1008
  * @param {DashboardVizOpts} opts
@@ -1450,41 +1204,41 @@ exports.default = withDashboardViz;
1450
1204
 
1451
1205
  /***/ }),
1452
1206
 
1453
- /***/ 31:
1207
+ /***/ 33:
1454
1208
  /***/ (function(module, exports) {
1455
1209
 
1456
1210
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1457
1211
 
1458
1212
  /***/ }),
1459
1213
 
1460
- /***/ 32:
1214
+ /***/ 34:
1461
1215
  /***/ (function(module, exports) {
1462
1216
 
1463
1217
  module.exports = require("@splunk/visualization-encoding/Options");
1464
1218
 
1465
1219
  /***/ }),
1466
1220
 
1467
- /***/ 33:
1221
+ /***/ 35:
1468
1222
  /***/ (function(module, exports) {
1469
1223
 
1470
1224
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1471
1225
 
1472
1226
  /***/ }),
1473
1227
 
1474
- /***/ 34:
1228
+ /***/ 36:
1475
1229
  /***/ (function(module, exports) {
1476
1230
 
1477
1231
  module.exports = require("@splunk/moment");
1478
1232
 
1479
1233
  /***/ }),
1480
1234
 
1481
- /***/ 35:
1235
+ /***/ 37:
1482
1236
  /***/ (function(module, exports, __webpack_require__) {
1483
1237
 
1484
1238
  "use strict";
1485
1239
 
1486
1240
 
1487
- var _classCallCheck = __webpack_require__(12);
1241
+ var _classCallCheck = __webpack_require__(11);
1488
1242
 
1489
1243
  Object.defineProperty(exports, "__esModule", {
1490
1244
  value: true
@@ -1494,9 +1248,9 @@ exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1494
1248
 
1495
1249
  var T = __webpack_require__(0);
1496
1250
 
1497
- var lodash_1 = __webpack_require__(2);
1251
+ var lodash_1 = __webpack_require__(3);
1498
1252
 
1499
- var VizActionHandler_1 = __webpack_require__(36); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1253
+ var VizActionHandler_1 = __webpack_require__(38); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1500
1254
 
1501
1255
 
1502
1256
  exports.INITIAL_WIDTH = 250;
@@ -1582,241 +1336,716 @@ SplunkVisualization.propTypes = {
1582
1336
  hasEventHandlers: T.bool,
1583
1337
 
1584
1338
  /**
1585
- * A callback to communicate computed props to a consumer
1339
+ * A callback to communicate computed props to a consumer
1340
+ */
1341
+ onComputedProps: T.func,
1342
+
1343
+ /**
1344
+ * A callback to obtain visualization api
1345
+ */
1346
+ vizActionHandlerRef: T.func,
1347
+ loading: T.bool,
1348
+ theme: T.object,
1349
+
1350
+ /**
1351
+ * A callback to request new data with updated request params
1352
+ */
1353
+ onRequestParamsChange: T.func
1354
+ };
1355
+ /**
1356
+ *
1357
+ */
1358
+
1359
+ SplunkVisualization.defaultProps = {
1360
+ // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1361
+ width: '100%',
1362
+ height: exports.INITIAL_HEIGHT,
1363
+ dataSources: {},
1364
+ onEventTrigger: function onEventTrigger() {
1365
+ return {};
1366
+ },
1367
+ mode: 'view',
1368
+ hasEventHandlers: false,
1369
+ options: {},
1370
+ context: {},
1371
+ onOptionsChange: function onOptionsChange() {
1372
+ return {};
1373
+ },
1374
+ vizActionHandlerRef: function vizActionHandlerRef() {
1375
+ return new VizActionHandler_1.DefaultVizActionHandler();
1376
+ },
1377
+ onComputedProps: function onComputedProps() {
1378
+ return {};
1379
+ },
1380
+ loading: false,
1381
+ onRequestParamsChange: lodash_1.noop
1382
+ };
1383
+ exports.default = SplunkVisualization;
1384
+
1385
+ /***/ }),
1386
+
1387
+ /***/ 38:
1388
+ /***/ (function(module, exports, __webpack_require__) {
1389
+
1390
+ "use strict";
1391
+
1392
+
1393
+ var _classCallCheck = __webpack_require__(11);
1394
+
1395
+ var _createClass = __webpack_require__(19);
1396
+
1397
+ Object.defineProperty(exports, "__esModule", {
1398
+ value: true
1399
+ });
1400
+ exports.DefaultVizActionHandler = void 0;
1401
+
1402
+ var DefaultVizActionHandler = /*#__PURE__*/function () {
1403
+ function DefaultVizActionHandler() {
1404
+ _classCallCheck(this, DefaultVizActionHandler);
1405
+ }
1406
+
1407
+ _createClass(DefaultVizActionHandler, [{
1408
+ key: "focus",
1409
+ value: function focus() {// noop
1410
+ }
1411
+ }, {
1412
+ key: "snapshot",
1413
+ value: function snapshot() {
1414
+ return null; // noop
1415
+ }
1416
+ }]);
1417
+
1418
+ return DefaultVizActionHandler;
1419
+ }();
1420
+
1421
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
1422
+
1423
+ /***/ }),
1424
+
1425
+ /***/ 39:
1426
+ /***/ (function(module, exports, __webpack_require__) {
1427
+
1428
+ "use strict";
1429
+
1430
+
1431
+ Object.defineProperty(exports, "__esModule", {
1432
+ value: true
1433
+ });
1434
+ exports.validSortDirs = void 0;
1435
+ exports.validSortDirs = ['asc', 'desc', 'none'];
1436
+
1437
+ /***/ }),
1438
+
1439
+ /***/ 4:
1440
+ /***/ (function(module, exports) {
1441
+
1442
+ module.exports = require("styled-components");
1443
+
1444
+ /***/ }),
1445
+
1446
+ /***/ 40:
1447
+ /***/ (function(module, exports, __webpack_require__) {
1448
+
1449
+ "use strict";
1450
+
1451
+
1452
+ Object.defineProperty(exports, "__esModule", {
1453
+ value: true
1454
+ });
1455
+ exports.useDeepMemo = void 0;
1456
+
1457
+ var react_1 = __webpack_require__(1);
1458
+
1459
+ var lodash_1 = __webpack_require__(3);
1460
+ /**
1461
+ * This hook evaluates and stores the result of a passed function and only
1462
+ * re-evaluates the function when passed dependencies change.
1463
+ *
1464
+ * It is different from the internal React useMemo in the following aspects:
1465
+ * - it only stores the last evaluated result
1466
+ * - it uses a deep equality check to determine if dependencies have changed
1467
+ *
1468
+ * Inspired by apollo-client's useDeepMemo
1469
+ *
1470
+ * @param fn the function to be executed and
1471
+ * @param dependencies an array of dependencies
1472
+ */
1473
+
1474
+
1475
+ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1476
+ var ref = react_1.useRef();
1477
+
1478
+ if (!ref.current || !lodash_1.isEqual(dependencies, ref.current.dependencies)) {
1479
+ ref.current = {
1480
+ dependencies: dependencies,
1481
+ value: fn()
1482
+ };
1483
+ }
1484
+
1485
+ return ref.current.value;
1486
+ };
1487
+
1488
+ exports.useDeepMemo = useDeepMemo;
1489
+
1490
+ /***/ }),
1491
+
1492
+ /***/ 41:
1493
+ /***/ (function(module, exports, __webpack_require__) {
1494
+
1495
+ "use strict";
1496
+
1497
+
1498
+ Object.defineProperty(exports, "__esModule", {
1499
+ value: true
1500
+ });
1501
+ exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1502
+
1503
+ var React = __webpack_require__(1);
1504
+
1505
+ var T = __webpack_require__(0);
1506
+
1507
+ var i18n_1 = __webpack_require__(2);
1508
+
1509
+ var Message_1 = __webpack_require__(10);
1510
+
1511
+ var FixedSizeContainer_1 = __webpack_require__(13);
1512
+ /**
1513
+ * @method isMissing
1514
+ * @param {any} v
1515
+ * @returns {boolean} true if the input value === null or undefined
1516
+ */
1517
+
1518
+
1519
+ var isMissing = function isMissing(v) {
1520
+ return v === null || v === undefined;
1521
+ };
1522
+
1523
+ exports.isMissing = isMissing;
1524
+ /**
1525
+ * @method misskingKeys
1526
+ * @param {string[]} keys
1527
+ * @param {object} target
1528
+ * @returns {string[]} the keys of missing required props
1529
+ */
1530
+
1531
+ var missingKeys = function missingKeys(keys, target) {
1532
+ return keys.filter(function (k) {
1533
+ return exports.isMissing(target[k]);
1534
+ });
1535
+ };
1536
+
1537
+ exports.missingKeys = missingKeys;
1538
+ var propTypes = {
1539
+ width: T.oneOfType([T.string, T.number]),
1540
+ height: T.oneOfType([T.string, T.number]),
1541
+ // eslint-disable-next-line react/no-unused-prop-types
1542
+ backgroundColor: T.string,
1543
+ missingProps: T.arrayOf(T.string)
1544
+ };
1545
+ /**
1546
+ * @method MissingPropsMessage
1547
+ * @param {MissingPropsProps} props
1548
+ * @returns {React.ReactElement}
1549
+ */
1550
+
1551
+ var MissingPropsMessage = function MissingPropsMessage(props) {
1552
+ var width = props.width,
1553
+ height = props.height,
1554
+ missingProps = props.missingProps;
1555
+ return React.createElement(Message_1.default, {
1556
+ "data-test": "message",
1557
+ width: width,
1558
+ height: height,
1559
+ message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
1560
+ });
1561
+ };
1562
+
1563
+ exports.MissingPropsMessage = MissingPropsMessage;
1564
+ exports.MissingPropsMessage.propTypes = propTypes;
1565
+ exports.MissingPropsMessage.defaultProps = {
1566
+ width: '100%',
1567
+ height: 250
1568
+ };
1569
+ exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
1570
+
1571
+ /***/ }),
1572
+
1573
+ /***/ 413:
1574
+ /***/ (function(module, exports, __webpack_require__) {
1575
+
1576
+ "use strict";
1577
+
1578
+
1579
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1580
+ if (k2 === undefined) k2 = k;
1581
+ Object.defineProperty(o, k2, {
1582
+ enumerable: true,
1583
+ get: function get() {
1584
+ return m[k];
1585
+ }
1586
+ });
1587
+ } : function (o, m, k, k2) {
1588
+ if (k2 === undefined) k2 = k;
1589
+ o[k2] = m[k];
1590
+ });
1591
+
1592
+ var __exportStar = this && this.__exportStar || function (m, exports) {
1593
+ for (var p in m) {
1594
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1595
+ }
1596
+ };
1597
+
1598
+ Object.defineProperty(exports, "__esModule", {
1599
+ value: true
1600
+ });
1601
+ exports.default = void 0;
1602
+
1603
+ __exportStar(__webpack_require__(146), exports);
1604
+
1605
+ var Pie_1 = __webpack_require__(146);
1606
+
1607
+ Object.defineProperty(exports, "default", {
1608
+ enumerable: true,
1609
+ get: function get() {
1610
+ return Pie_1.default;
1611
+ }
1612
+ });
1613
+
1614
+ /***/ }),
1615
+
1616
+ /***/ 414:
1617
+ /***/ (function(module, exports, __webpack_require__) {
1618
+
1619
+ "use strict";
1620
+
1621
+
1622
+ Object.defineProperty(exports, "__esModule", {
1623
+ value: true
1624
+ });
1625
+
1626
+ var ChartPie_1 = __webpack_require__(415);
1627
+
1628
+ var placeholders_1 = __webpack_require__(44);
1629
+
1630
+ var i18n_1 = __webpack_require__(2);
1631
+
1632
+ var schemaUtils_1 = __webpack_require__(16);
1633
+
1634
+ var visualization_color_palettes_1 = __webpack_require__(46);
1635
+
1636
+ var pick_1 = __webpack_require__(21);
1637
+
1638
+ var variables_1 = __webpack_require__(9);
1639
+
1640
+ var VizBehavior_1 = __webpack_require__(6);
1641
+
1642
+ var VizCategory_1 = __webpack_require__(31);
1643
+
1644
+ var configUtils_1 = __webpack_require__(17);
1645
+
1646
+ var BackgroundColor_1 = __webpack_require__(50);
1647
+
1648
+ var dataContract = {
1649
+ requiredDataSources: [{
1650
+ name: 'primary',
1651
+ description: 'DataSource that powers the visualization'
1652
+ }],
1653
+ optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
1654
+ // {
1655
+ // name: 'annotation',
1656
+ // description: 'DataSource that populate event annotations',
1657
+ // },
1658
+ ],
1659
+ initialRequestParams: {
1660
+ primary: {
1661
+ offset: 0,
1662
+ count: 10000
1663
+ }
1664
+ }
1665
+ };
1666
+ var size = {
1667
+ initialWidth: 300,
1668
+ initialHeight: 300
1669
+ };
1670
+ var defaultContext = {};
1671
+ var optionsSchema = {
1672
+ backgroundColor: {
1673
+ default: '> themes.defaultBackgroundColor',
1674
+ 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".',
1675
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
1676
+ type: 'string'
1677
+ },
1678
+ collapseLabel: {
1679
+ description: 'Specify the label for the consolidated slice.',
1680
+ type: 'string',
1681
+ default: 'other'
1682
+ },
1683
+ collapseThreshold: {
1684
+ 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.',
1685
+ type: 'number',
1686
+ default: 0.01
1687
+ },
1688
+ label: {
1689
+ description: 'List of string values to display the pie chart labels.',
1690
+ type: 'array',
1691
+ items: {
1692
+ type: 'string'
1693
+ },
1694
+ default: '> primary | seriesByIndex(0)'
1695
+ },
1696
+ labelField: {
1697
+ default: '> label | getField()',
1698
+ description: 'Specify the field that corresponds to the labels.',
1699
+ type: 'string'
1700
+ },
1701
+ labelDisplay: {
1702
+ description: 'Specify whether to display the labels and/or slice percentages.',
1703
+ type: 'string',
1704
+ pattern: schemaUtils_1.getPattern(['values', 'valuesAndPercentage', 'off']),
1705
+ default: 'values'
1706
+ },
1707
+ resultLimit: {
1708
+ default: 50000,
1709
+ description: 'Specify the number of data points rendered in a chart.',
1710
+ type: 'number'
1711
+ },
1712
+ seriesColors: {
1713
+ default: visualization_color_palettes_1.VIZ_CATEGORICAL,
1714
+ description: 'Specify the colors used for a series. For example, ["#FF0000", "#0000FF", "#008000"].',
1715
+ type: 'array',
1716
+ items: {
1717
+ type: 'string'
1718
+ }
1719
+ },
1720
+ seriesColorsByField: {
1721
+ description: 'Specify the colors used for specific pie slice labels. For example: {"April": "#008000", "May": "#FFA500"}.',
1722
+ type: 'object'
1723
+ },
1724
+ showDonutHole: {
1725
+ default: false,
1726
+ description: 'Specify whether the pie should be a donut.',
1727
+ type: 'boolean'
1728
+ },
1729
+ value: {
1730
+ description: 'List of numerical values to power the pie chart.',
1731
+ type: 'array',
1732
+ items: {
1733
+ type: 'number'
1734
+ },
1735
+ default: '> primary | seriesByIndex(1)'
1736
+ },
1737
+ valueField: {
1738
+ default: '> value | getField()',
1739
+ description: 'Specify the field that corresponds to the data powering values.',
1740
+ type: 'string'
1741
+ }
1742
+ };
1743
+ var themes = {
1744
+ defaultBackgroundColor: function defaultBackgroundColor(props) {
1745
+ return pick_1.default({
1746
+ enterprise: {
1747
+ dark: variables_1.default.black(props),
1748
+ light: variables_1.default.backgroundColor(props)
1749
+ },
1750
+ prisma: variables_1.default.backgroundColorSidebar(props)
1751
+ })(props);
1752
+ }
1753
+ };
1754
+ var editorConfig = [{
1755
+ label: i18n_1._('General'),
1756
+ layout: [BackgroundColor_1.default({
1757
+ themes: themes
1758
+ })]
1759
+ }, {
1760
+ label: i18n_1._('Appearance'),
1761
+ layout: [[{
1762
+ label: i18n_1._('Display type'),
1763
+ option: 'showDonutHole',
1764
+ editor: 'editor.radioBar',
1765
+ editorProps: {
1766
+ values: [{
1767
+ label: i18n_1._('Pie'),
1768
+ value: false
1769
+ }, {
1770
+ label: i18n_1._('Donut'),
1771
+ value: true
1772
+ }]
1773
+ }
1774
+ }]]
1775
+ }, {
1776
+ label: i18n_1._('Labels'),
1777
+ layout: [[{
1778
+ label: i18n_1._('Label display'),
1779
+ option: 'labelDisplay',
1780
+ editor: 'editor.radioBar',
1781
+ editorProps: {
1782
+ values: [{
1783
+ label: i18n_1._('Values'),
1784
+ value: 'values'
1785
+ }, {
1786
+ label: i18n_1._('Values & Percent'),
1787
+ value: 'valuesAndPercentage'
1788
+ }, {
1789
+ label: i18n_1._('Off'),
1790
+ value: 'off'
1791
+ }]
1792
+ }
1793
+ }]]
1794
+ }, {
1795
+ label: i18n_1._('Collapse to Summary'),
1796
+ layout: [[{
1797
+ label: i18n_1._('Collapse Threshold'),
1798
+ option: 'collapseThreshold',
1799
+ editor: 'editor.number',
1800
+ editorProps: {
1801
+ min: 0,
1802
+ max: 1,
1803
+ step: 0.01
1804
+ }
1805
+ }], [{
1806
+ label: i18n_1._('Collapsed Slice Label'),
1807
+ option: 'collapseLabel',
1808
+ editor: 'editor.text'
1809
+ }]]
1810
+ }];
1811
+ /**
1812
+ * visualization configuration
1813
+ */
1814
+
1815
+ var config = {
1816
+ /**
1817
+ * unique viz key
1586
1818
  */
1587
- onComputedProps: T.func,
1819
+ key: 'splunk.pie',
1588
1820
 
1589
1821
  /**
1590
- * A callback to obtain visualization api
1822
+ * viz name
1591
1823
  */
1592
- vizActionHandlerRef: T.func,
1593
- loading: T.bool,
1594
- theme: T.object,
1824
+ name: 'Pie',
1825
+ category: VizCategory_1.VizCategory.COMPARISONS,
1595
1826
 
1596
1827
  /**
1597
- * A callback to request new data with updated request params
1828
+ * viz icon
1598
1829
  */
1599
- onRequestParamsChange: T.func
1600
- };
1601
- /**
1602
- *
1603
- */
1604
-
1605
- SplunkVisualization.defaultProps = {
1606
- // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1607
- width: '100%',
1608
- height: exports.INITIAL_HEIGHT,
1609
- dataSources: {},
1610
- onEventTrigger: function onEventTrigger() {
1611
- return {};
1612
- },
1613
- mode: 'view',
1614
- hasEventHandlers: false,
1615
- options: {},
1616
- context: {},
1617
- onOptionsChange: function onOptionsChange() {
1618
- return {};
1619
- },
1620
- vizActionHandlerRef: function vizActionHandlerRef() {
1621
- return new VizActionHandler_1.DefaultVizActionHandler();
1622
- },
1623
- onComputedProps: function onComputedProps() {
1624
- return {};
1830
+ icon: ChartPie_1.default,
1831
+ placeholderIcon: placeholders_1.Pie,
1832
+ dataContract: dataContract,
1833
+ size: size,
1834
+ defaultContext: defaultContext,
1835
+ optionsSchema: optionsSchema,
1836
+ editorConfig: editorConfig,
1837
+ events: {
1838
+ 'point.click': {
1839
+ description: 'triggered when user clicks on a point in the pie chart'
1840
+ }
1625
1841
  },
1626
- loading: false,
1627
- onRequestParamsChange: lodash_1.noop
1842
+ supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
1843
+ themes: themes
1628
1844
  };
1629
- exports.default = SplunkVisualization;
1845
+ exports.default = configUtils_1.enhanceConfig(config);
1630
1846
 
1631
1847
  /***/ }),
1632
1848
 
1633
- /***/ 36:
1634
- /***/ (function(module, exports, __webpack_require__) {
1635
-
1636
- "use strict";
1637
-
1638
-
1639
- var _classCallCheck = __webpack_require__(12);
1640
-
1641
- var _createClass = __webpack_require__(17);
1642
-
1643
- Object.defineProperty(exports, "__esModule", {
1644
- value: true
1645
- });
1646
- exports.DefaultVizActionHandler = void 0;
1647
-
1648
- var DefaultVizActionHandler = /*#__PURE__*/function () {
1649
- function DefaultVizActionHandler() {
1650
- _classCallCheck(this, DefaultVizActionHandler);
1651
- }
1652
-
1653
- _createClass(DefaultVizActionHandler, [{
1654
- key: "focus",
1655
- value: function focus() {// noop
1656
- }
1657
- }, {
1658
- key: "snapshot",
1659
- value: function snapshot() {
1660
- return null; // noop
1661
- }
1662
- }]);
1663
-
1664
- return DefaultVizActionHandler;
1665
- }();
1849
+ /***/ 415:
1850
+ /***/ (function(module, exports) {
1666
1851
 
1667
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1852
+ module.exports = require("@splunk/react-icons/ChartPie");
1668
1853
 
1669
1854
  /***/ }),
1670
1855
 
1671
- /***/ 37:
1856
+ /***/ 416:
1672
1857
  /***/ (function(module, exports, __webpack_require__) {
1673
1858
 
1674
1859
  "use strict";
1675
1860
 
1676
1861
 
1862
+ var __rest = this && this.__rest || function (s, e) {
1863
+ var t = {};
1864
+
1865
+ for (var p in s) {
1866
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1867
+ }
1868
+
1869
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1870
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1871
+ }
1872
+ return t;
1873
+ };
1874
+
1677
1875
  Object.defineProperty(exports, "__esModule", {
1678
1876
  value: true
1679
1877
  });
1680
- exports.validSortDirs = void 0;
1681
- exports.validSortDirs = ['asc', 'desc', 'none'];
1878
+ exports.allInvalidDataValues = exports.invalidOptionField = exports.getPieOptionFieldIndex = exports.getPieMergedOptions = exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
1682
1879
 
1683
- /***/ }),
1880
+ var lodash_1 = __webpack_require__(3);
1684
1881
 
1685
- /***/ 38:
1686
- /***/ (function(module, exports, __webpack_require__) {
1882
+ var propUtils_1 = __webpack_require__(24);
1687
1883
 
1688
- "use strict";
1884
+ var dsl_1 = __webpack_require__(92);
1689
1885
 
1886
+ var hocUtils_1 = __webpack_require__(25);
1690
1887
 
1691
- Object.defineProperty(exports, "__esModule", {
1692
- value: true
1693
- });
1694
- exports.useDeepMemo = void 0;
1888
+ var JSONSchemaUtils_1 = __webpack_require__(26); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
1889
+ // map for key names which are either new or not present in SimpleXML options mapping
1695
1890
 
1696
- var react_1 = __webpack_require__(1);
1697
1891
 
1698
- var lodash_1 = __webpack_require__(2);
1892
+ var pieOptionsSCMapping = {
1893
+ resultLimit: 'resultTruncationLimit',
1894
+ seriesColorsByField: 'fieldColors',
1895
+ collapseThreshold: 'chart.sliceCollapsingThreshold',
1896
+ collapseLabel: 'chart.sliceCollapsingLabel'
1897
+ };
1898
+ /**
1899
+ * Helper method to convert option which contains object literal values (e.g. arrays, objects)
1900
+ * to strings as SC can only accept their stringified equivalents
1901
+ * @method convertToStringValues
1902
+ * @param {Object} options
1903
+ * @returns {Object}
1904
+ */
1905
+
1906
+ var convertToStringValues = function convertToStringValues(options) {
1907
+ var updatedOptions = propUtils_1.convertPropsToString({
1908
+ vizProps: options,
1909
+ propNames: ['seriesColors', 'fieldColors']
1910
+ });
1911
+ return Object.assign(Object.assign({}, options), updatedOptions);
1912
+ };
1913
+
1914
+ exports.convertToStringValues = convertToStringValues;
1699
1915
  /**
1700
- * This hook evaluates and stores the result of a passed function and only
1701
- * re-evaluates the function when passed dependencies change.
1702
- *
1703
- * It is different from the internal React useMemo in the following aspects:
1704
- * - it only stores the last evaluated result
1705
- * - it uses a deep equality check to determine if dependencies have changed
1706
- *
1707
- * Inspired by apollo-client's useDeepMemo
1708
- *
1709
- * @param fn the function to be executed and
1710
- * @param dependencies an array of dependencies
1916
+ * Helper method to map labelDisplay options to jsCharting options
1917
+ * @method mapLabelDisplay
1918
+ * @param {Object} options
1919
+ * @returns {Object}
1711
1920
  */
1712
1921
 
1922
+ var mapLabelDisplay = function mapLabelDisplay(_a) {
1923
+ var labelDisplay = _a.labelDisplay,
1924
+ options = __rest(_a, ["labelDisplay"]);
1713
1925
 
1714
- var useDeepMemo = function useDeepMemo(fn, dependencies) {
1715
- var ref = react_1.useRef();
1926
+ var convertedOptions = Object.assign(Object.assign({}, options), {
1927
+ // default for labelDisplay option is 'values'
1928
+ 'chart.showLabels': true,
1929
+ 'chart.showPercent': false
1930
+ });
1716
1931
 
1717
- if (!ref.current || !lodash_1.isEqual(dependencies, ref.current.dependencies)) {
1718
- ref.current = {
1719
- dependencies: dependencies,
1720
- value: fn()
1721
- };
1932
+ if (labelDisplay === 'valuesAndPercentage') {
1933
+ convertedOptions['chart.showPercent'] = true;
1934
+ } else if (labelDisplay === 'off') {
1935
+ convertedOptions['chart.showLabels'] = false;
1722
1936
  }
1723
1937
 
1724
- return ref.current.value;
1938
+ return convertedOptions;
1725
1939
  };
1726
1940
 
1727
- exports.useDeepMemo = useDeepMemo;
1941
+ exports.mapLabelDisplay = mapLabelDisplay;
1942
+ /**
1943
+ * Helper method to update the option names which can be mapped to SimpleXML options or
1944
+ * can be used directly with SC if don't have a 1-1 mapping in SimpleXML
1945
+ * @method mapToOldKey
1946
+ * @param {Object} options
1947
+ * @returns {Object}
1948
+ */
1728
1949
 
1729
- /***/ }),
1950
+ var mapToOldKey = function mapToOldKey(options) {
1951
+ return lodash_1.mapKeys(options, function (val, key) {
1952
+ return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
1953
+ });
1954
+ };
1730
1955
 
1731
- /***/ 39:
1732
- /***/ (function(module, exports, __webpack_require__) {
1956
+ exports.mapToOldKey = mapToOldKey;
1957
+ /**
1958
+ * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
1959
+ * This is for options that has new key name and can not directly be mapped with SimpleXML or
1960
+ * don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
1961
+ * @method convertToPieSCProperties
1962
+ * @param {Object} originalOptions
1963
+ * @returns {Object}
1964
+ */
1733
1965
 
1734
- "use strict";
1966
+ var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
1967
+ return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
1968
+ };
1735
1969
 
1970
+ exports.convertToPieSCProperties = convertToPieSCProperties;
1971
+ /**
1972
+ * Return all merged options (default + config) using vizConfig and options
1973
+ * @param options
1974
+ * @param vizConfig
1975
+ * @returns
1976
+ */
1736
1977
 
1737
- Object.defineProperty(exports, "__esModule", {
1738
- value: true
1739
- });
1740
- exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1978
+ var getPieMergedOptions = function getPieMergedOptions(options, vizConfig) {
1979
+ return hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default'));
1980
+ };
1741
1981
 
1742
- var React = __webpack_require__(1);
1982
+ exports.getPieMergedOptions = getPieMergedOptions;
1983
+ /**
1984
+ * Returns option's field index. If not found returns -1
1985
+ * @param optionName
1986
+ * @param dataSources
1987
+ * @param options
1988
+ * @param vizConfig
1989
+ * @returns
1990
+ */
1743
1991
 
1744
- var T = __webpack_require__(0);
1992
+ var getPieOptionFieldIndex = function getPieOptionFieldIndex(optionName, dataSources, options, vizConfig) {
1993
+ var mergedOptions = exports.getPieMergedOptions(options, vizConfig); // find the field name configured for pie "value"
1745
1994
 
1746
- var i18n_1 = __webpack_require__(3);
1995
+ var fieldName = dsl_1.getFieldsFromDSL(mergedOptions[optionName], dataSources)[0];
1996
+ var fields = dataSources.primary.data.fields; // find the field index configured for pie "value"
1747
1997
 
1748
- var Message_1 = __webpack_require__(11);
1998
+ var fieldIndex = fields.findIndex(function (field) {
1999
+ return (typeof field === 'string' ? field : field.name.toString()) === fieldName;
2000
+ });
2001
+ return fieldIndex;
2002
+ };
1749
2003
 
1750
- var FixedSizeContainer_1 = __webpack_require__(14);
2004
+ exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
1751
2005
  /**
1752
- * @method isMissing
1753
- * @param {any} v
1754
- * @returns {boolean} true if the input value === null or undefined
2006
+ * Returns true if columns data has invalid data format for specified option (label or value)
2007
+ * @param optionName
2008
+ * @param dataSources
2009
+ * @param options
2010
+ * @param vizConfig
2011
+ * @returns
1755
2012
  */
1756
2013
 
2014
+ var invalidOptionField = function invalidOptionField(optionName, dataSources, options, vizConfig) {
2015
+ var columns = dataSources.primary.data.columns;
2016
+ var fieldIndex = exports.getPieOptionFieldIndex(optionName, dataSources, options, vizConfig);
1757
2017
 
1758
- var isMissing = function isMissing(v) {
1759
- return v === null || v === undefined;
1760
- };
1761
-
1762
- exports.isMissing = isMissing;
1763
- /**
1764
- * @method misskingKeys
1765
- * @param {string[]} keys
1766
- * @param {object} target
1767
- * @returns {string[]} the keys of missing required props
1768
- */
2018
+ if (fieldIndex === -1 || !columns[fieldIndex] || !Array.isArray(columns[fieldIndex]) || Array.isArray(columns[fieldIndex]) && !columns[fieldIndex].length) {
2019
+ return true;
2020
+ }
1769
2021
 
1770
- var missingKeys = function missingKeys(keys, target) {
1771
- return keys.filter(function (k) {
1772
- return exports.isMissing(target[k]);
1773
- });
2022
+ return false;
1774
2023
  };
1775
2024
 
1776
- exports.missingKeys = missingKeys;
1777
- var propTypes = {
1778
- width: T.oneOfType([T.string, T.number]),
1779
- height: T.oneOfType([T.string, T.number]),
1780
- // eslint-disable-next-line react/no-unused-prop-types
1781
- backgroundColor: T.string,
1782
- missingProps: T.arrayOf(T.string)
1783
- };
2025
+ exports.invalidOptionField = invalidOptionField;
1784
2026
  /**
1785
- * @method MissingPropsMessage
1786
- * @param {MissingPropsProps} props
1787
- * @returns {React.ReactElement}
2027
+ * Helper function to evaluate if all data values are invalid (zero or negative)
1788
2028
  */
1789
2029
 
1790
- var MissingPropsMessage = function MissingPropsMessage(props) {
1791
- var width = props.width,
1792
- height = props.height,
1793
- missingProps = props.missingProps;
1794
- return React.createElement(Message_1.default, {
1795
- "data-test": "message",
1796
- width: width,
1797
- height: height,
1798
- message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
1799
- });
1800
- };
2030
+ var allInvalidDataValues = function allInvalidDataValues(dataSources, options, vizConfig) {
2031
+ var columns = dataSources.primary.data.columns; // find the field index configured for pie "value"
1801
2032
 
1802
- exports.MissingPropsMessage = MissingPropsMessage;
1803
- exports.MissingPropsMessage.propTypes = propTypes;
1804
- exports.MissingPropsMessage.defaultProps = {
1805
- width: '100%',
1806
- height: 250
1807
- };
1808
- exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
2033
+ var valueFieldIndex = exports.getPieOptionFieldIndex('value', dataSources, options, vizConfig); // check if all values are invalid
1809
2034
 
1810
- /***/ }),
2035
+ if (Array.isArray(columns) && columns[valueFieldIndex] && Array.isArray(columns[valueFieldIndex])) {
2036
+ return !columns[valueFieldIndex].some(function (value) {
2037
+ return +value > 0;
2038
+ });
2039
+ }
1811
2040
 
1812
- /***/ 4:
1813
- /***/ (function(module, exports) {
2041
+ return false;
2042
+ };
1814
2043
 
1815
- module.exports = require("styled-components");
2044
+ exports.allInvalidDataValues = allInvalidDataValues;
1816
2045
 
1817
2046
  /***/ }),
1818
2047
 
1819
- /***/ 40:
2048
+ /***/ 42:
1820
2049
  /***/ (function(module, exports, __webpack_require__) {
1821
2050
 
1822
2051
  "use strict";
@@ -1830,14 +2059,14 @@ var React = __webpack_require__(1);
1830
2059
 
1831
2060
  var styled_components_1 = __webpack_require__(4);
1832
2061
 
1833
- var hocUtils_1 = __webpack_require__(8);
2062
+ var hocUtils_1 = __webpack_require__(14);
1834
2063
 
1835
2064
  var Cover = styled_components_1.default.div.withConfig({
1836
2065
  displayName: "withEditModeCover__Cover",
1837
2066
  componentId: "sc-1gsbnxb-0"
1838
2067
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1839
2068
  var Blocker = styled_components_1.default.div.attrs({
1840
- 'data-splunk-visualization-version': "25.0.1 - de10ad954"
2069
+ 'data-splunk-visualization-version': "25.2.0 - 4373c5a66"
1841
2070
  }).withConfig({
1842
2071
  displayName: "withEditModeCover__Blocker",
1843
2072
  componentId: "sc-1gsbnxb-1"
@@ -1869,14 +2098,7 @@ exports.default = withEditModeCover;
1869
2098
 
1870
2099
  /***/ }),
1871
2100
 
1872
- /***/ 41:
1873
- /***/ (function(module, exports) {
1874
-
1875
- module.exports = require("@splunk/visualizations-shared/mapUtils");
1876
-
1877
- /***/ }),
1878
-
1879
- /***/ 42:
2101
+ /***/ 43:
1880
2102
  /***/ (function(module, exports, __webpack_require__) {
1881
2103
 
1882
2104
  "use strict";
@@ -1888,15 +2110,15 @@ Object.defineProperty(exports, "__esModule", {
1888
2110
 
1889
2111
  var React = __webpack_require__(1);
1890
2112
 
1891
- var colorUtils_1 = __webpack_require__(13);
2113
+ var colorUtils_1 = __webpack_require__(12);
1892
2114
 
1893
- var variables_1 = __webpack_require__(10);
2115
+ var variables_1 = __webpack_require__(9);
1894
2116
 
1895
- var IconPlaceholder_1 = __webpack_require__(26);
2117
+ var IconPlaceholder_1 = __webpack_require__(27);
1896
2118
 
1897
- var VizBehavior_1 = __webpack_require__(5);
2119
+ var VizBehavior_1 = __webpack_require__(6);
1898
2120
 
1899
- var hocUtils_1 = __webpack_require__(8);
2121
+ var hocUtils_1 = __webpack_require__(14);
1900
2122
 
1901
2123
  var withPlaceholder = function withPlaceholder(Visualization) {
1902
2124
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
@@ -1944,18 +2166,18 @@ exports.default = withPlaceholder;
1944
2166
  /***/ 44:
1945
2167
  /***/ (function(module, exports) {
1946
2168
 
1947
- module.exports = require("@splunk/visualization-color-palettes");
2169
+ module.exports = require("@splunk/visualization-icons/placeholders");
1948
2170
 
1949
2171
  /***/ }),
1950
2172
 
1951
- /***/ 45:
2173
+ /***/ 46:
1952
2174
  /***/ (function(module, exports) {
1953
2175
 
1954
- module.exports = require("@splunk/visualization-icons/placeholders");
2176
+ module.exports = require("@splunk/visualization-color-palettes");
1955
2177
 
1956
2178
  /***/ }),
1957
2179
 
1958
- /***/ 49:
2180
+ /***/ 50:
1959
2181
  /***/ (function(module, exports, __webpack_require__) {
1960
2182
 
1961
2183
  "use strict";
@@ -1965,7 +2187,7 @@ Object.defineProperty(exports, "__esModule", {
1965
2187
  value: true
1966
2188
  });
1967
2189
 
1968
- var i18n_1 = __webpack_require__(3);
2190
+ var i18n_1 = __webpack_require__(2);
1969
2191
 
1970
2192
  var background = function background(_ref) {
1971
2193
  var label = _ref.label,
@@ -1986,51 +2208,13 @@ exports.default = background;
1986
2208
 
1987
2209
  /***/ }),
1988
2210
 
1989
- /***/ 5:
1990
- /***/ (function(module, exports, __webpack_require__) {
1991
-
1992
- "use strict";
1993
-
1994
-
1995
- Object.defineProperty(exports, "__esModule", {
1996
- value: true
1997
- });
1998
- exports.VizBehavior = void 0;
1999
- var VizBehavior;
2000
-
2001
- (function (VizBehavior) {
2002
- /**
2003
- * Dynamic Options Behavior.
2004
- * This allows visualization options to be powered by data
2005
- *
2006
- * **Example**
2007
- *
2008
- * sparklineValues: ">primary|seriesByIndex(0)"
2009
- * would configure sparklineValues with an array of data points
2010
- * coming from the first series in the primary datasource
2011
- *
2012
- */
2013
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
2014
- VizBehavior["EVENTS"] = "events";
2015
- /**
2016
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
2017
- * missing.
2018
- * @type {string}
2019
- */
2020
-
2021
- VizBehavior["PLACEHOLDER"] = "placeholder";
2022
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
2023
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
2024
-
2025
- /***/ }),
2026
-
2027
- /***/ 50:
2211
+ /***/ 52:
2028
2212
  /***/ (function(module, exports, __webpack_require__) {
2029
2213
 
2030
2214
  "use strict";
2031
2215
 
2032
2216
 
2033
- var _toConsumableArray = __webpack_require__(9);
2217
+ var _toConsumableArray = __webpack_require__(8);
2034
2218
 
2035
2219
  var __rest = this && this.__rest || function (s, e) {
2036
2220
  var t = {};
@@ -2050,7 +2234,7 @@ Object.defineProperty(exports, "__esModule", {
2050
2234
  });
2051
2235
  exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
2052
2236
 
2053
- var lodash_1 = __webpack_require__(2);
2237
+ var lodash_1 = __webpack_require__(3);
2054
2238
  /**
2055
2239
  * Get formatted annotations
2056
2240
  * @method getAnnotations
@@ -2246,14 +2430,14 @@ exports.constructFieldsAndColumns = constructFieldsAndColumns;
2246
2430
 
2247
2431
  /***/ }),
2248
2432
 
2249
- /***/ 51:
2433
+ /***/ 53:
2250
2434
  /***/ (function(module, exports) {
2251
2435
 
2252
2436
  module.exports = require("@splunk/charting-bundle");
2253
2437
 
2254
2438
  /***/ }),
2255
2439
 
2256
- /***/ 55:
2440
+ /***/ 56:
2257
2441
  /***/ (function(module, exports, __webpack_require__) {
2258
2442
 
2259
2443
  "use strict";
@@ -2265,11 +2449,11 @@ Object.defineProperty(exports, "__esModule", {
2265
2449
  exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
2266
2450
  /* eslint-disable react/no-unused-prop-types */
2267
2451
 
2268
- var lodash_1 = __webpack_require__(2);
2452
+ var lodash_1 = __webpack_require__(3);
2269
2453
 
2270
- var i18n_1 = __webpack_require__(3);
2454
+ var i18n_1 = __webpack_require__(2);
2271
2455
 
2272
- var visualization_color_palettes_1 = __webpack_require__(44);
2456
+ var visualization_color_palettes_1 = __webpack_require__(46);
2273
2457
 
2274
2458
  var react_1 = __webpack_require__(1);
2275
2459
 
@@ -2277,26 +2461,26 @@ var React = __webpack_require__(1);
2277
2461
 
2278
2462
  var T = __webpack_require__(0);
2279
2463
 
2280
- var react_event_listener_1 = __webpack_require__(56);
2464
+ var react_event_listener_1 = __webpack_require__(57);
2281
2465
 
2282
- __webpack_require__(57); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
2466
+ __webpack_require__(58); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
2283
2467
 
2284
2468
 
2285
- var charting_bundle_1 = __webpack_require__(51);
2469
+ var charting_bundle_1 = __webpack_require__(53);
2286
2470
 
2287
- var TimezoneContext_1 = __webpack_require__(21);
2471
+ var TimezoneContext_1 = __webpack_require__(23);
2288
2472
 
2289
2473
  var style_1 = __webpack_require__(15);
2290
2474
 
2291
2475
  var styled_components_1 = __webpack_require__(4);
2292
2476
 
2293
- var Message_1 = __webpack_require__(11);
2477
+ var Message_1 = __webpack_require__(10);
2294
2478
 
2295
- var useSplunkTheme_1 = __webpack_require__(58);
2479
+ var useSplunkTheme_1 = __webpack_require__(59);
2296
2480
 
2297
- var themeUtils_1 = __webpack_require__(59);
2481
+ var themeUtils_1 = __webpack_require__(60);
2298
2482
 
2299
- var ChartingApi_1 = __webpack_require__(60);
2483
+ var ChartingApi_1 = __webpack_require__(61);
2300
2484
 
2301
2485
  exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
2302
2486
 
@@ -2645,311 +2829,112 @@ Charting.propTypes = propTypes;
2645
2829
  Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
2646
2830
 
2647
2831
  var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
2648
- var Wrapper = function Wrapper(props) {
2649
- var chartData = props.chartData;
2650
-
2651
- if (!chartData) {
2652
- return React.createElement(Message_1.default, {
2653
- message: i18n_1._('No DataSource'),
2654
- level: "warning"
2655
- });
2656
- }
2657
-
2658
- if (chartData && !Object.keys(chartData).length) {
2659
- return React.createElement(Message_1.default, {
2660
- message: i18n_1._('No Result'),
2661
- level: "info"
2662
- });
2663
- }
2664
-
2665
- return React.createElement(Chart, Object.assign({}, props));
2666
- };
2667
-
2668
- Wrapper.displayName = 'ChartingWrapper';
2669
- Wrapper.propTypes = propTypes;
2670
- Wrapper.defaultProps = defaultProps;
2671
- return Wrapper;
2672
- }; // export default Charting;
2673
-
2674
-
2675
- exports.default = withEmptyChartMessage(Charting);
2676
-
2677
- /***/ }),
2678
-
2679
- /***/ 56:
2680
- /***/ (function(module, exports) {
2681
-
2682
- module.exports = require("react-event-listener");
2683
-
2684
- /***/ }),
2685
-
2686
- /***/ 57:
2687
- /***/ (function(module, exports) {
2688
-
2689
- module.exports = require("@splunk/visualizations-shared/i18n");
2690
-
2691
- /***/ }),
2692
-
2693
- /***/ 58:
2694
- /***/ (function(module, exports) {
2695
-
2696
- module.exports = require("@splunk/themes/useSplunkTheme");
2697
-
2698
- /***/ }),
2699
-
2700
- /***/ 59:
2701
- /***/ (function(module, exports) {
2702
-
2703
- module.exports = require("@splunk/visualizations-shared/themeUtils");
2704
-
2705
- /***/ }),
2706
-
2707
- /***/ 6:
2708
- /***/ (function(module, exports, __webpack_require__) {
2709
-
2710
- "use strict";
2711
-
2712
-
2713
- var _toConsumableArray = __webpack_require__(9);
2714
-
2715
- var _defineProperty = __webpack_require__(7);
2716
-
2717
- var __rest = this && this.__rest || function (s, e) {
2718
- var t = {};
2719
-
2720
- for (var p in s) {
2721
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2722
- }
2723
-
2724
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2725
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2726
- }
2727
- return t;
2728
- };
2729
-
2730
- Object.defineProperty(exports, "__esModule", {
2731
- value: true
2732
- });
2733
- exports.insertLayout = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
2734
-
2735
- var lodash_1 = __webpack_require__(2);
2736
-
2737
- var schemaUtils_1 = __webpack_require__(16);
2738
-
2739
- var VizBehavior_1 = __webpack_require__(5);
2740
-
2741
- var dynamicOptionsDSLType = {
2742
- type: 'string',
2743
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
2744
- };
2745
- /**
2746
- * Helper function to extend an options schema with dynamic options DSL
2747
- * @param optionsSchema a visualization's options schema
2748
- * @returns an updated options schema that additionally allows strings starting with > for each option
2749
- */
2750
-
2751
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
2752
- var enhancedOptionsSchema = {};
2753
- Object.keys(optionsSchema).forEach(function (key) {
2754
- var _a = optionsSchema[key],
2755
- title = _a.title,
2756
- description = _a.description,
2757
- readOnly = _a.readOnly,
2758
- writeOnly = _a.writeOnly,
2759
- examples = _a.examples,
2760
- defaultValue = _a.default,
2761
- type = _a.type,
2762
- properties = _a.properties,
2763
- patternProperties = _a.patternProperties,
2764
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
2765
-
2766
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
2767
- title: title
2768
- }), description !== undefined && {
2769
- description: description
2770
- }), readOnly !== undefined && {
2771
- readOnly: readOnly
2772
- }), writeOnly !== undefined && {
2773
- writeOnly: writeOnly
2774
- }), examples !== undefined && {
2775
- examples: examples
2776
- }), defaultValue !== undefined && {
2777
- default: defaultValue
2778
- });
2779
-
2780
- if (type === 'object') {
2781
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
2782
- type: type
2783
- }), properties && {
2784
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
2832
+ var Wrapper = function Wrapper(props) {
2833
+ var chartData = props.chartData;
2834
+
2835
+ if (!chartData) {
2836
+ return React.createElement(Message_1.default, {
2837
+ message: i18n_1._('No DataSource'),
2838
+ level: "warning"
2785
2839
  });
2840
+ }
2786
2841
 
2787
- if (patternProperties) {
2788
- var enhancedPatternProperties = {};
2789
- Object.keys(patternProperties).forEach(function (opt) {
2790
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
2791
- });
2792
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
2793
- }
2794
- } else {
2795
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
2796
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
2797
- type: type
2798
- }), remainingSchemaEntry), dynamicOptionsDSLType]
2842
+ if (chartData && !Object.keys(chartData).length) {
2843
+ return React.createElement(Message_1.default, {
2844
+ message: i18n_1._('No Result'),
2845
+ level: "info"
2799
2846
  });
2800
2847
  }
2801
- });
2802
- return enhancedOptionsSchema;
2803
- }
2804
2848
 
2805
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
2806
- /**
2807
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
2808
- * this function also collapse all editor panels
2809
- * @param vizConfig a Visualization Config
2810
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
2811
- * and containing `open: false` for all editor panels in editorConfig
2812
- */
2849
+ return React.createElement(Chart, Object.assign({}, props));
2850
+ };
2813
2851
 
2814
- function enhanceConfig(vizConfig) {
2815
- var enhancedConfig = vizConfig;
2852
+ Wrapper.displayName = 'ChartingWrapper';
2853
+ Wrapper.propTypes = propTypes;
2854
+ Wrapper.defaultProps = defaultProps;
2855
+ return Wrapper;
2856
+ }; // export default Charting;
2816
2857
 
2817
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
2818
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
2819
- }
2820
2858
 
2821
- enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
2822
- return Object.assign(Object.assign({}, config), {
2823
- open: false
2824
- });
2825
- });
2826
- return enhancedConfig;
2827
- }
2859
+ exports.default = withEmptyChartMessage(Charting);
2828
2860
 
2829
- exports.enhanceConfig = enhanceConfig;
2830
- /**
2831
- * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
2832
- * Created for editor unit tests
2833
- * @param vizConfig a Visualization Config
2834
- * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
2835
- */
2861
+ /***/ }),
2836
2862
 
2837
- function uncollapseEditorConfig(vizConfig) {
2838
- var editorPanelUncollapsedConfig = vizConfig;
2839
- editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
2840
- return Object.assign(Object.assign({}, config), {
2841
- open: true
2842
- });
2843
- });
2844
- return editorPanelUncollapsedConfig;
2845
- }
2863
+ /***/ 57:
2864
+ /***/ (function(module, exports) {
2846
2865
 
2847
- exports.uncollapseEditorConfig = uncollapseEditorConfig;
2866
+ module.exports = require("react-event-listener");
2848
2867
 
2849
- function isDynamicOption(option) {
2850
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
2851
- }
2868
+ /***/ }),
2852
2869
 
2853
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
2854
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
2870
+ /***/ 58:
2871
+ /***/ (function(module, exports) {
2855
2872
 
2856
- /**
2857
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
2858
- * 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
2859
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
2860
- * 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
2861
- *
2862
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
2863
- */
2873
+ module.exports = require("@splunk/visualizations-shared/i18n");
2864
2874
 
2865
- function hasCompatibleContexts(vizContext, presetContext) {
2866
- var presetContextKeys = Object.keys(presetContext);
2867
- return presetContextKeys.every(function (contextKey) {
2868
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
2869
- });
2870
- }
2871
- /**
2872
- * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
2873
- */
2875
+ /***/ }),
2874
2876
 
2877
+ /***/ 59:
2878
+ /***/ (function(module, exports) {
2875
2879
 
2876
- function hasCompatibleOptions(vizOptions, presetOptions) {
2877
- var presetOptionKeys = Object.keys(presetOptions);
2878
- return presetOptionKeys.every(function (optionKey) {
2879
- return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
2880
- });
2881
- }
2882
- /**
2883
- * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
2884
- * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
2885
- *
2886
- * @param {Object} vizContext - the current vizContext definition
2887
- * @param {Object} vizOptions - the current vizOptions definition
2888
- * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
2889
- */
2880
+ module.exports = require("@splunk/themes/useSplunkTheme");
2890
2881
 
2882
+ /***/ }),
2891
2883
 
2892
- function getInitialPreset(vizContext, vizOptions, presets) {
2893
- return presets.find(function (preset) {
2894
- var presetContext = lodash_1.get(preset, ['value', 'context'], {});
2895
- var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
2896
- var presetContextKeys = Object.keys(presetContext);
2897
- var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
2898
- // if not, then the preset is invalid in config.ts
2884
+ /***/ 6:
2885
+ /***/ (function(module, exports, __webpack_require__) {
2899
2886
 
2900
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
2901
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
2902
- });
2903
- }
2887
+ "use strict";
2904
2888
 
2905
- exports.getInitialPreset = getInitialPreset;
2906
- /**
2907
- * generates number precision values for a Select editor
2908
- *
2909
- * @param {Number} numPrecisionValues - number of integer precision values to generate
2910
- * @returns {{ label: string; value; string }[]} array of { label, value } tuples
2911
- */
2912
2889
 
2913
- function generatePrecisionValues(numPrecisionValues) {
2914
- return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
2915
- return {
2916
- label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
2917
- value: i
2918
- };
2919
- });
2920
- }
2890
+ Object.defineProperty(exports, "__esModule", {
2891
+ value: true
2892
+ });
2893
+ exports.VizBehavior = void 0;
2894
+ var VizBehavior;
2921
2895
 
2922
- exports.generatePrecisionValues = generatePrecisionValues;
2923
- /**
2924
- * insert layout in layout array, return a new layout array instead of updating the original
2925
- *
2926
- * @param {EditorLayoutConfig[][]} layout - editor layout
2927
- * @param {Number} index - the index to insert layout item(s)
2928
- * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
2929
- * @returns {EditorLayoutConfig[][]} new editor layout with insertion
2930
- */
2896
+ (function (VizBehavior) {
2897
+ /**
2898
+ * Dynamic Options Behavior.
2899
+ * This allows visualization options to be powered by data
2900
+ *
2901
+ * **Example**
2902
+ *
2903
+ * sparklineValues: ">primary|seriesByIndex(0)"
2904
+ * would configure sparklineValues with an array of data points
2905
+ * coming from the first series in the primary datasource
2906
+ *
2907
+ */
2908
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
2909
+ VizBehavior["EVENTS"] = "events";
2910
+ /**
2911
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
2912
+ * missing.
2913
+ * @type {string}
2914
+ */
2931
2915
 
2932
- var insertLayout = function insertLayout(layout, index) {
2933
- for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2934
- layoutItems[_key - 2] = arguments[_key];
2935
- }
2916
+ VizBehavior["PLACEHOLDER"] = "placeholder";
2917
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
2918
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
2936
2919
 
2937
- return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
2938
- };
2920
+ /***/ }),
2939
2921
 
2940
- exports.insertLayout = insertLayout;
2922
+ /***/ 60:
2923
+ /***/ (function(module, exports) {
2924
+
2925
+ module.exports = require("@splunk/visualizations-shared/themeUtils");
2941
2926
 
2942
2927
  /***/ }),
2943
2928
 
2944
- /***/ 60:
2929
+ /***/ 61:
2945
2930
  /***/ (function(module, exports, __webpack_require__) {
2946
2931
 
2947
2932
  "use strict";
2948
2933
 
2949
2934
 
2950
- var _classCallCheck = __webpack_require__(12);
2935
+ var _classCallCheck = __webpack_require__(11);
2951
2936
 
2952
- var _createClass = __webpack_require__(17);
2937
+ var _createClass = __webpack_require__(19);
2953
2938
 
2954
2939
  Object.defineProperty(exports, "__esModule", {
2955
2940
  value: true
@@ -3010,7 +2995,7 @@ exports.ChartingApiFunctional = ChartingApiFunctional;
3010
2995
 
3011
2996
  /***/ }),
3012
2997
 
3013
- /***/ 61:
2998
+ /***/ 62:
3014
2999
  /***/ (function(module, exports) {
3015
3000
 
3016
3001
  module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
@@ -3025,96 +3010,23 @@ module.exports = require("@babel/runtime/helpers/defineProperty");
3025
3010
  /***/ }),
3026
3011
 
3027
3012
  /***/ 8:
3028
- /***/ (function(module, exports, __webpack_require__) {
3029
-
3030
- "use strict";
3031
-
3032
-
3033
- var _typeof = __webpack_require__(25);
3034
-
3035
- Object.defineProperty(exports, "__esModule", {
3036
- value: true
3037
- });
3038
- exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
3039
-
3040
- var lodash_1 = __webpack_require__(2);
3041
-
3042
- var mapUtils_1 = __webpack_require__(41);
3043
- /**
3044
- * @method extendStaticWrapperProps
3045
- * @param {Object} props
3046
- * @param {DashboardVizType} props.Wrapper
3047
- * @param {DashboardVizType} props.Visualization
3048
- */
3049
-
3050
-
3051
- var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
3052
- var Wrapper = _ref.Wrapper,
3053
- Visualization = _ref.Visualization;
3054
- var extendProperties = ['propTypes', 'defaultProps', 'config'];
3055
- extendProperties.forEach(function (prop) {
3056
- if (Visualization[prop]) {
3057
- // eslint-disable-next-line no-param-reassign
3058
- Wrapper[prop] = Visualization[prop];
3059
- }
3060
- });
3061
- };
3062
-
3063
- exports.extendStaticWrapperProps = extendStaticWrapperProps;
3064
- /**
3065
- * helper to deeply merge objects while preserving arrays in earlier source objects
3066
- * 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
3067
- * 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).
3068
- * 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
3069
- * 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.
3070
- *
3071
- * @method deepMergeWithArrayPrimitiveOverrides
3072
- * @param {Object} initial - target object to merge values into
3073
- * @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
3074
- *
3075
- * @returns {Object}
3076
- */
3077
-
3078
- var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
3079
- var clone = lodash_1.cloneDeep(initial);
3013
+ /***/ (function(module, exports) {
3080
3014
 
3081
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3082
- sources[_key - 1] = arguments[_key];
3083
- }
3015
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
3084
3016
 
3085
- sources.forEach(function (sourceToApply) {
3086
- Object.keys(sourceToApply).forEach(function (sourceKey) {
3087
- if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
3088
- clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
3089
- }
3017
+ /***/ }),
3090
3018
 
3091
- if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
3092
- clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
3093
- } else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
3094
- // If option is an array of objects
3095
- for (var i = 0; i < clone[sourceKey].length; i += 1) {
3096
- if (_typeof(clone[sourceKey][i]) === 'object') {
3097
- var closestMatchIdx = mapUtils_1.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
3098
-
3099
- if (closestMatchIdx > -1) {
3100
- clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
3101
- }
3102
- }
3103
- }
3104
- }
3105
- });
3106
- });
3107
- return clone;
3108
- };
3019
+ /***/ 9:
3020
+ /***/ (function(module, exports) {
3109
3021
 
3110
- exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
3022
+ module.exports = require("@splunk/themes/variables");
3111
3023
 
3112
3024
  /***/ }),
3113
3025
 
3114
- /***/ 9:
3026
+ /***/ 92:
3115
3027
  /***/ (function(module, exports) {
3116
3028
 
3117
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
3029
+ module.exports = require("@splunk/visualization-encoding/utils/dsl");
3118
3030
 
3119
3031
  /***/ })
3120
3032