@splunk/visualizations 25.0.0 → 25.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_custom_base_layer_tile_server.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_dynamic_color.png +0 -0
  4. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color.png +0 -0
  5. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color_with_no_seriesColors.png +0 -0
  6. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_off.png +0 -0
  7. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_unit_metric.png +0 -0
  8. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Area_Editor.png +0 -0
  9. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bar_Editor.png +0 -0
  10. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bubble_Editor.png +0 -0
  11. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_ChoroplethSvg_Editor.png +0 -0
  12. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Column_Editor.png +0 -0
  13. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Ellipse_Editor.png +0 -0
  14. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_FillerGauge_Editor.png +0 -0
  15. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Image_Editor.png +0 -0
  16. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Line_Editor.png +0 -0
  17. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_LinkGraph_Editor.png +0 -0
  18. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  19. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Markdown_Editor.png +0 -0
  20. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_MarkerGauge_Editor.png +0 -0
  21. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Parallel_Coordinates_Editor.png +0 -0
  22. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Pie_Editor.png +0 -0
  23. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Punchcard_Editor.png +0 -0
  24. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Rectangle_Editor.png +0 -0
  25. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Sankey_Editor.png +0 -0
  26. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Scatter_Editor.png +0 -0
  27. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Editor.png +0 -0
  28. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Icon_Editor.png +0 -0
  29. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Radial_Editor.png +0 -0
  30. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Table_Editor.png +0 -0
  31. package/.loki/reference/chrome_docker_Visualizations_Line_Line_Placeholder_if_datasource_does_not_have_any_data.png +0 -0
  32. package/.loki/reference/chrome_docker_Visualizations_Line_Line_Placeholder_if_viz_does_not_connect_to_datasource.png +0 -0
  33. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Basic_Map.png +0 -0
  34. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer.png +0 -0
  35. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET.png +0 -0
  36. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET_Dynamic_Coloring.png +0 -0
  37. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Internal_Fields.png +0 -0
  38. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Static_Coloring.png +0 -0
  39. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_Dynamic_Coloring.png +0 -0
  40. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer.png +0 -0
  41. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Dynamic_coloring.png +0 -0
  42. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Result_Limit_Set_To_3.png +0 -0
  43. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Restricted_Zoom.png +0 -0
  44. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
  45. package/Area.config.js +166 -152
  46. package/Area.config.js.map +1 -1
  47. package/Area.js +362 -433
  48. package/Area.js.map +1 -1
  49. package/Bar.config.js +168 -148
  50. package/Bar.config.js.map +1 -1
  51. package/Bar.js +364 -429
  52. package/Bar.js.map +1 -1
  53. package/Bubble.config.js +155 -117
  54. package/Bubble.config.js.map +1 -1
  55. package/Bubble.js +353 -400
  56. package/Bubble.js.map +1 -1
  57. package/ChoroplethSvg.config.js +112 -82
  58. package/ChoroplethSvg.config.js.map +1 -1
  59. package/ChoroplethSvg.js +336 -391
  60. package/ChoroplethSvg.js.map +1 -1
  61. package/Column.config.js +164 -146
  62. package/Column.config.js.map +1 -1
  63. package/Column.js +360 -427
  64. package/Column.js.map +1 -1
  65. package/Ellipse.config.js +111 -80
  66. package/Ellipse.config.js.map +1 -1
  67. package/Ellipse.js +317 -371
  68. package/Ellipse.js.map +1 -1
  69. package/FillerGauge.config.js +117 -86
  70. package/FillerGauge.config.js.map +1 -1
  71. package/FillerGauge.js +324 -378
  72. package/FillerGauge.js.map +1 -1
  73. package/Image.config.js +100 -76
  74. package/Image.config.js.map +1 -1
  75. package/Image.js +725 -789
  76. package/Image.js.map +1 -1
  77. package/Line.config.js +164 -137
  78. package/Line.config.js.map +1 -1
  79. package/Line.js +360 -418
  80. package/Line.js.map +1 -1
  81. package/LinkGraph.config.js +137 -112
  82. package/LinkGraph.config.js.map +1 -1
  83. package/LinkGraph.js +351 -410
  84. package/LinkGraph.js.map +1 -1
  85. package/Map.config.js +140 -97
  86. package/Map.config.js.map +1 -1
  87. package/Map.js +517 -523
  88. package/Map.js.map +1 -1
  89. package/Markdown.config.js +138 -115
  90. package/Markdown.config.js.map +1 -1
  91. package/Markdown.js +502 -553
  92. package/Markdown.js.map +1 -1
  93. package/MarkerGauge.config.js +218 -195
  94. package/MarkerGauge.config.js.map +1 -1
  95. package/MarkerGauge.js +2926 -3098
  96. package/MarkerGauge.js.map +1 -1
  97. package/ParallelCoordinates.config.js +158 -133
  98. package/ParallelCoordinates.config.js.map +1 -1
  99. package/ParallelCoordinates.js +319 -377
  100. package/ParallelCoordinates.js.map +1 -1
  101. package/Pie.config.js +160 -136
  102. package/Pie.config.js.map +1 -1
  103. package/Pie.js +1316 -1492
  104. package/Pie.js.map +1 -1
  105. package/Punchcard.config.js +164 -141
  106. package/Punchcard.config.js.map +1 -1
  107. package/Punchcard.js +344 -404
  108. package/Punchcard.js.map +1 -1
  109. package/Rectangle.config.js +280 -248
  110. package/Rectangle.config.js.map +1 -1
  111. package/Rectangle.js +1247 -1303
  112. package/Rectangle.js.map +1 -1
  113. package/Sankey.config.js +175 -143
  114. package/Sankey.config.js.map +1 -1
  115. package/Sankey.js +377 -426
  116. package/Sankey.js.map +1 -1
  117. package/Scatter.config.js +156 -117
  118. package/Scatter.config.js.map +1 -1
  119. package/Scatter.js +550 -601
  120. package/Scatter.js.map +1 -1
  121. package/SingleValue.config.js +147 -115
  122. package/SingleValue.config.js.map +1 -1
  123. package/SingleValue.js +542 -598
  124. package/SingleValue.js.map +1 -1
  125. package/SingleValueBasic.js +19 -19
  126. package/SingleValueBasic.js.map +1 -1
  127. package/SingleValueIcon.config.js +154 -120
  128. package/SingleValueIcon.config.js.map +1 -1
  129. package/SingleValueIcon.js +373 -424
  130. package/SingleValueIcon.js.map +1 -1
  131. package/SingleValueRadial.config.js +143 -111
  132. package/SingleValueRadial.config.js.map +1 -1
  133. package/SingleValueRadial.js +612 -668
  134. package/SingleValueRadial.js.map +1 -1
  135. package/Table.config.js +176 -152
  136. package/Table.config.js.map +1 -1
  137. package/Table.js +740 -797
  138. package/Table.js.map +1 -1
  139. package/common/Charting.js +11 -11
  140. package/common/Charting.js.map +1 -1
  141. package/common/ChartingApi.js +2 -2
  142. package/common/ChartingApi.js.map +1 -1
  143. package/common/EventsDoc.js +12 -12
  144. package/common/EventsDoc.js.map +1 -1
  145. package/common/GaugeMajorTicks.js +8 -8
  146. package/common/GaugeMajorTicks.js.map +1 -1
  147. package/common/GaugeValueMarker.js +8 -8
  148. package/common/GaugeValueMarker.js.map +1 -1
  149. package/common/OptionsDoc.js +51 -327
  150. package/common/OptionsDoc.js.map +1 -1
  151. package/common/OverviewDoc.js +22 -22
  152. package/common/OverviewDoc.js.map +1 -1
  153. package/common/SplunkVisualization.js +4 -4
  154. package/common/SplunkVisualization.js.map +1 -1
  155. package/common/SplunkVisualizationApi.js +2 -2
  156. package/common/SplunkVisualizationApi.js.map +1 -1
  157. package/common/ThemesDoc.js +19 -19
  158. package/common/ThemesDoc.js.map +1 -1
  159. package/common/chartingUtils.js +4 -4
  160. package/common/chartingUtils.js.map +1 -1
  161. package/common/docUtils.js +4 -4
  162. package/common/docUtils.js.map +1 -1
  163. package/common/gaugeUtils.js +13 -13
  164. package/common/gaugeUtils.js.map +1 -1
  165. package/common/shapeUtils.js +8 -8
  166. package/common/shapeUtils.js.map +1 -1
  167. package/common/utils/configUtils.js +42 -18
  168. package/common/utils/configUtils.js.map +1 -1
  169. package/common/utils/hocUtils.js +6 -86
  170. package/common/utils/hocUtils.js.map +1 -1
  171. package/common/utils/{JSONSchemaUtils.js → mapUtils.js} +89 -29
  172. package/common/utils/mapUtils.js.map +1 -0
  173. package/common/utils/singleValueUtils.js +14 -12
  174. package/common/utils/singleValueUtils.js.map +1 -1
  175. package/common/utils/testHelper.js +8 -8
  176. package/common/utils/testHelper.js.map +1 -1
  177. package/common/withDashboardViz.js +120 -207
  178. package/common/withDashboardViz.js.map +1 -1
  179. package/package.json +12 -12
  180. package/.loki/reference/chrome_docker_PureVisualizations_SvgChoroplethDynamic_SVG_Of_Size_Greater_Than_2_MB_Render.png +0 -0
  181. package/common/utils/JSONSchemaUtils.js.map +0 -1
package/Rectangle.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 = 242);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 245);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -109,144 +109,122 @@ 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("@babel/runtime/helpers/classCallCheck");
113
113
 
114
114
  /***/ }),
115
115
 
