@splunk/visualizations 25.0.1 → 25.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_Background_Color_Red.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_Basic.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_FieldSummaryTooltip_Actions_Simulated_Instance.png +0 -0
  4. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_FieldSummaryTooltip_Actions_for_Numeric_Field_Simulated_Instance.png +0 -0
  5. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_FieldSummaryTooltip_Dark.png +0 -0
  6. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_FieldSummaryTooltip_Light.png +0 -0
  7. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_custom_base_layer_tile_server.png +0 -0
  8. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValueIcon_Background_color_cyan.png +0 -0
  9. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValueIcon_Unit_specified_Unit_Position_after_default.png +0 -0
  10. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValueIcon_Unit_specified_Unit_Position_before.png +0 -0
  11. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValue_Background_Color_white_Under_Label_and_Unit_specified.png +0 -0
  12. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValue_Major_Value_is_null.png +0 -0
  13. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValue_Unit_specified_Unit_Position_after_default.png +0 -0
  14. package/.loki/reference/chrome_docker_PureVisualizations_PureSingleValue_Unit_specified_Unit_Position_before.png +0 -0
  15. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Area_Editor.png +0 -0
  16. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bar_Editor.png +0 -0
  17. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bubble_Editor.png +0 -0
  18. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_ChoroplethSvg_Editor.png +0 -0
  19. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Column_Editor.png +0 -0
  20. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Ellipse_Editor.png +0 -0
  21. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Events_Editor.png +0 -0
  22. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_FillerGauge_Editor.png +0 -0
  23. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Image_Editor.png +0 -0
  24. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Line_Editor.png +0 -0
  25. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_LinkGraph_Editor.png +0 -0
  26. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  27. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Markdown_Editor.png +0 -0
  28. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_MarkerGauge_Editor.png +0 -0
  29. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Parallel_Coordinates_Editor.png +0 -0
  30. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Pie_Editor.png +0 -0
  31. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Punchcard_Editor.png +0 -0
  32. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Rectangle_Editor.png +0 -0
  33. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Sankey_Editor.png +0 -0
  34. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Scatter_Editor.png +0 -0
  35. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Editor.png +0 -0
  36. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Icon_Editor.png +0 -0
  37. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Radial_Editor.png +0 -0
  38. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Table_Editor.png +0 -0
  39. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Background_Color_Light_Blue.png +0 -0
  40. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Basic_Events.png +0 -0
  41. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Event_Actions.png +0 -0
  42. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Actions.png +0 -0
  43. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Summary.png +0 -0
  44. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Summary_Simulated_Instance.png +0 -0
  45. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Footer_Fields.png +0 -0
  46. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Footer_Fields_with_Highlight.png +0 -0
  47. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Show_Placeholder.png +0 -0
  48. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Width_Height.png +0 -0
  49. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Width_Percentage_50.png +0 -0
  50. package/.loki/reference/chrome_docker_Visualizations_Events_Events_With_Options.png +0 -0
  51. package/.loki/reference/chrome_docker_Visualizations_LinkGraph_LinkGraph_ES.png +0 -0
  52. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Set_Unit_value_after.png +0 -0
  53. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Set_Unit_value_before.png +0 -0
  54. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Set_The_Unit_After.png +0 -0
  55. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Set_The_Unit_Before.png +0 -0
  56. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_Unit_Value_After.png +0 -0
  57. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_Unit_Value_Before.png +0 -0
  58. package/Area.config.js +146 -157
  59. package/Area.config.js.map +1 -1
  60. package/Area.js +459 -545
  61. package/Area.js.map +1 -1
  62. package/Bar.config.js +148 -153
  63. package/Bar.config.js.map +1 -1
  64. package/Bar.js +468 -548
  65. package/Bar.js.map +1 -1
  66. package/Bubble.config.js +143 -123
  67. package/Bubble.config.js.map +1 -1
  68. package/Bubble.js +475 -530
  69. package/Bubble.js.map +1 -1
  70. package/ChoroplethSvg.config.js +87 -81
  71. package/ChoroplethSvg.config.js.map +1 -1
  72. package/ChoroplethSvg.js +352 -422
  73. package/ChoroplethSvg.js.map +1 -1
  74. package/Column.config.js +144 -151
  75. package/Column.config.js.map +1 -1
  76. package/Column.js +463 -546
  77. package/Column.js.map +1 -1
  78. package/Ellipse.config.js +86 -80
  79. package/Ellipse.config.js.map +1 -1
  80. package/Ellipse.js +319 -389
  81. package/Ellipse.js.map +1 -1
  82. package/Events.config.js +668 -0
  83. package/Events.config.js.map +1 -0
  84. package/Events.js +3116 -0
  85. package/Events.js.map +1 -0
  86. package/FillerGauge.config.js +94 -87
  87. package/FillerGauge.config.js.map +1 -1
  88. package/FillerGauge.js +352 -415
  89. package/FillerGauge.js.map +1 -1
  90. package/Image.config.js +74 -74
  91. package/Image.config.js.map +1 -1
  92. package/Image.js +713 -801
  93. package/Image.js.map +1 -1
  94. package/Line.config.js +145 -142
  95. package/Line.config.js.map +1 -1
  96. package/Line.js +471 -538
  97. package/Line.js.map +1 -1
  98. package/LinkGraph.config.js +120 -113
  99. package/LinkGraph.config.js.map +1 -1
  100. package/LinkGraph.js +24563 -717
  101. package/LinkGraph.js.map +1 -1
  102. package/Map.config.js +107 -100
  103. package/Map.config.js.map +1 -1
  104. package/Map.js +2358 -2465
  105. package/Map.js.map +1 -1
  106. package/Markdown.config.js +112 -112
  107. package/Markdown.config.js.map +1 -1
  108. package/Markdown.js +844 -918
  109. package/Markdown.js.map +1 -1
  110. package/MarkerGauge.config.js +185 -186
  111. package/MarkerGauge.config.js.map +1 -1
  112. package/MarkerGauge.js +1274 -1363
  113. package/MarkerGauge.js.map +1 -1
  114. package/ParallelCoordinates.config.js +137 -137
  115. package/ParallelCoordinates.config.js.map +1 -1
  116. package/ParallelCoordinates.js +732 -923
  117. package/ParallelCoordinates.js.map +1 -1
  118. package/Pie.config.js +132 -132
  119. package/Pie.config.js.map +1 -1
  120. package/Pie.js +1193 -1281
  121. package/Pie.js.map +1 -1
  122. package/Punchcard.config.js +138 -138
  123. package/Punchcard.config.js.map +1 -1
  124. package/Punchcard.js +2723 -2923
  125. package/Punchcard.js.map +1 -1
  126. package/Rectangle.config.js +267 -260
  127. package/Rectangle.config.js.map +1 -1
  128. package/Rectangle.js +1107 -1188
  129. package/Rectangle.js.map +1 -1
  130. package/Sankey.config.js +149 -142
  131. package/Sankey.config.js.map +1 -1
  132. package/Sankey.js +2613 -2808
  133. package/Sankey.js.map +1 -1
  134. package/Scatter.config.js +144 -123
  135. package/Scatter.config.js.map +1 -1
  136. package/Scatter.js +1820 -1889
  137. package/Scatter.js.map +1 -1
  138. package/SingleValue.config.js +121 -114
  139. package/SingleValue.config.js.map +1 -1
  140. package/SingleValue.js +2554 -2635
  141. package/SingleValue.js.map +1 -1
  142. package/SingleValueBasic.js +34 -34
  143. package/SingleValueBasic.js.map +1 -1
  144. package/SingleValueIcon.config.js +129 -120
  145. package/SingleValueIcon.config.js.map +1 -1
  146. package/SingleValueIcon.js +994 -1212
  147. package/SingleValueIcon.js.map +1 -1
  148. package/SingleValueRadial.config.js +216 -178
  149. package/SingleValueRadial.config.js.map +1 -1
  150. package/SingleValueRadial.js +2235 -2316
  151. package/SingleValueRadial.js.map +1 -1
  152. package/Table.config.js +150 -151
  153. package/Table.config.js.map +1 -1
  154. package/Table.js +2446 -2525
  155. package/Table.js.map +1 -1
  156. package/common/Charting.js +11 -11
  157. package/common/Charting.js.map +1 -1
  158. package/common/ChartingApi.js +2 -2
  159. package/common/ChartingApi.js.map +1 -1
  160. package/common/EventsDoc.js +25 -18
  161. package/common/EventsDoc.js.map +1 -1
  162. package/common/GaugeMajorTicks.js +10 -10
  163. package/common/GaugeMajorTicks.js.map +1 -1
  164. package/common/GaugeValueMarker.js +10 -10
  165. package/common/GaugeValueMarker.js.map +1 -1
  166. package/common/OptionsDoc.js +57 -357
  167. package/common/OptionsDoc.js.map +1 -1
  168. package/common/OverviewDoc.js +22 -22
  169. package/common/OverviewDoc.js.map +1 -1
  170. package/common/SplunkVisualization.js +4 -4
  171. package/common/SplunkVisualization.js.map +1 -1
  172. package/common/SplunkVisualizationApi.js +2 -2
  173. package/common/SplunkVisualizationApi.js.map +1 -1
  174. package/common/ThemesDoc.js +21 -21
  175. package/common/ThemesDoc.js.map +1 -1
  176. package/common/chartingUtils.js +4 -4
  177. package/common/chartingUtils.js.map +1 -1
  178. package/common/docUtils.js +4 -4
  179. package/common/docUtils.js.map +1 -1
  180. package/common/gaugeUtils.js +13 -13
  181. package/common/gaugeUtils.js.map +1 -1
  182. package/common/shapeUtils.js +8 -8
  183. package/common/shapeUtils.js.map +1 -1
  184. package/common/utils/configUtils.js +17 -18
  185. package/common/utils/configUtils.js.map +1 -1
  186. package/common/utils/{JSONSchemaUtils.js → dataUtils.js} +24 -25
  187. package/common/utils/dataUtils.js.map +1 -0
  188. package/common/utils/hocUtils.js +5 -85
  189. package/common/utils/hocUtils.js.map +1 -1
  190. package/common/utils/mapUtils.js +198 -0
  191. package/common/utils/mapUtils.js.map +1 -0
  192. package/common/utils/singleValueUtils.js +15 -12
  193. package/common/utils/singleValueUtils.js.map +1 -1
  194. package/common/utils/testHelper.js +8 -8
  195. package/common/utils/testHelper.js.map +1 -1
  196. package/common/withDashboardViz.js +120 -207
  197. package/common/withDashboardViz.js.map +1 -1
  198. package/package.json +16 -14
  199. package/.loki/reference/chrome_docker_PureVisualizations_SvgChoroplethDynamic_SVG_Of_Size_Greater_Than_2_MB_Render.png +0 -0
  200. package/common/utils/JSONSchemaUtils.js.map +0 -1
package/MarkerGauge.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 = 214);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 399);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -109,11 +109,18 @@ module.exports = require("react");
109
109
  /***/ 10:
110
110
  /***/ (function(module, exports) {
111
111
 
112
- module.exports = require("@splunk/themes/variables");
112
+ module.exports = require("@splunk/visualizations-shared/Message");
113
+
114
+ /***/ }),
115
+
116
+ /***/ 11:
117
+ /***/ (function(module, exports) {
118
+
119
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
113
120
 
114
121
  /***/ }),
115
122
 
116
- /***/ 101:
123
+ /***/ 110:
117
124
  /***/ (function(module, exports, __webpack_require__) {
118
125
 
119
126
  "use strict";
@@ -123,7 +130,7 @@ Object.defineProperty(exports, "__esModule", {
123
130
  value: true
124
131
  });
125
132
 
126
- var i18n_1 = __webpack_require__(3);
133
+ var i18n_1 = __webpack_require__(2);
127
134
 
128
135
  var gauge = {
129
136
  label: i18n_1._('Gauge Settings'),
@@ -178,14 +185,14 @@ exports.default = gauge;
178
185
 
179
186
  /***/ }),
180
187
 
181
- /***/ 102:
188
+ /***/ 111:
182
189
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
183
190
 
184
191
  "use strict";
185
192
  __webpack_require__.r(__webpack_exports__);
186
193
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MajorTick", function() { return MajorTick; });
187
194
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionMajorTick", function() { return positionMajorTick; });
188
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(47);
195
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48);
189
196
  /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
190
197
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
191
198
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
@@ -193,7 +200,7 @@ __webpack_require__.r(__webpack_exports__);
193
200
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
194
201
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
195
202
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
196
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23);
203
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(30);
197
204
  /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
198
205
 
199
206
 
@@ -433,14 +440,14 @@ MajorTicks.defaultProps = {
433
440
 
434
441
  /***/ }),
435
442
 
436
- /***/ 103:
443
+ /***/ 112:
437
444
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
438
445
 
439
446
  "use strict";
440
447
  __webpack_require__.r(__webpack_exports__);
441
448
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionValueMarkerRect", function() { return positionValueMarkerRect; });
442
449
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionLabel", function() { return positionLabel; });
443
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(47);
450
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48);
444
451
  /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
445
452
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
446
453
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
@@ -448,7 +455,7 @@ __webpack_require__.r(__webpack_exports__);
448
455
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
449
456
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
450
457
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
451
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23);
458
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(30);
452
459
  /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
453
460
 
454
461
 
@@ -635,91 +642,14 @@ ValueMarker.defaultProps = {
635
642
 
636
643
  /***/ }),
637
644
 
638
- /***/ 11:
639
- /***/ (function(module, exports) {
640
-
641
- module.exports = require("@splunk/visualizations-shared/Message");
642
-
643
- /***/ }),
644
-
645
645
  /***/ 12:
646
646
  /***/ (function(module, exports) {
647
647
 
648
- module.exports = require("@babel/runtime/helpers/classCallCheck");
649
-
650
- /***/ }),
651
-
652
- /***/ 13:
653
- /***/ (function(module, exports) {
654
-
655
648
  module.exports = require("@splunk/visualizations-shared/colorUtils");
656
649
 
657
650
  /***/ }),
658
651
 