116
- /***/ 11:
117
- /***/ (function(module, exports) {
118
-
119
- module.exports = require("@splunk/visualizations-shared/Message");
116
+ /***/ 100:
117
+ /***/ (function(module, exports, __webpack_require__) {
120
118
 
121
- /***/ }),
119
+ "use strict";
122
120
 
123
- /***/ 12:
124
- /***/ (function(module, exports) {
125
121
 
126
- module.exports = require("@babel/runtime/helpers/classCallCheck");
122
+ Object.defineProperty(exports, "__esModule", {
123
+ value: true
124
+ });
127
125
 
128
- /***/ }),
126
+ var i18n_1 = __webpack_require__(2);
129
127
 
130
- /***/ 13:
131
- /***/ (function(module, exports) {
128
+ var configUtils_1 = __webpack_require__(17);
132
129
 
133
- module.exports = require("@splunk/visualizations-shared/colorUtils");
130
+ var StaticStrokeColorEditor = {
131
+ label: i18n_1._('Static Stroke'),
132
+ option: 'strokeColor',
133
+ editor: 'editor.color',
134
+ showEditor: function showEditor(_ref) {
135
+ var options = _ref.options;
136
+ return !configUtils_1.isDynamicOption(options.strokeColor);
137
+ }
138
+ };
139
+ exports.default = StaticStrokeColorEditor;
134
140
 
135
141
  /***/ }),
136
142
 
137
- /***/ 135:
143
+ /***/ 101:
138
144
  /***/ (function(module, exports, __webpack_require__) {
139
145
 
140
146
  "use strict";
141
147
 
142
148
 
143
- var __rest = this && this.__rest || function (s, e) {
144
- var t = {};
145
-
146
- for (var p in s) {
147
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
148
- }
149
-
150
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
151
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
152
- }
153
- return t;
154
- };
155
-
156
149
  Object.defineProperty(exports, "__esModule", {
157
150
  value: true
158
151
  });
159
- exports.config = exports.computeVizProps = void 0;
152
+ exports.getStyledShape = exports.mapToOldKey = void 0;
160
153
 
161
- var React = __webpack_require__(1);
154
+ var lodash_1 = __webpack_require__(3);
162
155
 
163
156
  var styled_components_1 = __webpack_require__(4);
164
157
 
165
- var lodash_1 = __webpack_require__(2);
166
-
167
- var T = __webpack_require__(0);
158
+ var pick_1 = __webpack_require__(21);
168
159
 
169
- var withDashboardViz_1 = __webpack_require__(30);
160
+ var variables_1 = __webpack_require__(8);
170
161
 
171
- var config_1 = __webpack_require__(243);
162
+ var propUtils_1 = __webpack_require__(23); // map for new options names to old option names
172
163
 
173
- exports.config = config_1.default;
174
164
 
175
- var shapeUtils_1 = __webpack_require__(99);
165
+ var shapeOptionsMapping = {
166
+ fillColor: 'fill',
167
+ strokeColor: 'stroke',
168
+ strokeDashStyle: 'strokeDasharray',
169
+ strokeJoinStyle: 'strokeLinejoin'
170
+ };
171
+ /**
172
+ * Helper method to update the option names to old option names
173
+ * @method mapToOldKey
174
+ * @param {Object} options
175
+ * @returns {Object}
176
+ */
176
177
 
177
- var SVGContainer = styled_components_1.default.svg.withConfig({
178
- displayName: "Rectangle__SVGContainer",
179
- componentId: "iwvil2-0"
180
- })(["width:", "px;height:", "px;"], function (props) {
181
- return props.width;
182
- }, function (props) {
183
- return props.height;
184
- });
185
- var propTypes = {
186
- width: T.number,
187
- height: T.number,
188
- options: T.object,
189
- mode: T.string,
190
- onRectangleClick: T.func
178
+ var mapToOldKey = function mapToOldKey(options) {
179
+ return lodash_1.mapKeys(options, function (val, key) {
180
+ return shapeOptionsMapping[key] ? shapeOptionsMapping[key] : key;
181
+ });
191
182
  };
192
- var RectangleShape = shapeUtils_1.getStyledShape('rect');
193
183
 
194
- var RectangleViz = function RectangleViz(props) {
195
- var width = props.width,
196
- height = props.height,
197
- options = props.options,
198
- onRectangleClick = props.onRectangleClick;
199
- var strokeWidth = options.strokeWidth;
200
- var rx = options.rx,
201
- ry = options.ry; // If either radius value is NaN/undefined, sets value to 0.
184
+ exports.mapToOldKey = mapToOldKey;
185
+ /**
186
+ * Helper method to get styled component for ellipse or rectangle
187
+ * @method mapToOldKey
188
+ * @param {Shape} shape
189
+ */
202
190
 
203
- rx = rx || 0;
204
- ry = ry || 0;
205
- return React.createElement(SVGContainer, {
206
- width: width,
207
- height: height
208
- }, React.createElement(RectangleShape, Object.assign({}, options, {
209
- rx: rx,
210
- ry: ry,
211
- x: "".concat(strokeWidth / 2, "px"),
212
- y: "".concat(strokeWidth / 2, "px"),
213
- vectorEffect: "non-scaling-stroke",
214
- width: "".concat(width - strokeWidth, "px"),
215
- height: "".concat(height - strokeWidth, "px"),
216
- onClick: onRectangleClick
217
- })));
191
+ var getStyledShape = function getStyledShape(shape) {
192
+ return styled_components_1.default(shape).withConfig({
193
+ displayName: "shapeUtils",
194
+ componentId: "sc-1myvp5h-0"
195
+ })(["fill:", ";stroke:", ";cursor:", ";"], function (props) {
196
+ return props.fill && propUtils_1.formatColor(props.fill) || pick_1.default({
197
+ enterprise: {
198
+ light: variables_1.default.gray80,
199
+ dark: variables_1.default.gray25
200
+ },
201
+ prisma: variables_1.default.backgroundColorSidebar
202
+ })(props);
203
+ }, function (props) {
204
+ return props.stroke && propUtils_1.formatColor(props.stroke) || pick_1.default({
205
+ enterprise: {
206
+ dark: variables_1.default.gray80,
207
+ light: variables_1.default.textColor
208
+ },
209
+ prisma: variables_1.default.neutral500
210
+ })(props);
211
+ }, function (props) {
212
+ return props.onClick ? 'pointer' : 'inherit';
213
+ });
218
214
  };
219
215
 
220
- var validOptions = Object.keys(config_1.default.optionsSchema);
216
+ exports.getStyledShape = getStyledShape;
221
217
 
222
- var computeVizProps = function computeVizProps(props) {
223
- var dataSources = props.dataSources,
224
- otherOptions = __rest(props, ["dataSources"]);
218
+ /***/ }),
225
219
 
226
- var computedProps = {
227
- dataSources: dataSources,
228
- options: null
229
- };
230
- computedProps.options = lodash_1.chain(otherOptions).pick(validOptions).thru(shapeUtils_1.mapToOldKey).value();
231
- return computedProps;
232
- };
220
+ /***/ 11:
221
+ /***/ (function(module, exports) {
233
222
 
234
- exports.computeVizProps = computeVizProps;
235
- RectangleViz.propTypes = propTypes;
236
- RectangleViz.defaultProps = {
237
- width: 250,
238
- height: 300
239
- };
240
- var Rectangle = withDashboardViz_1.default({
241
- ReactViz: RectangleViz,
242
- computeVizProps: exports.computeVizProps,
243
- vizConfig: config_1.default
244
- });
245
- exports.default = Rectangle;
223
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
246
224
 
247
225
  /***/ }),
248
226
 
249
- /***/ 14:
227
+ /***/ 12:
250
228
  /***/ (function(module, exports, __webpack_require__) {
251
229
 
252
230
  "use strict";
@@ -260,11 +238,11 @@ var React = __webpack_require__(1);
260
238
 
261
239
  var styled_components_1 = __webpack_require__(4);
262
240
 
263
- var SizeAwareWrapper_1 = __webpack_require__(18);
241
+ var SizeAwareWrapper_1 = __webpack_require__(19);
264
242
 
265
- var style_1 = __webpack_require__(15);
243
+ var style_1 = __webpack_require__(14);
266
244
 
267
- var colorUtils_1 = __webpack_require__(13);
245
+ var colorUtils_1 = __webpack_require__(11);
268
246
 
269
247
  var Item = styled_components_1.default.div.attrs(function (_ref) {
270
248
  var width = _ref.width;
@@ -321,7 +299,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
321
299
 
322
300
  return React.createElement(FixSizeItem, {
323
301
  "data-test": "fix-size-item",
324
- "data-splunk-visualization-version": "25.0.0 - 5e0f30e5a",
302
+ "data-splunk-visualization-version": "25.1.0 - 812a9a4d8",
325
303
  width: width,
326
304
  height: height,
327
305
  backgroundColor: backgroundColor
@@ -343,187 +321,576 @@ exports.default = withFixedSizeContainer;
343
321
 
344
322
  /***/ }),
345
323
 
346
- /***/ 15:
347
- /***/ (function(module, exports) {
348
-
349
- module.exports = require("@splunk/visualizations-shared/style");
350
-
351
- /***/ }),
324
+ /***/ 13:
325
+ /***/ (function(module, exports, __webpack_require__) {
352
326
 
353
- /***/ 16:
354
- /***/ (function(module, exports) {
327
+ "use strict";
355
328
 
356
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
357
329
 
358
- /***/ }),
330
+ Object.defineProperty(exports, "__esModule", {
331
+ value: true
332
+ });
333
+ exports.extendStaticWrapperProps = void 0;
334
+ /**
335
+ * @method extendStaticWrapperProps
336
+ * @param {Object} props
337
+ * @param {DashboardVizType} props.Wrapper
338
+ * @param {DashboardVizType} props.Visualization
339
+ */
359
340
 
360
- /***/ 17:
361
- /***/ (function(module, exports) {
341
+ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
342
+ var Wrapper = _ref.Wrapper,
343
+ Visualization = _ref.Visualization;
344
+ var extendProperties = ['propTypes', 'defaultProps', 'config'];
345
+ extendProperties.forEach(function (prop) {
346
+ if (Visualization[prop]) {
347
+ // eslint-disable-next-line no-param-reassign
348
+ Wrapper[prop] = Visualization[prop];
349
+ }
350
+ });
351
+ };
362
352
 
363
- module.exports = require("@babel/runtime/helpers/createClass");
353
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
364
354
 
365
355
  /***/ }),
366
356
 
367
- /***/ 18:
368
- /***/ (function(module, exports) {
369
-
370
- module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
357
+ /***/ 137:
358
+ /***/ (function(module, exports, __webpack_require__) {
371
359
 
372
- /***/ }),
360
+ "use strict";
373
361
 
374
- /***/ 2:
375
- /***/ (function(module, exports) {
376
362
 
377
- module.exports = require("lodash");
363
+ var __rest = this && this.__rest || function (s, e) {
364
+ var t = {};
378
365
 
379
- /***/ }),
366
+ for (var p in s) {
367
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
368
+ }
380
369
 
381
- /***/ 20:
382
- /***/ (function(module, exports) {
370
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
371
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
372
+ }
373
+ return t;
374
+ };
383
375
 
384
- module.exports = require("@splunk/themes/pick");
376
+ Object.defineProperty(exports, "__esModule", {
377
+ value: true
378
+ });
379
+ exports.config = exports.computeVizProps = void 0;
385
380
 
386
- /***/ }),
381
+ var React = __webpack_require__(1);
387
382
 
388
- /***/ 21:
389
- /***/ (function(module, exports) {
383
+ var styled_components_1 = __webpack_require__(4);
390
384
 
391
- module.exports = require("@splunk/visualization-context/TimezoneContext");
385
+ var lodash_1 = __webpack_require__(3);
392
386
 
393
- /***/ }),
387
+ var T = __webpack_require__(0);
394
388
 
395
- /***/ 22:
396
- /***/ (function(module, exports) {
389
+ var withDashboardViz_1 = __webpack_require__(31);
397
390
 
398
- module.exports = require("@splunk/visualizations-shared/propUtils");
391
+ var config_1 = __webpack_require__(246);
399
392
 
400
- /***/ }),
393
+ exports.config = config_1.default;
401
394
 
402
- /***/ 23:
403
- /***/ (function(module, exports) {
395
+ var shapeUtils_1 = __webpack_require__(101);
404
396
 
405
- module.exports = require("@babel/runtime/helpers/typeof");
397
+ var SVGContainer = styled_components_1.default.svg.withConfig({
398
+ displayName: "Rectangle__SVGContainer",
399
+ componentId: "iwvil2-0"
400
+ })(["width:", "px;height:", "px;"], function (props) {
401
+ return props.width;
402
+ }, function (props) {
403
+ return props.height;
404
+ });
405
+ var propTypes = {
406
+ width: T.number,
407
+ height: T.number,
408
+ options: T.object,
409
+ mode: T.string,
410
+ onRectangleClick: T.func
411
+ };
412
+ var RectangleShape = shapeUtils_1.getStyledShape('rect');
413
+
414
+ var RectangleViz = function RectangleViz(props) {
415
+ var width = props.width,
416
+ height = props.height,
417
+ options = props.options,
418
+ onRectangleClick = props.onRectangleClick;
419
+ var strokeWidth = options.strokeWidth;
420
+ var rx = options.rx,
421
+ ry = options.ry; // If either radius value is NaN/undefined, sets value to 0.
422
+
423
+ rx = rx || 0;
424
+ ry = ry || 0;
425
+ return React.createElement(SVGContainer, {
426
+ width: width,
427
+ height: height
428
+ }, React.createElement(RectangleShape, Object.assign({}, options, {
429
+ rx: rx,
430
+ ry: ry,
431
+ x: "".concat(strokeWidth / 2, "px"),
432
+ y: "".concat(strokeWidth / 2, "px"),
433
+ vectorEffect: "non-scaling-stroke",
434
+ width: "".concat(width - strokeWidth, "px"),
435
+ height: "".concat(height - strokeWidth, "px"),
436
+ onClick: onRectangleClick
437
+ })));
438
+ };
439
+
440
+ var validOptions = Object.keys(config_1.default.optionsSchema);
441
+
442
+ var computeVizProps = function computeVizProps(props) {
443
+ var dataSources = props.dataSources,
444
+ otherOptions = __rest(props, ["dataSources"]);
445
+
446
+ var computedProps = {
447
+ dataSources: dataSources,
448
+ options: null
449
+ };
450
+ computedProps.options = lodash_1.chain(otherOptions).pick(validOptions).thru(shapeUtils_1.mapToOldKey).value();
451
+ return computedProps;
452
+ };
453
+
454
+ exports.computeVizProps = computeVizProps;
455
+ RectangleViz.propTypes = propTypes;
456
+ RectangleViz.defaultProps = {
457
+ width: 250,
458
+ height: 300
459
+ };
460
+ var Rectangle = withDashboardViz_1.default({
461
+ ReactViz: RectangleViz,
462
+ computeVizProps: exports.computeVizProps,
463
+ vizConfig: config_1.default
464
+ });
465
+ exports.default = Rectangle;
466
+
467
+ /***/ }),
468
+
469
+ /***/ 14:
470
+ /***/ (function(module, exports) {
471
+
472
+ module.exports = require("@splunk/visualizations-shared/style");
473
+
474
+ /***/ }),
475
+
476
+ /***/ 15:
477
+ /***/ (function(module, exports) {
478
+
479
+ module.exports = require("@splunk/visualizations-shared/schemaUtils");
406
480
 
407
481
  /***/ }),
408
482
 
409
- /***/ 242:
483
+ /***/ 16:
410
484
  /***/ (function(module, exports, __webpack_require__) {
411
485
 
412
486
  "use strict";
413
487
 
414
488
 
415
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
416
- if (k2 === undefined) k2 = k;
417
- Object.defineProperty(o, k2, {
418
- enumerable: true,
419
- get: function get() {
420
- return m[k];
421
- }
422
- });
423
- } : function (o, m, k, k2) {
424
- if (k2 === undefined) k2 = k;
425
- o[k2] = m[k];
426
- });
489
+ var _toConsumableArray = __webpack_require__(7);
427
490
 
428
- var __exportStar = this && this.__exportStar || function (m, exports) {
429
- for (var p in m) {
430
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
491
+ var _defineProperty = __webpack_require__(6);
492
+
493
+ var __rest = this && this.__rest || function (s, e) {
494
+ var t = {};
495
+
496
+ for (var p in s) {
497
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
498
+ }
499
+
500
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
501
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
431
502
  }
503
+ return t;
432
504
  };
433
505
 
434
506
  Object.defineProperty(exports, "__esModule", {
435
507
  value: true
436
508
  });
437
- exports.default = void 0;
509
+ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
438
510
 
439
- __exportStar(__webpack_require__(135), exports);
511
+ var lodash_1 = __webpack_require__(3);
440
512
 
441
- var Rectangle_1 = __webpack_require__(135);
513
+ var schemaUtils_1 = __webpack_require__(15);
442
514
 
443
- Object.defineProperty(exports, "default", {
444
- enumerable: true,
445
- get: function get() {
446
- return Rectangle_1.default;
447
- }
448
- });
515
+ var VizBehavior_1 = __webpack_require__(5);
449
516
 
450
- /***/ }),
517
+ var dynamicOptionsDSLType = {
518
+ type: 'string',
519
+ pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
520
+ };
521
+ /**
522
+ * Helper function to extend an options schema with dynamic options DSL
523
+ * @param optionsSchema a visualization's options schema
524
+ * @returns an updated options schema that additionally allows strings starting with > for each option
525
+ */
451
526
 
452
- /***/ 243:
453
- /***/ (function(module, exports, __webpack_require__) {
527
+ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
528
+ var enhancedOptionsSchema = {};
529
+ Object.keys(optionsSchema).forEach(function (key) {
530
+ var _a = optionsSchema[key],
531
+ title = _a.title,
532
+ description = _a.description,
533
+ readOnly = _a.readOnly,
534
+ writeOnly = _a.writeOnly,
535
+ examples = _a.examples,
536
+ defaultValue = _a.default,
537
+ type = _a.type,
538
+ properties = _a.properties,
539
+ patternProperties = _a.patternProperties,
540
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
454
541
 
455
- "use strict";
542
+ var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
543
+ title: title
544
+ }), description !== undefined && {
545
+ description: description
546
+ }), readOnly !== undefined && {
547
+ readOnly: readOnly
548
+ }), writeOnly !== undefined && {
549
+ writeOnly: writeOnly
550
+ }), examples !== undefined && {
551
+ examples: examples
552
+ }), defaultValue !== undefined && {
553
+ default: defaultValue
554
+ });
456
555
 
556
+ if (type === 'object') {
557
+ enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
558
+ type: type
559
+ }), properties && {
560
+ properties: enhanceOptionsSchemaWithDynamicOptions(properties)
561
+ });
457
562
 
458
- Object.defineProperty(exports, "__esModule", {
459
- value: true
460
- });
461
- exports.optionsSchema = void 0;
563
+ if (patternProperties) {
564
+ var enhancedPatternProperties = {};
565
+ Object.keys(patternProperties).forEach(function (opt) {
566
+ enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
567
+ });
568
+ enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
569
+ }
570
+ } else {
571
+ enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
572
+ anyOf: [Object.assign(Object.assign({}, type !== undefined && {
573
+ type: type
574
+ }), remainingSchemaEntry), dynamicOptionsDSLType]
575
+ });
576
+ }
577
+ });
578
+ return enhancedOptionsSchema;
579
+ }
462
580
 
463
- var visualization_icons_1 = __webpack_require__(46);
581
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
582
+ /**
583
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
584
+ * this function also collapse all editor panels
585
+ * @param vizConfig a Visualization Config
586
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
587
+ * and containing `open: false` for all editor panels in editorConfig
588
+ */
464
589
 
465
- var schemaUtils_1 = __webpack_require__(16);
590
+ function enhanceConfig(vizConfig) {
591
+ var enhancedConfig = vizConfig;
466
592
 
467
- var i18n_1 = __webpack_require__(3);
593
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
594
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
595
+ }
468
596
 
469
- var PresetPalettes_1 = __webpack_require__(53);
597
+ enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
598
+ return Object.assign(Object.assign({}, config), {
599
+ open: false
600
+ });
601
+ });
602
+ return enhancedConfig;
603
+ }
470
604
 
471
- var themes_1 = __webpack_require__(69);
605
+ exports.enhanceConfig = enhanceConfig;
606
+ /**
607
+ * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
608
+ * Created for editor unit tests
609
+ * @param vizConfig a Visualization Config
610
+ * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
611
+ */
472
612
 
473
- var VizBehavior_1 = __webpack_require__(5);
613
+ function uncollapseEditorConfig(vizConfig) {
614
+ var editorPanelUncollapsedConfig = vizConfig;
615
+ editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
616
+ return Object.assign(Object.assign({}, config), {
617
+ open: true
618
+ });
619
+ });
620
+ return editorPanelUncollapsedConfig;
621
+ }
474
622
 
475
- var VizCategory_1 = __webpack_require__(29);
623
+ exports.uncollapseEditorConfig = uncollapseEditorConfig;
476
624
 
477
- var configUtils_1 = __webpack_require__(6);
625
+ function isDynamicOption(option) {
626
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
627
+ }
478
628
 
479
- var DynamicFillColorEditor_1 = __webpack_require__(95);
629
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
630
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
480
631
 
481
- var DynamicStrokeColorEditor_1 = __webpack_require__(96);
632
+ /**
633
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
634
+ * 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
635
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
636
+ * 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
637
+ *
638
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
639
+ */
482
640
 
483
- var StaticFillColorEditor_1 = __webpack_require__(97);
641
+ function hasCompatibleContexts(vizContext, presetContext) {
642
+ var presetContextKeys = Object.keys(presetContext);
643
+ return presetContextKeys.every(function (contextKey) {
644
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
645
+ });
646
+ }
647
+ /**
648
+ * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
649
+ */
484
650
 
485
- var StaticStrokeColorEditor_1 = __webpack_require__(98);
486
651
 