659
- /***/ 133:
660
- /***/ (function(module, exports, __webpack_require__) {
661
-
662
- "use strict";
663
-
664
-
665
- var __rest = this && this.__rest || function (s, e) {
666
- var t = {};
667
-
668
- for (var p in s) {
669
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
670
- }
671
-
672
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
673
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
674
- }
675
- return t;
676
- };
677
-
678
- Object.defineProperty(exports, "__esModule", {
679
- value: true
680
- });
681
- exports.config = exports.computeVizProps = exports.PureMarkerGauge = void 0;
682
-
683
- var lodash_1 = __webpack_require__(2);
684
-
685
- var MarkerGauge_1 = __webpack_require__(215);
686
-
687
- var config_1 = __webpack_require__(217);
688
-
689
- exports.config = config_1.default;
690
-
691
- var withDashboardViz_1 = __webpack_require__(30);
692
-
693
- var gaugeUtils_1 = __webpack_require__(80);
694
-
695
- exports.PureMarkerGauge = MarkerGauge_1.default;
696
- var validOptions = Object.keys(config_1.default.optionsSchema);
697
-
698
- var computeVizProps = function computeVizProps(_a) {
699
- var props = __rest(_a, []);
700
-
701
- var options = lodash_1.chain(props).pick(validOptions).thru(gaugeUtils_1.convertToGaugeProperties).value();
702
- var defaultColors = {
703
- fillColor: config_1.default.themes.defaultFillColor(props),
704
- majorTickFillColor: config_1.default.themes.majorTickFillColor(props),
705
- majorTickStrokeColor: config_1.default.themes.majorTickStrokeColor(props),
706
- valueMarkerFillColor: config_1.default.themes.valueMarkerFillColor(props),
707
- valueMarkerLabelFillColor: config_1.default.themes.valueMarkerLabelFillColor(props)
708
- };
709
- return Object.assign(Object.assign({}, options), defaultColors);
710
- };
711
-
712
- exports.computeVizProps = computeVizProps;
713
- var viz = withDashboardViz_1.default({
714
- ReactViz: MarkerGauge_1.default,
715
- computeVizProps: exports.computeVizProps,
716
- vizConfig: config_1.default
717
- });
718
- exports.default = viz;
719
-
720
- /***/ }),
721
-
722
- /***/ 14:
652
+ /***/ 13:
723
653
  /***/ (function(module, exports, __webpack_require__) {
724
654
 
725
655
  "use strict";
@@ -733,11 +663,11 @@ var React = __webpack_require__(1);
733
663
 
734
664
  var styled_components_1 = __webpack_require__(4);
735
665
 
736
- var SizeAwareWrapper_1 = __webpack_require__(18);
666
+ var SizeAwareWrapper_1 = __webpack_require__(20);
737
667
 
738
668
  var style_1 = __webpack_require__(15);
739
669
 
740
- var colorUtils_1 = __webpack_require__(13);
670
+ var colorUtils_1 = __webpack_require__(12);
741
671
 
742
672
  var Item = styled_components_1.default.div.attrs(function (_ref) {
743
673
  var width = _ref.width;
@@ -794,7 +724,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
794
724
 
795
725
  return React.createElement(FixSizeItem, {
796
726
  "data-test": "fix-size-item",
797
- "data-splunk-visualization-version": "25.0.1 - de10ad954",
727
+ "data-splunk-visualization-version": "25.2.0 - 4373c5a66",
798
728
  width: width,
799
729
  height: height,
800
730
  backgroundColor: backgroundColor
@@ -816,104 +746,126 @@ exports.default = withFixedSizeContainer;
816
746
 
817
747
  /***/ }),
818
748
 
819
- /***/ 15:
820
- /***/ (function(module, exports) {
821
-
822
- module.exports = require("@splunk/visualizations-shared/style");
823
-
824
- /***/ }),
749
+ /***/ 14:
750
+ /***/ (function(module, exports, __webpack_require__) {
825
751
 
826
- /***/ 16:
827
- /***/ (function(module, exports) {
752
+ "use strict";
828
753
 
829
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
830
754
 
831
- /***/ }),
755
+ Object.defineProperty(exports, "__esModule", {
756
+ value: true
757
+ });
758
+ exports.extendStaticWrapperProps = void 0;
759
+ /**
760
+ * @method extendStaticWrapperProps
761
+ * @param {Object} props
762
+ * @param {DashboardVizType} props.Wrapper
763
+ * @param {DashboardVizType} props.Visualization
764
+ */
832
765
 
833
- /***/ 17:
834
- /***/ (function(module, exports) {
766
+ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
767
+ var Wrapper = _ref.Wrapper,
768
+ Visualization = _ref.Visualization;
769
+ var extendProperties = ['propTypes', 'defaultProps', 'config'];
770
+ extendProperties.forEach(function (prop) {
771
+ if (Visualization[prop]) {
772
+ // eslint-disable-next-line no-param-reassign
773
+ Wrapper[prop] = Visualization[prop];
774
+ }
775
+ });
776
+ };
835
777
 
836
- module.exports = require("@babel/runtime/helpers/createClass");
778
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
837
779
 
838
780
  /***/ }),
839
781
 
840
- /***/ 18:
841
- /***/ (function(module, exports) {
842
-
843
- module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
782
+ /***/ 144:
783
+ /***/ (function(module, exports, __webpack_require__) {
844
784
 
845
- /***/ }),
785
+ "use strict";
846
786
 
847
- /***/ 2:
848
- /***/ (function(module, exports) {
849
787
 
850
- module.exports = require("lodash");
788
+ var __rest = this && this.__rest || function (s, e) {
789
+ var t = {};
851
790
 
852
- /***/ }),
791
+ for (var p in s) {
792
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
793
+ }
853
794
 
854
- /***/ 20:
855
- /***/ (function(module, exports) {
795
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
796
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
797
+ }
798
+ return t;
799
+ };
856
800
 
857
- module.exports = require("@splunk/themes/pick");
801
+ Object.defineProperty(exports, "__esModule", {
802
+ value: true
803
+ });
804
+ exports.config = exports.computeVizProps = exports.PureMarkerGauge = void 0;
858
805
 
859
- /***/ }),
806
+ var lodash_1 = __webpack_require__(3);
860
807
 
861
- /***/ 21:
862
- /***/ (function(module, exports) {
808
+ var MarkerGauge_1 = __webpack_require__(400);
863
809
 
864
- module.exports = require("@splunk/visualization-context/TimezoneContext");
810
+ var config_1 = __webpack_require__(402);
865
811
 
866
- /***/ }),
812
+ exports.config = config_1.default;
867
813
 
868
- /***/ 214:
869
- /***/ (function(module, exports, __webpack_require__) {
814
+ var withDashboardViz_1 = __webpack_require__(32);
870
815
 
871
- "use strict";
816
+ var gaugeUtils_1 = __webpack_require__(84);
872
817
 
818
+ exports.PureMarkerGauge = MarkerGauge_1.default;
819
+ var validOptions = Object.keys(config_1.default.optionsSchema);
873
820
 
874
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
875
- if (k2 === undefined) k2 = k;
876
- Object.defineProperty(o, k2, {
877
- enumerable: true,
878
- get: function get() {
879
- return m[k];
880
- }
881
- });
882
- } : function (o, m, k, k2) {
883
- if (k2 === undefined) k2 = k;
884
- o[k2] = m[k];
885
- });
821
+ var computeVizProps = function computeVizProps(_a) {
822
+ var props = __rest(_a, []);
886
823
 
887
- var __exportStar = this && this.__exportStar || function (m, exports) {
888
- for (var p in m) {
889
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
890
- }
824
+ var options = lodash_1.chain(props).pick(validOptions).thru(gaugeUtils_1.convertToGaugeProperties).value();
825
+ var defaultColors = {
826
+ fillColor: config_1.default.themes.defaultFillColor(props),
827
+ majorTickFillColor: config_1.default.themes.majorTickFillColor(props),
828
+ majorTickStrokeColor: config_1.default.themes.majorTickStrokeColor(props),
829
+ valueMarkerFillColor: config_1.default.themes.valueMarkerFillColor(props),
830
+ valueMarkerLabelFillColor: config_1.default.themes.valueMarkerLabelFillColor(props)
831
+ };
832
+ return Object.assign(Object.assign({}, options), defaultColors);
891
833
  };
892
834
 
893
- Object.defineProperty(exports, "__esModule", {
894
- value: true
835
+ exports.computeVizProps = computeVizProps;
836
+ var viz = withDashboardViz_1.default({
837
+ ReactViz: MarkerGauge_1.default,
838
+ computeVizProps: exports.computeVizProps,
839
+ vizConfig: config_1.default
895
840
  });
896
- exports.default = void 0;
841
+ exports.default = viz;
897
842
 
898
- __exportStar(__webpack_require__(133), exports);
843
+ /***/ }),
899
844
 
900
- var MarkerGauge_1 = __webpack_require__(133);
845
+ /***/ 15:
846
+ /***/ (function(module, exports) {
901
847
 
902
- Object.defineProperty(exports, "default", {
903
- enumerable: true,
904
- get: function get() {
905
- return MarkerGauge_1.default;
906
- }
907
- });
848
+ module.exports = require("@splunk/visualizations-shared/style");
849
+
850
+ /***/ }),
851
+
852
+ /***/ 16:
853
+ /***/ (function(module, exports) {
854
+
855
+ module.exports = require("@splunk/visualizations-shared/schemaUtils");
908
856
 
909
857
  /***/ }),
910
858
 
911
- /***/ 215:
859
+ /***/ 17:
912
860
  /***/ (function(module, exports, __webpack_require__) {
913
861
 
914
862
  "use strict";
915
863
 
916
864
 
865
+ var _toConsumableArray = __webpack_require__(8);
866
+
867
+ var _defineProperty = __webpack_require__(7);
868
+
917
869
  var __rest = this && this.__rest || function (s, e) {
918
870
  var t = {};
919
871
 
@@ -930,363 +882,267 @@ var __rest = this && this.__rest || function (s, e) {
930
882
  Object.defineProperty(exports, "__esModule", {
931
883
  value: true
932
884
  });
885
+ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
933
886
 
934
- var React = __webpack_require__(1);
935
-
936
- var react_1 = __webpack_require__(1);
887
+ var lodash_1 = __webpack_require__(3);
937
888
 
938
- var T = __webpack_require__(0);
889
+ var schemaUtils_1 = __webpack_require__(16);
939
890
 
940
- var styled_components_1 = __webpack_require__(4);
891
+ var VizBehavior_1 = __webpack_require__(6);
941
892
 
942
- var lodash_1 = __webpack_require__(2);
893
+ var dynamicOptionsDSLType = {
894
+ type: 'string',
895
+ pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
896
+ };
897
+ /**
898
+ * Helper function to extend an options schema with dynamic options DSL
899
+ * @param optionsSchema a visualization's options schema
900
+ * @returns an updated options schema that additionally allows strings starting with > for each option
901
+ */
943
902
 
944
- var i18n_1 = __webpack_require__(3);
903
+ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
904
+ var enhancedOptionsSchema = {};
905
+ Object.keys(optionsSchema).forEach(function (key) {
906
+ var _a = optionsSchema[key],
907
+ title = _a.title,
908
+ description = _a.description,
909
+ readOnly = _a.readOnly,
910
+ writeOnly = _a.writeOnly,
911
+ examples = _a.examples,
912
+ defaultValue = _a.default,
913
+ type = _a.type,
914
+ properties = _a.properties,
915
+ patternProperties = _a.patternProperties,
916
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
945
917
 
946
- var style_1 = __webpack_require__(15);
918
+ var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
919
+ title: title
920
+ }), description !== undefined && {
921
+ description: description
922
+ }), readOnly !== undefined && {
923
+ readOnly: readOnly
924
+ }), writeOnly !== undefined && {
925
+ writeOnly: writeOnly
926
+ }), examples !== undefined && {
927
+ examples: examples
928
+ }), defaultValue !== undefined && {
929
+ default: defaultValue
930
+ });
947
931
 
948
- var SizeAwareWrapper_1 = __webpack_require__(18);
949
-
950
- var Message_1 = __webpack_require__(11);
951
-
952
- var id_1 = __webpack_require__(216);
932
+ if (type === 'object') {
933
+ enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
934
+ type: type
935
+ }), properties && {
936
+ properties: enhanceOptionsSchemaWithDynamicOptions(properties)
937
+ });
953
938
 
954
- var gaugeUtils_1 = __webpack_require__(80);
939
+ if (patternProperties) {
940
+ var enhancedPatternProperties = {};
941
+ Object.keys(patternProperties).forEach(function (opt) {
942
+ enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
943
+ });
944
+ enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
945
+ }
946
+ } else {
947
+ enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
948
+ anyOf: [Object.assign(Object.assign({}, type !== undefined && {
949
+ type: type
950
+ }), remainingSchemaEntry), dynamicOptionsDSLType]
951
+ });
952
+ }
953
+ });
954
+ return enhancedOptionsSchema;
955
+ }
955
956
 
956
- var GaugeMajorTicks_1 = __webpack_require__(102);
957
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
958
+ /**
959
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
960
+ * this function also collapse all editor panels
961
+ * @param vizConfig a Visualization Config
962
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
963
+ * and containing `open: false` for all editor panels in editorConfig
964
+ */
957
965
 
958
- var GaugeValueMarker_1 = __webpack_require__(103);
966
+ function enhanceConfig(vizConfig) {
967
+ var enhancedConfig = vizConfig;
959
968
 
960
- var MAX_VERTICAL_CONTAINER_WIDTH = 200;
961
- var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
962
- var MIN_HORIZONTAL_CONTAINER_WIDTH = 200;
963
- var MIN_HORIZONTAL_CONTAINER_HEIGHT = 100;
964
- var Container = styled_components_1.default.div.withConfig({
965
- displayName: "MarkerGauge__Container",
966
- componentId: "sc-10z02va-0"
967
- })(["overflow:hidden;", ";background-color:", ";"], function (props) {
968
- return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
969
- }, function (props) {
970
- return props.backgroundColor;
971
- });
972
- var MarkerGaugeWrapper = styled_components_1.default.div.withConfig({
973
- displayName: "MarkerGauge__MarkerGaugeWrapper",
974
- componentId: "sc-10z02va-1"
975
- })(["display:flex;justify-content:center;flex-direction:row;width:100%;height:100%;background-color:", ";"], function (props) {
976
- return props.backgroundColor;
977
- });
978
- var MarkerGaugeContainer = styled_components_1.default.div.withConfig({
979
- displayName: "MarkerGauge__MarkerGaugeContainer",
980
- componentId: "sc-10z02va-2"
981
- })(["overflow:hidden;position:relative;", ";"], function (props) {
982
- return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
983
- });
984
- var MarkerGaugeSVG = styled_components_1.default.svg.withConfig({
985
- displayName: "MarkerGauge__MarkerGaugeSVG",
986
- componentId: "sc-10z02va-3"
987
- })(["", ";"], function (props) {
988
- return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
989
- });
990
- var BackgroundBar = styled_components_1.default.rect.attrs({
991
- 'data-test': 'background-bar-rect'
992
- }).withConfig({
993
- displayName: "MarkerGauge__BackgroundBar",
994
- componentId: "sc-10z02va-4"
995
- })(["fill:", ";"], function (props) {
996
- return props.fillColor;
997
- });
998
- var MarkerBar = styled_components_1.default.rect.attrs({
999
- 'data-test': 'marker-bar-rect'
1000
- }).withConfig({
1001
- displayName: "MarkerGauge__MarkerBar",
1002
- componentId: "sc-10z02va-5"
1003
- })([""]);
969
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
970
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
971
+ }
1004
972
 
1005
- var MarkerGauge = function MarkerGauge(_a) {
1006
- var props = __rest(_a, []);
973
+ enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
974
+ return Object.assign(Object.assign({}, config), {
975
+ open: false
976
+ });
977
+ });
978
+ return enhancedConfig;
979
+ }
1007
980
 
1008
- var width = props.width,
1009
- height = props.height,
1010
- value = props.value,
1011
- orientation = props.orientation,
1012
- majorUnit = props.majorUnit,
1013
- showLabels = props.showLabels,
1014
- showValue = props.showValue,
1015
- usePercentageRange = props.usePercentageRange,
1016
- usePercentageValue = props.usePercentageValue,
1017
- backgroundColor = props.backgroundColor,
1018
- fillColor = props.fillColor,
1019
- ranges = props.ranges,
1020
- majorTickFillColor = props.majorTickFillColor,
1021
- majorTickStrokeColor = props.majorTickStrokeColor,
1022
- valueMarkerFillColor = props.valueMarkerFillColor,
1023
- valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
1024
- /**
1025
- * Standard error message render
1026
- */
981
+ exports.enhanceConfig = enhanceConfig;
982
+ /**
983
+ * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
984
+ * Created for editor unit tests
985
+ * @param vizConfig a Visualization Config
986
+ * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
987
+ */
1027
988
 
1028
- var errorMessage = react_1.useCallback(function (containerWidth, containerHeight, err, errID) {
1029
- return React.createElement(Message_1.default, {
1030
- width: containerWidth,
1031
- height: containerHeight,
1032
- message: err,
1033
- level: "info",
1034
- id: errID
989
+ function uncollapseEditorConfig(vizConfig) {
990
+ var editorPanelUncollapsedConfig = vizConfig;
991
+ editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
992
+ return Object.assign(Object.assign({}, config), {
993
+ open: true
1035
994
  });
1036
- }, []);
1037
- var errorId = react_1.useMemo(function () {
1038
- return id_1.createDOMID();
1039
- }, []);
1040
- /**
1041
- * Pre-calculate linearGradientId, error, sortedRanges, gauge range and linear gradient
1042
- */
995
+ });
996
+ return editorPanelUncollapsedConfig;
997
+ }
1043
998
 
1044
- var error = react_1.useMemo(function () {
1045
- return gaugeUtils_1.validateRanges(ranges);
1046
- }, [ranges]);
1047
- var sortedRanges = react_1.useMemo(function () {
1048
- return gaugeUtils_1.getSortedRanges(ranges);
1049
- }, [ranges]);
999
+ exports.uncollapseEditorConfig = uncollapseEditorConfig;
1050
1000
 
1051
- var _react_1$useMemo = react_1.useMemo(function () {
1052
- return gaugeUtils_1.getGaugeRange(sortedRanges);
1053
- }, [sortedRanges]),
1054
- min = _react_1$useMemo.min,
1055
- max = _react_1$useMemo.max;
1001
+ function isDynamicOption(option) {
1002
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
1003
+ }
1056
1004
 