487
- var dataContract = {
488
- requiredDataSources: [],
489
- optionalDataSources: [{
490
- name: 'primary',
491
- description: 'DataSource that powers the visualization'
492
- }],
493
- initialRequestParams: {
494
- primary: {
495
- offset: 0,
496
- count: 10000
497
- }
498
- }
499
- };
500
- var size = {
501
- initialWidth: 300,
502
- initialHeight: 300
503
- };
504
- var defaultContext = {
505
- fillColorConfig: [{
506
- from: 100,
507
- value: '#088F44'
508
- }, {
509
- from: 80,
510
- to: 100,
511
- value: '#2EB82E'
512
- }, {
513
- from: 60,
514
- to: 80,
515
- value: '#C3CC33'
516
- }, {
517
- from: 40,
518
- to: 60,
519
- value: '#FFD442'
520
- }, {
521
- from: 20,
522
- to: 40,
523
- value: '#FFA857'
524
- }, {
525
- from: 0,
526
- to: 20,
652
+ function hasCompatibleOptions(vizOptions, presetOptions) {
653
+ var presetOptionKeys = Object.keys(presetOptions);
654
+ return presetOptionKeys.every(function (optionKey) {
655
+ return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
656
+ });
657
+ }
658
+ /**
659
+ * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
660
+ * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
661
+ *
662
+ * @param {Object} vizContext - the current vizContext definition
663
+ * @param {Object} vizOptions - the current vizOptions definition
664
+ * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
665
+ */
666
+
667
+
668
+ function getInitialPreset(vizContext, vizOptions, presets) {
669
+ return presets.find(function (preset) {
670
+ var presetContext = lodash_1.get(preset, ['value', 'context'], {});
671
+ var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
672
+ var presetContextKeys = Object.keys(presetContext);
673
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
674
+ // if not, then the preset is invalid in config.ts
675
+
676
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
677
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
678
+ });
679
+ }
680
+
681
+ exports.getInitialPreset = getInitialPreset;
682
+ /**
683
+ * generates number precision values for a Select editor
684
+ *
685
+ * @param {Number} numPrecisionValues - number of integer precision values to generate
686
+ * @returns {{ label: string; value; string }[]} array of { label, value } tuples
687
+ */
688
+
689
+ function generatePrecisionValues(numPrecisionValues) {
690
+ return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
691
+ return {
692
+ label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
693
+ value: i
694
+ };
695
+ });
696
+ }
697
+
698
+ exports.generatePrecisionValues = generatePrecisionValues;
699
+ /**
700
+ * insert layout in layout array, return a new layout array instead of updating the original
701
+ *
702
+ * @param {EditorLayoutConfig[][]} layout - editor layout
703
+ * @param {Number} index - the index to insert layout item(s)
704
+ * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
705
+ * @returns {EditorLayoutConfig[][]} new editor layout with insertion
706
+ */
707
+
708
+ var insertLayout = function insertLayout(layout, index) {
709
+ for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
710
+ layoutItems[_key - 2] = arguments[_key];
711
+ }
712
+
713
+ return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
714
+ };
715
+
716
+ exports.insertLayout = insertLayout;
717
+
718
+ /***/ }),
719
+
720
+ /***/ 17:
721
+ /***/ (function(module, exports) {
722
+
723
+ module.exports = require("@splunk/visualizations-shared/configUtils");
724
+
725
+ /***/ }),
726
+
727
+ /***/ 18:
728
+ /***/ (function(module, exports) {
729
+
730
+ module.exports = require("@babel/runtime/helpers/createClass");
731
+
732
+ /***/ }),
733
+
734
+ /***/ 19:
735
+ /***/ (function(module, exports) {
736
+
737
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
738
+
739
+ /***/ }),
740
+
741
+ /***/ 2:
742
+ /***/ (function(module, exports) {
743
+
744
+ module.exports = require("@splunk/ui-utils/i18n");
745
+
746
+ /***/ }),
747
+
748
+ /***/ 21:
749
+ /***/ (function(module, exports) {
750
+
751
+ module.exports = require("@splunk/themes/pick");
752
+
753
+ /***/ }),
754
+
755
+ /***/ 22:
756
+ /***/ (function(module, exports) {
757
+
758
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
759
+
760
+ /***/ }),
761
+
762
+ /***/ 23:
763
+ /***/ (function(module, exports) {
764
+
765
+ module.exports = require("@splunk/visualizations-shared/propUtils");
766
+
767
+ /***/ }),
768
+
769
+ /***/ 24:
770
+ /***/ (function(module, exports) {
771
+
772
+ module.exports = require("@splunk/visualizations-shared/hocUtils");
773
+
774
+ /***/ }),
775
+
776
+ /***/ 245:
777
+ /***/ (function(module, exports, __webpack_require__) {
778
+
779
+ "use strict";
780
+
781
+
782
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
783
+ if (k2 === undefined) k2 = k;
784
+ Object.defineProperty(o, k2, {
785
+ enumerable: true,
786
+ get: function get() {
787
+ return m[k];
788
+ }
789
+ });
790
+ } : function (o, m, k, k2) {
791
+ if (k2 === undefined) k2 = k;
792
+ o[k2] = m[k];
793
+ });
794
+
795
+ var __exportStar = this && this.__exportStar || function (m, exports) {
796
+ for (var p in m) {
797
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
798
+ }
799
+ };
800
+
801
+ Object.defineProperty(exports, "__esModule", {
802
+ value: true
803
+ });
804
+ exports.default = void 0;
805
+
806
+ __exportStar(__webpack_require__(137), exports);
807
+
808
+ var Rectangle_1 = __webpack_require__(137);
809
+
810
+ Object.defineProperty(exports, "default", {
811
+ enumerable: true,
812
+ get: function get() {
813
+ return Rectangle_1.default;
814
+ }
815
+ });
816
+
817
+ /***/ }),
818
+
819
+ /***/ 246:
820
+ /***/ (function(module, exports, __webpack_require__) {
821
+
822
+ "use strict";
823
+
824
+
825
+ Object.defineProperty(exports, "__esModule", {
826
+ value: true
827
+ });
828
+ exports.optionsSchema = void 0;
829
+
830
+ var visualization_icons_1 = __webpack_require__(46);
831
+
832
+ var schemaUtils_1 = __webpack_require__(15);
833
+
834
+ var i18n_1 = __webpack_require__(2);
835
+
836
+ var PresetPalettes_1 = __webpack_require__(53);
837
+
838
+ var themes_1 = __webpack_require__(69);
839
+
840
+ var VizBehavior_1 = __webpack_require__(5);
841
+
842
+ var VizCategory_1 = __webpack_require__(30);
843
+
844
+ var configUtils_1 = __webpack_require__(16);
845
+
846
+ var DynamicFillColorEditor_1 = __webpack_require__(97);
847
+
848
+ var DynamicStrokeColorEditor_1 = __webpack_require__(98);
849
+
850
+ var StaticFillColorEditor_1 = __webpack_require__(99);
851
+
852
+ var StaticStrokeColorEditor_1 = __webpack_require__(100);
853
+
854
+ var dataContract = {
855
+ requiredDataSources: [],
856
+ optionalDataSources: [{
857
+ name: 'primary',
858
+ description: 'DataSource that powers the visualization'
859
+ }],
860
+ initialRequestParams: {
861
+ primary: {
862
+ offset: 0,
863
+ count: 10000
864
+ }
865
+ }
866
+ };
867
+ var size = {
868
+ initialWidth: 300,
869
+ initialHeight: 300
870
+ };
871
+ var defaultContext = {
872
+ fillColorConfig: [{
873
+ from: 100,
874
+ value: '#088F44'
875
+ }, {
876
+ from: 80,
877
+ to: 100,
878
+ value: '#2EB82E'
879
+ }, {
880
+ from: 60,
881
+ to: 80,
882
+ value: '#C3CC33'
883
+ }, {
884
+ from: 40,
885
+ to: 60,
886
+ value: '#FFD442'
887
+ }, {
888
+ from: 20,
889
+ to: 40,
890
+ value: '#FFA857'
891
+ }, {
892
+ from: 0,
893
+ to: 20,
527
894
  value: '#FF7149'
528
895
  }, {
529
896
  to: 0,
@@ -799,40 +1166,13 @@ exports.default = configUtils_1.enhanceConfig(config);
799
1166
  /***/ }),
800
1167
 
801
1168
  /***/ 25:
802
- /***/ (function(module, exports, __webpack_require__) {
803
-
804
- "use strict";
805
-
806
-
807
- Object.defineProperty(exports, "__esModule", {
808
- value: true
809
- });
810
- exports.pickFieldFromJSONSchema = void 0;
811
-
812
- var lodash_1 = __webpack_require__(2);
813
-
814
- var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
815
- var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
816
- return Object.keys(optionsSchema).reduce(function (accum, k) {
817
- if (lodash_1.has(optionsSchema[k], fieldName)) {
818
- accum[k] = optionsSchema[k][fieldName];
819
- } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
820
- var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
821
-
822
- if (!lodash_1.isEmpty(nestedSchema)) {
823
- accum[k] = nestedSchema;
824
- }
825
- }
826
-
827
- return accum;
828
- }, {});
829
- };
1169
+ /***/ (function(module, exports) {
830
1170
 
831
- exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
1171
+ module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
832
1172
 
833
1173
  /***/ }),
834
1174
 
835
- /***/ 26:
1175
+ /***/ 27:
836
1176
  /***/ (function(module, exports, __webpack_require__) {
837
1177
 
838
1178
  "use strict";
@@ -847,13 +1187,13 @@ var React = __webpack_require__(1);
847
1187
 
848
1188
  var T = __webpack_require__(0);
849
1189
 
850
- var lodash_1 = __webpack_require__(2);
1190
+ var lodash_1 = __webpack_require__(3);
851
1191
 
852
- var i18n_1 = __webpack_require__(3);
1192
+ var i18n_1 = __webpack_require__(2);
853
1193
 
854
- var Message_1 = __webpack_require__(11);
1194
+ var Message_1 = __webpack_require__(9);
855
1195
 
856
- var FixedSizeContainer_1 = __webpack_require__(14);
1196
+ var FixedSizeContainer_1 = __webpack_require__(12);
857
1197
  /**
858
1198
  * @method shouldShowIconPlaceholder
859
1199
  * @param {object} dataSources
@@ -924,13 +1264,13 @@ exports.default = FixedSizeContainer_1.default(IconPlaceholder);
924
1264
 
925
1265
  /***/ }),
926
1266
 
927
- /***/ 27:
1267
+ /***/ 28:
928
1268
  /***/ (function(module, exports, __webpack_require__) {
929
1269
 
930
1270
  "use strict";
931
1271
 
932
1272
 
933
- var _defineProperty = __webpack_require__(7);
1273
+ var _defineProperty = __webpack_require__(6);
934
1274
 
935
1275
  Object.defineProperty(exports, "__esModule", {
936
1276
  value: true
@@ -939,9 +1279,9 @@ exports.getSortingParams = exports.SortParamsPropTypes = void 0;
939
1279
 
940
1280
  var T = __webpack_require__(0);
941
1281
 
942
- var lodash_1 = __webpack_require__(2);
1282
+ var lodash_1 = __webpack_require__(3);
943
1283
 
944
- var DataSource_1 = __webpack_require__(37);
1284
+ var DataSource_1 = __webpack_require__(38);
945
1285
 
946
1286
  exports.SortParamsPropTypes = T.shape({
947
1287
  currentSortKey: T.string,
@@ -995,7 +1335,7 @@ exports.getSortingParams = getSortingParams;
995
1335
 
996
1336
  /***/ }),
997
1337
 
998
- /***/ 28:
1338
+ /***/ 29:
999
1339
  /***/ (function(module, exports, __webpack_require__) {
1000
1340
 
1001
1341
  "use strict";
@@ -1008,7 +1348,7 @@ exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1008
1348
 
1009
1349
  var T = __webpack_require__(0);
1010
1350
 
1011
- var lodash_1 = __webpack_require__(2);
1351
+ var lodash_1 = __webpack_require__(3);
1012
1352
 
1013
1353
  exports.PaginatorParamsPropTypes = T.shape({
1014
1354
  isPaging: T.bool,
@@ -1040,807 +1380,541 @@ var getPaginationParams = function getPaginationParams(_ref) {
1040
1380
 
1041
1381
  var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
1042
1382
 
1043
- if (typeof page === 'number' && page > 0) {
1044
- newParams.count = pageCount;
1045
- newParams.offset = (page - 1) * pageCount;
1046
- }
1047
-
1048
- onRequestParamsChange(newParams);
1049
- };
1050
-
1051
- return {
1052
- isPaging: isPaging,
1053
- current: current,
1054
- totalPages: totalPages,
1055
- onChange: lodash_1.isFunction(onRequestParamsChange) ? onChangeHandler : lodash_1.noop
1056
- };
1057
- };
1058
-
1059
- exports.getPaginationParams = getPaginationParams;
1060
-
1061
- /***/ }),
1062
-
1063
- /***/ 29:
1064
- /***/ (function(module, exports, __webpack_require__) {
1065
-
1066
- "use strict";
1067
-
1068
-
1069
- Object.defineProperty(exports, "__esModule", {
1070
- value: true
1071
- });
1072
- exports.VizCategory = void 0;
1073
- var VizCategory;
1074
-
1075
- (function (VizCategory) {
1076
- VizCategory["SINGLE_VALUE"] = "Single Value";
1077
- VizCategory["TRENDS"] = "Trends";
1078
- VizCategory["COMPARISONS"] = "Comparisons";
1079
- VizCategory["TABLE"] = "Table";
1080
- VizCategory["GAUGE"] = "Gauge";
1081
- VizCategory["DISTRIBUTIONS"] = "Distributions";
1082
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
1083
- VizCategory["SHAPES"] = "Shapes";
1084
- VizCategory["MISC"] = "misc";
1085
- VizCategory["FLOW"] = "Flow";
1086
- VizCategory["CORRELATION"] = "Correlation";
1087
- VizCategory["SPATIAL"] = "Spatial";
1088
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
1089
-
1090
- /***/ }),
1091
-
1092
- /***/ 3:
1093
- /***/ (function(module, exports) {
1094
-
1095
- module.exports = require("@splunk/ui-utils/i18n");
1096
-
1097
- /***/ }),
1098
-
1099
- /***/ 30:
1100
- /***/ (function(module, exports, __webpack_require__) {
1101
-
1102
- "use strict";
1103
-
1104
-
1105
- Object.defineProperty(exports, "__esModule", {
1106
- value: true
1107
- });
1108
-
1109
- var React = __webpack_require__(1);
1110
-
1111
- var lodash_1 = __webpack_require__(2);
1112
-
1113
- var getSettingsFromThemedProps_1 = __webpack_require__(31);
1114
-
1115
- var Options_1 = __webpack_require__(32);
1116
-
1117
- var SanitizeProps_1 = __webpack_require__(33);
1118
-
1119
- var TimezoneContext_1 = __webpack_require__(21);
1120
-
1121
- var moment_1 = __webpack_require__(34);
1122
-
1123
- var styled_components_1 = __webpack_require__(4);
1124
-
1125
- var SplunkVisualization_1 = __webpack_require__(35);
1126
-
1127
- var VizBehavior_1 = __webpack_require__(5);
1128
-
1129
- var getSorting_1 = __webpack_require__(27);
1130
-
1131
- var getPagination_1 = __webpack_require__(28);
1132
-
1133
- var useDeepMemo_1 = __webpack_require__(38);
1134
-
1135
- var JSONSchemaUtils_1 = __webpack_require__(25);
1136
-
1137
- var MissingPropsMessage_1 = __webpack_require__(39);
1138
-
1139
- var withEditModeCover_1 = __webpack_require__(40);
1140
-
1141
- var withPlaceholder_1 = __webpack_require__(42);
1142
-
1143
- var hocUtils_1 = __webpack_require__(8);
1144
- /**
1145
- * hoc that wraps a pure react visualization in a Dashboard visualization
1146
- * @param {DashboardVizOpts} opts
1147
- * @returns {HOC}
1148
- */
1149
-
1150
-
1151
- var withDashboardViz = function withDashboardViz(opts) {
1152
- var ReactViz = opts.ReactViz,
1153
- vizConfig = opts.vizConfig,
1154
- _opts$computeVizProps = opts.computeVizProps,
1155
- computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
1156
- disableEditModeCover = opts.disableEditModeCover,
1157
- useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
1158
-
1159
- var SanitizedReactViz = SanitizeProps_1.withSanitizedProps(ReactViz);
1160
- var defaultOptions = JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default');
1161
-
1162
- var DashboardViz = function DashboardViz(props) {
1163
- var mode = props.mode,
1164
- hasEventHandlers = props.hasEventHandlers,
1165
- dataSources = props.dataSources,
1166
- options = props.options,
1167
- _props$context = props.context,
1168
- context = _props$context === void 0 ? {} : _props$context,
1169
- width = props.width,
1170
- height = props.height,
1171
- onComputedProps = props.onComputedProps,
1172
- onEventTrigger = props.onEventTrigger,
1173
- theme = props.theme,
1174
- onRequestParamsChange = props.onRequestParamsChange;
1175
-
1176
- var _React$useContext = React.useContext(TimezoneContext_1.default),
1177
- serializedTimezone = _React$useContext.serializedTimezone;
1178
-
1179
- if (serializedTimezone) {
1180
- /*
1181
- @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
1182
- This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
1183
- will use it.
1184
- @TODO(pwied):
1185
- - remove when we moved away from @splunk/moment
1186
- - provide timezone context to dynamic option evaluation phase
1187
- */
1188
- if (!moment_1.default.getDefaultSplunkTimezone()) {
1189
- moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
1190
- }
1191
- }
1192
-
1193
- var themeFunc = function themeFunc(themeVar) {
1194
- var _a, _b;
1195
-
1196
- return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
1197
- };
1198
-
1199
- var bgColorFromTheme = themeFunc('defaultBackgroundColor');
1200
-
1201
- var _getSettingsFromTheme = getSettingsFromThemedProps_1.default({
1202
- theme: theme
1203
- }),
1204
- currentThemeFamily = _getSettingsFromTheme.family,
1205
- currentThemeColorScheme = _getSettingsFromTheme.colorScheme,
1206
- currentThemeDensity = _getSettingsFromTheme.density;
1207
-
1208
- var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
1209
-
1210
- evaluatedOptions = useDeepMemo_1.useDeepMemo(function () {
1211
- try {
1212
- return Options_1.Options.evaluate({
1213
- context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
1214
- options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
1215
- }, dataSources, themeFunc);
1216
- } catch (e) {
1217
- // eslint-disable-next-line no-console
1218
- console.error("unexpected error evaluating options: + ".concat(e.message));
1219
- return {};
1220
- }
1221
- }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone]); // useEffect hook needs to be initialized before any early returns
1222
- // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
1223
-
1224
- React.useEffect(function () {
1225
- onComputedProps(evaluatedOptions);
1226
- }); // present warning message if any required props are missing
1227
-
1228
- var _vizConfig$requiredPr = vizConfig.requiredProps,
1229
- requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1230
- supports = vizConfig.supports;
1231
- var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptions);
1232
-
1233
- if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER)) {
1234
- return React.createElement(MissingPropsMessage_1.default, {
1235
- "data-test": "missing-props-message",
1236
- width: width,
1237
- height: height,
1238
- missingProps: missing,
1239
- backgroundColor: bgColorFromTheme
1240
- });
1241
- } // events
1242
-
1243
-
1244
- var eventCallbackProps = {};
1245
-
1246
- if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
1247
- var supportedEvents = vizConfig.events;
1248
- Object.keys(supportedEvents).forEach(function (eventName) {
1249
- var eventCallbackPropName = lodash_1.camelCase("on.".concat(eventName));
1250
- eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
1251
- // then remove these lines
1252
-
1253
- var payloadKeys = supportedEvents[eventName].payloadKeys;
1254
- var payload = {};
1255
-
1256
- if (Array.isArray(payloadKeys) && payloadKeys.length) {
1257
- payloadKeys.forEach(function (p) {
1258
- payload[p] = evaluatedOptions[p];
1259
- });
1260
- }
1261
-
1262
- eventCallbackProps[eventCallbackPropName] = function (ev) {
1263
- if (ev && ev.payload) {
1264
- payload = ev.payload;
1265
- }
1266
-
1267
- return onEventTrigger({
1268
- originalEvent: ev,
1269
- payload: payload,
1270
- type: eventName
1271
- });
1272
- };
1273
- });
1274
- } // compute pure viz props which are not from options
1275
-
1276
-
1277
- var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptions), eventCallbackProps), {
1278
- themeFunc: themeFunc
1279
- }));
1280
- /**
1281
- * PAGE_AND_SORT behavior
1282
- *
1283
- * Some visualizations, like table, requires metadata about the datasource,
1284
- * like total number of results, current count, offset, and sort, for rendering
1285
- * paginator and sorting direction. In this approach, the visualization
1286
- * allow users to set 'paginateDataSourceKey' to select which datasource
1287
- * should the visualization extract the metadata from. It defaults to 'primary' datasource.
1288
- * The visualization config should set the PAGE_AND_SORT behavior to receive
1289
- * 'requestParams', 'meta' and onRequestParams callback as props.
1290
- *
1291
- * In future, we could automatically detect which all datasources are being used
1292
- * and bind those magically to pagination/sorting behavior.
1293
- */
1294
-
1295
- var dataSourceMetadata = {};
1296
- var OptionKey = 'paginateDataSourceKey';
1297
- var paginateDataSourceKey = lodash_1.has(evaluatedOptions, OptionKey) && evaluatedOptions[OptionKey] || 'primary';
1298
-
1299
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && lodash_1.has(dataSources, paginateDataSourceKey)) {
1300
- var requestParams = lodash_1.get(dataSources, [paginateDataSourceKey, 'requestParams'], {});
1301
- var meta = lodash_1.get(dataSources, [paginateDataSourceKey, 'meta'], {});
1302
-
1303
- var handleRequestParamsChange = function handleRequestParamsChange(payload) {
1304
- return onRequestParamsChange(paginateDataSourceKey, payload);
1305
- };
1306
-
1307
- var sortParams = getSorting_1.getSortingParams({
1308
- requestParams: requestParams,
1309
- meta: meta,
1310
- onRequestParamsChange: handleRequestParamsChange
1311
- });
1312
- var paginatorParams = getPagination_1.getPaginationParams({
1313
- requestParams: requestParams,
1314
- meta: meta,
1315
- onRequestParamsChange: handleRequestParamsChange
1316
- });
1317
- dataSourceMetadata = {
1318
- sortParams: sortParams,
1319
- paginatorParams: paginatorParams
1320
- };
1321
- }
1322
-
1323
- return React.createElement(SanitizedReactViz, Object.assign({
1324
- mode: mode,
1325
- width: width,
1326
- height: height
1327
- }, evaluatedOptions, computedVizProps, eventCallbackProps, dataSourceMetadata));
1328
- };
1329
-
1330
- DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
1331
- DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
1332
- // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
1333
- theme: {}
1334
- }); // attach viz config
1335
-
1336
- DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1337
-
1338
- return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
1339
- };
1340
-
1341
- exports.default = withDashboardViz;
1383
+ if (typeof page === 'number' && page > 0) {
1384
+ newParams.count = pageCount;
1385
+ newParams.offset = (page - 1) * pageCount;
1386
+ }
1342
1387
 
1343
- /***/ }),
1388
+ onRequestParamsChange(newParams);
1389
+ };
1344
1390
 
1345
- /***/ 31:
1346
- /***/ (function(module, exports) {
1391
+ return {
1392
+ isPaging: isPaging,
1393
+ current: current,
1394
+ totalPages: totalPages,
1395
+ onChange: lodash_1.isFunction(onRequestParamsChange) ? onChangeHandler : lodash_1.noop
1396
+ };
1397
+ };
1347
1398
 
1348
- module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1399
+ exports.getPaginationParams = getPaginationParams;
1349
1400
 
1350
1401
  /***/ }),
1351
1402
 
1352
- /***/ 32:
1403
+ /***/ 3:
1353
1404
  /***/ (function(module, exports) {
1354
1405
 
1355
- module.exports = require("@splunk/visualization-encoding/Options");
1406
+ module.exports = require("lodash");
1356
1407
 
1357
1408
  /***/ }),
1358
1409
 