1057
- var linearGradientId = react_1.useMemo(function () {
1058
- return id_1.createDOMID('marker');
1059
- }, []);
1060
- var linearGradient = react_1.useMemo(function () {
1061
- var stops = gaugeUtils_1.getGradientStops({
1062
- ranges: sortedRanges,
1063
- orientation: orientation
1064
- });
1005
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
1006
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
1065
1007
 
1066
- var _gaugeUtils_1$getGrad = gaugeUtils_1.getGradientDimensions(orientation),
1067
- x1 = _gaugeUtils_1$getGrad.x1,
1068
- y1 = _gaugeUtils_1$getGrad.y1,
1069
- x2 = _gaugeUtils_1$getGrad.x2,
1070
- y2 = _gaugeUtils_1$getGrad.y2;
1008
+ /**
1009
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
1010
+ * 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
1011
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
1012
+ * 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
1013
+ *
1014
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
1015
+ */
1071
1016
 
1072
- var linearGradientStops = stops.map(function (stop) {
1073
- return React.createElement("stop", {
1074
- key: "".concat(stop.offset, "_").concat(stop.stopColor),
1075
- offset: stop.offset,
1076
- stopColor: stop.stopColor
1077
- });
1078
- });
1079
- return React.createElement("linearGradient", {
1080
- id: linearGradientId,
1081
- x1: x1,
1082
- y1: y1,
1083
- x2: x2,
1084
- y2: y2
1085
- }, linearGradientStops);
1086
- }, [sortedRanges, orientation, linearGradientId]);
1087
- /**
1088
- * Calculate marker gauge dimensions
1089
- */
1017
+ function hasCompatibleContexts(vizContext, presetContext) {
1018
+ var presetContextKeys = Object.keys(presetContext);
1019
+ return presetContextKeys.every(function (contextKey) {
1020
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
1021
+ });
1022
+ }
1023
+ /**
1024
+ * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
1025
+ */
1090
1026
 
1091
- var calculateMarkerGaugeDimensions = react_1.useCallback(function (containerWidth, containerHeight) {
1092
- var _gaugeUtils_1$getGaug = gaugeUtils_1.getGaugeDimensions({
1093
- containerWidth: containerWidth,
1094
- containerHeight: containerHeight,
1095
- orientation: orientation
1096
- }),
1097
- gaugeLength = _gaugeUtils_1$getGaug.gaugeLength,
1098
- gaugeStartX = _gaugeUtils_1$getGaug.gaugeStartX,
1099
- gaugeStartY = _gaugeUtils_1$getGaug.gaugeStartY,
1100
- gaugeWidth = _gaugeUtils_1$getGaug.gaugeWidth,
1101
- gaugeHeight = _gaugeUtils_1$getGaug.gaugeHeight;
1102
1027
 
1103
- var _gaugeUtils_1$getMark = gaugeUtils_1.getMarkerBarDimensions({
1104
- gaugeLength: gaugeLength,
1105
- gaugeStartX: gaugeStartX,
1106
- gaugeStartY: gaugeStartY,
1107
- gaugeWidth: gaugeWidth,
1108
- gaugeHeight: gaugeHeight,
1109
- orientation: orientation
1110
- }),
1111
- markerBarLength = _gaugeUtils_1$getMark.markerBarLength,
1112
- markerBarX = _gaugeUtils_1$getMark.markerBarX,
1113
- markerBarY = _gaugeUtils_1$getMark.markerBarY,
1114
- markerBarWidth = _gaugeUtils_1$getMark.markerBarWidth,
1115
- markerBarHeight = _gaugeUtils_1$getMark.markerBarHeight;
1028
+ function hasCompatibleOptions(vizOptions, presetOptions) {
1029
+ var presetOptionKeys = Object.keys(presetOptions);
1030
+ return presetOptionKeys.every(function (optionKey) {
1031
+ return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
1032
+ });
1033
+ }
1034
+ /**
1035
+ * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
1036
+ * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
1037
+ *
1038
+ * @param {Object} vizContext - the current vizContext definition
1039
+ * @param {Object} vizOptions - the current vizOptions definition
1040
+ * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
1041
+ */
1116
1042
 
1117
- var _gaugeUtils_1$getMark2 = gaugeUtils_1.getMarkerGaugeValueMarkerPositions({
1118
- markerBarX: markerBarX,
1119
- markerBarY: markerBarY,
1120
- markerBarHeight: markerBarHeight,
1121
- markerBarLength: markerBarLength,
1122
- orientation: orientation,
1123
- value: value,
1124
- min: min,
1125
- max: max
1126
- }),
1127
- valueMarkerX = _gaugeUtils_1$getMark2.valueMarkerX,
1128
- valueMarkerY = _gaugeUtils_1$getMark2.valueMarkerY;
1129
1043
 
1130
- return {
1131
- markerBarX: markerBarX,
1132
- markerBarY: markerBarY,
1133
- markerBarWidth: markerBarWidth,
1134
- markerBarHeight: markerBarHeight,
1135
- valueMarkerX: valueMarkerX,
1136
- valueMarkerY: valueMarkerY,
1137
- gaugeStartX: gaugeStartX,
1138
- gaugeStartY: gaugeStartY,
1139
- gaugeWidth: gaugeWidth,
1140
- gaugeHeight: gaugeHeight
1141
- };
1142
- }, [orientation, value, min, max]);
1143
- var renderVisualization = react_1.useCallback(function (_ref) {
1144
- var containerWidth = _ref.width,
1145
- containerHeight = _ref.height;
1044
+ function getInitialPreset(vizContext, vizOptions, presets) {
1045
+ return presets.find(function (preset) {
1046
+ var presetContext = lodash_1.get(preset, ['value', 'context'], {});
1047
+ var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
1048
+ var presetContextKeys = Object.keys(presetContext);
1049
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
1050
+ // if not, then the preset is invalid in config.ts
1146
1051
 
1147
- // todo: need change the size when get design for smaller space
1148
- // 58 is the title & description header height in dashboard visualization
1149
- if ((containerWidth < MAX_VERTICAL_CONTAINER_WIDTH || containerHeight + 58 < MIN_VERTICAL_CONTAINER_HEIGHT) && orientation === 'vertical' || (containerWidth < MIN_HORIZONTAL_CONTAINER_WIDTH || containerHeight < MIN_HORIZONTAL_CONTAINER_HEIGHT) && orientation === 'horizontal') {
1150
- return errorMessage(containerWidth, containerHeight, i18n_1._('Too small to render content'), errorId);
1151
- }
1052
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
1053
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
1054
+ });
1055
+ }
1152
1056
 
1153
- if (error) {
1154
- return errorMessage(containerWidth, containerHeight, error, errorId);
1155
- }
1057
+ exports.getInitialPreset = getInitialPreset;
1058
+ /**
1059
+ * generates number precision values for a Select editor
1060
+ *
1061
+ * @param {Number} numPrecisionValues - number of integer precision values to generate
1062
+ * @returns {{ label: string; value; string }[]} array of { label, value } tuples
1063
+ */
1156
1064
 
1157
- var _calculateMarkerGauge = calculateMarkerGaugeDimensions(containerWidth, containerHeight),
1158
- markerBarX = _calculateMarkerGauge.markerBarX,
1159
- markerBarY = _calculateMarkerGauge.markerBarY,
1160
- markerBarWidth = _calculateMarkerGauge.markerBarWidth,
1161
- markerBarHeight = _calculateMarkerGauge.markerBarHeight,
1162
- valueMarkerX = _calculateMarkerGauge.valueMarkerX,
1163
- valueMarkerY = _calculateMarkerGauge.valueMarkerY,
1164
- gaugeStartX = _calculateMarkerGauge.gaugeStartX,
1165
- gaugeStartY = _calculateMarkerGauge.gaugeStartY,
1166
- gaugeWidth = _calculateMarkerGauge.gaugeWidth,
1167
- gaugeHeight = _calculateMarkerGauge.gaugeHeight;
1065
+ function generatePrecisionValues(numPrecisionValues) {
1066
+ return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
1067
+ return {
1068
+ label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
1069
+ value: i
1070
+ };
1071
+ });
1072
+ }
1168
1073
 
1169
- return React.createElement(MarkerGaugeWrapper, {
1170
- backgroundColor: backgroundColor
1171
- }, React.createElement(MarkerGaugeContainer, {
1172
- width: containerWidth,
1173
- height: containerHeight
1174
- }, React.createElement(MarkerGaugeSVG, {
1175
- width: containerWidth,
1176
- height: containerHeight
1177
- }, linearGradient, React.createElement(BackgroundBar, {
1178
- x: gaugeStartX,
1179
- y: gaugeStartY,
1180
- width: gaugeWidth,
1181
- height: gaugeHeight,
1182
- fillColor: fillColor
1183
- }), React.createElement(GaugeMajorTicks_1.default, {
1184
- width: gaugeWidth,
1185
- height: gaugeHeight,
1186
- startX: gaugeStartX,
1187
- startY: gaugeStartY,
1188
- min: min,
1189
- max: max,
1190
- majorUnit: majorUnit,
1191
- orientation: orientation,
1192
- showLabels: showLabels,
1193
- usePercentageRange: usePercentageRange,
1194
- majorTickFillColor: majorTickFillColor,
1195
- majorTickStrokeColor: majorTickStrokeColor
1196
- }), React.createElement(MarkerBar, {
1197
- x: markerBarX,
1198
- y: markerBarY,
1199
- width: markerBarWidth,
1200
- height: markerBarHeight,
1201
- fill: "url(#".concat(linearGradientId, ")")
1202
- }), React.createElement(GaugeValueMarker_1.default, {
1203
- x: valueMarkerX,
1204
- y: valueMarkerY,
1205
- length: gaugeUtils_1.GAUGE_THICKNESS,
1206
- min: min,
1207
- max: max,
1208
- value: value,
1209
- orientation: orientation,
1210
- showValue: showValue,
1211
- usePercentageValue: usePercentageValue,
1212
- valueMarkerFillColor: valueMarkerFillColor,
1213
- valueMarkerLabelFillColor: valueMarkerLabelFillColor
1214
- }))));
1215
- }, [orientation, error, calculateMarkerGaugeDimensions, backgroundColor, linearGradient, fillColor, min, max, majorUnit, showLabels, usePercentageRange, majorTickFillColor, majorTickStrokeColor, linearGradientId, value, showValue, usePercentageValue, valueMarkerFillColor, valueMarkerLabelFillColor, errorMessage, errorId]);
1216
- return React.createElement(Container, {
1217
- width: width,
1218
- height: height,
1219
- backgroundColor: backgroundColor
1220
- }, React.createElement(SizeAwareWrapper_1.default, null, function (containerDimension) {
1221
- return renderVisualization(containerDimension);
1222
- }));
1223
- };
1074
+ exports.generatePrecisionValues = generatePrecisionValues;
1075
+ /**
1076
+ * insert layout in layout array, return a new layout array instead of updating the original
1077
+ *
1078
+ * @param {EditorLayoutConfig[][]} layout - editor layout
1079
+ * @param {Number} index - the index to insert layout item(s)
1080
+ * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
1081
+ * @returns {EditorLayoutConfig[][]} new editor layout with insertion
1082
+ */
1224
1083
 
1225
- MarkerGauge.propTypes = {
1226
- width: T.oneOfType([T.string, T.number]),
1227
- height: T.oneOfType([T.string, T.number]),
1228
- value: T.number,
1229
- // valueFieldName: T.string, // todo: need add it back when displaying name later
1230
- orientation: T.oneOf(['horizontal', 'vertical']),
1231
- majorUnit: T.oneOfType([T.string, T.number]),
1232
- showLabels: T.bool,
1233
- showValue: T.bool,
1234
- usePercentageRange: T.bool,
1235
- usePercentageValue: T.bool,
1236
- backgroundColor: T.string,
1237
- fillColor: T.string,
1238
- ranges: T.arrayOf(T.shape({
1239
- from: T.number.isRequired,
1240
- to: T.number.isRequired,
1241
- value: T.string.isRequired
1242
- })),
1243
- majorTickFillColor: T.string,
1244
- majorTickStrokeColor: T.string,
1245
- valueMarkerFillColor: T.string,
1246
- valueMarkerLabelFillColor: T.string
1247
- };
1248
- MarkerGauge.defaultProps = {
1249
- width: '100%',
1250
- height: 250,
1251
- orientation: 'vertical',
1252
- majorUnit: 'auto',
1253
- showLabels: true,
1254
- showValue: true,
1255
- usePercentageRange: false,
1256
- usePercentageValue: false,
1257
- backgroundColor: 'transparent',
1258
- value: 0,
1259
- fillColor: '#f2f4f5',
1260
- majorTickFillColor: '#3c444d',
1261
- majorTickStrokeColor: '#6b7785',
1262
- valueMarkerFillColor: '#3c444d',
1263
- valueMarkerLabelFillColor: '#f2f4f5',
1264
- ranges: [{
1265
- from: 0,
1266
- to: 50,
1267
- value: '#4BEBA8'
1268
- }, {
1269
- from: 50,
1270
- to: 90,
1271
- value: '#F4DF7A'
1272
- }, {
1273
- from: 90,
1274
- to: 100,
1275
- value: '#CB3B43'
1276
- }]
1084
+ var insertLayout = function insertLayout(layout, index) {
1085
+ for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1086
+ layoutItems[_key - 2] = arguments[_key];
1087
+ }
1088
+
1089
+ return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
1277
1090
  };
1278
- exports.default = MarkerGauge;
1091
+
1092
+ exports.insertLayout = insertLayout;
1279
1093
 
1280
1094
  /***/ }),
1281
1095
 
1282
- /***/ 216:
1096
+ /***/ 19:
1283
1097
  /***/ (function(module, exports) {
1284
1098
 
1285
- module.exports = require("@splunk/ui-utils/id");
1099
+ module.exports = require("@babel/runtime/helpers/createClass");
1100
+
1101
+ /***/ }),
1102
+
1103
+ /***/ 2:
1104
+ /***/ (function(module, exports) {
1105
+
1106
+ module.exports = require("@splunk/ui-utils/i18n");
1107
+
1108
+ /***/ }),
1109
+
1110
+ /***/ 20:
1111
+ /***/ (function(module, exports) {
1112
+
1113
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
1114
+
1115
+ /***/ }),
1116
+
1117
+ /***/ 21:
1118
+ /***/ (function(module, exports) {
1119
+
1120
+ module.exports = require("@splunk/themes/pick");
1121
+
1122
+ /***/ }),
1123
+
1124
+ /***/ 23:
1125
+ /***/ (function(module, exports) {
1126
+
1127
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
1128
+
1129
+ /***/ }),
1130
+
1131
+ /***/ 25:
1132
+ /***/ (function(module, exports) {
1133
+
1134
+ module.exports = require("@splunk/visualizations-shared/hocUtils");
1135
+
1136
+ /***/ }),
1137
+
1138
+ /***/ 26:
1139
+ /***/ (function(module, exports) {
1140
+
1141
+ module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
1286
1142
 
1287
1143
  /***/ }),
1288
1144
 