1359
- /***/ 33:
1360
- /***/ (function(module, exports) {
1410
+ /***/ 30:
1411
+ /***/ (function(module, exports, __webpack_require__) {
1361
1412
 
1362
- module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1413
+ "use strict";
1363
1414
 
1364
- /***/ }),
1365
1415
 
1366
- /***/ 34:
1367
- /***/ (function(module, exports) {
1416
+ Object.defineProperty(exports, "__esModule", {
1417
+ value: true
1418
+ });
1419
+ exports.VizCategory = void 0;
1420
+ var VizCategory;
1368
1421
 
1369
- module.exports = require("@splunk/moment");
1422
+ (function (VizCategory) {
1423
+ VizCategory["SINGLE_VALUE"] = "Single Value";
1424
+ VizCategory["TRENDS"] = "Trends";
1425
+ VizCategory["COMPARISONS"] = "Comparisons";
1426
+ VizCategory["TABLE"] = "Table";
1427
+ VizCategory["GAUGE"] = "Gauge";
1428
+ VizCategory["DISTRIBUTIONS"] = "Distributions";
1429
+ VizCategory["CHOROPLETH"] = "Choropleth Maps";
1430
+ VizCategory["SHAPES"] = "Shapes";
1431
+ VizCategory["MISC"] = "misc";
1432
+ VizCategory["FLOW"] = "Flow";
1433
+ VizCategory["CORRELATION"] = "Correlation";
1434
+ VizCategory["SPATIAL"] = "Spatial";
1435
+ })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
1370
1436
 
1371
1437
  /***/ }),
1372
1438
 
1373
- /***/ 35:
1439
+ /***/ 31:
1374
1440
  /***/ (function(module, exports, __webpack_require__) {
1375
1441
 
1376
1442
  "use strict";
1377
1443
 
1378
1444
 
1379
- var _classCallCheck = __webpack_require__(12);
1380
-
1381
1445
  Object.defineProperty(exports, "__esModule", {
1382
1446
  value: true
1383
1447
  });
1384
- exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1385
- /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1386
1448
 
1387
- var T = __webpack_require__(0);
1449
+ var React = __webpack_require__(1);
1388
1450
 
1389
- var lodash_1 = __webpack_require__(2);
1451
+ var lodash_1 = __webpack_require__(3);
1390
1452
 
1391
- var VizActionHandler_1 = __webpack_require__(36); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1453
+ var getSettingsFromThemedProps_1 = __webpack_require__(32);
1392
1454
 
1455
+ var Options_1 = __webpack_require__(33);
1393
1456
 
1394
- exports.INITIAL_WIDTH = 250;
1395
- exports.INITIAL_HEIGHT = 250;
1396
- /**
1397
- * A Splunk visualization
1398
- */
1457
+ var SanitizeProps_1 = __webpack_require__(34);
1399
1458
 
1400
- var SplunkVisualization = function SplunkVisualization() {
1401
- _classCallCheck(this, SplunkVisualization);
1402
- };
1459
+ var TimezoneContext_1 = __webpack_require__(22);
1403
1460
 
1404
- SplunkVisualization.propTypes = {
1405
- /**
1406
- * display mode
1407
- */
1408
- mode: T.oneOf(['view', 'edit', 'export']).isRequired,
1461
+ var moment_1 = __webpack_require__(35);
1409
1462
 
1410
- /**
1411
- * width in pixel or string, defaults to 100%
1412
- */
1413
- width: T.oneOfType([T.string, T.number]).isRequired,
1463
+ var styled_components_1 = __webpack_require__(4);
1414
1464
 
1415
- /**
1416
- * height in pixel or string
1417
- */
1418
- height: T.oneOfType([T.string, T.number]).isRequired,
1465
+ var hocUtils_1 = __webpack_require__(24);
1419
1466
 
1420
- /**
1421
- * visualization context used for dynamic option evaluation
1422
- */
1423
- context: T.object,
1467
+ var JSONSchemaUtils_1 = __webpack_require__(25);
1424
1468
 
1425
- /**
1426
- * visualization formatting options
1427
- */
1428
- options: T.object,
1469
+ var SplunkVisualization_1 = __webpack_require__(36);
1429
1470
 
1430
- /**
1431
- * A callback to update formatting options
1432
- */
1433
- onOptionsChange: T.func,
1471
+ var VizBehavior_1 = __webpack_require__(5);
1434
1472
 
1435
- /**
1436
- * datasource state which include data and request params, object key indicate the datasource type.
1437
- */
1438
- dataSources: T.objectOf(T.shape({
1439
- /**
1440
- * current request params
1441
- */
1442
- requestParams: T.object,
1473
+ var getSorting_1 = __webpack_require__(28);
1443
1474
 
1444
- /**
1445
- * current dataset
1446
- */
1447
- data: T.shape({
1448
- fields: T.array,
1449
- columns: T.array
1450
- }),
1475
+ var getPagination_1 = __webpack_require__(29);
1451
1476
 
1452
- /**
1453
- * error
1454
- */
1455
- error: T.shape({
1456
- level: T.string,
1457
- message: T.string
1458
- }),
1477
+ var useDeepMemo_1 = __webpack_require__(39);
1459
1478
 
1460
- /**
1461
- * meta data that came with the dataset
1462
- */
1463
- meta: T.object
1464
- })),
1479
+ var MissingPropsMessage_1 = __webpack_require__(40);
1465
1480
 
1466
- /**
1467
- * A callback to trigger event
1468
- */
1469
- onEventTrigger: T.func,
1481
+ var withEditModeCover_1 = __webpack_require__(41);
1470
1482
 
1471
- /**
1472
- * Inform viz if there are handlers listening to events
1473
- */
1474
- hasEventHandlers: T.bool,
1483
+ var withPlaceholder_1 = __webpack_require__(42);
1484
+ /**
1485
+ * hoc that wraps a pure react visualization in a Dashboard visualization
1486
+ * @param {DashboardVizOpts} opts
1487
+ * @returns {HOC}
1488
+ */
1475
1489
 
1476
- /**
1477
- * A callback to communicate computed props to a consumer
1478
- */
1479
- onComputedProps: T.func,
1480
1490
 
1481
- /**
1482
- * A callback to obtain visualization api
1483
- */
1484
- vizActionHandlerRef: T.func,
1485
- loading: T.bool,
1486
- theme: T.object,
1491
+ var withDashboardViz = function withDashboardViz(opts) {
1492
+ var ReactViz = opts.ReactViz,
1493
+ vizConfig = opts.vizConfig,
1494
+ _opts$computeVizProps = opts.computeVizProps,
1495
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
1496
+ disableEditModeCover = opts.disableEditModeCover,
1497
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
1487
1498
 
1488
- /**
1489
- * A callback to request new data with updated request params
1490
- */
1491
- onRequestParamsChange: T.func
1492
- };
1493
- /**
1494
- *
1495
- */
1499
+ var SanitizedReactViz = SanitizeProps_1.withSanitizedProps(ReactViz);
1500
+ var defaultOptions = JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default');
1496
1501
 
1497
- SplunkVisualization.defaultProps = {
1498
- // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1499
- width: '100%',
1500
- height: exports.INITIAL_HEIGHT,
1501
- dataSources: {},
1502
- onEventTrigger: function onEventTrigger() {
1503
- return {};
1504
- },
1505
- mode: 'view',
1506
- hasEventHandlers: false,
1507
- options: {},
1508
- context: {},
1509
- onOptionsChange: function onOptionsChange() {
1510
- return {};
1511
- },
1512
- vizActionHandlerRef: function vizActionHandlerRef() {
1513
- return new VizActionHandler_1.DefaultVizActionHandler();
1514
- },
1515
- onComputedProps: function onComputedProps() {
1516
- return {};
1517
- },
1518
- loading: false,
1519
- onRequestParamsChange: lodash_1.noop
1520
- };
1521
- exports.default = SplunkVisualization;
1502
+ var DashboardViz = function DashboardViz(props) {
1503
+ var mode = props.mode,
1504
+ hasEventHandlers = props.hasEventHandlers,
1505
+ dataSources = props.dataSources,
1506
+ options = props.options,
1507
+ _props$context = props.context,
1508
+ context = _props$context === void 0 ? {} : _props$context,
1509
+ width = props.width,
1510
+ height = props.height,
1511
+ onComputedProps = props.onComputedProps,
1512
+ onEventTrigger = props.onEventTrigger,
1513
+ theme = props.theme,
1514
+ onRequestParamsChange = props.onRequestParamsChange;
1515
+
1516
+ var _React$useContext = React.useContext(TimezoneContext_1.default),
1517
+ serializedTimezone = _React$useContext.serializedTimezone;
1518
+
1519
+ if (serializedTimezone) {
1520
+ /*
1521
+ @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
1522
+ This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
1523
+ will use it.
1524
+ @TODO(pwied):
1525
+ - remove when we moved away from @splunk/moment
1526
+ - provide timezone context to dynamic option evaluation phase
1527
+ */
1528
+ if (!moment_1.default.getDefaultSplunkTimezone()) {
1529
+ moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
1530
+ }
1531
+ }
1532
+
1533
+ var themeFunc = function themeFunc(themeVar) {
1534
+ var _a, _b;
1535
+
1536
+ return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
1537
+ };
1538
+
1539
+ var bgColorFromTheme = themeFunc('defaultBackgroundColor');
1540
+
1541
+ var _getSettingsFromTheme = getSettingsFromThemedProps_1.default({
1542
+ theme: theme
1543
+ }),
1544
+ currentThemeFamily = _getSettingsFromTheme.family,
1545
+ currentThemeColorScheme = _getSettingsFromTheme.colorScheme,
1546
+ currentThemeDensity = _getSettingsFromTheme.density;
1547
+
1548
+ var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
1549
+
1550
+ evaluatedOptions = useDeepMemo_1.useDeepMemo(function () {
1551
+ try {
1552
+ return Options_1.Options.evaluate({
1553
+ context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
1554
+ options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
1555
+ }, dataSources, themeFunc);
1556
+ } catch (e) {
1557
+ // eslint-disable-next-line no-console
1558
+ console.error("unexpected error evaluating options: + ".concat(e.message));
1559
+ return {};
1560
+ }
1561
+ }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone]); // useEffect hook needs to be initialized before any early returns
1562
+ // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
1563
+
1564
+ React.useEffect(function () {
1565
+ onComputedProps(evaluatedOptions);
1566
+ }); // present warning message if any required props are missing
1567
+
1568
+ var _vizConfig$requiredPr = vizConfig.requiredProps,
1569
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1570
+ supports = vizConfig.supports;
1571
+ var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptions);
1522
1572
 
1523
- /***/ }),
1573
+ if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER)) {
1574
+ return React.createElement(MissingPropsMessage_1.default, {
1575
+ "data-test": "missing-props-message",
1576
+ width: width,
1577
+ height: height,
1578
+ missingProps: missing,
1579
+ backgroundColor: bgColorFromTheme
1580
+ });
1581
+ } // events
1524
1582
 
1525
- /***/ 36:
1526
- /***/ (function(module, exports, __webpack_require__) {
1527
1583
 
1528
- "use strict";
1584
+ var eventCallbackProps = {};
1529
1585
 
1586
+ if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
1587
+ var supportedEvents = vizConfig.events;
1588
+ Object.keys(supportedEvents).forEach(function (eventName) {
1589
+ var eventCallbackPropName = lodash_1.camelCase("on.".concat(eventName));
1590
+ eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
1591
+ // then remove these lines
1530
1592
 
1531
- var _classCallCheck = __webpack_require__(12);
1593
+ var payloadKeys = supportedEvents[eventName].payloadKeys;
1594
+ var payload = {};
1532
1595
 
1533
- var _createClass = __webpack_require__(17);
1596
+ if (Array.isArray(payloadKeys) && payloadKeys.length) {
1597
+ payloadKeys.forEach(function (p) {
1598
+ payload[p] = evaluatedOptions[p];
1599
+ });
1600
+ }
1534
1601
 
1535
- Object.defineProperty(exports, "__esModule", {
1536
- value: true
1537
- });
1538
- exports.DefaultVizActionHandler = void 0;
1602
+ eventCallbackProps[eventCallbackPropName] = function (ev) {
1603
+ if (ev && ev.payload) {
1604
+ payload = ev.payload;
1605
+ }
1539
1606
 
1540
- var DefaultVizActionHandler = /*#__PURE__*/function () {
1541
- function DefaultVizActionHandler() {
1542
- _classCallCheck(this, DefaultVizActionHandler);
1543
- }
1607
+ return onEventTrigger({
1608
+ originalEvent: ev,
1609
+ payload: payload,
1610
+ type: eventName
1611
+ });
1612
+ };
1613
+ });
1614
+ } // compute pure viz props which are not from options
1544
1615
 
1545
- _createClass(DefaultVizActionHandler, [{
1546
- key: "focus",
1547
- value: function focus() {// noop
1548
- }
1549
- }, {
1550
- key: "snapshot",
1551
- value: function snapshot() {
1552
- return null; // noop
1553
- }
1554
- }]);
1555
1616
 
1556
- return DefaultVizActionHandler;
1557
- }();
1617
+ var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptions), eventCallbackProps), {
1618
+ themeFunc: themeFunc
1619
+ }));
1620
+ /**
1621
+ * PAGE_AND_SORT behavior
1622
+ *
1623
+ * Some visualizations, like table, requires metadata about the datasource,
1624
+ * like total number of results, current count, offset, and sort, for rendering
1625
+ * paginator and sorting direction. In this approach, the visualization
1626
+ * allow users to set 'paginateDataSourceKey' to select which datasource
1627
+ * should the visualization extract the metadata from. It defaults to 'primary' datasource.
1628
+ * The visualization config should set the PAGE_AND_SORT behavior to receive
1629
+ * 'requestParams', 'meta' and onRequestParams callback as props.
1630
+ *
1631
+ * In future, we could automatically detect which all datasources are being used
1632
+ * and bind those magically to pagination/sorting behavior.
1633
+ */
1558
1634
 
1559
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1635
+ var dataSourceMetadata = {};
1636
+ var OptionKey = 'paginateDataSourceKey';
1637
+ var paginateDataSourceKey = lodash_1.has(evaluatedOptions, OptionKey) && evaluatedOptions[OptionKey] || 'primary';
1560
1638
 
1561
- /***/ }),
1639
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && lodash_1.has(dataSources, paginateDataSourceKey)) {
1640
+ var requestParams = lodash_1.get(dataSources, [paginateDataSourceKey, 'requestParams'], {});
1641
+ var meta = lodash_1.get(dataSources, [paginateDataSourceKey, 'meta'], {});
1562
1642
 
1563
- /***/ 37:
1564
- /***/ (function(module, exports, __webpack_require__) {
1643
+ var handleRequestParamsChange = function handleRequestParamsChange(payload) {
1644
+ return onRequestParamsChange(paginateDataSourceKey, payload);
1645
+ };
1565
1646
 
1566
- "use strict";
1647
+ var sortParams = getSorting_1.getSortingParams({
1648
+ requestParams: requestParams,
1649
+ meta: meta,
1650
+ onRequestParamsChange: handleRequestParamsChange
1651
+ });
1652
+ var paginatorParams = getPagination_1.getPaginationParams({
1653
+ requestParams: requestParams,
1654
+ meta: meta,
1655
+ onRequestParamsChange: handleRequestParamsChange
1656
+ });
1657
+ dataSourceMetadata = {
1658
+ sortParams: sortParams,
1659
+ paginatorParams: paginatorParams
1660
+ };
1661
+ }
1662
+
1663
+ return React.createElement(SanitizedReactViz, Object.assign({
1664
+ mode: mode,
1665
+ width: width,
1666
+ height: height
1667
+ }, evaluatedOptions, computedVizProps, eventCallbackProps, dataSourceMetadata));
1668
+ };
1567
1669
 
1670
+ DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
1671
+ DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
1672
+ // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
1673
+ theme: {}
1674
+ }); // attach viz config
1568
1675
 
1569
- Object.defineProperty(exports, "__esModule", {
1570
- value: true
1571
- });
1572
- exports.validSortDirs = void 0;
1573
- exports.validSortDirs = ['asc', 'desc', 'none'];
1676
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1677
+
1678
+ return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
1679
+ };
1680
+
1681
+ exports.default = withDashboardViz;
1574
1682
 
1575
1683
  /***/ }),
1576
1684
 
1577
- /***/ 38:
1578
- /***/ (function(module, exports, __webpack_require__) {
1685
+ /***/ 32:
1686
+ /***/ (function(module, exports) {
1579
1687
 
1580
- "use strict";
1688
+ module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1581
1689
 
1690
+ /***/ }),
1582
1691
 
1583
- Object.defineProperty(exports, "__esModule", {
1584
- value: true
1585
- });
1586
- exports.useDeepMemo = void 0;
1692
+ /***/ 33:
1693
+ /***/ (function(module, exports) {
1587
1694
 
1588
- var react_1 = __webpack_require__(1);
1695
+ module.exports = require("@splunk/visualization-encoding/Options");
1589
1696
 
1590
- var lodash_1 = __webpack_require__(2);
1591
- /**
1592
- * This hook evaluates and stores the result of a passed function and only
1593
- * re-evaluates the function when passed dependencies change.
1594
- *
1595
- * It is different from the internal React useMemo in the following aspects:
1596
- * - it only stores the last evaluated result
1597
- * - it uses a deep equality check to determine if dependencies have changed
1598
- *
1599
- * Inspired by apollo-client's useDeepMemo
1600
- *
1601
- * @param fn the function to be executed and
1602
- * @param dependencies an array of dependencies
1603
- */
1697
+ /***/ }),
1604
1698
 
1699
+ /***/ 34:
1700
+ /***/ (function(module, exports) {
1605
1701
 
1606
- var useDeepMemo = function useDeepMemo(fn, dependencies) {
1607
- var ref = react_1.useRef();
1702
+ module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1608
1703
 
1609
- if (!ref.current || !lodash_1.isEqual(dependencies, ref.current.dependencies)) {
1610
- ref.current = {
1611
- dependencies: dependencies,
1612
- value: fn()
1613
- };
1614
- }
1704
+ /***/ }),
1615
1705
 
1616
- return ref.current.value;
1617
- };
1706
+ /***/ 35:
1707
+ /***/ (function(module, exports) {
1618
1708
 
1619
- exports.useDeepMemo = useDeepMemo;
1709
+ module.exports = require("@splunk/moment");
1620
1710
 
1621
1711
  /***/ }),
1622
1712
 
1623
- /***/ 39:
1713
+ /***/ 36:
1624
1714
  /***/ (function(module, exports, __webpack_require__) {
1625
1715
 
1626
1716
  "use strict";
1627
1717
 
1628
1718
 
1719
+ var _classCallCheck = __webpack_require__(10);
1720
+
1629
1721
  Object.defineProperty(exports, "__esModule", {
1630
1722
  value: true
1631
1723
  });
1632
- exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1633
-
1634
- var React = __webpack_require__(1);
1724
+ exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1725
+ /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1635
1726
 
1636
1727
  var T = __webpack_require__(0);
1637
1728
 
1638
- var i18n_1 = __webpack_require__(3);
1639
-
1640
- var Message_1 = __webpack_require__(11);
1641
-
1642
- var FixedSizeContainer_1 = __webpack_require__(14);
1643
- /**
1644
- * @method isMissing
1645
- * @param {any} v
1646
- * @returns {boolean} true if the input value === null or undefined
1647
- */
1729
+ var lodash_1 = __webpack_require__(3);
1648
1730
 
1731
+ var VizActionHandler_1 = __webpack_require__(37); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1649
1732
 
1650
- var isMissing = function isMissing(v) {
1651
- return v === null || v === undefined;
1652
- };
1653
1733
 
1654
- exports.isMissing = isMissing;
1734
+ exports.INITIAL_WIDTH = 250;
1735
+ exports.INITIAL_HEIGHT = 250;
1655
1736
  /**
1656
- * @method misskingKeys
1657
- * @param {string[]} keys
1658
- * @param {object} target
1659
- * @returns {string[]} the keys of missing required props
1737
+ * A Splunk visualization
1660
1738
  */
1661
1739
 
1662
- var missingKeys = function missingKeys(keys, target) {
1663
- return keys.filter(function (k) {
1664
- return exports.isMissing(target[k]);
1665
- });
1740
+ var SplunkVisualization = function SplunkVisualization() {
1741
+ _classCallCheck(this, SplunkVisualization);
1666
1742
  };
1667
1743
 
1668
- exports.missingKeys = missingKeys;
1669
- var propTypes = {
1670
- width: T.oneOfType([T.string, T.number]),
1671
- height: T.oneOfType([T.string, T.number]),
1672
- // eslint-disable-next-line react/no-unused-prop-types
1673
- backgroundColor: T.string,
1674
- missingProps: T.arrayOf(T.string)
1675
- };
1676
- /**
1677
- * @method MissingPropsMessage
1678
- * @param {MissingPropsProps} props
1679
- * @returns {React.ReactElement}
1680
- */
1744
+ SplunkVisualization.propTypes = {
1745
+ /**
1746
+ * display mode
1747
+ */
1748
+ mode: T.oneOf(['view', 'edit', 'export']).isRequired,
1681
1749
 
1682
- var MissingPropsMessage = function MissingPropsMessage(props) {
1683
- var width = props.width,
1684
- height = props.height,
1685
- missingProps = props.missingProps;
1686
- return React.createElement(Message_1.default, {
1687
- "data-test": "message",
1688
- width: width,
1689
- height: height,
1690
- message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
1691
- });
1692
- };
1750
+ /**
1751
+ * width in pixel or string, defaults to 100%
1752
+ */
1753
+ width: T.oneOfType([T.string, T.number]).isRequired,
1693
1754
 
1694
- exports.MissingPropsMessage = MissingPropsMessage;
1695
- exports.MissingPropsMessage.propTypes = propTypes;
1696
- exports.MissingPropsMessage.defaultProps = {
1697
- width: '100%',
1698
- height: 250
1699
- };
1700
- exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
1755
+ /**
1756
+ * height in pixel or string
1757
+ */
1758
+ height: T.oneOfType([T.string, T.number]).isRequired,
1701
1759
 
1702
- /***/ }),
1760
+ /**
1761
+ * visualization context used for dynamic option evaluation
1762
+ */
1763
+ context: T.object,
1703
1764
 
1704
- /***/ 4:
1705
- /***/ (function(module, exports) {
1765
+ /**
1766
+ * visualization formatting options
1767
+ */
1768
+ options: T.object,
1706
1769
 
1707
- module.exports = require("styled-components");
1770
+ /**
1771
+ * A callback to update formatting options
1772
+ */
1773
+ onOptionsChange: T.func,
1708
1774
 
1709
- /***/ }),
1775
+ /**
1776
+ * datasource state which include data and request params, object key indicate the datasource type.
1777
+ */
1778
+ dataSources: T.objectOf(T.shape({
1779
+ /**
1780
+ * current request params
1781
+ */
1782
+ requestParams: T.object,
1710
1783
 
1711
- /***/ 40:
1712
- /***/ (function(module, exports, __webpack_require__) {
1784
+ /**
1785
+ * current dataset
1786
+ */
1787
+ data: T.shape({
1788
+ fields: T.array,
1789
+ columns: T.array
1790
+ }),
1713
1791
 
1714
- "use strict";
1792
+ /**
1793
+ * error
1794
+ */
1795
+ error: T.shape({
1796
+ level: T.string,
1797
+ message: T.string
1798
+ }),
1715
1799
 
1800
+ /**
1801
+ * meta data that came with the dataset
1802
+ */
1803
+ meta: T.object
1804
+ })),
1716
1805
 
1717
- Object.defineProperty(exports, "__esModule", {
1718
- value: true
1719
- });
1806
+ /**
1807
+ * A callback to trigger event
1808
+ */
1809
+ onEventTrigger: T.func,
1720
1810
 
1721
- var React = __webpack_require__(1);
1811
+ /**
1812
+ * Inform viz if there are handlers listening to events
1813
+ */
1814
+ hasEventHandlers: T.bool,
1722
1815
 
1723
- var styled_components_1 = __webpack_require__(4);
1816
+ /**
1817
+ * A callback to communicate computed props to a consumer
1818
+ */
1819
+ onComputedProps: T.func,
1724
1820
 
1725
- var hocUtils_1 = __webpack_require__(8);
1821
+ /**
1822
+ * A callback to obtain visualization api
1823
+ */
1824
+ vizActionHandlerRef: T.func,
1825
+ loading: T.bool,
1826
+ theme: T.object,
1726
1827
 
1727
- var Cover = styled_components_1.default.div.withConfig({
1728
- displayName: "withEditModeCover__Cover",
1729
- componentId: "sc-1gsbnxb-0"
1730
- })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1731
- var Blocker = styled_components_1.default.div.attrs({
1732
- 'data-splunk-visualization-version': "25.0.0 - 5e0f30e5a"
1733
- }).withConfig({
1734
- displayName: "withEditModeCover__Blocker",
1735
- componentId: "sc-1gsbnxb-1"
1736
- })(["position:relative;width:100%;height:100%;"]);
1828
+ /**
1829
+ * A callback to request new data with updated request params
1830
+ */
1831
+ onRequestParamsChange: T.func
1832
+ };
1737
1833
  /**
1738
- * HOC that renders a cover layer in edit mode
1739
- * @method withEditModeCover
1740
- * @param {ExtendedDashViz} Visualization
1741
- * @returns {ExtendedDashViz} Wrapper
1834
+ *
1742
1835
  */
1743
1836
 
1744
- var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
1745
- var Wrapper = function Wrapper(props) {
1746
- var mode = props.mode;
1747
- var showEditCover = mode === 'edit' && !disableEditModeCover;
1748
- return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
1749
- "data-test": "edit-mode-cover"
1750
- }));
1751
- };
1752
-
1753
- hocUtils_1.extendStaticWrapperProps({
1754
- Wrapper: Wrapper,
1755
- Visualization: Visualization
1756
- });
1757
- return Wrapper;
1837
+ SplunkVisualization.defaultProps = {
1838
+ // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1839
+ width: '100%',
1840
+ height: exports.INITIAL_HEIGHT,
1841
+ dataSources: {},
1842
+ onEventTrigger: function onEventTrigger() {
1843
+ return {};
1844
+ },
1845
+ mode: 'view',
1846
+ hasEventHandlers: false,
1847
+ options: {},
1848
+ context: {},
1849
+ onOptionsChange: function onOptionsChange() {
1850
+ return {};
1851
+ },
1852
+ vizActionHandlerRef: function vizActionHandlerRef() {
1853
+ return new VizActionHandler_1.DefaultVizActionHandler();
1854
+ },
1855
+ onComputedProps: function onComputedProps() {
1856
+ return {};
1857
+ },
1858
+ loading: false,
1859
+ onRequestParamsChange: lodash_1.noop
1758
1860
  };
1759
-
1760
- exports.default = withEditModeCover;
1761
-
1762
- /***/ }),
1763
-
1764
- /***/ 41:
1765
- /***/ (function(module, exports) {
1766
-
1767
- module.exports = require("@splunk/visualizations-shared/mapUtils");
1861
+ exports.default = SplunkVisualization;
1768
1862
 
1769
1863
  /***/ }),
1770
1864
 