1289
- /***/ 217:
1145
+ /***/ 27:
1290
1146
  /***/ (function(module, exports, __webpack_require__) {
1291
1147
 
1292
1148
  "use strict";
@@ -1295,414 +1151,107 @@ module.exports = require("@splunk/ui-utils/id");
1295
1151
  Object.defineProperty(exports, "__esModule", {
1296
1152
  value: true
1297
1153
  });
1154
+ exports.shouldShowIconPlaceholder = void 0;
1298
1155
 
1299
- var i18n_1 = __webpack_require__(3);
1300
-
1301
- var GaugeMarker_1 = __webpack_require__(218);
1302
-
1303
- var placeholders_1 = __webpack_require__(45);
1304
-
1305
- var schemaUtils_1 = __webpack_require__(16);
1156
+ var React = __webpack_require__(1);
1306
1157
 
1307
- var variables_1 = __webpack_require__(10);
1158
+ var T = __webpack_require__(0);
1308
1159
 
1309
- var pick_1 = __webpack_require__(20);
1160
+ var lodash_1 = __webpack_require__(3);
1310
1161
 
1311
- var Gauge_1 = __webpack_require__(101);
1162
+ var i18n_1 = __webpack_require__(2);
1312
1163
 
1313
- var VizBehavior_1 = __webpack_require__(5);
1164
+ var Message_1 = __webpack_require__(10);
1314
1165
 
1315
- var VizCategory_1 = __webpack_require__(29);
1166
+ var FixedSizeContainer_1 = __webpack_require__(13);
1167
+ /**
1168
+ * @method shouldShowIconPlaceholder
1169
+ * @param {object} dataSources
1170
+ * @param {boolean} loading
1171
+ * @returns {boolean}
1172
+ */
1316
1173
 
1317
- var configUtils_1 = __webpack_require__(6);
1318
1174
 
1319
- var BackgroundColor_1 = __webpack_require__(49);
1175
+ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
1176
+ var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1177
+ var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
1178
+ var noData = data === undefined;
1179
+ var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
1180
+ var noFields = fields === undefined;
1181
+ return loading || noData || noFields;
1182
+ };
1320
1183
 
1321
- var dataContract = {
1322
- requiredDataSources: [{
1323
- name: 'primary',
1324
- description: 'DataSource that powers the visualization'
1325
- }],
1326
- optionalDataSources: [],
1327
- initialRequestParams: {
1328
- primary: {
1329
- offset: 0,
1330
- count: 10000
1331
- }
1332
- }
1333
- };
1334
- var size = {
1335
- initialWidth: 300,
1336
- initialHeight: 300
1184
+ exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
1185
+ var propTypes = {
1186
+ icon: T.func,
1187
+ width: T.oneOfType([T.string, T.number]),
1188
+ height: T.oneOfType([T.string, T.number]),
1189
+ // eslint-disable-next-line react/no-unused-prop-types
1190
+ backgroundColor: T.string,
1191
+ iconColor: T.string
1337
1192
  };
1338
- var defaultContext = {};
1339
- var optionsSchema = {
1340
- backgroundColor: {
1341
- description: 'Specify the color used for the background. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
1342
- type: 'string',
1343
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
1344
- default: '> themes.defaultBackgroundColor'
1345
- },
1346
- gaugeRanges: {
1347
- description: 'Specify the overall range of the gauge as a series of continuous, color-coded subranges. For example, [{"from": 0, "to": 20, "value": "#4BEBA8"}, {"from": 20, "to": 50, "value": "#F4DF7A"}].',
1348
- default: [{
1349
- from: 0,
1350
- to: 50,
1351
- value: '#118832'
1352
- }, {
1353
- from: 50,
1354
- to: 90,
1355
- value: '#CBA700'
1356
- }, {
1357
- from: 90,
1358
- to: 100,
1359
- value: '#D41F1F'
1360
- }],
1361
- type: 'array',
1362
- items: {
1363
- type: 'object',
1364
- properties: {
1365
- from: {
1366
- type: 'number',
1367
- description: 'Starting value for range.'
1368
- },
1369
- to: {
1370
- type: 'number',
1371
- description: 'Ending value for range.'
1372
- },
1373
- value: {
1374
- description: 'Color for sub range.',
1375
- type: 'string',
1376
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN // insert pattern for color variables - #HEX etc
1193
+ /**
1194
+ * @method IconPlaceholder
1195
+ * @param {IconPlaceholderProps} props
1196
+ * @returns {React.ReactElement}
1197
+ */
1377
1198
 
1378
- }
1199
+ var IconPlaceholder = function IconPlaceholder(props) {
1200
+ var width = props.width,
1201
+ height = props.height,
1202
+ icon = props.icon,
1203
+ iconColor = props.iconColor;
1204
+
1205
+ if (icon) {
1206
+ return React.createElement(icon, {
1207
+ style: {
1208
+ left: '50%',
1209
+ top: '50%',
1210
+ color: iconColor,
1211
+ opacity: 0.15,
1212
+ position: 'absolute',
1213
+ transform: 'translate(-50%, -50%)'
1379
1214
  },
1380
- required: ['from', 'to', 'value'],
1381
- additionalProperties: false
1382
- }
1383
- },
1384
- labelDisplay: {
1385
- description: 'Specify whether to display the labels as numbers, percentages, or off.',
1386
- default: 'number',
1387
- type: 'string',
1388
- pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
1389
- },
1390
- majorTickInterval: {
1391
- description: 'Specify, in pixels, the spacing between major tick marks.',
1392
- default: 'auto',
1393
- type: ['string', 'number']
1394
- },
1395
- orientation: {
1396
- description: 'Specify the axis orientation of the gauge.',
1397
- default: 'vertical',
1398
- type: 'string',
1399
- pattern: schemaUtils_1.getPattern(['horizontal', 'vertical'])
1400
- },
1401
- value: {
1402
- description: 'Specify the dataSource applied to the value of the marker gauge.',
1403
- type: 'string',
1404
- default: '> primary | seriesByType("number") | lastPoint()'
1405
- },
1406
- valueDisplay: {
1407
- description: 'Specify whether to display the value as a number, percentage, or off.',
1408
- default: 'number',
1409
- type: 'string',
1410
- pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
1215
+ width: '50%',
1216
+ height: '50%'
1217
+ });
1411
1218
  }
1412
- };
1413
- var themes = {
1414
- defaultFillColor: function defaultFillColor(props) {
1415
- return pick_1.default({
1416
- enterprise: variables_1.default.backgroundColorHover(props),
1417
- prisma: variables_1.default.neutral100(props)
1418
- })(props);
1419
- },
1420
- defaultBackgroundColor: function defaultBackgroundColor(props) {
1421
- return pick_1.default({
1422
- enterprise: {
1423
- dark: variables_1.default.black(props),
1424
- light: variables_1.default.backgroundColor(props)
1425
- },
1426
- prisma: variables_1.default.backgroundColorSidebar(props)
1427
- })(props);
1428
- },
1429
- majorTickFillColor: function majorTickFillColor(props) {
1430
- return pick_1.default({
1431
- enterprise: {
1432
- light: variables_1.default.gray30(props),
1433
- dark: variables_1.default.textGray(props) // was #D7DAE0
1434
1219
 
1435
- },
1436
- prisma: {
1437
- // TODO: missed colors :(
1438
- light: variables_1.default.neutral100(props),
1439
- dark: variables_1.default.contentColorMuted(props) // was #D7DAE0; contentColor
1220
+ return React.createElement(Message_1.default, {
1221
+ width: width,
1222
+ height: height,
1223
+ level: "warning",
1224
+ message: i18n_1._('No DataSource Connected')
1225
+ });
1226
+ };
1440
1227
 
1441
- }
1442
- })(props);
1443
- },
1444
- majorTickStrokeColor: function majorTickStrokeColor(props) {
1445
- return pick_1.default({
1446
- enterprise: {
1447
- light: variables_1.default.textGray(props),
1448
- dark: variables_1.default.contentColorMuted(props)
1449
- },
1450
- prisma: variables_1.default.contentColorMuted(props)
1451
- })(props);
1452
- },
1453
- valueMarkerFillColor: function valueMarkerFillColor(props) {
1454
- return pick_1.default({
1455
- enterprise: variables_1.default.textColor(props),
1456
- prisma: {
1457
- dark: variables_1.default.white(props),
1458
- light: variables_1.default.black(props)
1459
- }
1460
- })(props);
1461
- },
1462
- valueMarkerLabelFillColor: function valueMarkerLabelFillColor(props) {
1463
- return pick_1.default({
1464
- enterprise: {
1465
- light: variables_1.default.gray96(props),
1466
- dark: variables_1.default.black(props)
1467
- },
1468
- prisma: variables_1.default.black(props)
1469
- })(props);
1470
- }
1228
+ IconPlaceholder.propTypes = propTypes;
1229
+ IconPlaceholder.defaultProps = {
1230
+ width: '100%',
1231
+ height: 250
1471
1232
  };
1472
- var editorConfig = [{
1473
- label: i18n_1._('Select Data Field'),
1474
- layout: [[{
1475
- label: i18n_1._('Data field'),
1476
- editor: 'editor.columnSelector',
1477
- option: 'value',
1478
- context: 'defaultContext',
1479
- editorProps: {
1480
- dataSourceKey: 'primary',
1481
- prepareValue: function prepareValue(definition) {
1482
- var value = definition.options.value;
1483
- return {
1484
- context: {},
1485
- options: {
1486
- value: "".concat(value, " | lastPoint()")
1487
- }
1488
- };
1489
- }
1490
- }
1491
- }]]
1492
- }, Gauge_1.default, {
1493
- label: i18n_1._('Coloring'),
1494
- layout: [[{
1495
- label: i18n_1._('Gauge Ranges'),
1496
- option: 'gaugeRanges',
1497
- editor: 'editor.threshold',
1498
- editorProps: {
1499
- openRanges: false,
1500
- isTogglable: false // Can not disable thresholds
1233
+ exports.default = FixedSizeContainer_1.default(IconPlaceholder);
1501
1234
 
1502
- }
1503
- }], BackgroundColor_1.default({
1504
- themes: themes,
1505
- labelPosition: 'top'
1506
- })]
1507
- }];
1508
- /**
1509
- * visualization configuration
1510
- */
1235
+ /***/ }),
1511
1236
 
1512
- var config = {
1513
- /**
1514
- * unique viz key
1515
- */
1516
- key: 'splunk.markergauge',
1237
+ /***/ 28:
1238
+ /***/ (function(module, exports, __webpack_require__) {
1517
1239
 
1518
- /**
1519
- * viz name
1520
- */
1521
- name: 'MarkerGauge',
1522
- category: VizCategory_1.VizCategory.GAUGE,
1240
+ "use strict";
1523
1241
 
1524
- /**
1525
- * viz icon
1526
- */
1527
- icon: GaugeMarker_1.default,
1528
- placeholderIcon: placeholders_1.MarkerGauge,
1529
- dataContract: dataContract,
1530
- size: size,
1531
- defaultContext: defaultContext,
1532
- optionsSchema: optionsSchema,
1533
- editorConfig: editorConfig,
1534
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER],
1535
- themes: themes
1536
- };
1537
- exports.default = configUtils_1.enhanceConfig(config);
1538
1242
 
1539
- /***/ }),
1243
+ var _defineProperty = __webpack_require__(7);
1540
1244
 
1541
- /***/ 218:
1542
- /***/ (function(module, exports) {
1245
+ Object.defineProperty(exports, "__esModule", {
1246
+ value: true
1247
+ });
1248
+ exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1543
1249
 
1544
- module.exports = require("@splunk/react-icons/GaugeMarker");
1250
+ var T = __webpack_require__(0);
1545
1251
 
1546
- /***/ }),
1252
+ var lodash_1 = __webpack_require__(3);
1547
1253
 
1548
- /***/ 23:
1549
- /***/ (function(module, exports) {
1550
-
1551
- module.exports = require("@splunk/visualizations-shared/numberUtils");
1552
-
1553
- /***/ }),
1554
-
1555
- /***/ 24:
1556
- /***/ (function(module, exports, __webpack_require__) {
1557
-
1558
- "use strict";
1559
-
1560
-
1561
- Object.defineProperty(exports, "__esModule", {
1562
- value: true
1563
- });
1564
- exports.pickFieldFromJSONSchema = void 0;
1565
-
1566
- var lodash_1 = __webpack_require__(2);
1567
-
1568
- var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
1569
- var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
1570
- return Object.keys(optionsSchema).reduce(function (accum, k) {
1571
- if (lodash_1.has(optionsSchema[k], fieldName)) {
1572
- accum[k] = optionsSchema[k][fieldName];
1573
- } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
1574
- var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
1575
-
1576
- if (!lodash_1.isEmpty(nestedSchema)) {
1577
- accum[k] = nestedSchema;
1578
- }
1579
- }
1580
-
1581
- return accum;
1582
- }, {});
1583
- };
1584
-
1585
- exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
1586
-
1587
- /***/ }),
1588
-
1589
- /***/ 25:
1590
- /***/ (function(module, exports) {
1591
-
1592
- module.exports = require("@babel/runtime/helpers/typeof");
1593
-
1594
- /***/ }),
1595
-
1596
- /***/ 26:
1597
- /***/ (function(module, exports, __webpack_require__) {
1598
-
1599
- "use strict";
1600
-
1601
-
1602
- Object.defineProperty(exports, "__esModule", {
1603
- value: true
1604
- });
1605
- exports.shouldShowIconPlaceholder = void 0;
1606
-
1607
- var React = __webpack_require__(1);
1608
-
1609
- var T = __webpack_require__(0);
1610
-
1611
- var lodash_1 = __webpack_require__(2);
1612
-
1613
- var i18n_1 = __webpack_require__(3);
1614
-
1615
- var Message_1 = __webpack_require__(11);
1616
-
1617
- var FixedSizeContainer_1 = __webpack_require__(14);
1618
- /**
1619
- * @method shouldShowIconPlaceholder
1620
- * @param {object} dataSources
1621
- * @param {boolean} loading
1622
- * @returns {boolean}
1623
- */
1624
-
1625
-
1626
- var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
1627
- var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1628
- var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
1629
- var noData = data === undefined;
1630
- var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
1631
- var noFields = fields === undefined;
1632
- return loading || noData || noFields;
1633
- };
1634
-
1635
- exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
1636
- var propTypes = {
1637
- icon: T.func,
1638
- width: T.oneOfType([T.string, T.number]),
1639
- height: T.oneOfType([T.string, T.number]),
1640
- // eslint-disable-next-line react/no-unused-prop-types
1641
- backgroundColor: T.string,
1642
- iconColor: T.string
1643
- };
1644
- /**
1645
- * @method IconPlaceholder
1646
- * @param {IconPlaceholderProps} props
1647
- * @returns {React.ReactElement}
1648
- */
1649
-
1650
- var IconPlaceholder = function IconPlaceholder(props) {
1651
- var width = props.width,
1652
- height = props.height,
1653
- icon = props.icon,
1654
- iconColor = props.iconColor;
1655
-
1656
- if (icon) {
1657
- return React.createElement(icon, {
1658
- style: {
1659
- left: '50%',
1660
- top: '50%',
1661
- color: iconColor,
1662
- opacity: 0.15,
1663
- position: 'absolute',
1664
- transform: 'translate(-50%, -50%)'
1665
- },
1666
- width: '50%',
1667
- height: '50%'
1668
- });
1669
- }
1670
-
1671
- return React.createElement(Message_1.default, {
1672
- width: width,
1673
- height: height,
1674
- level: "warning",
1675
- message: i18n_1._('No DataSource Connected')
1676
- });
1677
- };
1678
-
1679
- IconPlaceholder.propTypes = propTypes;
1680
- IconPlaceholder.defaultProps = {
1681
- width: '100%',
1682
- height: 250
1683
- };
1684
- exports.default = FixedSizeContainer_1.default(IconPlaceholder);
1685
-
1686
- /***/ }),
1687
-
1688
- /***/ 27:
1689
- /***/ (function(module, exports, __webpack_require__) {
1690
-
1691
- "use strict";
1692
-
1693
-
1694
- var _defineProperty = __webpack_require__(7);
1695
-
1696
- Object.defineProperty(exports, "__esModule", {
1697
- value: true
1698
- });
1699
- exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1700
-
1701
- var T = __webpack_require__(0);
1702
-
1703
- var lodash_1 = __webpack_require__(2);
1704
-
1705
- var DataSource_1 = __webpack_require__(37);
1254
+ var DataSource_1 = __webpack_require__(39);
1706
1255
 
1707
1256
  exports.SortParamsPropTypes = T.shape({
1708
1257
  currentSortKey: T.string,
@@ -1756,7 +1305,7 @@ exports.getSortingParams = getSortingParams;
1756
1305
 
1757
1306
  /***/ }),
1758
1307
 
1759
- /***/ 28:
1308
+ /***/ 29:
1760
1309
  /***/ (function(module, exports, __webpack_require__) {
1761
1310
 
1762
1311
  "use strict";
@@ -1769,7 +1318,7 @@ exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1769
1318
 
1770
1319
  var T = __webpack_require__(0);
1771
1320
 
1772
- var lodash_1 = __webpack_require__(2);
1321
+ var lodash_1 = __webpack_require__(3);
1773
1322
 
1774
1323
  exports.PaginatorParamsPropTypes = T.shape({
1775
1324
  isPaging: T.bool,
@@ -1821,7 +1370,21 @@ exports.getPaginationParams = getPaginationParams;
1821
1370
 
1822
1371
  /***/ }),
1823
1372
 
1824
- /***/ 29:
1373
+ /***/ 3:
1374
+ /***/ (function(module, exports) {
1375
+
1376
+ module.exports = require("lodash");
1377
+
1378
+ /***/ }),
1379
+
1380
+ /***/ 30:
1381
+ /***/ (function(module, exports) {
1382
+
1383
+ module.exports = require("@splunk/visualizations-shared/numberUtils");
1384
+
1385
+ /***/ }),
1386
+
1387
+ /***/ 31:
1825
1388
  /***/ (function(module, exports, __webpack_require__) {
1826
1389
 
1827
1390
  "use strict";
@@ -1850,14 +1413,7 @@ var VizCategory;
1850
1413
 
1851
1414
  /***/ }),
1852
1415
 
1853
- /***/ 3:
1854
- /***/ (function(module, exports) {
1855
-
1856
- module.exports = require("@splunk/ui-utils/i18n");
1857
-
1858
- /***/ }),
1859
-
1860
- /***/ 30:
1416
+ /***/ 32:
1861
1417
  /***/ (function(module, exports, __webpack_require__) {
1862
1418
 
1863
1419
  "use strict";
@@ -1869,39 +1425,39 @@ Object.defineProperty(exports, "__esModule", {
1869
1425
 
1870
1426
  var React = __webpack_require__(1);
1871
1427
 
1872
- var lodash_1 = __webpack_require__(2);
1428
+ var lodash_1 = __webpack_require__(3);
1873
1429
 
1874
- var getSettingsFromThemedProps_1 = __webpack_require__(31);
1430
+ var getSettingsFromThemedProps_1 = __webpack_require__(33);
1875
1431
 
1876
- var Options_1 = __webpack_require__(32);
1432
+ var Options_1 = __webpack_require__(34);
1877
1433
 
1878
- var SanitizeProps_1 = __webpack_require__(33);
1434
+ var SanitizeProps_1 = __webpack_require__(35);
1879
1435
 
1880
- var TimezoneContext_1 = __webpack_require__(21);
1436
+ var TimezoneContext_1 = __webpack_require__(23);
1881
1437
 
1882
- var moment_1 = __webpack_require__(34);
1438
+ var moment_1 = __webpack_require__(36);
1883
1439
 
1884
1440
  var styled_components_1 = __webpack_require__(4);
1885
1441
 
1886
- var SplunkVisualization_1 = __webpack_require__(35);
1442
+ var hocUtils_1 = __webpack_require__(25);
1887
1443
 
1888
- var VizBehavior_1 = __webpack_require__(5);
1444
+ var JSONSchemaUtils_1 = __webpack_require__(26);
1889
1445
 
1890
- var getSorting_1 = __webpack_require__(27);
1446
+ var SplunkVisualization_1 = __webpack_require__(37);
1891
1447
 
1892
- var getPagination_1 = __webpack_require__(28);
1448
+ var VizBehavior_1 = __webpack_require__(6);
1893
1449
 
1894
- var useDeepMemo_1 = __webpack_require__(38);
1450
+ var getSorting_1 = __webpack_require__(28);
1895
1451
 
1896
- var JSONSchemaUtils_1 = __webpack_require__(24);
1452
+ var getPagination_1 = __webpack_require__(29);
1897
1453
 
1898
- var MissingPropsMessage_1 = __webpack_require__(39);
1454
+ var useDeepMemo_1 = __webpack_require__(40);
1899
1455
 
1900
- var withEditModeCover_1 = __webpack_require__(40);
1456
+ var MissingPropsMessage_1 = __webpack_require__(41);
1901
1457
 
1902
- var withPlaceholder_1 = __webpack_require__(42);
1458
+ var withEditModeCover_1 = __webpack_require__(42);
1903
1459
 
1904
- var hocUtils_1 = __webpack_require__(8);
1460
+ var withPlaceholder_1 = __webpack_require__(43);
1905
1461
  /**
1906
1462
  * hoc that wraps a pure react visualization in a Dashboard visualization
1907
1463
  * @param {DashboardVizOpts} opts
@@ -2103,41 +1659,41 @@ exports.default = withDashboardViz;
2103
1659
 
2104
1660
  /***/ }),
2105
1661
 
2106
- /***/ 31:
1662
+ /***/ 33:
2107
1663
  /***/ (function(module, exports) {
2108
1664
 
2109
1665
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
2110
1666
 
2111
1667
  /***/ }),
2112
1668
 
2113
- /***/ 32:
1669
+ /***/ 34:
2114
1670
  /***/ (function(module, exports) {
2115
1671
 
2116
1672
  module.exports = require("@splunk/visualization-encoding/Options");
2117
1673
 
2118
1674
  /***/ }),
2119
1675
 
2120
- /***/ 33:
1676
+ /***/ 35:
2121
1677
  /***/ (function(module, exports) {
2122
1678
 
2123
1679
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
2124
1680
 
2125
1681
  /***/ }),
2126
1682
 
2127
- /***/ 34:
1683
+ /***/ 36:
2128
1684
  /***/ (function(module, exports) {
2129
1685
 
2130
1686
  module.exports = require("@splunk/moment");
2131
1687
 
2132
1688
  /***/ }),
2133
1689
 
2134
- /***/ 35:
1690
+ /***/ 37:
2135
1691
  /***/ (function(module, exports, __webpack_require__) {
2136
1692
 
2137
1693
  "use strict";
2138
1694
 
2139
1695
 
2140
- var _classCallCheck = __webpack_require__(12);
1696
+ var _classCallCheck = __webpack_require__(11);
2141
1697
 
2142
1698
  Object.defineProperty(exports, "__esModule", {
2143
1699
  value: true
@@ -2147,9 +1703,9 @@ exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
2147
1703
 
2148
1704
  var T = __webpack_require__(0);
2149
1705
 
2150
- var lodash_1 = __webpack_require__(2);
1706
+ var lodash_1 = __webpack_require__(3);
2151
1707
 
2152
- var VizActionHandler_1 = __webpack_require__(36); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1708
+ var VizActionHandler_1 = __webpack_require__(38); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
2153
1709
 
2154
1710
 
2155
1711
  exports.INITIAL_WIDTH = 250;
@@ -2283,15 +1839,15 @@ exports.default = SplunkVisualization;
2283
1839
 
2284
1840
  /***/ }),
2285
1841
 
2286
- /***/ 36:
1842
+ /***/ 38:
2287
1843
  /***/ (function(module, exports, __webpack_require__) {
2288
1844
 
2289
1845
  "use strict";
2290
1846
 
2291
1847
 
2292
- var _classCallCheck = __webpack_require__(12);
1848
+ var _classCallCheck = __webpack_require__(11);
2293
1849
 
2294
- var _createClass = __webpack_require__(17);
1850
+ var _createClass = __webpack_require__(19);
2295
1851
 
2296
1852
  Object.defineProperty(exports, "__esModule", {
2297
1853
  value: true
@@ -2321,7 +1877,7 @@ exports.DefaultVizActionHandler = DefaultVizActionHandler;
2321
1877
 
2322
1878
  /***/ }),
2323
1879
 
2324
- /***/ 37:
1880
+ /***/ 39:
2325
1881
  /***/ (function(module, exports, __webpack_require__) {
2326
1882
 
2327
1883
  "use strict";
@@ -2335,7 +1891,57 @@ exports.validSortDirs = ['asc', 'desc', 'none'];
2335
1891
 
2336
1892
  /***/ }),
2337
1893
 
2338
- /***/ 38:
1894
+ /***/ 399:
1895
+ /***/ (function(module, exports, __webpack_require__) {
1896
+
1897
+ "use strict";
1898
+
1899
+
1900
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1901
+ if (k2 === undefined) k2 = k;
1902
+ Object.defineProperty(o, k2, {
1903
+ enumerable: true,
1904
+ get: function get() {
1905
+ return m[k];
1906
+ }
1907
+ });
1908
+ } : function (o, m, k, k2) {
1909
+ if (k2 === undefined) k2 = k;
1910
+ o[k2] = m[k];
1911
+ });
1912
+
1913
+ var __exportStar = this && this.__exportStar || function (m, exports) {
1914
+ for (var p in m) {
1915
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1916
+ }
1917
+ };
1918
+
1919
+ Object.defineProperty(exports, "__esModule", {
1920
+ value: true
1921
+ });
1922
+ exports.default = void 0;
1923
+
1924
+ __exportStar(__webpack_require__(144), exports);
1925
+
1926
+ var MarkerGauge_1 = __webpack_require__(144);
1927
+
1928
+ Object.defineProperty(exports, "default", {
1929
+ enumerable: true,
1930
+ get: function get() {
1931
+ return MarkerGauge_1.default;
1932
+ }
1933
+ });
1934
+
1935
+ /***/ }),
1936
+
1937
+ /***/ 4:
1938
+ /***/ (function(module, exports) {
1939
+
1940
+ module.exports = require("styled-components");
1941
+
1942
+ /***/ }),
1943
+
1944
+ /***/ 40:
2339
1945
  /***/ (function(module, exports, __webpack_require__) {
2340
1946
 
2341
1947
  "use strict";
@@ -2348,7 +1954,7 @@ exports.useDeepMemo = void 0;
2348
1954
 
2349
1955
  var react_1 = __webpack_require__(1);
2350
1956
 
2351
- var lodash_1 = __webpack_require__(2);
1957
+ var lodash_1 = __webpack_require__(3);
2352
1958
  /**
2353
1959
  * This hook evaluates and stores the result of a passed function and only
2354
1960
  * re-evaluates the function when passed dependencies change.
@@ -2381,155 +1987,385 @@ exports.useDeepMemo = useDeepMemo;
2381
1987
 
2382
1988
  /***/ }),
2383
1989
 
2384
- /***/ 39:
1990
+ /***/ 400:
2385
1991
  /***/ (function(module, exports, __webpack_require__) {
2386
1992
 
2387
1993
  "use strict";
2388
1994
 
2389
1995
 
1996
+ var __rest = this && this.__rest || function (s, e) {
1997
+ var t = {};
1998
+
1999
+ for (var p in s) {
2000
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2001
+ }
2002
+
2003
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2004
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2005
+ }
2006
+ return t;
2007
+ };
2008
+
2390
2009
  Object.defineProperty(exports, "__esModule", {
2391
2010
  value: true
2392
2011
  });
2393
- exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
2394
2012
 
2395
2013
  var React = __webpack_require__(1);
2396
2014
 
2015
+ var react_1 = __webpack_require__(1);
2016
+
2397
2017
  var T = __webpack_require__(0);
2398
2018
 
2399
- var i18n_1 = __webpack_require__(3);
2019
+ var styled_components_1 = __webpack_require__(4);
2400
2020
 
2401
- var Message_1 = __webpack_require__(11);
2021
+ var lodash_1 = __webpack_require__(3);
2402
2022
 
2403
- var FixedSizeContainer_1 = __webpack_require__(14);
2404
- /**
2405
- * @method isMissing
2406
- * @param {any} v
2407
- * @returns {boolean} true if the input value === null or undefined
2408
- */
2023
+ var i18n_1 = __webpack_require__(2);
2409
2024
 
2025
+ var style_1 = __webpack_require__(15);
2410
2026
 
2411
- var isMissing = function isMissing(v) {
2412
- return v === null || v === undefined;
2413
- };
2027
+ var SizeAwareWrapper_1 = __webpack_require__(20);
2414
2028
 
2415
- exports.isMissing = isMissing;
2416
- /**
2417
- * @method misskingKeys
2418
- * @param {string[]} keys
2419
- * @param {object} target
2420
- * @returns {string[]} the keys of missing required props
2421
- */
2029
+ var Message_1 = __webpack_require__(10);
2422
2030
 
2423
- var missingKeys = function missingKeys(keys, target) {
2424
- return keys.filter(function (k) {
2425
- return exports.isMissing(target[k]);
2426
- });
2427
- };
2031
+ var id_1 = __webpack_require__(401);
2428
2032
 
2429
- exports.missingKeys = missingKeys;
2430
- var propTypes = {
2431
- width: T.oneOfType([T.string, T.number]),
2432
- height: T.oneOfType([T.string, T.number]),
2433
- // eslint-disable-next-line react/no-unused-prop-types
2434
- backgroundColor: T.string,
2435
- missingProps: T.arrayOf(T.string)
2436
- };
2437
- /**
2438
- * @method MissingPropsMessage
2439
- * @param {MissingPropsProps} props
2440
- * @returns {React.ReactElement}
2441
- */
2033
+ var gaugeUtils_1 = __webpack_require__(84);
2034
+
2035
+ var GaugeMajorTicks_1 = __webpack_require__(111);
2036
+
2037
+ var GaugeValueMarker_1 = __webpack_require__(112);
2038
+
2039
+ var MAX_VERTICAL_CONTAINER_WIDTH = 200;
2040
+ var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
2041
+ var MIN_HORIZONTAL_CONTAINER_WIDTH = 200;
2042
+ var MIN_HORIZONTAL_CONTAINER_HEIGHT = 100;
2043
+ var Container = styled_components_1.default.div.withConfig({
2044
+ displayName: "MarkerGauge__Container",
2045
+ componentId: "sc-10z02va-0"
2046
+ })(["overflow:hidden;", ";background-color:", ";"], function (props) {
2047
+ return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
2048
+ }, function (props) {
2049
+ return props.backgroundColor;
2050
+ });
2051
+ var MarkerGaugeWrapper = styled_components_1.default.div.withConfig({
2052
+ displayName: "MarkerGauge__MarkerGaugeWrapper",
2053
+ componentId: "sc-10z02va-1"
2054
+ })(["display:flex;justify-content:center;flex-direction:row;width:100%;height:100%;background-color:", ";"], function (props) {
2055
+ return props.backgroundColor;
2056
+ });
2057
+ var MarkerGaugeContainer = styled_components_1.default.div.withConfig({
2058
+ displayName: "MarkerGauge__MarkerGaugeContainer",
2059
+ componentId: "sc-10z02va-2"
2060
+ })(["overflow:hidden;position:relative;", ";"], function (props) {
2061
+ return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
2062
+ });
2063
+ var MarkerGaugeSVG = styled_components_1.default.svg.withConfig({
2064
+ displayName: "MarkerGauge__MarkerGaugeSVG",
2065
+ componentId: "sc-10z02va-3"
2066
+ })(["", ";"], function (props) {
2067
+ return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
2068
+ });
2069
+ var BackgroundBar = styled_components_1.default.rect.attrs({
2070
+ 'data-test': 'background-bar-rect'
2071
+ }).withConfig({
2072
+ displayName: "MarkerGauge__BackgroundBar",
2073
+ componentId: "sc-10z02va-4"
2074
+ })(["fill:", ";"], function (props) {
2075
+ return props.fillColor;
2076
+ });
2077
+ var MarkerBar = styled_components_1.default.rect.attrs({
2078
+ 'data-test': 'marker-bar-rect'
2079
+ }).withConfig({
2080
+ displayName: "MarkerGauge__MarkerBar",
2081
+ componentId: "sc-10z02va-5"
2082
+ })([""]);
2083
+
2084
+ var MarkerGauge = function MarkerGauge(_a) {
2085
+ var props = __rest(_a, []);
2442
2086
 
2443
- var MissingPropsMessage = function MissingPropsMessage(props) {
2444
2087
  var width = props.width,
2445
2088
  height = props.height,
2446
- missingProps = props.missingProps;
2447
- return React.createElement(Message_1.default, {
2448
- "data-test": "message",
2449
- width: width,
2450
- height: height,
2451
- message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
2452
- });
2453
- };
2089
+ value = props.value,
2090
+ orientation = props.orientation,
2091
+ majorUnit = props.majorUnit,
2092
+ showLabels = props.showLabels,
2093
+ showValue = props.showValue,
2094
+ usePercentageRange = props.usePercentageRange,
2095
+ usePercentageValue = props.usePercentageValue,
2096
+ backgroundColor = props.backgroundColor,
2097
+ fillColor = props.fillColor,
2098
+ ranges = props.ranges,
2099
+ majorTickFillColor = props.majorTickFillColor,
2100
+ majorTickStrokeColor = props.majorTickStrokeColor,
2101
+ valueMarkerFillColor = props.valueMarkerFillColor,
2102
+ valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
2103
+ /**
2104
+ * Standard error message render
2105
+ */
2454
2106
 
2455
- exports.MissingPropsMessage = MissingPropsMessage;
2456
- exports.MissingPropsMessage.propTypes = propTypes;
2457
- exports.MissingPropsMessage.defaultProps = {
2458
- width: '100%',
2459
- height: 250
2460
- };
2461
- exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
2107
+ var errorMessage = react_1.useCallback(function (containerWidth, containerHeight, err, errID) {
2108
+ return React.createElement(Message_1.default, {
2109
+ width: containerWidth,
2110
+ height: containerHeight,
2111
+ message: err,
2112
+ level: "info",
2113
+ id: errID
2114
+ });
2115
+ }, []);
2116
+ var errorId = react_1.useMemo(function () {
2117
+ return id_1.createDOMID();
2118
+ }, []);
2119
+ /**
2120
+ * Pre-calculate linearGradientId, error, sortedRanges, gauge range and linear gradient
2121
+ */
2462
2122
 
2463
- /***/ }),
2123
+ var error = react_1.useMemo(function () {
2124
+ return gaugeUtils_1.validateRanges(ranges);
2125
+ }, [ranges]);
2126
+ var sortedRanges = react_1.useMemo(function () {
2127
+ return gaugeUtils_1.getSortedRanges(ranges);
2128
+ }, [ranges]);
2464
2129
 
2465
- /***/ 4:
2466
- /***/ (function(module, exports) {
2130
+ var _react_1$useMemo = react_1.useMemo(function () {
2131
+ return gaugeUtils_1.getGaugeRange(sortedRanges);
2132
+ }, [sortedRanges]),
2133
+ min = _react_1$useMemo.min,
2134
+ max = _react_1$useMemo.max;
2467
2135
 
2468
- module.exports = require("styled-components");
2136
+ var linearGradientId = react_1.useMemo(function () {
2137
+ return id_1.createDOMID('marker');
2138
+ }, []);
2139
+ var linearGradient = react_1.useMemo(function () {
2140
+ var stops = gaugeUtils_1.getGradientStops({
2141
+ ranges: sortedRanges,
2142
+ orientation: orientation
2143
+ });
2469
2144
 
2470
- /***/ }),
2145
+ var _gaugeUtils_1$getGrad = gaugeUtils_1.getGradientDimensions(orientation),
2146
+ x1 = _gaugeUtils_1$getGrad.x1,
2147
+ y1 = _gaugeUtils_1$getGrad.y1,
2148
+ x2 = _gaugeUtils_1$getGrad.x2,
2149
+ y2 = _gaugeUtils_1$getGrad.y2;
2471
2150
 
2472
- /***/ 40:
2473
- /***/ (function(module, exports, __webpack_require__) {
2151
+ var linearGradientStops = stops.map(function (stop) {
2152
+ return React.createElement("stop", {
2153
+ key: "".concat(stop.offset, "_").concat(stop.stopColor),
2154
+ offset: stop.offset,
2155
+ stopColor: stop.stopColor
2156
+ });
2157
+ });
2158
+ return React.createElement("linearGradient", {
2159
+ id: linearGradientId,
2160
+ x1: x1,
2161
+ y1: y1,
2162
+ x2: x2,
2163
+ y2: y2
2164
+ }, linearGradientStops);
2165
+ }, [sortedRanges, orientation, linearGradientId]);
2166
+ /**
2167
+ * Calculate marker gauge dimensions
2168
+ */
2474
2169
 
2475
- "use strict";
2170
+ var calculateMarkerGaugeDimensions = react_1.useCallback(function (containerWidth, containerHeight) {
2171
+ var _gaugeUtils_1$getGaug = gaugeUtils_1.getGaugeDimensions({
2172
+ containerWidth: containerWidth,
2173
+ containerHeight: containerHeight,
2174
+ orientation: orientation
2175
+ }),
2176
+ gaugeLength = _gaugeUtils_1$getGaug.gaugeLength,
2177
+ gaugeStartX = _gaugeUtils_1$getGaug.gaugeStartX,
2178
+ gaugeStartY = _gaugeUtils_1$getGaug.gaugeStartY,
2179
+ gaugeWidth = _gaugeUtils_1$getGaug.gaugeWidth,
2180
+ gaugeHeight = _gaugeUtils_1$getGaug.gaugeHeight;
2476
2181
 
2182
+ var _gaugeUtils_1$getMark = gaugeUtils_1.getMarkerBarDimensions({
2183
+ gaugeLength: gaugeLength,
2184
+ gaugeStartX: gaugeStartX,
2185
+ gaugeStartY: gaugeStartY,
2186
+ gaugeWidth: gaugeWidth,
2187
+ gaugeHeight: gaugeHeight,
2188
+ orientation: orientation
2189
+ }),
2190
+ markerBarLength = _gaugeUtils_1$getMark.markerBarLength,
2191
+ markerBarX = _gaugeUtils_1$getMark.markerBarX,
2192
+ markerBarY = _gaugeUtils_1$getMark.markerBarY,
2193
+ markerBarWidth = _gaugeUtils_1$getMark.markerBarWidth,
2194
+ markerBarHeight = _gaugeUtils_1$getMark.markerBarHeight;
2477
2195
 
2478
- Object.defineProperty(exports, "__esModule", {
2479
- value: true
2480
- });
2196
+ var _gaugeUtils_1$getMark2 = gaugeUtils_1.getMarkerGaugeValueMarkerPositions({
2197
+ markerBarX: markerBarX,
2198
+ markerBarY: markerBarY,
2199
+ markerBarHeight: markerBarHeight,
2200
+ markerBarLength: markerBarLength,
2201
+ orientation: orientation,
2202
+ value: value,
2203
+ min: min,
2204
+ max: max
2205
+ }),
2206
+ valueMarkerX = _gaugeUtils_1$getMark2.valueMarkerX,
2207
+ valueMarkerY = _gaugeUtils_1$getMark2.valueMarkerY;
2481
2208
 
2482
- var React = __webpack_require__(1);
2209
+ return {
2210
+ markerBarX: markerBarX,
2211
+ markerBarY: markerBarY,
2212
+ markerBarWidth: markerBarWidth,
2213
+ markerBarHeight: markerBarHeight,
2214
+ valueMarkerX: valueMarkerX,
2215
+ valueMarkerY: valueMarkerY,
2216
+ gaugeStartX: gaugeStartX,
2217
+ gaugeStartY: gaugeStartY,
2218
+ gaugeWidth: gaugeWidth,
2219
+ gaugeHeight: gaugeHeight
2220
+ };
2221
+ }, [orientation, value, min, max]);
2222
+ var renderVisualization = react_1.useCallback(function (_ref) {
2223
+ var containerWidth = _ref.width,
2224
+ containerHeight = _ref.height;
2483
2225
 
2484
- var styled_components_1 = __webpack_require__(4);
2226
+ // todo: need change the size when get design for smaller space
2227
+ // 58 is the title & description header height in dashboard visualization
2228
+ if ((containerWidth < MAX_VERTICAL_CONTAINER_WIDTH || containerHeight + 58 < MIN_VERTICAL_CONTAINER_HEIGHT) && orientation === 'vertical' || (containerWidth < MIN_HORIZONTAL_CONTAINER_WIDTH || containerHeight < MIN_HORIZONTAL_CONTAINER_HEIGHT) && orientation === 'horizontal') {
2229
+ return errorMessage(containerWidth, containerHeight, i18n_1._('Too small to render content'), errorId);
2230
+ }
2485
2231
 
2486
- var hocUtils_1 = __webpack_require__(8);
2232
+ if (error) {
2233
+ return errorMessage(containerWidth, containerHeight, error, errorId);
2234
+ }
2487
2235
 
2488
- var Cover = styled_components_1.default.div.withConfig({
2489
- displayName: "withEditModeCover__Cover",
2490
- componentId: "sc-1gsbnxb-0"
2491
- })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
2492
- var Blocker = styled_components_1.default.div.attrs({
2493
- 'data-splunk-visualization-version': "25.0.1 - de10ad954"
2494
- }).withConfig({
2495
- displayName: "withEditModeCover__Blocker",
2496
- componentId: "sc-1gsbnxb-1"
2497
- })(["position:relative;width:100%;height:100%;"]);
2498
- /**
2499
- * HOC that renders a cover layer in edit mode
2500
- * @method withEditModeCover
2501
- * @param {ExtendedDashViz} Visualization
2502
- * @returns {ExtendedDashViz} Wrapper
2503
- */
2236
+ var _calculateMarkerGauge = calculateMarkerGaugeDimensions(containerWidth, containerHeight),
2237
+ markerBarX = _calculateMarkerGauge.markerBarX,
2238
+ markerBarY = _calculateMarkerGauge.markerBarY,
2239
+ markerBarWidth = _calculateMarkerGauge.markerBarWidth,
2240
+ markerBarHeight = _calculateMarkerGauge.markerBarHeight,
2241
+ valueMarkerX = _calculateMarkerGauge.valueMarkerX,
2242
+ valueMarkerY = _calculateMarkerGauge.valueMarkerY,
2243
+ gaugeStartX = _calculateMarkerGauge.gaugeStartX,
2244
+ gaugeStartY = _calculateMarkerGauge.gaugeStartY,
2245
+ gaugeWidth = _calculateMarkerGauge.gaugeWidth,
2246
+ gaugeHeight = _calculateMarkerGauge.gaugeHeight;
2504
2247
 
2505
- var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
2506
- var Wrapper = function Wrapper(props) {
2507
- var mode = props.mode;
2508
- var showEditCover = mode === 'edit' && !disableEditModeCover;
2509
- return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
2510
- "data-test": "edit-mode-cover"
2511
- }));
2512
- };
2248
+ return React.createElement(MarkerGaugeWrapper, {
2249
+ backgroundColor: backgroundColor
2250
+ }, React.createElement(MarkerGaugeContainer, {
2251
+ width: containerWidth,
2252
+ height: containerHeight
2253
+ }, React.createElement(MarkerGaugeSVG, {
2254
+ width: containerWidth,
2255
+ height: containerHeight
2256
+ }, linearGradient, React.createElement(BackgroundBar, {
2257
+ x: gaugeStartX,
2258
+ y: gaugeStartY,
2259
+ width: gaugeWidth,
2260
+ height: gaugeHeight,
2261
+ fillColor: fillColor
2262
+ }), React.createElement(GaugeMajorTicks_1.default, {
2263
+ width: gaugeWidth,
2264
+ height: gaugeHeight,
2265
+ startX: gaugeStartX,
2266
+ startY: gaugeStartY,
2267
+ min: min,
2268
+ max: max,
2269
+ majorUnit: majorUnit,
2270
+ orientation: orientation,
2271
+ showLabels: showLabels,
2272
+ usePercentageRange: usePercentageRange,
2273
+ majorTickFillColor: majorTickFillColor,
2274
+ majorTickStrokeColor: majorTickStrokeColor
2275
+ }), React.createElement(MarkerBar, {
2276
+ x: markerBarX,
2277
+ y: markerBarY,
2278
+ width: markerBarWidth,
2279
+ height: markerBarHeight,
2280
+ fill: "url(#".concat(linearGradientId, ")")
2281
+ }), React.createElement(GaugeValueMarker_1.default, {
2282
+ x: valueMarkerX,
2283
+ y: valueMarkerY,
2284
+ length: gaugeUtils_1.GAUGE_THICKNESS,
2285
+ min: min,
2286
+ max: max,
2287
+ value: value,
2288
+ orientation: orientation,
2289
+ showValue: showValue,
2290
+ usePercentageValue: usePercentageValue,
2291
+ valueMarkerFillColor: valueMarkerFillColor,
2292
+ valueMarkerLabelFillColor: valueMarkerLabelFillColor
2293
+ }))));
2294
+ }, [orientation, error, calculateMarkerGaugeDimensions, backgroundColor, linearGradient, fillColor, min, max, majorUnit, showLabels, usePercentageRange, majorTickFillColor, majorTickStrokeColor, linearGradientId, value, showValue, usePercentageValue, valueMarkerFillColor, valueMarkerLabelFillColor, errorMessage, errorId]);
2295
+ return React.createElement(Container, {
2296
+ width: width,
2297
+ height: height,
2298
+ backgroundColor: backgroundColor
2299
+ }, React.createElement(SizeAwareWrapper_1.default, null, function (containerDimension) {
2300
+ return renderVisualization(containerDimension);
2301
+ }));
2302
+ };
2513
2303
 
2514
- hocUtils_1.extendStaticWrapperProps({
2515
- Wrapper: Wrapper,
2516
- Visualization: Visualization
2517
- });
2518
- return Wrapper;
2304
+ MarkerGauge.propTypes = {
2305
+ width: T.oneOfType([T.string, T.number]),
2306
+ height: T.oneOfType([T.string, T.number]),
2307
+ value: T.number,
2308
+ // valueFieldName: T.string, // todo: need add it back when displaying name later
2309
+ orientation: T.oneOf(['horizontal', 'vertical']),
2310
+ majorUnit: T.oneOfType([T.string, T.number]),
2311
+ showLabels: T.bool,
2312
+ showValue: T.bool,
2313
+ usePercentageRange: T.bool,
2314
+ usePercentageValue: T.bool,
2315
+ backgroundColor: T.string,
2316
+ fillColor: T.string,
2317
+ ranges: T.arrayOf(T.shape({
2318
+ from: T.number.isRequired,
2319
+ to: T.number.isRequired,
2320
+ value: T.string.isRequired
2321
+ })),
2322
+ majorTickFillColor: T.string,
2323
+ majorTickStrokeColor: T.string,
2324
+ valueMarkerFillColor: T.string,
2325
+ valueMarkerLabelFillColor: T.string
2519
2326
  };
2520
-
2521
- exports.default = withEditModeCover;
2327
+ MarkerGauge.defaultProps = {
2328
+ width: '100%',
2329
+ height: 250,
2330
+ orientation: 'vertical',
2331
+ majorUnit: 'auto',
2332
+ showLabels: true,
2333
+ showValue: true,
2334
+ usePercentageRange: false,
2335
+ usePercentageValue: false,
2336
+ backgroundColor: 'transparent',
2337
+ value: 0,
2338
+ fillColor: '#f2f4f5',
2339
+ majorTickFillColor: '#3c444d',
2340
+ majorTickStrokeColor: '#6b7785',
2341
+ valueMarkerFillColor: '#3c444d',
2342
+ valueMarkerLabelFillColor: '#f2f4f5',
2343
+ ranges: [{
2344
+ from: 0,
2345
+ to: 50,
2346
+ value: '#4BEBA8'
2347
+ }, {
2348
+ from: 50,
2349
+ to: 90,
2350
+ value: '#F4DF7A'
2351
+ }, {
2352
+ from: 90,
2353
+ to: 100,
2354
+ value: '#CB3B43'
2355
+ }]
2356
+ };
2357
+ exports.default = MarkerGauge;
2522
2358
 
2523
2359
  /***/ }),
2524
2360
 
2525
- /***/ 41:
2361
+ /***/ 401:
2526
2362
  /***/ (function(module, exports) {
2527
2363
 
2528
- module.exports = require("@splunk/visualizations-shared/mapUtils");
2364
+ module.exports = require("@splunk/ui-utils/id");
2529
2365
 
2530
2366
  /***/ }),
2531
2367
 
2532
- /***/ 42:
2368
+ /***/ 402:
2533
2369
  /***/ (function(module, exports, __webpack_require__) {
2534
2370
 
2535
2371
  "use strict";
@@ -2539,83 +2375,255 @@ Object.defineProperty(exports, "__esModule", {
2539
2375
  value: true
2540
2376
  });
2541
2377
 
2542
- var React = __webpack_require__(1);
2378
+ var i18n_1 = __webpack_require__(2);
2543
2379
 
2544
- var colorUtils_1 = __webpack_require__(13);
2380
+ var GaugeMarker_1 = __webpack_require__(403);
2545
2381
 
2546
- var variables_1 = __webpack_require__(10);
2382
+ var placeholders_1 = __webpack_require__(44);
2547
2383
 
2548
- var IconPlaceholder_1 = __webpack_require__(26);
2384
+ var schemaUtils_1 = __webpack_require__(16);
2549
2385
 
2550
- var VizBehavior_1 = __webpack_require__(5);
2386
+ var variables_1 = __webpack_require__(9);
2551
2387
 
2552
- var hocUtils_1 = __webpack_require__(8);
2388
+ var pick_1 = __webpack_require__(21);
2553
2389
 
2554
- var withPlaceholder = function withPlaceholder(Visualization) {
2555
- var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
2556
- var config = Visualization.config;
2557
- var themes = config.themes;
2390
+ var Gauge_1 = __webpack_require__(110);
2558
2391
 
2559
- var Wrapper = function Wrapper(props) {
2560
- var _a, _b;
2392
+ var VizBehavior_1 = __webpack_require__(6);
2561
2393
 
2562
- var dataSources = props.dataSources,
2563
- loading = props.loading,
2564
- options = props.options,
2565
- height = props.height,
2566
- width = props.width;
2567
- var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
2568
- 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);
2569
- var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
2570
- var iconColor = variables_1.default.contentColorActive(props);
2394
+ var VizCategory_1 = __webpack_require__(31);
2571
2395
 
2572
- if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
2573
- return React.createElement(IconPlaceholder_1.default, {
2574
- "data-test": "icon-placeholder",
2575
- icon: icon,
2576
- width: width,
2577
- height: height,
2578
- backgroundColor: bgColorFromTheme,
2579
- iconColor: iconColor
2580
- });
2581
- }
2396
+ var configUtils_1 = __webpack_require__(17);
2582
2397
 
2583
- return React.createElement(Visualization, Object.assign({}, props));
2584
- };
2398
+ var BackgroundColor_1 = __webpack_require__(50);
2585
2399
 
2586
- hocUtils_1.extendStaticWrapperProps({
2587
- Wrapper: Wrapper,
2588
- Visualization: Visualization
2589
- });
2590
- return Wrapper;
2400
+ var dataContract = {
2401
+ requiredDataSources: [{
2402
+ name: 'primary',
2403
+ description: 'DataSource that powers the visualization'
2404
+ }],
2405
+ optionalDataSources: [],
2406
+ initialRequestParams: {
2407
+ primary: {
2408
+ offset: 0,
2409
+ count: 10000
2410
+ }
2411
+ }
2591
2412
  };
2413
+ var size = {
2414
+ initialWidth: 300,
2415
+ initialHeight: 300
2416
+ };
2417
+ var defaultContext = {};
2418
+ var optionsSchema = {
2419
+ backgroundColor: {
2420
+ description: 'Specify the color used for the background. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
2421
+ type: 'string',
2422
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
2423
+ default: '> themes.defaultBackgroundColor'
2424
+ },
2425
+ gaugeRanges: {
2426
+ description: 'Specify the overall range of the gauge as a series of continuous, color-coded subranges. For example, [{"from": 0, "to": 20, "value": "#4BEBA8"}, {"from": 20, "to": 50, "value": "#F4DF7A"}].',
2427
+ default: [{
2428
+ from: 0,
2429
+ to: 50,
2430
+ value: '#118832'
2431
+ }, {
2432
+ from: 50,
2433
+ to: 90,
2434
+ value: '#CBA700'
2435
+ }, {
2436
+ from: 90,
2437
+ to: 100,
2438
+ value: '#D41F1F'
2439
+ }],
2440
+ type: 'array',
2441
+ items: {
2442
+ type: 'object',
2443
+ properties: {
2444
+ from: {
2445
+ type: 'number',
2446
+ description: 'Starting value for range.'
2447
+ },
2448
+ to: {
2449
+ type: 'number',
2450
+ description: 'Ending value for range.'
2451
+ },
2452
+ value: {
2453
+ description: 'Color for sub range.',
2454
+ type: 'string',
2455
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
2456
+ }
2457
+ },
2458
+ required: ['from', 'to', 'value'],
2459
+ additionalProperties: false
2460
+ }
2461
+ },
2462
+ labelDisplay: {
2463
+ description: 'Specify whether to display the labels as numbers, percentages, or off.',
2464
+ default: 'number',
2465
+ type: 'string',
2466
+ pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
2467
+ },
2468
+ majorTickInterval: {
2469
+ description: 'Specify, in pixels, the spacing between major tick marks.',
2470
+ default: 'auto',
2471
+ type: ['string', 'number']
2472
+ },
2473
+ orientation: {
2474
+ description: 'Specify the axis orientation of the gauge.',
2475
+ default: 'vertical',
2476
+ type: 'string',
2477
+ pattern: schemaUtils_1.getPattern(['horizontal', 'vertical'])
2478
+ },
2479
+ value: {
2480
+ description: 'Specify the dataSource applied to the value of the marker gauge.',
2481
+ type: 'string',
2482
+ default: '> primary | seriesByType("number") | lastPoint()'
2483
+ },
2484
+ valueDisplay: {
2485
+ description: 'Specify whether to display the value as a number, percentage, or off.',
2486
+ default: 'number',
2487
+ type: 'string',
2488
+ pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
2489
+ }
2490
+ };
2491
+ var themes = {
2492
+ defaultFillColor: function defaultFillColor(props) {
2493
+ return pick_1.default({
2494
+ enterprise: variables_1.default.backgroundColorHover(props),
2495
+ prisma: variables_1.default.neutral100(props)
2496
+ })(props);
2497
+ },
2498
+ defaultBackgroundColor: function defaultBackgroundColor(props) {
2499
+ return pick_1.default({
2500
+ enterprise: {
2501
+ dark: variables_1.default.black(props),
2502
+ light: variables_1.default.backgroundColor(props)
2503
+ },
2504
+ prisma: variables_1.default.backgroundColorSidebar(props)
2505
+ })(props);
2506
+ },
2507
+ majorTickFillColor: function majorTickFillColor(props) {
2508
+ return pick_1.default({
2509
+ enterprise: {
2510
+ light: variables_1.default.gray30(props),
2511
+ dark: variables_1.default.textGray(props) // was #D7DAE0
2592
2512
 
2593
- exports.default = withPlaceholder;
2594
-
2595
- /***/ }),
2513
+ },
2514
+ prisma: {
2515
+ // TODO: missed colors :(
2516
+ light: variables_1.default.neutral100(props),
2517
+ dark: variables_1.default.contentColorMuted(props) // was #D7DAE0; contentColor
2596
2518
 
2597
- /***/ 43:
2598
- /***/ (function(module, exports) {
2519
+ }
2520
+ })(props);
2521
+ },
2522
+ majorTickStrokeColor: function majorTickStrokeColor(props) {
2523
+ return pick_1.default({
2524
+ enterprise: {
2525
+ light: variables_1.default.textGray(props),
2526
+ dark: variables_1.default.contentColorMuted(props)
2527
+ },
2528
+ prisma: variables_1.default.contentColorMuted(props)
2529
+ })(props);
2530
+ },
2531
+ valueMarkerFillColor: function valueMarkerFillColor(props) {
2532
+ return pick_1.default({
2533
+ enterprise: variables_1.default.textColor(props),
2534
+ prisma: {
2535
+ dark: variables_1.default.white(props),
2536
+ light: variables_1.default.black(props)
2537
+ }
2538
+ })(props);
2539
+ },
2540
+ valueMarkerLabelFillColor: function valueMarkerLabelFillColor(props) {
2541
+ return pick_1.default({
2542
+ enterprise: {
2543
+ light: variables_1.default.gray96(props),
2544
+ dark: variables_1.default.black(props)
2545
+ },
2546
+ prisma: variables_1.default.black(props)
2547
+ })(props);
2548
+ }
2549
+ };
2550
+ var editorConfig = [{
2551
+ label: i18n_1._('Select Data Field'),
2552
+ layout: [[{
2553
+ label: i18n_1._('Data field'),
2554
+ editor: 'editor.columnSelector',
2555
+ option: 'value',
2556
+ context: 'defaultContext',
2557
+ editorProps: {
2558
+ dataSourceKey: 'primary',
2559
+ prepareValue: function prepareValue(definition) {
2560
+ var value = definition.options.value;
2561
+ return {
2562
+ context: {},
2563
+ options: {
2564
+ value: "".concat(value, " | lastPoint()")
2565
+ }
2566
+ };
2567
+ }
2568
+ }
2569
+ }]]
2570
+ }, Gauge_1.default, {
2571
+ label: i18n_1._('Coloring'),
2572
+ layout: [[{
2573
+ label: i18n_1._('Gauge Ranges'),
2574
+ option: 'gaugeRanges',
2575
+ editor: 'editor.threshold',
2576
+ editorProps: {
2577
+ openRanges: false,
2578
+ isTogglable: false // Can not disable thresholds
2599
2579
 
2600
- module.exports = require("@splunk/visualizations-shared/colorConstants");
2580
+ }
2581
+ }], BackgroundColor_1.default({
2582
+ themes: themes,
2583
+ labelPosition: 'top'
2584
+ })]
2585
+ }];
2586
+ /**
2587
+ * visualization configuration
2588
+ */
2601
2589
 
2602
- /***/ }),
2590
+ var config = {
2591
+ /**
2592
+ * unique viz key
2593
+ */
2594
+ key: 'splunk.markergauge',
2603
2595
 
2604
- /***/ 45:
2605
- /***/ (function(module, exports) {
2596
+ /**
2597
+ * viz name
2598
+ */
2599
+ name: 'MarkerGauge',
2600
+ category: VizCategory_1.VizCategory.GAUGE,
2606
2601
 
2607
- module.exports = require("@splunk/visualization-icons/placeholders");
2602
+ /**
2603
+ * viz icon
2604
+ */
2605
+ icon: GaugeMarker_1.default,
2606
+ placeholderIcon: placeholders_1.MarkerGauge,
2607
+ dataContract: dataContract,
2608
+ size: size,
2609
+ defaultContext: defaultContext,
2610
+ optionsSchema: optionsSchema,
2611
+ editorConfig: editorConfig,
2612
+ supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER],
2613
+ themes: themes
2614
+ };
2615
+ exports.default = configUtils_1.enhanceConfig(config);
2608
2616
 
2609
2617
  /***/ }),
2610
2618
 
2611
- /***/ 47:
2619
+ /***/ 403:
2612
2620
  /***/ (function(module, exports) {
2613
2621
 
2614
- module.exports = require("@babel/runtime/helpers/extends");
2622
+ module.exports = require("@splunk/react-icons/GaugeMarker");
2615
2623
 
2616
2624
  /***/ }),
2617
2625
 
2618
- /***/ 49:
2626
+ /***/ 41:
2619
2627
  /***/ (function(module, exports, __webpack_require__) {
2620
2628
 
2621
2629
  "use strict";
@@ -2624,415 +2632,318 @@ module.exports = require("@babel/runtime/helpers/extends");
2624
2632
  Object.defineProperty(exports, "__esModule", {
2625
2633
  value: true
2626
2634
  });
2635
+ exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
2627
2636
 
2628
- var i18n_1 = __webpack_require__(3);
2637
+ var React = __webpack_require__(1);
2629
2638
 
2630
- var background = function background(_ref) {
2631
- var label = _ref.label,
2632
- themes = _ref.themes,
2633
- labelPosition = _ref.labelPosition;
2634
- return [{
2635
- label: i18n_1._(label || 'Background'),
2636
- option: 'backgroundColor',
2637
- editor: 'editor.color',
2638
- editorProps: {
2639
- labelPosition: labelPosition || 'top',
2640
- themes: themes
2641
- }
2642
- }];
2643
- };
2639
+ var T = __webpack_require__(0);
2644
2640
 
2645
- exports.default = background;
2641
+ var i18n_1 = __webpack_require__(2);
2646
2642
 
2647
- /***/ }),
2643
+ var Message_1 = __webpack_require__(10);
2648
2644
 
2649
- /***/ 5:
2650
- /***/ (function(module, exports, __webpack_require__) {
2645
+ var FixedSizeContainer_1 = __webpack_require__(13);
2646
+ /**
2647
+ * @method isMissing
2648
+ * @param {any} v
2649
+ * @returns {boolean} true if the input value === null or undefined
2650
+ */
2651
2651
 
2652
- "use strict";
2653
2652
 
2653
+ var isMissing = function isMissing(v) {
2654
+ return v === null || v === undefined;
2655
+ };
2654
2656
 
2655
- Object.defineProperty(exports, "__esModule", {
2656
- value: true
2657
- });
2658
- exports.VizBehavior = void 0;
2659
- var VizBehavior;
2657
+ exports.isMissing = isMissing;
2658
+ /**
2659
+ * @method misskingKeys
2660
+ * @param {string[]} keys
2661
+ * @param {object} target
2662
+ * @returns {string[]} the keys of missing required props
2663
+ */
2660
2664
 
2661
- (function (VizBehavior) {
2662
- /**
2663
- * Dynamic Options Behavior.
2664
- * This allows visualization options to be powered by data
2665
- *
2666
- * **Example**
2667
- *
2668
- * sparklineValues: ">primary|seriesByIndex(0)"
2669
- * would configure sparklineValues with an array of data points
2670
- * coming from the first series in the primary datasource
2671
- *
2672
- */
2673
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
2674
- VizBehavior["EVENTS"] = "events";
2675
- /**
2676
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
2677
- * missing.
2678
- * @type {string}
2679
- */
2665
+ var missingKeys = function missingKeys(keys, target) {
2666
+ return keys.filter(function (k) {
2667
+ return exports.isMissing(target[k]);
2668
+ });
2669
+ };
2680
2670
 
2681
- VizBehavior["PLACEHOLDER"] = "placeholder";
2682
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
2683
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
2671
+ exports.missingKeys = missingKeys;
2672
+ var propTypes = {
2673
+ width: T.oneOfType([T.string, T.number]),
2674
+ height: T.oneOfType([T.string, T.number]),
2675
+ // eslint-disable-next-line react/no-unused-prop-types
2676
+ backgroundColor: T.string,
2677
+ missingProps: T.arrayOf(T.string)
2678
+ };
2679
+ /**
2680
+ * @method MissingPropsMessage
2681
+ * @param {MissingPropsProps} props
2682
+ * @returns {React.ReactElement}
2683
+ */
2684
+
2685
+ var MissingPropsMessage = function MissingPropsMessage(props) {
2686
+ var width = props.width,
2687
+ height = props.height,
2688
+ missingProps = props.missingProps;
2689
+ return React.createElement(Message_1.default, {
2690
+ "data-test": "message",
2691
+ width: width,
2692
+ height: height,
2693
+ message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
2694
+ });
2695
+ };
2696
+
2697
+ exports.MissingPropsMessage = MissingPropsMessage;
2698
+ exports.MissingPropsMessage.propTypes = propTypes;
2699
+ exports.MissingPropsMessage.defaultProps = {
2700
+ width: '100%',
2701
+ height: 250
2702
+ };
2703
+ exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
2684
2704
 
2685
2705
  /***/ }),
2686
2706
 
2687
- /***/ 6:
2707
+ /***/ 42:
2688
2708
  /***/ (function(module, exports, __webpack_require__) {
2689
2709
 
2690
2710
  "use strict";
2691
2711
 
2692
2712
 
2693
- var _toConsumableArray = __webpack_require__(9);
2694
-
2695
- var _defineProperty = __webpack_require__(7);
2696
-
2697
- var __rest = this && this.__rest || function (s, e) {
2698
- var t = {};
2699
-
2700
- for (var p in s) {
2701
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2702
- }
2703
-
2704
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2705
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2706
- }
2707
- return t;
2708
- };
2709
-
2710
2713
  Object.defineProperty(exports, "__esModule", {
2711
2714
  value: true
2712
2715
  });
2713
- exports.insertLayout = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
2714
2716
 
2715
- var lodash_1 = __webpack_require__(2);
2717
+ var React = __webpack_require__(1);
2716
2718
 
2717
- var schemaUtils_1 = __webpack_require__(16);
2719
+ var styled_components_1 = __webpack_require__(4);
2718
2720
 
2719
- var VizBehavior_1 = __webpack_require__(5);
2721
+ var hocUtils_1 = __webpack_require__(14);
2720
2722
 
2721
- var dynamicOptionsDSLType = {
2722
- type: 'string',
2723
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
2724
- };
2723
+ var Cover = styled_components_1.default.div.withConfig({
2724
+ displayName: "withEditModeCover__Cover",
2725
+ componentId: "sc-1gsbnxb-0"
2726
+ })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
2727
+ var Blocker = styled_components_1.default.div.attrs({
2728
+ 'data-splunk-visualization-version': "25.2.0 - 4373c5a66"
2729
+ }).withConfig({
2730
+ displayName: "withEditModeCover__Blocker",
2731
+ componentId: "sc-1gsbnxb-1"
2732
+ })(["position:relative;width:100%;height:100%;"]);
2725
2733
  /**
2726
- * Helper function to extend an options schema with dynamic options DSL
2727
- * @param optionsSchema a visualization's options schema
2728
- * @returns an updated options schema that additionally allows strings starting with > for each option
2734
+ * HOC that renders a cover layer in edit mode
2735
+ * @method withEditModeCover
2736
+ * @param {ExtendedDashViz} Visualization
2737
+ * @returns {ExtendedDashViz} Wrapper
2729
2738
  */
2730
2739
 
2731
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
2732
- var enhancedOptionsSchema = {};
2733
- Object.keys(optionsSchema).forEach(function (key) {
2734
- var _a = optionsSchema[key],
2735
- title = _a.title,
2736
- description = _a.description,
2737
- readOnly = _a.readOnly,
2738
- writeOnly = _a.writeOnly,
2739
- examples = _a.examples,
2740
- defaultValue = _a.default,
2741
- type = _a.type,
2742
- properties = _a.properties,
2743
- patternProperties = _a.patternProperties,
2744
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
2745
-
2746
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
2747
- title: title
2748
- }), description !== undefined && {
2749
- description: description
2750
- }), readOnly !== undefined && {
2751
- readOnly: readOnly
2752
- }), writeOnly !== undefined && {
2753
- writeOnly: writeOnly
2754
- }), examples !== undefined && {
2755
- examples: examples
2756
- }), defaultValue !== undefined && {
2757
- default: defaultValue
2758
- });
2759
-
2760
- if (type === 'object') {
2761
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
2762
- type: type
2763
- }), properties && {
2764
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
2765
- });
2740
+ var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
2741
+ var Wrapper = function Wrapper(props) {
2742
+ var mode = props.mode;
2743
+ var showEditCover = mode === 'edit' && !disableEditModeCover;
2744
+ return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
2745
+ "data-test": "edit-mode-cover"
2746
+ }));
2747
+ };
2766
2748
 
2767
- if (patternProperties) {
2768
- var enhancedPatternProperties = {};
2769
- Object.keys(patternProperties).forEach(function (opt) {
2770
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
2771
- });
2772
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
2773
- }
2774
- } else {
2775
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
2776
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
2777
- type: type
2778
- }), remainingSchemaEntry), dynamicOptionsDSLType]
2779
- });
2780
- }
2749
+ hocUtils_1.extendStaticWrapperProps({
2750
+ Wrapper: Wrapper,
2751
+ Visualization: Visualization
2781
2752
  });
2782
- return enhancedOptionsSchema;
2783
- }
2753
+ return Wrapper;
2754
+ };
2784
2755
 
2785
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
2786
- /**
2787
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
2788
- * this function also collapse all editor panels
2789
- * @param vizConfig a Visualization Config
2790
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
2791
- * and containing `open: false` for all editor panels in editorConfig
2792
- */
2756
+ exports.default = withEditModeCover;
2793
2757
 
2794
- function enhanceConfig(vizConfig) {
2795
- var enhancedConfig = vizConfig;
2758
+ /***/ }),
2796
2759
 
2797
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
2798
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
2799
- }
2760
+ /***/ 43:
2761
+ /***/ (function(module, exports, __webpack_require__) {
2800
2762
 
2801
- enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
2802
- return Object.assign(Object.assign({}, config), {
2803
- open: false
2804
- });
2805
- });
2806
- return enhancedConfig;
2807
- }
2763
+ "use strict";
2808
2764
 