1771
- /***/ 42:
1865
+ /***/ 37:
1772
1866
  /***/ (function(module, exports, __webpack_require__) {
1773
1867
 
1774
1868
  "use strict";
1775
1869
 
1776
1870
 
1871
+ var _classCallCheck = __webpack_require__(10);
1872
+
1873
+ var _createClass = __webpack_require__(18);
1874
+
1777
1875
  Object.defineProperty(exports, "__esModule", {
1778
1876
  value: true
1779
1877
  });
1878
+ exports.DefaultVizActionHandler = void 0;
1780
1879
 
1781
- var React = __webpack_require__(1);
1782
-
1783
- var colorUtils_1 = __webpack_require__(13);
1784
-
1785
- var variables_1 = __webpack_require__(10);
1786
-
1787
- var IconPlaceholder_1 = __webpack_require__(26);
1788
-
1789
- var VizBehavior_1 = __webpack_require__(5);
1790
-
1791
- var hocUtils_1 = __webpack_require__(8);
1792
-
1793
- var withPlaceholder = function withPlaceholder(Visualization) {
1794
- var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
1795
- var config = Visualization.config;
1796
- var themes = config.themes;
1797
-
1798
- var Wrapper = function Wrapper(props) {
1799
- var _a, _b;
1800
-
1801
- var dataSources = props.dataSources,
1802
- loading = props.loading,
1803
- options = props.options,
1804
- height = props.height,
1805
- width = props.width;
1806
- var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
1807
- var bgColorFromTheme = colorUtils_1.isColor(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
1808
- var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
1809
- var iconColor = variables_1.default.contentColorActive(props);
1880
+ var DefaultVizActionHandler = /*#__PURE__*/function () {
1881
+ function DefaultVizActionHandler() {
1882
+ _classCallCheck(this, DefaultVizActionHandler);
1883
+ }
1810
1884
 
1811
- if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
1812
- return React.createElement(IconPlaceholder_1.default, {
1813
- "data-test": "icon-placeholder",
1814
- icon: icon,
1815
- width: width,
1816
- height: height,
1817
- backgroundColor: bgColorFromTheme,
1818
- iconColor: iconColor
1819
- });
1885
+ _createClass(DefaultVizActionHandler, [{
1886
+ key: "focus",
1887
+ value: function focus() {// noop
1820
1888
  }
1889
+ }, {
1890
+ key: "snapshot",
1891
+ value: function snapshot() {
1892
+ return null; // noop
1893
+ }
1894
+ }]);
1821
1895
 
1822
- return React.createElement(Visualization, Object.assign({}, props));
1823
- };
1824
-
1825
- hocUtils_1.extendStaticWrapperProps({
1826
- Wrapper: Wrapper,
1827
- Visualization: Visualization
1828
- });
1829
- return Wrapper;
1830
- };
1896
+ return DefaultVizActionHandler;
1897
+ }();
1831
1898
 
1832
- exports.default = withPlaceholder;
1899
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
1833
1900
 
1834
1901
  /***/ }),
1835
1902
 
1836
- /***/ 46:
1837
- /***/ (function(module, exports) {
1903
+ /***/ 38:
1904
+ /***/ (function(module, exports, __webpack_require__) {
1838
1905
 
1839
- module.exports = require("@splunk/visualization-icons");
1906
+ "use strict";
1907
+
1908
+
1909
+ Object.defineProperty(exports, "__esModule", {
1910
+ value: true
1911
+ });
1912
+ exports.validSortDirs = void 0;
1913
+ exports.validSortDirs = ['asc', 'desc', 'none'];
1840
1914
 
1841
1915
  /***/ }),
1842
1916
 
1843
- /***/ 5:
1917
+ /***/ 39:
1844
1918
  /***/ (function(module, exports, __webpack_require__) {
1845
1919
 
1846
1920
  "use strict";
@@ -1849,363 +1923,337 @@ module.exports = require("@splunk/visualization-icons");
1849
1923
  Object.defineProperty(exports, "__esModule", {
1850
1924
  value: true
1851
1925
  });
1852
- exports.VizBehavior = void 0;
1853
- var VizBehavior;
1926
+ exports.useDeepMemo = void 0;
1854
1927
 
1855
- (function (VizBehavior) {
1856
- /**
1857
- * Dynamic Options Behavior.
1858
- * This allows visualization options to be powered by data
1859
- *
1860
- * **Example**
1861
- *
1862
- * sparklineValues: ">primary|seriesByIndex(0)"
1863
- * would configure sparklineValues with an array of data points
1864
- * coming from the first series in the primary datasource
1865
- *
1866
- */
1867
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
1868
- VizBehavior["EVENTS"] = "events";
1869
- /**
1870
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
1871
- * missing.
1872
- * @type {string}
1873
- */
1928
+ var react_1 = __webpack_require__(1);
1929
+
1930
+ var lodash_1 = __webpack_require__(3);
1931
+ /**
1932
+ * This hook evaluates and stores the result of a passed function and only
1933
+ * re-evaluates the function when passed dependencies change.
1934
+ *
1935
+ * It is different from the internal React useMemo in the following aspects:
1936
+ * - it only stores the last evaluated result
1937
+ * - it uses a deep equality check to determine if dependencies have changed
1938
+ *
1939
+ * Inspired by apollo-client's useDeepMemo
1940
+ *
1941
+ * @param fn the function to be executed and
1942
+ * @param dependencies an array of dependencies
1943
+ */
1944
+
1945
+
1946
+ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1947
+ var ref = react_1.useRef();
1948
+
1949
+ if (!ref.current || !lodash_1.isEqual(dependencies, ref.current.dependencies)) {
1950
+ ref.current = {
1951
+ dependencies: dependencies,
1952
+ value: fn()
1953
+ };
1954
+ }
1874
1955
 
1875
- VizBehavior["PLACEHOLDER"] = "placeholder";
1876
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
1877
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
1956
+ return ref.current.value;
1957
+ };
1958
+
1959
+ exports.useDeepMemo = useDeepMemo;
1878
1960
 
1879
1961
  /***/ }),
1880
1962
 
1881
- /***/ 53:
1963
+ /***/ 4:
1882
1964
  /***/ (function(module, exports) {
1883
1965
 
1884
- module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
1966
+ module.exports = require("styled-components");
1885
1967
 
1886
1968
  /***/ }),
1887
1969
 
1888
- /***/ 6:
1970
+ /***/ 40:
1889
1971
  /***/ (function(module, exports, __webpack_require__) {
1890
1972
 
1891
1973
  "use strict";
1892
1974
 
1893
1975
 
1894
- var _toConsumableArray = __webpack_require__(9);
1895
-
1896
- var _defineProperty = __webpack_require__(7);
1897
-
1898
- var __rest = this && this.__rest || function (s, e) {
1899
- var t = {};
1900
-
1901
- for (var p in s) {
1902
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1903
- }
1904
-
1905
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1906
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1907
- }
1908
- return t;
1909
- };
1910
-
1911
1976
  Object.defineProperty(exports, "__esModule", {
1912
1977
  value: true
1913
1978
  });
1914
- exports.insertLayout = exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
1979
+ exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1915
1980
 
1916
- var lodash_1 = __webpack_require__(2);
1981
+ var React = __webpack_require__(1);
1917
1982
 
1918
- var schemaUtils_1 = __webpack_require__(16);
1983
+ var T = __webpack_require__(0);
1919
1984
 
1920
- var VizBehavior_1 = __webpack_require__(5);
1985
+ var i18n_1 = __webpack_require__(2);
1921
1986
 
1922
- var dynamicOptionsDSLType = {
1923
- type: 'string',
1924
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
1925
- };
1987
+ var Message_1 = __webpack_require__(9);
1988
+
1989
+ var FixedSizeContainer_1 = __webpack_require__(12);
1926
1990
  /**
1927
- * Helper function to extend an options schema with dynamic options DSL
1928
- * @param optionsSchema a visualization's options schema
1929
- * @returns an updated options schema that additionally allows strings starting with > for each option
1991
+ * @method isMissing
1992
+ * @param {any} v
1993
+ * @returns {boolean} true if the input value === null or undefined
1930
1994
  */
1931
1995
 
1932
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
1933
- var enhancedOptionsSchema = {};
1934
- Object.keys(optionsSchema).forEach(function (key) {
1935
- var _a = optionsSchema[key],
1936
- title = _a.title,
1937
- description = _a.description,
1938
- readOnly = _a.readOnly,
1939
- writeOnly = _a.writeOnly,
1940
- examples = _a.examples,
1941
- defaultValue = _a.default,
1942
- type = _a.type,
1943
- properties = _a.properties,
1944
- patternProperties = _a.patternProperties,
1945
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
1946
1996
 
1947
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
1948
- title: title
1949
- }), description !== undefined && {
1950
- description: description
1951
- }), readOnly !== undefined && {
1952
- readOnly: readOnly
1953
- }), writeOnly !== undefined && {
1954
- writeOnly: writeOnly
1955
- }), examples !== undefined && {
1956
- examples: examples
1957
- }), defaultValue !== undefined && {
1958
- default: defaultValue
1959
- });
1997
+ var isMissing = function isMissing(v) {
1998
+ return v === null || v === undefined;
1999
+ };
1960
2000
 
1961
- if (type === 'object') {
1962
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
1963
- type: type
1964
- }), properties && {
1965
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
1966
- });
2001
+ exports.isMissing = isMissing;
2002
+ /**
2003
+ * @method misskingKeys
2004
+ * @param {string[]} keys
2005
+ * @param {object} target
2006
+ * @returns {string[]} the keys of missing required props
2007
+ */
1967
2008
 
1968
- if (patternProperties) {
1969
- var enhancedPatternProperties = {};
1970
- Object.keys(patternProperties).forEach(function (opt) {
1971
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
1972
- });
1973
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
1974
- }
1975
- } else {
1976
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
1977
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
1978
- type: type
1979
- }), remainingSchemaEntry), dynamicOptionsDSLType]
1980
- });
1981
- }
2009
+ var missingKeys = function missingKeys(keys, target) {
2010
+ return keys.filter(function (k) {
2011
+ return exports.isMissing(target[k]);
1982
2012
  });
1983
- return enhancedOptionsSchema;
1984
- }
2013
+ };
1985
2014
 
1986
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
2015
+ exports.missingKeys = missingKeys;
2016
+ var propTypes = {
2017
+ width: T.oneOfType([T.string, T.number]),
2018
+ height: T.oneOfType([T.string, T.number]),
2019
+ // eslint-disable-next-line react/no-unused-prop-types
2020
+ backgroundColor: T.string,
2021
+ missingProps: T.arrayOf(T.string)
2022
+ };
1987
2023
  /**
1988
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
1989
- * @param vizConfig a Visualization Config
1990
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
2024
+ * @method MissingPropsMessage
2025
+ * @param {MissingPropsProps} props
2026
+ * @returns {React.ReactElement}
1991
2027
  */
1992
2028
 
1993
- function enhanceConfig(vizConfig) {
1994
- var enhancedConfig = vizConfig;
2029
+ var MissingPropsMessage = function MissingPropsMessage(props) {
2030
+ var width = props.width,
2031
+ height = props.height,
2032
+ missingProps = props.missingProps;
2033
+ return React.createElement(Message_1.default, {
2034
+ "data-test": "message",
2035
+ width: width,
2036
+ height: height,
2037
+ message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
2038
+ });
2039
+ };
1995
2040
 
1996
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
1997
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
1998
- }
2041
+ exports.MissingPropsMessage = MissingPropsMessage;
2042
+ exports.MissingPropsMessage.propTypes = propTypes;
2043
+ exports.MissingPropsMessage.defaultProps = {
2044
+ width: '100%',
2045
+ height: 250
2046
+ };
2047
+ exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
1999
2048
 
2000
- return enhancedConfig;
2001
- }
2049
+ /***/ }),
2002
2050
 
2003
- exports.enhanceConfig = enhanceConfig;
2051
+ /***/ 41:
2052
+ /***/ (function(module, exports, __webpack_require__) {
2004
2053
 
2005
- function isDynamicOption(option) {
2006
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
2007
- }
2054
+ "use strict";
2008
2055
 
2009
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
2010
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
2011
2056
 
2012
- /**
2013
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
2014
- * 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
2015
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
2016
- * 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
2017
- *
2018
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
2019
- */
2057
+ Object.defineProperty(exports, "__esModule", {
2058
+ value: true
2059
+ });
2020
2060
 
2021
- function hasCompatibleContexts(vizContext, presetContext) {
2022
- var presetContextKeys = Object.keys(presetContext);
2023
- return presetContextKeys.every(function (contextKey) {
2024
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
2025
- });
2026
- }
2061
+ var React = __webpack_require__(1);
2062
+
2063
+ var styled_components_1 = __webpack_require__(4);
2064
+
2065
+ var hocUtils_1 = __webpack_require__(13);
2066
+
2067
+ var Cover = styled_components_1.default.div.withConfig({
2068
+ displayName: "withEditModeCover__Cover",
2069
+ componentId: "sc-1gsbnxb-0"
2070
+ })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
2071
+ var Blocker = styled_components_1.default.div.attrs({
2072
+ 'data-splunk-visualization-version': "25.1.0 - 812a9a4d8"
2073
+ }).withConfig({
2074
+ displayName: "withEditModeCover__Blocker",
2075
+ componentId: "sc-1gsbnxb-1"
2076
+ })(["position:relative;width:100%;height:100%;"]);
2027
2077
  /**
2028
- * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
2078
+ * HOC that renders a cover layer in edit mode
2079
+ * @method withEditModeCover
2080
+ * @param {ExtendedDashViz} Visualization
2081
+ * @returns {ExtendedDashViz} Wrapper
2029
2082
  */
2030
2083
 
2084
+ var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
2085
+ var Wrapper = function Wrapper(props) {
2086
+ var mode = props.mode;
2087
+ var showEditCover = mode === 'edit' && !disableEditModeCover;
2088
+ return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
2089
+ "data-test": "edit-mode-cover"
2090
+ }));
2091
+ };
2031
2092
 
2032
- function hasCompatibleOptions(vizOptions, presetOptions) {
2033
- var presetOptionKeys = Object.keys(presetOptions);
2034
- return presetOptionKeys.every(function (optionKey) {
2035
- return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
2093
+ hocUtils_1.extendStaticWrapperProps({
2094
+ Wrapper: Wrapper,
2095
+ Visualization: Visualization
2036
2096
  });
2037
- }
2038
- /**
2039
- * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
2040
- * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
2041
- *
2042
- * @param {Object} vizContext - the current vizContext definition
2043
- * @param {Object} vizOptions - the current vizOptions definition
2044
- * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
2045
- */
2097
+ return Wrapper;
2098
+ };
2046
2099
 
2100
+ exports.default = withEditModeCover;
2047
2101
 
2048
- function getInitialPreset(vizContext, vizOptions, presets) {
2049
- return presets.find(function (preset) {
2050
- var presetContext = lodash_1.get(preset, ['value', 'context'], {});
2051
- var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
2052
- var presetContextKeys = Object.keys(presetContext);
2053
- var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
2054
- // if not, then the preset is invalid in config.ts
2102
+ /***/ }),
2055
2103
 
2056
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
2057
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
2058
- });
2059
- }
2104
+ /***/ 42:
2105
+ /***/ (function(module, exports, __webpack_require__) {
2060
2106
 
2061
- exports.getInitialPreset = getInitialPreset;
2062
- /**
2063
- * generates number precision values for a Select editor
2064
- *
2065
- * @param {Number} numPrecisionValues - number of integer precision values to generate
2066
- * @returns {{ label: string; value; string }[]} array of { label, value } tuples
2067
- */
2107
+ "use strict";
2108
+
2109
+
2110
+ Object.defineProperty(exports, "__esModule", {
2111
+ value: true
2112
+ });
2113
+
2114
+ var React = __webpack_require__(1);
2115
+
2116
+ var colorUtils_1 = __webpack_require__(11);
2117
+
2118
+ var variables_1 = __webpack_require__(8);
2119
+
2120
+ var IconPlaceholder_1 = __webpack_require__(27);
2121
+
2122
+ var VizBehavior_1 = __webpack_require__(5);
2068
2123
 
2069
- function generatePrecisionValues(numPrecisionValues) {
2070
- return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
2071
- return {
2072
- label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
2073
- value: i
2074
- };
2075
- });
2076
- }
2124
+ var hocUtils_1 = __webpack_require__(13);
2077
2125
 