2809
- exports.enhanceConfig = enhanceConfig;
2810
- /**
2811
- * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
2812
- * Created for editor unit tests
2813
- * @param vizConfig a Visualization Config
2814
- * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
2815
- */
2816
2765
 
2817
- function uncollapseEditorConfig(vizConfig) {
2818
- var editorPanelUncollapsedConfig = vizConfig;
2819
- editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
2820
- return Object.assign(Object.assign({}, config), {
2821
- open: true
2822
- });
2823
- });
2824
- return editorPanelUncollapsedConfig;
2825
- }
2766
+ Object.defineProperty(exports, "__esModule", {
2767
+ value: true
2768
+ });
2826
2769
 
2827
- exports.uncollapseEditorConfig = uncollapseEditorConfig;
2770
+ var React = __webpack_require__(1);
2828
2771
 
2829
- function isDynamicOption(option) {
2830
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
2831
- }
2772
+ var colorUtils_1 = __webpack_require__(12);
2832
2773
 
2833
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
2834
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
2774
+ var variables_1 = __webpack_require__(9);
2835
2775
 
2836
- /**
2837
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
2838
- * 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
2839
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
2840
- * 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
2841
- *
2842
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
2843
- */
2776
+ var IconPlaceholder_1 = __webpack_require__(27);
2844
2777
 