2078
- exports.generatePrecisionValues = generatePrecisionValues;
2079
- /**
2080
- * insert layout in layout array, return a new layout array instead of updating the original
2081
- *
2082
- * @param {EditorLayoutConfig[][]} layout - editor layout
2083
- * @param {Number} index - the index to insert layout item(s)
2084
- * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
2085
- * @returns {EditorLayoutConfig[][]} new editor layout with insertion
2086
- */
2126
+ var withPlaceholder = function withPlaceholder(Visualization) {
2127
+ var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
2128
+ var config = Visualization.config;
2129
+ var themes = config.themes;
2087
2130
 
2088
- var insertLayout = function insertLayout(layout, index) {
2089
- for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2090
- layoutItems[_key - 2] = arguments[_key];
2091
- }
2131
+ var Wrapper = function Wrapper(props) {
2132
+ var _a, _b;
2092
2133
 
2093
- return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
2094
- };
2134
+ var dataSources = props.dataSources,
2135
+ loading = props.loading,
2136
+ options = props.options,
2137
+ height = props.height,
2138
+ width = props.width;
2139
+ var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
2140
+ var bgColorFromTheme = colorUtils_1.isColor(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
2141
+ var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
2142
+ var iconColor = variables_1.default.contentColorActive(props);
2095
2143
 
2096
- exports.insertLayout = insertLayout;
2144
+ if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
2145
+ return React.createElement(IconPlaceholder_1.default, {
2146
+ "data-test": "icon-placeholder",
2147
+ icon: icon,
2148
+ width: width,
2149
+ height: height,
2150
+ backgroundColor: bgColorFromTheme,
2151
+ iconColor: iconColor
2152
+ });
2153
+ }
2097
2154
 
2098
- /***/ }),
2155
+ return React.createElement(Visualization, Object.assign({}, props));
2156
+ };
2099
2157
 
2100
- /***/ 69:
2101
- /***/ (function(module, exports) {
2158
+ hocUtils_1.extendStaticWrapperProps({
2159
+ Wrapper: Wrapper,
2160
+ Visualization: Visualization
2161
+ });
2162
+ return Wrapper;
2163
+ };
2102
2164
 
2103
- module.exports = require("@splunk/themes");
2165
+ exports.default = withPlaceholder;
2104
2166
 
2105
2167
  /***/ }),
2106
2168
 
2107
- /***/ 7:
2169
+ /***/ 46:
2108
2170
  /***/ (function(module, exports) {
2109
2171
 
2110
- module.exports = require("@babel/runtime/helpers/defineProperty");
2172
+ module.exports = require("@splunk/visualization-icons");
2111
2173
 
2112
2174
  /***/ }),
2113
2175
 
2114
- /***/ 8:
2176
+ /***/ 5:
2115
2177
  /***/ (function(module, exports, __webpack_require__) {
2116
2178
 
2117
2179
  "use strict";
2118
2180
 
2119
2181
 
2120
- var _typeof = __webpack_require__(23);
2121
-
2122
2182
  Object.defineProperty(exports, "__esModule", {
2123
2183
  value: true
2124
2184
  });
2125
- exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
2185
+ exports.VizBehavior = void 0;
2186
+ var VizBehavior;
2126
2187
 
2127
- var lodash_1 = __webpack_require__(2);
2188
+ (function (VizBehavior) {
2189
+ /**
2190
+ * Dynamic Options Behavior.
2191
+ * This allows visualization options to be powered by data
2192
+ *
2193
+ * **Example**
2194
+ *
2195
+ * sparklineValues: ">primary|seriesByIndex(0)"
2196
+ * would configure sparklineValues with an array of data points
2197
+ * coming from the first series in the primary datasource
2198
+ *
2199
+ */
2200
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
2201
+ VizBehavior["EVENTS"] = "events";
2202
+ /**
2203
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
2204
+ * missing.
2205
+ * @type {string}
2206
+ */
2128
2207
 
2129
- var mapUtils_1 = __webpack_require__(41);
2130
- /**
2131
- * @method extendStaticWrapperProps
2132
- * @param {Object} props
2133
- * @param {DashboardVizType} props.Wrapper
2134
- * @param {DashboardVizType} props.Visualization
2135
- */
2208
+ VizBehavior["PLACEHOLDER"] = "placeholder";
2209
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
2210
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
2136
2211
 
2212
+ /***/ }),
2137
2213
 
2138
- var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
2139
- var Wrapper = _ref.Wrapper,
2140
- Visualization = _ref.Visualization;
2141
- var extendProperties = ['propTypes', 'defaultProps', 'config'];
2142
- extendProperties.forEach(function (prop) {
2143
- if (Visualization[prop]) {
2144
- // eslint-disable-next-line no-param-reassign
2145
- Wrapper[prop] = Visualization[prop];
2146
- }
2147
- });
2148
- };
2214
+ /***/ 53:
2215
+ /***/ (function(module, exports) {
2149
2216
 
2150
- exports.extendStaticWrapperProps = extendStaticWrapperProps;
2151
- /**
2152
- * helper to deeply merge objects while preserving arrays in earlier source objects
2153
- * 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
2154
- * 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).
2155
- * 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
2156
- * 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.
2157
- *
2158
- * @method deepMergeWithArrayPrimitiveOverrides
2159
- * @param {Object} initial - target object to merge values into
2160
- * @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
2161
- *
2162
- * @returns {Object}
2163
- */
2217
+ module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
2164
2218
 
2165
- var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
2166
- var clone = lodash_1.cloneDeep(initial);
2219
+ /***/ }),
2167
2220
 
2168
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2169
- sources[_key - 1] = arguments[_key];
2170
- }
2221
+ /***/ 6:
2222
+ /***/ (function(module, exports) {
2171
2223
 
2172
- sources.forEach(function (sourceToApply) {
2173
- Object.keys(sourceToApply).forEach(function (sourceKey) {
2174
- if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
2175
- clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
2176
- }
2224
+ module.exports = require("@babel/runtime/helpers/defineProperty");
2177
2225
 
2178
- if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
2179
- clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
2180
- } else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
2181
- // If option is an array of objects
2182
- for (var i = 0; i < clone[sourceKey].length; i += 1) {
2183
- if (_typeof(clone[sourceKey][i]) === 'object') {
2184
- var closestMatchIdx = mapUtils_1.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
2185
-
2186
- if (closestMatchIdx > -1) {
2187
- clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
2188
- }
2189
- }
2190
- }
2191
- }
2192
- });
2193
- });
2194
- return clone;
2195
- };
2226
+ /***/ }),
2227
+
2228
+ /***/ 69:
2229
+ /***/ (function(module, exports) {
2196
2230
 
2197
- exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
2231
+ module.exports = require("@splunk/themes");
2198
2232
 
2199
2233
  /***/ }),
2200
2234
 
2201
- /***/ 9:
2235
+ /***/ 7:
2202
2236
  /***/ (function(module, exports) {
2203
2237
 
2204
2238
  module.exports = require("@babel/runtime/helpers/toConsumableArray");
2205
2239
 
2206
2240
  /***/ }),
2207
2241
 
2208
- /***/ 95:
2242
+ /***/ 8:
2243
+ /***/ (function(module, exports) {
2244
+
2245
+ module.exports = require("@splunk/themes/variables");
2246
+
2247
+ /***/ }),
2248
+
2249
+ /***/ 9:
2250
+ /***/ (function(module, exports) {
2251
+
2252
+ module.exports = require("@splunk/visualizations-shared/Message");
2253
+
2254
+ /***/ }),
2255
+
2256
+ /***/ 97:
2209
2257
  /***/ (function(module, exports, __webpack_require__) {
2210
2258
 
2211
2259
  "use strict";
@@ -2216,9 +2264,9 @@ Object.defineProperty(exports, "__esModule", {
2216
2264
  });
2217
2265
  exports.getDynamicFillColorEditor = void 0;
2218
2266
 
2219
- var i18n_1 = __webpack_require__(3);
2267
+ var i18n_1 = __webpack_require__(2);
2220
2268
 
2221
- var configUtils_1 = __webpack_require__(6);
2269
+ var configUtils_1 = __webpack_require__(17);
2222
2270
 
2223
2271
  var getDynamicFillColorEditor = function getDynamicFillColorEditor(_ref) {
2224
2272
  var defaultContext = _ref.defaultContext,
@@ -2261,7 +2309,7 @@ exports.getDynamicFillColorEditor = getDynamicFillColorEditor;
2261
2309
 
2262
2310
  /***/ }),
2263
2311
 
2264
- /***/ 96:
2312
+ /***/ 98:
2265
2313
  /***/ (function(module, exports, __webpack_require__) {
2266
2314
 
2267
2315
  "use strict";
@@ -2272,9 +2320,9 @@ Object.defineProperty(exports, "__esModule", {
2272
2320
  });
2273
2321
  exports.getDynamicStrokeColorEditor = void 0;
2274
2322
 
2275
- var i18n_1 = __webpack_require__(3);
2323
+ var i18n_1 = __webpack_require__(2);
2276
2324
 
2277
- var configUtils_1 = __webpack_require__(6);
2325
+ var configUtils_1 = __webpack_require__(17);
2278
2326
 
2279
2327
  var getDynamicStrokeColorEditor = function getDynamicStrokeColorEditor(_ref) {
2280
2328
  var defaultContext = _ref.defaultContext,
@@ -2317,7 +2365,7 @@ exports.getDynamicStrokeColorEditor = getDynamicStrokeColorEditor;
2317
2365
 
2318
2366
  /***/ }),
2319
2367
 
2320
- /***/ 97:
2368
+ /***/ 99:
2321
2369
  /***/ (function(module, exports, __webpack_require__) {
2322
2370
 
2323
2371
  "use strict";
@@ -2327,9 +2375,9 @@ Object.defineProperty(exports, "__esModule", {
2327
2375
  value: true
2328
2376
  });
2329
2377
 
2330
- var i18n_1 = __webpack_require__(3);
2378
+ var i18n_1 = __webpack_require__(2);
2331
2379
 
2332
- var configUtils_1 = __webpack_require__(6);
2380
+ var configUtils_1 = __webpack_require__(17);
2333
2381
 
2334
2382
  var StaticFillColorEditor = {
2335
2383
  label: i18n_1._('Static Fill'),
@@ -2342,110 +2390,6 @@ var StaticFillColorEditor = {
2342
2390
  };
2343
2391
  exports.default = StaticFillColorEditor;
2344
2392
 
2345
- /***/ }),
2346
-
2347
- /***/ 98:
2348
- /***/ (function(module, exports, __webpack_require__) {
2349
-
2350
- "use strict";
2351
-
2352
-
2353
- Object.defineProperty(exports, "__esModule", {
2354
- value: true
2355
- });
2356
-
2357
- var i18n_1 = __webpack_require__(3);
2358
-
2359
- var configUtils_1 = __webpack_require__(6);
2360
-
2361
- var StaticStrokeColorEditor = {
2362
- label: i18n_1._('Static Stroke'),
2363
- option: 'strokeColor',
2364
- editor: 'editor.color',
2365
- showEditor: function showEditor(_ref) {
2366
- var options = _ref.options;
2367
- return !configUtils_1.isDynamicOption(options.strokeColor);
2368
- }
2369
- };
2370
- exports.default = StaticStrokeColorEditor;
2371
-
2372
- /***/ }),
2373
-
2374
- /***/ 99:
2375
- /***/ (function(module, exports, __webpack_require__) {
2376
-
2377
- "use strict";
2378
-
2379
-
2380
- Object.defineProperty(exports, "__esModule", {
2381
- value: true
2382
- });
2383
- exports.getStyledShape = exports.mapToOldKey = void 0;
2384
-
2385
- var lodash_1 = __webpack_require__(2);
2386
-
2387
- var styled_components_1 = __webpack_require__(4);
2388
-
2389
- var pick_1 = __webpack_require__(20);
2390
-
2391
- var variables_1 = __webpack_require__(10);
2392
-
2393
- var propUtils_1 = __webpack_require__(22); // map for new options names to old option names
2394
-
2395
-
2396
- var shapeOptionsMapping = {
2397
- fillColor: 'fill',
2398
- strokeColor: 'stroke',
2399
- strokeDashStyle: 'strokeDasharray',
2400
- strokeJoinStyle: 'strokeLinejoin'
2401
- };
2402
- /**
2403
- * Helper method to update the option names to old option names
2404
- * @method mapToOldKey
2405
- * @param {Object} options
2406
- * @returns {Object}
2407
- */
2408
-
2409
- var mapToOldKey = function mapToOldKey(options) {
2410
- return lodash_1.mapKeys(options, function (val, key) {
2411
- return shapeOptionsMapping[key] ? shapeOptionsMapping[key] : key;
2412
- });
2413
- };
2414
-
2415
- exports.mapToOldKey = mapToOldKey;
2416
- /**
2417
- * Helper method to get styled component for ellipse or rectangle
2418
- * @method mapToOldKey
2419
- * @param {Shape} shape
2420
- */
2421
-
2422
- var getStyledShape = function getStyledShape(shape) {
2423
- return styled_components_1.default(shape).withConfig({
2424
- displayName: "shapeUtils",
2425
- componentId: "sc-1myvp5h-0"
2426
- })(["fill:", ";stroke:", ";cursor:", ";"], function (props) {
2427
- return props.fill && propUtils_1.formatColor(props.fill) || pick_1.default({
2428
- enterprise: {
2429
- light: variables_1.default.gray80,
2430
- dark: variables_1.default.gray25
2431
- },
2432
- prisma: variables_1.default.backgroundColorSidebar
2433
- })(props);
2434
- }, function (props) {
2435
- return props.stroke && propUtils_1.formatColor(props.stroke) || pick_1.default({
2436
- enterprise: {
2437
- dark: variables_1.default.gray80,
2438
- light: variables_1.default.textColor
2439
- },
2440
- prisma: variables_1.default.neutral500
2441
- })(props);
2442
- }, function (props) {
2443
- return props.onClick ? 'pointer' : 'inherit';
2444
- });
2445
- };
2446
-
2447
- exports.getStyledShape = getStyledShape;
2448
-
2449
2393
  /***/ })
2450
2394
 
2451
2395
  /******/ });