2845
- function hasCompatibleContexts(vizContext, presetContext) {
2846
- var presetContextKeys = Object.keys(presetContext);
2847
- return presetContextKeys.every(function (contextKey) {
2848
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
2849
- });
2850
- }
2851
- /**
2852
- * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
2853
- */
2778
+ var VizBehavior_1 = __webpack_require__(6);
2854
2779
 
2780
+ var hocUtils_1 = __webpack_require__(14);
2855
2781
 
2856
- function hasCompatibleOptions(vizOptions, presetOptions) {
2857
- var presetOptionKeys = Object.keys(presetOptions);
2858
- return presetOptionKeys.every(function (optionKey) {
2859
- return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
2860
- });
2861
- }
2862
- /**
2863
- * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
2864
- * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
2865
- *
2866
- * @param {Object} vizContext - the current vizContext definition
2867
- * @param {Object} vizOptions - the current vizOptions definition
2868
- * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
2869
- */
2782
+ var withPlaceholder = function withPlaceholder(Visualization) {
2783
+ var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
2784
+ var config = Visualization.config;
2785
+ var themes = config.themes;
2870
2786
 
2787
+ var Wrapper = function Wrapper(props) {
2788
+ var _a, _b;
2871
2789
 
2872
- function getInitialPreset(vizContext, vizOptions, presets) {
2873
- return presets.find(function (preset) {
2874
- var presetContext = lodash_1.get(preset, ['value', 'context'], {});
2875
- var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
2876
- var presetContextKeys = Object.keys(presetContext);
2877
- var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
2878
- // if not, then the preset is invalid in config.ts
2790
+ var dataSources = props.dataSources,
2791
+ loading = props.loading,
2792
+ options = props.options,
2793
+ height = props.height,
2794
+ width = props.width;
2795
+ var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
2796
+ 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);
2797
+ var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
2798
+ var iconColor = variables_1.default.contentColorActive(props);
2879
2799
 
2880
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
2881
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
2882
- });
2883
- }
2800
+ if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
2801
+ return React.createElement(IconPlaceholder_1.default, {
2802
+ "data-test": "icon-placeholder",
2803
+ icon: icon,
2804
+ width: width,
2805
+ height: height,
2806
+ backgroundColor: bgColorFromTheme,
2807
+ iconColor: iconColor
2808
+ });
2809
+ }
2884
2810
 
2885
- exports.getInitialPreset = getInitialPreset;
2886
- /**
2887
- * generates number precision values for a Select editor
2888
- *
2889
- * @param {Number} numPrecisionValues - number of integer precision values to generate
2890
- * @returns {{ label: string; value; string }[]} array of { label, value } tuples
2891
- */
2811
+ return React.createElement(Visualization, Object.assign({}, props));
2812
+ };
2892
2813
 
2893
- function generatePrecisionValues(numPrecisionValues) {
2894
- return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
2895
- return {
2896
- label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
2897
- value: i
2898
- };
2814
+ hocUtils_1.extendStaticWrapperProps({
2815
+ Wrapper: Wrapper,
2816
+ Visualization: Visualization
2899
2817
  });
2900
- }
2818
+ return Wrapper;
2819
+ };
2901
2820
 
2902
- exports.generatePrecisionValues = generatePrecisionValues;
2903
- /**
2904
- * insert layout in layout array, return a new layout array instead of updating the original
2905
- *
2906
- * @param {EditorLayoutConfig[][]} layout - editor layout
2907
- * @param {Number} index - the index to insert layout item(s)
2908
- * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
2909
- * @returns {EditorLayoutConfig[][]} new editor layout with insertion
2910
- */
2821
+ exports.default = withPlaceholder;
2911
2822
 
2912
- var insertLayout = function insertLayout(layout, index) {
2913
- for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2914
- layoutItems[_key - 2] = arguments[_key];
2915
- }
2823
+ /***/ }),
2916
2824
 
2917
- return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
2918
- };
2825
+ /***/ 44:
2826
+ /***/ (function(module, exports) {
2919
2827
 
2920
- exports.insertLayout = insertLayout;
2828
+ module.exports = require("@splunk/visualization-icons/placeholders");
2921
2829
 
2922
2830
  /***/ }),
2923
2831
 
2924
- /***/ 7:
2832
+ /***/ 45:
2925
2833
  /***/ (function(module, exports) {
2926
2834
 
2927
- module.exports = require("@babel/runtime/helpers/defineProperty");
2835
+ module.exports = require("@splunk/visualizations-shared/colorConstants");
2928
2836
 
2929
2837
  /***/ }),
2930
2838
 
2931
- /***/ 8:
2839
+ /***/ 48:
2840
+ /***/ (function(module, exports) {
2841
+
2842
+ module.exports = require("@babel/runtime/helpers/extends");
2843
+
2844
+ /***/ }),
2845
+
2846
+ /***/ 50:
2932
2847
  /***/ (function(module, exports, __webpack_require__) {
2933
2848
 
2934
2849
  "use strict";
2935
2850
 
2936
2851
 
2937
- var _typeof = __webpack_require__(25);
2938
-
2939
2852
  Object.defineProperty(exports, "__esModule", {
2940
2853
  value: true
2941
2854
  });
2942
- exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
2943
-
2944
- var lodash_1 = __webpack_require__(2);
2945
-
2946
- var mapUtils_1 = __webpack_require__(41);
2947
- /**
2948
- * @method extendStaticWrapperProps
2949
- * @param {Object} props
2950
- * @param {DashboardVizType} props.Wrapper
2951
- * @param {DashboardVizType} props.Visualization
2952
- */
2953
2855
 
2856
+ var i18n_1 = __webpack_require__(2);
2954
2857
 
2955
- var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
2956
- var Wrapper = _ref.Wrapper,
2957
- Visualization = _ref.Visualization;
2958
- var extendProperties = ['propTypes', 'defaultProps', 'config'];
2959
- extendProperties.forEach(function (prop) {
2960
- if (Visualization[prop]) {
2961
- // eslint-disable-next-line no-param-reassign
2962
- Wrapper[prop] = Visualization[prop];
2858
+ var background = function background(_ref) {
2859
+ var label = _ref.label,
2860
+ themes = _ref.themes,
2861
+ labelPosition = _ref.labelPosition;
2862
+ return [{
2863
+ label: i18n_1._(label || 'Background'),
2864
+ option: 'backgroundColor',
2865
+ editor: 'editor.color',
2866
+ editorProps: {
2867
+ labelPosition: labelPosition || 'top',
2868
+ themes: themes
2963
2869
  }
2964
- });
2870
+ }];
2965
2871
  };
2966
2872
 
2967
- exports.extendStaticWrapperProps = extendStaticWrapperProps;
2968
- /**
2969
- * helper to deeply merge objects while preserving arrays in earlier source objects
2970
- * 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
2971
- * 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).
2972
- * 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
2973
- * 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.
2974
- *
2975
- * @method deepMergeWithArrayPrimitiveOverrides
2976
- * @param {Object} initial - target object to merge values into
2977
- * @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
2978
- *
2979
- * @returns {Object}
2980
- */
2873
+ exports.default = background;
2981
2874
 
2982
- var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
2983
- var clone = lodash_1.cloneDeep(initial);
2875
+ /***/ }),
2984
2876
 
2985
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2986
- sources[_key - 1] = arguments[_key];
2987
- }
2877
+ /***/ 6:
2878
+ /***/ (function(module, exports, __webpack_require__) {
2988
2879
 
2989
- sources.forEach(function (sourceToApply) {
2990
- Object.keys(sourceToApply).forEach(function (sourceKey) {
2991
- if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
2992
- clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
2993
- }
2880
+ "use strict";
2994
2881
 
2995
- if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
2996
- clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
2997
- } else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
2998
- // If option is an array of objects
2999
- for (var i = 0; i < clone[sourceKey].length; i += 1) {
3000
- if (_typeof(clone[sourceKey][i]) === 'object') {
3001
- var closestMatchIdx = mapUtils_1.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
3002
-
3003
- if (closestMatchIdx > -1) {
3004
- clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
3005
- }
3006
- }
3007
- }
3008
- }
3009
- });
3010
- });
3011
- return clone;
3012
- };
3013
2882
 
3014
- exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
2883
+ Object.defineProperty(exports, "__esModule", {
2884
+ value: true
2885
+ });
2886
+ exports.VizBehavior = void 0;
2887
+ var VizBehavior;
2888
+
2889
+ (function (VizBehavior) {
2890
+ /**
2891
+ * Dynamic Options Behavior.
2892
+ * This allows visualization options to be powered by data
2893
+ *
2894
+ * **Example**
2895
+ *
2896
+ * sparklineValues: ">primary|seriesByIndex(0)"
2897
+ * would configure sparklineValues with an array of data points
2898
+ * coming from the first series in the primary datasource
2899
+ *
2900
+ */
2901
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
2902
+ VizBehavior["EVENTS"] = "events";
2903
+ /**
2904
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
2905
+ * missing.
2906
+ * @type {string}
2907
+ */
2908
+
2909
+ VizBehavior["PLACEHOLDER"] = "placeholder";
2910
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
2911
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
2912
+
2913
+ /***/ }),
2914
+
2915
+ /***/ 7:
2916
+ /***/ (function(module, exports) {
2917
+
2918
+ module.exports = require("@babel/runtime/helpers/defineProperty");
2919
+
2920
+ /***/ }),
2921
+
2922
+ /***/ 8:
2923
+ /***/ (function(module, exports) {
2924
+
2925
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
3015
2926
 
3016
2927
  /***/ }),
3017
2928
 
3018
- /***/ 80:
2929
+ /***/ 84:
3019
2930
  /***/ (function(module, exports, __webpack_require__) {
3020
2931
 
3021
2932
  "use strict";
3022
2933
 
3023
2934
 
3024
- var _toConsumableArray = __webpack_require__(9);
2935
+ var _toConsumableArray = __webpack_require__(8);
3025
2936
 
3026
2937
  Object.defineProperty(exports, "__esModule", {
3027
2938
  value: true
3028
2939
  });
3029
2940
  exports.convertToGaugeProperties = exports.mapValueLabelDisplay = exports.mapToOldKey = exports.getGradientDimensions = exports.getGradientStops = exports.getGradientStopColors = exports.getGradientStopOffsets = exports.getGaugeRange = exports.validateRanges = exports.getSortedRanges = exports.getMarkerGaugeValueMarkerPositions = exports.getMarkerBarDimensions = exports.getFillerGaugeValueMarkerPositions = exports.getFillBarDimensions = exports.getGaugeBarHeight = exports.getGaugeBarWidth = exports.getGaugeBarStartPositions = exports.getGaugeBarLength = exports.assignGaugeColor = exports.getGaugeDimensions = exports.getGaugeStartPosition = exports.getGaugeLength = exports.getGaugeHeight = exports.getGaugeWidth = exports.FILL_THICKNESS = exports.GAUGE_THICKNESS = void 0;
3030
2941
 
3031
- var lodash_1 = __webpack_require__(2);
2942
+ var lodash_1 = __webpack_require__(3);
3032
2943
 
3033
- var colorConstants_1 = __webpack_require__(43);
2944
+ var colorConstants_1 = __webpack_require__(45);
3034
2945
 
3035
- var i18n_1 = __webpack_require__(3);
2946
+ var i18n_1 = __webpack_require__(2);
3036
2947
 
3037
2948
  exports.GAUGE_THICKNESS = 50;
3038
2949
  exports.FILL_THICKNESS = 38;
@@ -3787,7 +3698,7 @@ exports.convertToGaugeProperties = convertToGaugeProperties;
3787
3698
  /***/ 9:
3788
3699
  /***/ (function(module, exports) {
3789
3700
 
3790
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
3701
+ module.exports = require("@splunk/themes/variables");
3791
3702
 
3792
3703
  /***/ })
3793
3704