@splunk/visualizations 26.0.0 → 26.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/Area.config.js +102 -18
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +618 -221
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +104 -20
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +624 -219
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +94 -20
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +606 -211
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +65 -14
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +550 -183
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +103 -18
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +637 -221
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +82 -17
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +425 -148
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +100 -18
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +752 -293
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +96 -27
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +759 -374
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +62 -18
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +419 -154
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +106 -22
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +631 -223
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +72 -22
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +632 -219
  44. package/LinkGraph.js.map +1 -1
  45. package/MIGRATION.md +1082 -0
  46. package/Map.config.js +241 -97
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +1195 -595
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +70 -20
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +460 -195
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +79 -21
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +802 -411
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +72 -18
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +853 -484
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +75 -22
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +612 -212
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +81 -29
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +844 -379
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +85 -19
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +432 -152
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +84 -22
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +878 -342
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +96 -22
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +607 -212
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +94 -24
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +1182 -650
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +286 -225
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +92 -22
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +965 -506
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +99 -26
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +1167 -616
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +126 -67
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +73 -20
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +810 -322
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +107 -35
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +18 -7
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/EventsDoc.js +76 -22
  107. package/common/EventsDoc.js.map +1 -1
  108. package/common/GaugeMajorTicks.js +68 -58
  109. package/common/GaugeMajorTicks.js.map +1 -1
  110. package/common/GaugeValueMarker.js +43 -34
  111. package/common/GaugeValueMarker.js.map +1 -1
  112. package/common/OptionsDoc.js +156 -65
  113. package/common/OptionsDoc.js.map +1 -1
  114. package/common/OverviewDoc.js +33 -5
  115. package/common/OverviewDoc.js.map +1 -1
  116. package/common/SplunkVisualization.js +31 -4
  117. package/common/SplunkVisualization.js.map +1 -1
  118. package/common/SplunkVisualizationApi.js +8 -2
  119. package/common/SplunkVisualizationApi.js.map +1 -1
  120. package/common/ThemesDoc.js +27 -14
  121. package/common/ThemesDoc.js.map +1 -1
  122. package/common/chartingUtils.js +44 -12
  123. package/common/chartingUtils.js.map +1 -1
  124. package/common/docUtils.js +11 -1
  125. package/common/docUtils.js.map +1 -1
  126. package/common/gaugeUtils.js +173 -90
  127. package/common/gaugeUtils.js.map +1 -1
  128. package/common/shapeUtils.js +14 -2
  129. package/common/shapeUtils.js.map +1 -1
  130. package/common/utils/configUtils.js +49 -14
  131. package/common/utils/configUtils.js.map +1 -1
  132. package/common/utils/dataUtils.js +7 -2
  133. package/common/utils/dataUtils.js.map +1 -1
  134. package/common/utils/hocUtils.js +3 -1
  135. package/common/utils/hocUtils.js.map +1 -1
  136. package/common/utils/layoutUtils.js +1 -0
  137. package/common/utils/layoutUtils.js.map +1 -1
  138. package/common/utils/mapUtils.js +287 -127
  139. package/common/utils/mapUtils.js.map +1 -1
  140. package/common/utils/singleValueUtils.js +241 -196
  141. package/common/utils/singleValueUtils.js.map +1 -1
  142. package/common/utils/testHelper.js +9 -0
  143. package/common/utils/testHelper.js.map +1 -1
  144. package/common/utils/trellisUtils.js +61 -0
  145. package/common/utils/trellisUtils.js.map +1 -1
  146. package/common/utils/urlUtils.js +2 -0
  147. package/common/utils/urlUtils.js.map +1 -1
  148. package/common/withDashboardViz.js +274 -95
  149. package/common/withDashboardViz.js.map +1 -1
  150. package/package.json +16 -18
package/FillerGauge.js CHANGED
@@ -133,6 +133,7 @@ Object.defineProperty(exports, "__esModule", {
133
133
  });
134
134
  exports.VizBehavior = void 0;
135
135
  var VizBehavior;
136
+
136
137
  (function (VizBehavior) {
137
138
  /**
138
139
  * Dynamic Options Behavior.
@@ -152,6 +153,7 @@ var VizBehavior;
152
153
  * missing.
153
154
  * @type {string}
154
155
  */
156
+
155
157
  VizBehavior["PLACEHOLDER"] = "placeholder";
156
158
  VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
157
159
  VizBehavior["TRELLIS"] = "trellis";
@@ -203,11 +205,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
203
205
  Object.defineProperty(exports, "__esModule", {
204
206
  value: true
205
207
  });
208
+
206
209
  var React = __webpack_require__(1);
210
+
207
211
  var styled_components_1 = __webpack_require__(4);
212
+
208
213
  var SizeAwareWrapper_1 = __webpack_require__(19);
214
+
209
215
  var style_1 = __webpack_require__(14);
216
+
210
217
  var colorUtils_1 = __webpack_require__(12);
218
+
211
219
  var Item = styled_components_1.default.div.attrs(function (_ref) {
212
220
  var width = _ref.width;
213
221
  return {
@@ -220,11 +228,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
220
228
  componentId: "sc-1yhgpod-0"
221
229
  })(["position:relative;background-color:", "};"], function (props) {
222
230
  return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
223
- });
224
- // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
231
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
232
+
225
233
  var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
226
234
  var width = _ref2.width,
227
- height = _ref2.height;
235
+ height = _ref2.height;
228
236
  return {
229
237
  style: Object.assign(Object.assign({}, width && {
230
238
  width: (0, style_1.toPx)(width)
@@ -246,11 +254,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
246
254
  displayName: "FixedSizeContainer__FixSizeItemContent",
247
255
  componentId: "sc-1yhgpod-3"
248
256
  })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
257
+
249
258
  var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
250
259
  var FixedSizeContainer = function FixedSizeContainer(props) {
251
260
  var width = props.width,
252
- height = props.height,
253
- backgroundColor = props.backgroundColor;
261
+ height = props.height,
262
+ backgroundColor = props.backgroundColor;
263
+
254
264
  if (!height) {
255
265
  return React.createElement(Item, {
256
266
  "data-test": "item",
@@ -258,24 +268,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
258
268
  backgroundColor: backgroundColor
259
269
  }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
260
270
  }
271
+
261
272
  return React.createElement(FixSizeItem, {
262
273
  "data-test": "fix-size-item",
263
- "data-splunk-visualization-version": "26.0.0 - 2f7458907",
274
+ "data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
264
275
  width: width,
265
276
  height: height,
266
277
  backgroundColor: backgroundColor
267
278
  }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
268
279
  var newWidth = _ref3.width,
269
- newHeight = _ref3.height;
280
+ newHeight = _ref3.height;
270
281
  return React.createElement(Viz, Object.assign({}, props, {
271
282
  width: newWidth,
272
283
  height: newHeight
273
284
  }));
274
285
  })));
275
286
  };
287
+
276
288
  FixedSizeContainer.displayName = 'withFixedSizeContainer';
277
289
  return FixedSizeContainer;
278
290
  };
291
+
279
292
  exports.default = withFixedSizeContainer;
280
293
 
281
294
  /***/ }),
@@ -301,9 +314,10 @@ exports.extendStaticWrapperProps = void 0;
301
314
  * @param {DashboardVizType} props.Wrapper
302
315
  * @param {DashboardVizType} props.Visualization
303
316
  */
317
+
304
318
  var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
305
319
  var Wrapper = _ref.Wrapper,
306
- Visualization = _ref.Visualization;
320
+ Visualization = _ref.Visualization;
307
321
  var extendProperties = ['propTypes', 'defaultProps', 'config'];
308
322
  extendProperties.forEach(function (prop) {
309
323
  if (Visualization[prop]) {
@@ -312,6 +326,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
312
326
  }
313
327
  });
314
328
  };
329
+
315
330
  exports.extendStaticWrapperProps = extendStaticWrapperProps;
316
331
 
317
332
  /***/ }),
@@ -346,24 +361,33 @@ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
346
361
 
347
362
 
348
363
  var _toConsumableArray = __webpack_require__(8);
364
+
349
365
  var _defineProperty = __webpack_require__(7);
366
+
350
367
  var __rest = this && this.__rest || function (s, e) {
351
368
  var t = {};
369
+
352
370
  for (var p in s) {
353
371
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
354
372
  }
373
+
355
374
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
356
375
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
357
376
  }
358
377
  return t;
359
378
  };
379
+
360
380
  Object.defineProperty(exports, "__esModule", {
361
381
  value: true
362
382
  });
363
383
  exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
384
+
364
385
  var lodash_1 = __webpack_require__(3);
386
+
365
387
  var schemaUtils_1 = __webpack_require__(16);
388
+
366
389
  var VizBehavior_1 = __webpack_require__(6);
390
+
367
391
  var dynamicOptionsDSLType = {
368
392
  type: 'string',
369
393
  pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
@@ -373,20 +397,22 @@ var dynamicOptionsDSLType = {
373
397
  * @param optionsSchema a visualization's options schema
374
398
  * @returns an updated options schema that additionally allows strings starting with > for each option
375
399
  */
400
+
376
401
  function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
377
402
  var enhancedOptionsSchema = {};
378
403
  Object.keys(optionsSchema).forEach(function (key) {
379
404
  var _a = optionsSchema[key],
380
- title = _a.title,
381
- description = _a.description,
382
- readOnly = _a.readOnly,
383
- writeOnly = _a.writeOnly,
384
- examples = _a.examples,
385
- defaultValue = _a.default,
386
- type = _a.type,
387
- properties = _a.properties,
388
- patternProperties = _a.patternProperties,
389
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
405
+ title = _a.title,
406
+ description = _a.description,
407
+ readOnly = _a.readOnly,
408
+ writeOnly = _a.writeOnly,
409
+ examples = _a.examples,
410
+ defaultValue = _a.default,
411
+ type = _a.type,
412
+ properties = _a.properties,
413
+ patternProperties = _a.patternProperties,
414
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
415
+
390
416
  var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
391
417
  title: title
392
418
  }), description !== undefined && {
@@ -400,12 +426,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
400
426
  }), defaultValue !== undefined && {
401
427
  default: defaultValue
402
428
  });
429
+
403
430
  if (type === 'object') {
404
431
  enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
405
432
  type: type
406
433
  }), properties && {
407
434
  properties: enhanceOptionsSchemaWithDynamicOptions(properties)
408
435
  });
436
+
409
437
  if (patternProperties) {
410
438
  var enhancedPatternProperties = {};
411
439
  Object.keys(patternProperties).forEach(function (opt) {
@@ -423,6 +451,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
423
451
  });
424
452
  return enhancedOptionsSchema;
425
453
  }
454
+
426
455
  exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
427
456
  /**
428
457
  * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
@@ -431,11 +460,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
431
460
  * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
432
461
  * and containing `open: false` for all editor panels in editorConfig
433
462
  */
463
+
434
464
  function enhanceConfig(vizConfig) {
435
465
  var enhancedConfig = Object.assign({}, vizConfig);
466
+
436
467
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
437
468
  enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
438
469
  }
470
+
439
471
  enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
440
472
  return Object.assign(Object.assign({}, config), {
441
473
  open: config.open || false
@@ -443,6 +475,7 @@ function enhanceConfig(vizConfig) {
443
475
  });
444
476
  return enhancedConfig;
445
477
  }
478
+
446
479
  exports.enhanceConfig = enhanceConfig;
447
480
  /**
448
481
  * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
@@ -450,6 +483,7 @@ exports.enhanceConfig = enhanceConfig;
450
483
  * @param vizConfig a Visualization Config
451
484
  * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
452
485
  */
486
+
453
487
  function uncollapseEditorConfig(vizConfig) {
454
488
  var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
455
489
  editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
@@ -459,13 +493,16 @@ function uncollapseEditorConfig(vizConfig) {
459
493
  });
460
494
  return editorPanelUncollapsedConfig;
461
495
  }
496
+
462
497
  exports.uncollapseEditorConfig = uncollapseEditorConfig;
498
+
463
499
  function isDynamicOption(option) {
464
500
  return option && typeof option === 'string' && option.trim().startsWith('>') || false;
465
501
  }
466
- exports.isDynamicOption = isDynamicOption;
467
- // private helpers to improve readability of getInitialPreset
502
+
503
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
468
504
  // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
505
+
469
506
  /**
470
507
  * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
471
508
  * 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
@@ -474,6 +511,7 @@ exports.isDynamicOption = isDynamicOption;
474
511
  *
475
512
  * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
476
513
  */
514
+
477
515
  function hasCompatibleContexts(vizContext, presetContext) {
478
516
  var presetContextKeys = Object.keys(presetContext);
479
517
  return presetContextKeys.every(function (contextKey) {
@@ -483,6 +521,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
483
521
  /**
484
522
  * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
485
523
  */
524
+
525
+
486
526
  function hasCompatibleOptions(vizOptions, presetOptions) {
487
527
  var presetOptionKeys = Object.keys(presetOptions);
488
528
  return presetOptionKeys.every(function (optionKey) {
@@ -497,18 +537,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
497
537
  * @param {Object} vizOptions - the current vizOptions definition
498
538
  * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
499
539
  */
540
+
541
+
500
542
  function getInitialPreset(vizContext, vizOptions, presets) {
501
543
  return presets.find(function (preset) {
502
544
  var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
503
545
  var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
504
546
  var presetContextKeys = Object.keys(presetContext);
505
- var presetOptionKeys = Object.keys(presetOptions);
506
- // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
547
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
507
548
  // if not, then the preset is invalid in config.ts
549
+
508
550
  if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
509
551
  return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
510
552
  });
511
553
  }
554
+
512
555
  exports.getInitialPreset = getInitialPreset;
513
556
  /**
514
557
  * generates number precision values for a Select editor
@@ -516,6 +559,7 @@ exports.getInitialPreset = getInitialPreset;
516
559
  * @param {Number} numPrecisionValues - number of integer precision values to generate
517
560
  * @returns {{ label: string; value; string }[]} array of { label, value } tuples
518
561
  */
562
+
519
563
  function generatePrecisionValues(numPrecisionValues) {
520
564
  return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
521
565
  return {
@@ -524,6 +568,7 @@ function generatePrecisionValues(numPrecisionValues) {
524
568
  };
525
569
  });
526
570
  }
571
+
527
572
  exports.generatePrecisionValues = generatePrecisionValues;
528
573
  /**
529
574
  * insert layout in layout array, return a new layout array instead of updating the original
@@ -533,12 +578,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
533
578
  * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
534
579
  * @returns {EditorLayoutConfig[][]} new editor layout with insertion
535
580
  */
581
+
536
582
  var insertLayout = function insertLayout(layout, index) {
537
583
  for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
538
584
  layoutItems[_key - 2] = arguments[_key];
539
585
  }
586
+
540
587
  return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
541
588
  };
589
+
542
590
  exports.insertLayout = insertLayout;
543
591
 
544
592
  /***/ }),
@@ -608,11 +656,17 @@ Object.defineProperty(exports, "__esModule", {
608
656
  value: true
609
657
  });
610
658
  exports.shouldShowIconPlaceholder = void 0;
659
+
611
660
  var React = __webpack_require__(1);
661
+
612
662
  var T = __webpack_require__(0);
663
+
613
664
  var lodash_1 = __webpack_require__(3);
665
+
614
666
  var i18n_1 = __webpack_require__(2);
667
+
615
668
  var Message_1 = __webpack_require__(10);
669
+
616
670
  var FixedSizeContainer_1 = __webpack_require__(13);
617
671
  /**
618
672
  * @method shouldShowIconPlaceholder
@@ -620,6 +674,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
620
674
  * @param {boolean} loading
621
675
  * @returns {boolean}
622
676
  */
677
+
678
+
623
679
  var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
624
680
  var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
625
681
  var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
@@ -628,6 +684,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
628
684
  var noFields = fields === undefined;
629
685
  return loading || noData || noFields;
630
686
  };
687
+
631
688
  exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
632
689
  var propTypes = {
633
690
  icon: T.func,
@@ -642,11 +699,13 @@ var propTypes = {
642
699
  * @param {IconPlaceholderProps} props
643
700
  * @returns {React.ReactElement}
644
701
  */
702
+
645
703
  var IconPlaceholder = function IconPlaceholder(props) {
646
704
  var width = props.width,
647
- height = props.height,
648
- icon = props.icon,
649
- iconColor = props.iconColor;
705
+ height = props.height,
706
+ icon = props.icon,
707
+ iconColor = props.iconColor;
708
+
650
709
  if (icon) {
651
710
  return React.createElement(icon, {
652
711
  style: {
@@ -661,6 +720,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
661
720
  height: '50%'
662
721
  });
663
722
  }
723
+
664
724
  return React.createElement(Message_1.default, {
665
725
  width: width,
666
726
  height: height,
@@ -668,6 +728,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
668
728
  message: (0, i18n_1._)('No DataSource Connected')
669
729
  });
670
730
  };
731
+
671
732
  IconPlaceholder.propTypes = propTypes;
672
733
  IconPlaceholder.defaultProps = {
673
734
  width: '100%',
@@ -683,21 +744,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
683
744
 
684
745
 
685
746
  var _defineProperty = __webpack_require__(7);
747
+
686
748
  Object.defineProperty(exports, "__esModule", {
687
749
  value: true
688
750
  });
689
751
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
752
+
690
753
  var T = __webpack_require__(0);
754
+
691
755
  var lodash_1 = __webpack_require__(3);
692
- var DataSource_1 = __webpack_require__(43);
756
+
757
+ var DataSource_1 = __webpack_require__(34);
758
+
693
759
  exports.SortParamsPropTypes = T.shape({
694
760
  currentSortKey: T.string,
695
761
  currentSortDir: T.oneOf(DataSource_1.validSortDirs),
696
762
  onSort: T.func
697
763
  });
764
+
698
765
  var getSortingParams = function getSortingParams(_ref) {
699
766
  var requestParams = _ref.requestParams,
700
- onRequestParamsChange = _ref.onRequestParamsChange;
767
+ onRequestParamsChange = _ref.onRequestParamsChange;
701
768
  var currentSortKey;
702
769
  var currentSortDir;
703
770
  var nextSortDirMap = {
@@ -706,15 +773,18 @@ var getSortingParams = function getSortingParams(_ref) {
706
773
  none: 'asc'
707
774
  };
708
775
  var onSort;
776
+
709
777
  if (typeof onRequestParamsChange === 'function') {
710
778
  if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
711
779
  currentSortKey = Object.keys(requestParams.sort).shift();
712
780
  currentSortDir = requestParams.sort[currentSortKey];
713
- }
714
- // undid memoization since there is a dependency on requestParams, which is a deeply nested object
781
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
782
+
783
+
715
784
  onSort = function onSort(e, _ref2) {
716
785
  var sortKey = _ref2.sortKey,
717
- sortDir = _ref2.sortDir;
786
+ sortDir = _ref2.sortDir;
787
+
718
788
  if (typeof sortKey === 'string') {
719
789
  var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
720
790
  onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
@@ -726,12 +796,14 @@ var getSortingParams = function getSortingParams(_ref) {
726
796
  }
727
797
  };
728
798
  }
799
+
729
800
  return {
730
801
  currentSortKey: currentSortKey,
731
802
  currentSortDir: currentSortDir,
732
803
  onSort: onSort
733
804
  };
734
805
  };
806
+
735
807
  exports.getSortingParams = getSortingParams;
736
808
 
737
809
  /***/ }),
@@ -741,43 +813,68 @@ exports.getSortingParams = getSortingParams;
741
813
  "use strict";
742
814
 
743
815
 
816
+ Object.defineProperty(exports, "__esModule", {
817
+ value: true
818
+ });
819
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
820
+ exports.validSortDirs = ['asc', 'desc', 'none'];
821
+ exports.validSegmentationModes = ['none', 'inner'];
822
+ exports.validOutputModes = ['json_cols', 'json'];
823
+
824
+ /***/ }),
825
+ /* 35 */
826
+ /***/ (function(module, exports, __webpack_require__) {
827
+
828
+ "use strict";
829
+
830
+
744
831
  Object.defineProperty(exports, "__esModule", {
745
832
  value: true
746
833
  });
747
834
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
835
+
748
836
  var T = __webpack_require__(0);
837
+
749
838
  var lodash_1 = __webpack_require__(3);
839
+
750
840
  exports.PaginatorParamsPropTypes = T.shape({
751
841
  isPaging: T.bool,
752
842
  current: T.number,
753
843
  totalPages: T.number,
754
844
  onChange: T.func
755
845
  });
846
+
756
847
  var getPaginationParams = function getPaginationParams(_ref) {
757
848
  var requestParams = _ref.requestParams,
758
- meta = _ref.meta,
759
- onRequestParamsChange = _ref.onRequestParamsChange;
849
+ meta = _ref.meta,
850
+ onRequestParamsChange = _ref.onRequestParamsChange;
760
851
  var totalCount = meta && meta.totalCount || 0;
761
852
  var offset = requestParams && requestParams.offset || 0;
762
853
  var count = requestParams && requestParams.count;
763
854
  var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
764
855
  var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
765
856
  var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
857
+
766
858
  var onChangeHandler = function onChangeHandler(e, _ref2) {
767
859
  var page = _ref2.page,
768
- countArg = _ref2.count;
860
+ countArg = _ref2.count;
769
861
  var newParams = (0, lodash_1.cloneDeep)(requestParams);
862
+
770
863
  if (typeof countArg === 'number') {
771
864
  newParams.count = countArg;
772
865
  newParams.offset = 0;
773
866
  }
867
+
774
868
  var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
869
+
775
870
  if (typeof page === 'number' && page > 0) {
776
871
  newParams.count = pageCount;
777
872
  newParams.offset = (page - 1) * pageCount;
778
873
  }
874
+
779
875
  onRequestParamsChange(newParams);
780
876
  };
877
+
781
878
  return {
782
879
  isPaging: isPaging,
783
880
  current: current,
@@ -785,10 +882,11 @@ var getPaginationParams = function getPaginationParams(_ref) {
785
882
  onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
786
883
  };
787
884
  };
885
+
788
886
  exports.getPaginationParams = getPaginationParams;
789
887
 
790
888
  /***/ }),
791
- /* 35 */
889
+ /* 36 */
792
890
  /***/ (function(module, exports, __webpack_require__) {
793
891
 
794
892
  "use strict";
@@ -799,6 +897,7 @@ Object.defineProperty(exports, "__esModule", {
799
897
  });
800
898
  exports.VizCategory = void 0;
801
899
  var VizCategory;
900
+
802
901
  (function (VizCategory) {
803
902
  VizCategory["SINGLE_VALUE"] = "Single Value";
804
903
  VizCategory["TRENDS"] = "Trends";
@@ -815,67 +914,96 @@ var VizCategory;
815
914
  })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
816
915
 
817
916
  /***/ }),
818
- /* 36 */
917
+ /* 37 */
819
918
  /***/ (function(module, exports, __webpack_require__) {
820
919
 
821
920
  "use strict";
822
921
 
823
922
 
824
923
  var _slicedToArray = __webpack_require__(17);
924
+
825
925
  Object.defineProperty(exports, "__esModule", {
826
926
  value: true
827
927
  });
928
+
828
929
  var React = __webpack_require__(1);
930
+
829
931
  var lodash_1 = __webpack_require__(3);
830
- var getSettingsFromThemedProps_1 = __webpack_require__(37);
932
+
933
+ var getSettingsFromThemedProps_1 = __webpack_require__(38);
934
+
831
935
  var Options_1 = __webpack_require__(30);
832
- var SanitizeProps_1 = __webpack_require__(38);
936
+
937
+ var SanitizeProps_1 = __webpack_require__(39);
938
+
833
939
  var TimezoneContext_1 = __webpack_require__(26);
834
- var moment_1 = __webpack_require__(39);
940
+
941
+ var moment_1 = __webpack_require__(40);
942
+
835
943
  var FeatureFlagContext_1 = __webpack_require__(21);
944
+
836
945
  var styled_components_1 = __webpack_require__(4);
946
+
837
947
  var hocUtils_1 = __webpack_require__(27);
948
+
838
949
  var JSONSchemaUtils_1 = __webpack_require__(28);
839
- var async_dynamic_options_evaluator_1 = __webpack_require__(40);
950
+
951
+ var async_dynamic_options_evaluator_1 = __webpack_require__(41);
952
+
840
953
  var id_1 = __webpack_require__(25);
841
- var SplunkVisualization_1 = __webpack_require__(41);
954
+
955
+ var SplunkVisualization_1 = __webpack_require__(42);
956
+
842
957
  var VizBehavior_1 = __webpack_require__(6);
958
+
843
959
  var getSorting_1 = __webpack_require__(33);
844
- var getPagination_1 = __webpack_require__(34);
960
+
961
+ var getPagination_1 = __webpack_require__(35);
962
+
845
963
  var useDeepMemo_1 = __webpack_require__(44);
964
+
846
965
  var MissingPropsMessage_1 = __webpack_require__(45);
966
+
847
967
  var withEditModeCover_1 = __webpack_require__(46);
968
+
848
969
  var withPlaceholder_1 = __webpack_require__(47);
849
970
  /**
850
971
  * hoc that wraps a pure react visualization in a Dashboard visualization
851
972
  * @param {DashboardVizOpts} opts
852
973
  * @returns {HOC}
853
974
  */
975
+
976
+
854
977
  var withDashboardViz = function withDashboardViz(opts) {
855
978
  var ReactViz = opts.ReactViz,
856
- vizConfig = opts.vizConfig,
857
- _opts$computeVizProps = opts.computeVizProps,
858
- computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
859
- disableEditModeCover = opts.disableEditModeCover,
860
- useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
979
+ vizConfig = opts.vizConfig,
980
+ _opts$computeVizProps = opts.computeVizProps,
981
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
982
+ disableEditModeCover = opts.disableEditModeCover,
983
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
984
+
861
985
  var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
862
986
  var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
987
+
863
988
  var DashboardViz = function DashboardViz(props) {
864
989
  var _a;
990
+
865
991
  var mode = props.mode,
866
- hasEventHandlers = props.hasEventHandlers,
867
- dataSources = props.dataSources,
868
- options = props.options,
869
- _props$context = props.context,
870
- context = _props$context === void 0 ? {} : _props$context,
871
- width = props.width,
872
- height = props.height,
873
- onComputedProps = props.onComputedProps,
874
- onEventTrigger = props.onEventTrigger,
875
- theme = props.theme,
876
- onRequestParamsChange = props.onRequestParamsChange;
992
+ hasEventHandlers = props.hasEventHandlers,
993
+ dataSources = props.dataSources,
994
+ options = props.options,
995
+ _props$context = props.context,
996
+ context = _props$context === void 0 ? {} : _props$context,
997
+ width = props.width,
998
+ height = props.height,
999
+ onComputedProps = props.onComputedProps,
1000
+ onEventTrigger = props.onEventTrigger,
1001
+ theme = props.theme,
1002
+ onRequestParamsChange = props.onRequestParamsChange;
1003
+
877
1004
  var _React$useContext = React.useContext(TimezoneContext_1.default),
878
- serializedTimezone = _React$useContext.serializedTimezone;
1005
+ serializedTimezone = _React$useContext.serializedTimezone;
1006
+
879
1007
  if (serializedTimezone) {
880
1008
  /*
881
1009
  @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
@@ -889,38 +1017,51 @@ var withDashboardViz = function withDashboardViz(opts) {
889
1017
  moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
890
1018
  }
891
1019
  }
1020
+
892
1021
  var themeFunc = function themeFunc(themeVar) {
893
1022
  var _a, _b;
1023
+
894
1024
  return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
895
1025
  };
1026
+
896
1027
  var bgColorFromTheme = themeFunc('defaultBackgroundColor');
1028
+
897
1029
  var _ref = (0, getSettingsFromThemedProps_1.default)({
898
- theme: theme
899
- }),
900
- currentThemeFamily = _ref.family,
901
- currentThemeColorScheme = _ref.colorScheme,
902
- currentThemeDensity = _ref.density;
1030
+ theme: theme
1031
+ }),
1032
+ currentThemeFamily = _ref.family,
1033
+ currentThemeColorScheme = _ref.colorScheme,
1034
+ currentThemeDensity = _ref.density;
1035
+
903
1036
  var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
1037
+
904
1038
  var _React$useState = React.useState({}),
905
- _React$useState2 = _slicedToArray(_React$useState, 2),
906
- evaluatedOptionsAsync = _React$useState2[0],
907
- setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1039
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1040
+ evaluatedOptionsAsync = _React$useState2[0],
1041
+ setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1042
+
1043
+
908
1044
  var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
1045
+
909
1046
  var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
910
- _React$useState4 = _slicedToArray(_React$useState3, 1),
911
- visualizationID = _React$useState4[0];
1047
+ _React$useState4 = _slicedToArray(_React$useState3, 1),
1048
+ visualizationID = _React$useState4[0];
1049
+
912
1050
  var _React$useState5 = React.useState({}),
913
- _React$useState6 = _slicedToArray(_React$useState5, 2),
914
- dataSourcesInState = _React$useState6[0],
915
- setDataSourcesInState = _React$useState6[1];
1051
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
1052
+ dataSourcesInState = _React$useState6[0],
1053
+ setDataSourcesInState = _React$useState6[1];
1054
+
916
1055
  var _React$useState7 = React.useState(),
917
- _React$useState8 = _slicedToArray(_React$useState7, 2),
918
- dataFramesInState = _React$useState8[0],
919
- setDataFramesInState = _React$useState8[1];
1056
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
1057
+ dataFramesInState = _React$useState8[0],
1058
+ setDataFramesInState = _React$useState8[1];
1059
+
920
1060
  var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
921
- _React$useState10 = _slicedToArray(_React$useState9, 2),
922
- useAsyncEvaluatedOptions = _React$useState10[0],
923
- setUseAsyncEvaluatedOptions = _React$useState10[1];
1061
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
1062
+ useAsyncEvaluatedOptions = _React$useState10[0],
1063
+ setUseAsyncEvaluatedOptions = _React$useState10[1];
1064
+
924
1065
  var isMounted = React.useRef(true);
925
1066
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
926
1067
  try {
@@ -945,11 +1086,13 @@ var withDashboardViz = function withDashboardViz(opts) {
945
1086
  });
946
1087
  } else {
947
1088
  var dataFrames = dataFramesInState;
1089
+
948
1090
  if (dataSources !== dataSourcesInState) {
949
1091
  setDataSourcesInState(dataSources);
950
1092
  dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
951
1093
  setDataFramesInState(dataFrames);
952
1094
  }
1095
+
953
1096
  return Options_1.Options.evaluate({
954
1097
  context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
955
1098
  options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
@@ -960,21 +1103,24 @@ var withDashboardViz = function withDashboardViz(opts) {
960
1103
  console.error("unexpected error evaluating options: ".concat(e.message));
961
1104
  return {};
962
1105
  }
1106
+
963
1107
  return {};
964
1108
  }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
965
- var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
966
- // trellis specific backgroundColor update for onComputedProps
1109
+ var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
967
1110
  // if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
968
1111
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
1112
+
969
1113
  var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
970
1114
  var clonedEvaluatedOptions = evaluatedOptionsToUse;
1115
+
971
1116
  if (isTrellisFeatureFlagOn && ((_a = vizConfig === null || vizConfig === void 0 ? void 0 : vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(VizBehavior_1.VizBehavior.TRELLIS)) && (clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.splitByLayout) === VizBehavior_1.VizBehavior.TRELLIS) {
972
1117
  clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
973
1118
  backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
974
1119
  });
975
- }
976
- // useEffect hook needs to be initialized before any early returns
1120
+ } // useEffect hook needs to be initialized before any early returns
977
1121
  // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
1122
+
1123
+
978
1124
  React.useEffect(function () {
979
1125
  onComputedProps(clonedEvaluatedOptions);
980
1126
  });
@@ -984,44 +1130,49 @@ var withDashboardViz = function withDashboardViz(opts) {
984
1130
  isMounted.current = false;
985
1131
  async_dynamic_options_evaluator_1.default.reset(visualizationID);
986
1132
  }
987
- };
988
- // eslint-disable-next-line react-hooks/exhaustive-deps
989
- }, []);
990
- // present warning message if any required props are missing
1133
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
1134
+ }, []); // present warning message if any required props are missing
1135
+
991
1136
  var _vizConfig$requiredPr = vizConfig.requiredProps,
992
- requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
993
- supports = vizConfig.supports;
1137
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1138
+ supports = vizConfig.supports;
994
1139
  var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
1140
+
995
1141
  if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
996
1142
  ) {
997
- return React.createElement(MissingPropsMessage_1.default, {
998
- "data-test": "missing-props-message",
999
- width: width,
1000
- height: height,
1001
- missingProps: missing,
1002
- backgroundColor: bgColorFromTheme
1003
- });
1004
- }
1005
- // events
1143
+ return React.createElement(MissingPropsMessage_1.default, {
1144
+ "data-test": "missing-props-message",
1145
+ width: width,
1146
+ height: height,
1147
+ missingProps: missing,
1148
+ backgroundColor: bgColorFromTheme
1149
+ });
1150
+ } // events
1151
+
1152
+
1006
1153
  var eventCallbackProps = {};
1154
+
1007
1155
  if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
1008
1156
  var supportedEvents = vizConfig.events;
1009
1157
  Object.keys(supportedEvents).forEach(function (eventName) {
1010
1158
  var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
1011
- eventCallbackProps[eventCallbackPropName] = null;
1012
- // todo: refactor single value and single value icon to send payload from viz
1159
+ eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
1013
1160
  // then remove these lines
1161
+
1014
1162
  var payloadKeys = supportedEvents[eventName].payloadKeys;
1015
1163
  var payload = {};
1164
+
1016
1165
  if (Array.isArray(payloadKeys) && payloadKeys.length) {
1017
1166
  payloadKeys.forEach(function (p) {
1018
1167
  payload[p] = evaluatedOptionsToUse[p];
1019
1168
  });
1020
1169
  }
1170
+
1021
1171
  eventCallbackProps[eventCallbackPropName] = function (ev) {
1022
1172
  if (ev && ev.payload) {
1023
1173
  payload = ev.payload;
1024
1174
  }
1175
+
1025
1176
  return onEventTrigger({
1026
1177
  originalEvent: ev,
1027
1178
  payload: payload,
@@ -1029,8 +1180,9 @@ var withDashboardViz = function withDashboardViz(opts) {
1029
1180
  });
1030
1181
  };
1031
1182
  });
1032
- }
1033
- // compute pure viz props which are not from options
1183
+ } // compute pure viz props which are not from options
1184
+
1185
+
1034
1186
  var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
1035
1187
  themeFunc: themeFunc
1036
1188
  }));
@@ -1048,15 +1200,19 @@ var withDashboardViz = function withDashboardViz(opts) {
1048
1200
  * In future, we could automatically detect which all datasources are being used
1049
1201
  * and bind those magically to pagination/sorting behavior.
1050
1202
  */
1203
+
1051
1204
  var dataSourceMetadata = {};
1052
1205
  var OptionKey = 'paginateDataSourceKey';
1053
1206
  var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
1207
+
1054
1208
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
1055
1209
  var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
1056
1210
  var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
1211
+
1057
1212
  var handleRequestParamsChange = function handleRequestParamsChange(payload) {
1058
1213
  return onRequestParamsChange(paginateDataSourceKey, payload);
1059
1214
  };
1215
+
1060
1216
  var sortParams = (0, getSorting_1.getSortingParams)({
1061
1217
  requestParams: requestParams,
1062
1218
  meta: meta,
@@ -1071,103 +1227,120 @@ var withDashboardViz = function withDashboardViz(opts) {
1071
1227
  sortParams: sortParams,
1072
1228
  paginatorParams: paginatorParams
1073
1229
  };
1074
- }
1075
- // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
1230
+ } // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
1231
+
1232
+
1076
1233
  if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
1077
1234
  return null;
1078
1235
  }
1236
+
1079
1237
  return React.createElement(SanitizedReactViz, Object.assign({
1080
1238
  mode: mode,
1081
1239
  width: width,
1082
1240
  height: height
1083
1241
  }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1084
1242
  };
1243
+
1085
1244
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
1086
1245
  DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
1087
1246
  // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
1088
1247
  theme: {}
1089
- });
1090
- // attach viz config
1091
- DashboardViz.config = vizConfig;
1092
- // @ts-ignore: TODO fix sc upgrade TS issues
1248
+ }); // attach viz config
1249
+
1250
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1251
+
1093
1252
  return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
1094
1253
  };
1254
+
1095
1255
  exports.default = withDashboardViz;
1096
1256
 
1097
1257
  /***/ }),
1098
- /* 37 */
1258
+ /* 38 */
1099
1259
  /***/ (function(module, exports) {
1100
1260
 
1101
1261
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1102
1262
 
1103
1263
  /***/ }),
1104
- /* 38 */
1264
+ /* 39 */
1105
1265
  /***/ (function(module, exports) {
1106
1266
 
1107
1267
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1108
1268
 
1109
1269
  /***/ }),
1110
- /* 39 */
1270
+ /* 40 */
1111
1271
  /***/ (function(module, exports) {
1112
1272
 
1113
1273
  module.exports = require("@splunk/moment");
1114
1274
 
1115
1275
  /***/ }),
1116
- /* 40 */
1276
+ /* 41 */
1117
1277
  /***/ (function(module, exports) {
1118
1278
 
1119
1279
  module.exports = require("@splunk/async-dynamic-options-evaluator");
1120
1280
 
1121
1281
  /***/ }),
1122
- /* 41 */
1282
+ /* 42 */
1123
1283
  /***/ (function(module, exports, __webpack_require__) {
1124
1284
 
1125
1285
  "use strict";
1126
1286
 
1127
1287
 
1128
1288
  var _classCallCheck = __webpack_require__(9);
1289
+
1129
1290
  Object.defineProperty(exports, "__esModule", {
1130
1291
  value: true
1131
1292
  });
1132
1293
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1133
1294
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1295
+
1134
1296
  var T = __webpack_require__(0);
1297
+
1135
1298
  var lodash_1 = __webpack_require__(3);
1136
- var VizActionHandler_1 = __webpack_require__(42);
1137
- // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1299
+
1300
+ var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1301
+
1302
+
1138
1303
  exports.INITIAL_WIDTH = 250;
1139
1304
  exports.INITIAL_HEIGHT = 250;
1140
1305
  /**
1141
1306
  * A Splunk visualization
1142
1307
  */
1308
+
1143
1309
  var SplunkVisualization = function SplunkVisualization() {
1144
1310
  _classCallCheck(this, SplunkVisualization);
1145
1311
  };
1312
+
1146
1313
  SplunkVisualization.propTypes = {
1147
1314
  /**
1148
1315
  * display mode
1149
1316
  */
1150
1317
  mode: T.oneOf(['view', 'edit', 'export']).isRequired,
1318
+
1151
1319
  /**
1152
1320
  * width in pixel or string, defaults to 100%
1153
1321
  */
1154
1322
  width: T.oneOfType([T.string, T.number]).isRequired,
1323
+
1155
1324
  /**
1156
1325
  * height in pixel or string
1157
1326
  */
1158
1327
  height: T.oneOfType([T.string, T.number]).isRequired,
1328
+
1159
1329
  /**
1160
1330
  * visualization context used for dynamic option evaluation
1161
1331
  */
1162
1332
  context: T.object,
1333
+
1163
1334
  /**
1164
1335
  * visualization formatting options
1165
1336
  */
1166
1337
  options: T.object,
1338
+
1167
1339
  /**
1168
1340
  * A callback to update formatting options
1169
1341
  */
1170
1342
  onOptionsChange: T.func,
1343
+
1171
1344
  /**
1172
1345
  * datasource state which include data and request params, object key indicate the datasource type.
1173
1346
  */
@@ -1176,6 +1349,7 @@ SplunkVisualization.propTypes = {
1176
1349
  * current request params
1177
1350
  */
1178
1351
  requestParams: T.object,
1352
+
1179
1353
  /**
1180
1354
  * current dataset
1181
1355
  */
@@ -1183,6 +1357,7 @@ SplunkVisualization.propTypes = {
1183
1357
  fields: T.array,
1184
1358
  columns: T.array
1185
1359
  }),
1360
+
1186
1361
  /**
1187
1362
  * error
1188
1363
  */
@@ -1190,29 +1365,35 @@ SplunkVisualization.propTypes = {
1190
1365
  level: T.string,
1191
1366
  message: T.string
1192
1367
  }),
1368
+
1193
1369
  /**
1194
1370
  * meta data that came with the dataset
1195
1371
  */
1196
1372
  meta: T.object
1197
1373
  })),
1374
+
1198
1375
  /**
1199
1376
  * A callback to trigger event
1200
1377
  */
1201
1378
  onEventTrigger: T.func,
1379
+
1202
1380
  /**
1203
1381
  * Inform viz if there are handlers listening to events
1204
1382
  */
1205
1383
  hasEventHandlers: T.bool,
1384
+
1206
1385
  /**
1207
1386
  * A callback to communicate computed props to a consumer
1208
1387
  */
1209
1388
  onComputedProps: T.func,
1389
+
1210
1390
  /**
1211
1391
  * A callback to obtain visualization api
1212
1392
  */
1213
1393
  vizActionHandlerRef: T.func,
1214
1394
  loading: T.bool,
1215
1395
  theme: T.object,
1396
+
1216
1397
  /**
1217
1398
  * A callback to request new data with updated request params
1218
1399
  */
@@ -1221,6 +1402,7 @@ SplunkVisualization.propTypes = {
1221
1402
  /**
1222
1403
  *
1223
1404
  */
1405
+
1224
1406
  SplunkVisualization.defaultProps = {
1225
1407
  // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1226
1408
  width: '100%',
@@ -1248,26 +1430,29 @@ SplunkVisualization.defaultProps = {
1248
1430
  exports.default = SplunkVisualization;
1249
1431
 
1250
1432
  /***/ }),
1251
- /* 42 */
1433
+ /* 43 */
1252
1434
  /***/ (function(module, exports, __webpack_require__) {
1253
1435
 
1254
1436
  "use strict";
1255
1437
 
1256
1438
 
1257
1439
  var _classCallCheck = __webpack_require__(9);
1440
+
1258
1441
  var _createClass = __webpack_require__(18);
1442
+
1259
1443
  Object.defineProperty(exports, "__esModule", {
1260
1444
  value: true
1261
1445
  });
1262
1446
  exports.DefaultVizActionHandler = void 0;
1447
+
1263
1448
  var DefaultVizActionHandler = /*#__PURE__*/function () {
1264
1449
  function DefaultVizActionHandler() {
1265
1450
  _classCallCheck(this, DefaultVizActionHandler);
1266
1451
  }
1452
+
1267
1453
  _createClass(DefaultVizActionHandler, [{
1268
1454
  key: "focus",
1269
- value: function focus() {
1270
- // noop
1455
+ value: function focus() {// noop
1271
1456
  }
1272
1457
  }, {
1273
1458
  key: "snapshot",
@@ -1275,22 +1460,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
1275
1460
  return null; // noop
1276
1461
  }
1277
1462
  }]);
1463
+
1278
1464
  return DefaultVizActionHandler;
1279
1465
  }();
1280
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1281
1466
 
1282
- /***/ }),
1283
- /* 43 */
1284
- /***/ (function(module, exports, __webpack_require__) {
1285
-
1286
- "use strict";
1287
-
1288
-
1289
- Object.defineProperty(exports, "__esModule", {
1290
- value: true
1291
- });
1292
- exports.validSortDirs = void 0;
1293
- exports.validSortDirs = ['asc', 'desc', 'none'];
1467
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
1294
1468
 
1295
1469
  /***/ }),
1296
1470
  /* 44 */
@@ -1303,7 +1477,9 @@ Object.defineProperty(exports, "__esModule", {
1303
1477
  value: true
1304
1478
  });
1305
1479
  exports.useDeepMemo = void 0;
1480
+
1306
1481
  var react_1 = __webpack_require__(1);
1482
+
1307
1483
  var lodash_1 = __webpack_require__(3);
1308
1484
  /**
1309
1485
  * This hook evaluates and stores the result of a passed function and only
@@ -1318,16 +1494,21 @@ var lodash_1 = __webpack_require__(3);
1318
1494
  * @param fn the function to be executed and
1319
1495
  * @param dependencies an array of dependencies
1320
1496
  */
1497
+
1498
+
1321
1499
  var useDeepMemo = function useDeepMemo(fn, dependencies) {
1322
1500
  var ref = (0, react_1.useRef)();
1501
+
1323
1502
  if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
1324
1503
  ref.current = {
1325
1504
  dependencies: dependencies,
1326
1505
  value: fn()
1327
1506
  };
1328
1507
  }
1508
+
1329
1509
  return ref.current.value;
1330
1510
  };
1511
+
1331
1512
  exports.useDeepMemo = useDeepMemo;
1332
1513
 
1333
1514
  /***/ }),
@@ -1341,19 +1522,27 @@ Object.defineProperty(exports, "__esModule", {
1341
1522
  value: true
1342
1523
  });
1343
1524
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1525
+
1344
1526
  var React = __webpack_require__(1);
1527
+
1345
1528
  var T = __webpack_require__(0);
1529
+
1346
1530
  var i18n_1 = __webpack_require__(2);
1531
+
1347
1532
  var Message_1 = __webpack_require__(10);
1533
+
1348
1534
  var FixedSizeContainer_1 = __webpack_require__(13);
1349
1535
  /**
1350
1536
  * @method isMissing
1351
1537
  * @param {any} v
1352
1538
  * @returns {boolean} true if the input value === null or undefined
1353
1539
  */
1540
+
1541
+
1354
1542
  var isMissing = function isMissing(v) {
1355
1543
  return v === null || v === undefined;
1356
1544
  };
1545
+
1357
1546
  exports.isMissing = isMissing;
1358
1547
  /**
1359
1548
  * @method misskingKeys
@@ -1361,11 +1550,13 @@ exports.isMissing = isMissing;
1361
1550
  * @param {object} target
1362
1551
  * @returns {string[]} the keys of missing required props
1363
1552
  */
1553
+
1364
1554
  var missingKeys = function missingKeys(keys, target) {
1365
1555
  return keys.filter(function (k) {
1366
1556
  return (0, exports.isMissing)(target[k]);
1367
1557
  });
1368
1558
  };
1559
+
1369
1560
  exports.missingKeys = missingKeys;
1370
1561
  var propTypes = {
1371
1562
  width: T.oneOfType([T.string, T.number]),
@@ -1379,10 +1570,11 @@ var propTypes = {
1379
1570
  * @param {MissingPropsProps} props
1380
1571
  * @returns {React.ReactElement}
1381
1572
  */
1573
+
1382
1574
  var MissingPropsMessage = function MissingPropsMessage(props) {
1383
1575
  var width = props.width,
1384
- height = props.height,
1385
- missingProps = props.missingProps;
1576
+ height = props.height,
1577
+ missingProps = props.missingProps;
1386
1578
  return React.createElement(Message_1.default, {
1387
1579
  "data-test": "message",
1388
1580
  width: width,
@@ -1390,6 +1582,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
1390
1582
  message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
1391
1583
  });
1392
1584
  };
1585
+
1393
1586
  exports.MissingPropsMessage = MissingPropsMessage;
1394
1587
  exports.MissingPropsMessage.propTypes = propTypes;
1395
1588
  exports.MissingPropsMessage.defaultProps = {
@@ -1408,15 +1601,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
1408
1601
  Object.defineProperty(exports, "__esModule", {
1409
1602
  value: true
1410
1603
  });
1604
+
1411
1605
  var React = __webpack_require__(1);
1606
+
1412
1607
  var styled_components_1 = __webpack_require__(4);
1608
+
1413
1609
  var hocUtils_1 = __webpack_require__(15);
1610
+
1414
1611
  var Cover = styled_components_1.default.div.withConfig({
1415
1612
  displayName: "withEditModeCover__Cover",
1416
1613
  componentId: "sc-1gsbnxb-0"
1417
1614
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1418
1615
  var Blocker = styled_components_1.default.div.attrs({
1419
- 'data-splunk-visualization-version': "26.0.0 - 2f7458907"
1616
+ 'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
1420
1617
  }).withConfig({
1421
1618
  displayName: "withEditModeCover__Blocker",
1422
1619
  componentId: "sc-1gsbnxb-1"
@@ -1427,6 +1624,7 @@ var Blocker = styled_components_1.default.div.attrs({
1427
1624
  * @param {ExtendedDashViz} Visualization
1428
1625
  * @returns {ExtendedDashViz} Wrapper
1429
1626
  */
1627
+
1430
1628
  var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
1431
1629
  var Wrapper = function Wrapper(props) {
1432
1630
  var mode = props.mode;
@@ -1435,12 +1633,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1435
1633
  "data-test": "edit-mode-cover"
1436
1634
  }));
1437
1635
  };
1636
+
1438
1637
  (0, hocUtils_1.extendStaticWrapperProps)({
1439
1638
  Wrapper: Wrapper,
1440
1639
  Visualization: Visualization
1441
1640
  });
1442
1641
  return Wrapper;
1443
1642
  };
1643
+
1444
1644
  exports.default = withEditModeCover;
1445
1645
 
1446
1646
  /***/ }),
@@ -1453,27 +1653,37 @@ exports.default = withEditModeCover;
1453
1653
  Object.defineProperty(exports, "__esModule", {
1454
1654
  value: true
1455
1655
  });
1656
+
1456
1657
  var React = __webpack_require__(1);
1658
+
1457
1659
  var colorUtils_1 = __webpack_require__(12);
1660
+
1458
1661
  var variables_1 = __webpack_require__(11);
1662
+
1459
1663
  var IconPlaceholder_1 = __webpack_require__(32);
1664
+
1460
1665
  var VizBehavior_1 = __webpack_require__(6);
1666
+
1461
1667
  var hocUtils_1 = __webpack_require__(15);
1668
+
1462
1669
  var withPlaceholder = function withPlaceholder(Visualization) {
1463
1670
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
1464
1671
  var config = Visualization.config;
1465
1672
  var themes = config.themes;
1673
+
1466
1674
  var Wrapper = function Wrapper(props) {
1467
1675
  var _a, _b;
1676
+
1468
1677
  var dataSources = props.dataSources,
1469
- loading = props.loading,
1470
- options = props.options,
1471
- height = props.height,
1472
- width = props.width;
1678
+ loading = props.loading,
1679
+ options = props.options,
1680
+ height = props.height,
1681
+ width = props.width;
1473
1682
  var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
1474
1683
  var bgColorFromTheme = (0, 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);
1475
1684
  var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
1476
1685
  var iconColor = variables_1.default.contentColorActive(props);
1686
+
1477
1687
  if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
1478
1688
  return React.createElement(IconPlaceholder_1.default, {
1479
1689
  "data-test": "icon-placeholder",
@@ -1484,14 +1694,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1484
1694
  iconColor: iconColor
1485
1695
  });
1486
1696
  }
1697
+
1487
1698
  return React.createElement(Visualization, Object.assign({}, props));
1488
1699
  };
1700
+
1489
1701
  (0, hocUtils_1.extendStaticWrapperProps)({
1490
1702
  Wrapper: Wrapper,
1491
1703
  Visualization: Visualization
1492
1704
  });
1493
1705
  return Wrapper;
1494
1706
  };
1707
+
1495
1708
  exports.default = withPlaceholder;
1496
1709
 
1497
1710
  /***/ }),
@@ -1529,11 +1742,13 @@ module.exports = require("@splunk/visualization-color-palettes");
1529
1742
  Object.defineProperty(exports, "__esModule", {
1530
1743
  value: true
1531
1744
  });
1745
+
1532
1746
  var i18n_1 = __webpack_require__(2);
1747
+
1533
1748
  var background = function background(_ref) {
1534
1749
  var label = _ref.label,
1535
- themes = _ref.themes,
1536
- labelPosition = _ref.labelPosition;
1750
+ themes = _ref.themes,
1751
+ labelPosition = _ref.labelPosition;
1537
1752
  return [{
1538
1753
  label: (0, i18n_1._)(label || 'Background'),
1539
1754
  option: 'backgroundColor',
@@ -1544,6 +1759,7 @@ var background = function background(_ref) {
1544
1759
  }
1545
1760
  }];
1546
1761
  };
1762
+
1547
1763
  exports.default = background;
1548
1764
 
1549
1765
  /***/ }),
@@ -1603,13 +1819,18 @@ module.exports = require("@splunk/visualization-color-palettes/editors/PresetPal
1603
1819
 
1604
1820
 
1605
1821
  var _toConsumableArray = __webpack_require__(8);
1822
+
1606
1823
  Object.defineProperty(exports, "__esModule", {
1607
1824
  value: true
1608
1825
  });
1609
1826
  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;
1827
+
1610
1828
  var lodash_1 = __webpack_require__(3);
1829
+
1611
1830
  var colorConstants_1 = __webpack_require__(49);
1831
+
1612
1832
  var i18n_1 = __webpack_require__(2);
1833
+
1613
1834
  exports.GAUGE_THICKNESS = 50;
1614
1835
  exports.FILL_THICKNESS = 38;
1615
1836
  var GRADIENT_STOP_OFFSET_MIN = 0;
@@ -1622,11 +1843,13 @@ var GRADIENT_STOP_OFFSET_MAX = 100;
1622
1843
  * @param {String} orientation
1623
1844
  * @return {Number} width
1624
1845
  */
1846
+
1625
1847
  var getGaugeWidth = function getGaugeWidth(_ref) {
1626
1848
  var containerWidth = _ref.containerWidth,
1627
- orientation = _ref.orientation;
1849
+ orientation = _ref.orientation;
1628
1850
  return orientation === 'vertical' ? exports.GAUGE_THICKNESS : containerWidth * 0.8;
1629
1851
  };
1852
+
1630
1853
  exports.getGaugeWidth = getGaugeWidth;
1631
1854
  /**
1632
1855
  * get height for the whole gauge viz for horizontal or vertical view
@@ -1636,11 +1859,13 @@ exports.getGaugeWidth = getGaugeWidth;
1636
1859
  * @param {String} orientation
1637
1860
  * @return {Number} height
1638
1861
  */
1862
+
1639
1863
  var getGaugeHeight = function getGaugeHeight(_ref2) {
1640
1864
  var containerHeight = _ref2.containerHeight,
1641
- orientation = _ref2.orientation;
1865
+ orientation = _ref2.orientation;
1642
1866
  return orientation === 'vertical' ? containerHeight * 0.8 : exports.GAUGE_THICKNESS;
1643
1867
  };
1868
+
1644
1869
  exports.getGaugeHeight = getGaugeHeight;
1645
1870
  /**
1646
1871
  * get how long the gauge shoud be.
@@ -1652,10 +1877,11 @@ exports.getGaugeHeight = getGaugeHeight;
1652
1877
  * @param {String} input.orientation
1653
1878
  * @return {Number} gaugeLength
1654
1879
  */
1880
+
1655
1881
  var getGaugeLength = function getGaugeLength(_ref3) {
1656
1882
  var containerWidth = _ref3.containerWidth,
1657
- containerHeight = _ref3.containerHeight,
1658
- orientation = _ref3.orientation;
1883
+ containerHeight = _ref3.containerHeight,
1884
+ orientation = _ref3.orientation;
1659
1885
  return orientation === 'vertical' ? (0, exports.getGaugeHeight)({
1660
1886
  containerHeight: containerHeight,
1661
1887
  orientation: orientation
@@ -1664,6 +1890,7 @@ var getGaugeLength = function getGaugeLength(_ref3) {
1664
1890
  orientation: orientation
1665
1891
  });
1666
1892
  };
1893
+
1667
1894
  exports.getGaugeLength = getGaugeLength;
1668
1895
  /**
1669
1896
  * get start x and y for rendering gauge
@@ -1677,23 +1904,27 @@ exports.getGaugeLength = getGaugeLength;
1677
1904
  * @return {Number} position.gaugeStartX
1678
1905
  * @return {Number} position.gaugeStartY
1679
1906
  */
1907
+
1680
1908
  var getGaugeStartPosition = function getGaugeStartPosition(_ref4) {
1681
1909
  var containerWidth = _ref4.containerWidth,
1682
- containerHeight = _ref4.containerHeight,
1683
- gaugeLength = _ref4.gaugeLength,
1684
- orientation = _ref4.orientation;
1910
+ containerHeight = _ref4.containerHeight,
1911
+ gaugeLength = _ref4.gaugeLength,
1912
+ orientation = _ref4.orientation;
1685
1913
  // for horizontal view
1686
1914
  var gaugeStartX = (containerWidth - gaugeLength) / 2.0;
1687
1915
  var gaugeStartY = (containerHeight - exports.GAUGE_THICKNESS) / 2.0;
1916
+
1688
1917
  if (orientation === 'vertical') {
1689
1918
  gaugeStartX = (containerWidth - exports.GAUGE_THICKNESS) / 2.0;
1690
1919
  gaugeStartY = (containerHeight - gaugeLength) / 2.0;
1691
1920
  }
1921
+
1692
1922
  return {
1693
1923
  gaugeStartX: gaugeStartX,
1694
1924
  gaugeStartY: gaugeStartY
1695
1925
  };
1696
1926
  };
1927
+
1697
1928
  exports.getGaugeStartPosition = getGaugeStartPosition;
1698
1929
  /**
1699
1930
  * get dimensions for the whole gauge viz,
@@ -1710,23 +1941,26 @@ exports.getGaugeStartPosition = getGaugeStartPosition;
1710
1941
  * @return {Number} gaugeDimensions.gaugeWidth natural width of gauge
1711
1942
  * @return {Number} gaugeDimensions.gaugeHeight natural height of gauge
1712
1943
  */
1944
+
1713
1945
  var getGaugeDimensions = function getGaugeDimensions(_ref5) {
1714
1946
  var containerWidth = _ref5.containerWidth,
1715
- containerHeight = _ref5.containerHeight,
1716
- orientation = _ref5.orientation;
1947
+ containerHeight = _ref5.containerHeight,
1948
+ orientation = _ref5.orientation;
1717
1949
  var gaugeLength = (0, exports.getGaugeLength)({
1718
1950
  containerWidth: containerWidth,
1719
1951
  containerHeight: containerHeight,
1720
1952
  orientation: orientation
1721
1953
  });
1954
+
1722
1955
  var _ref6 = (0, exports.getGaugeStartPosition)({
1723
- containerWidth: containerWidth,
1724
- containerHeight: containerHeight,
1725
- gaugeLength: gaugeLength,
1726
- orientation: orientation
1727
- }),
1728
- gaugeStartX = _ref6.gaugeStartX,
1729
- gaugeStartY = _ref6.gaugeStartY;
1956
+ containerWidth: containerWidth,
1957
+ containerHeight: containerHeight,
1958
+ gaugeLength: gaugeLength,
1959
+ orientation: orientation
1960
+ }),
1961
+ gaugeStartX = _ref6.gaugeStartX,
1962
+ gaugeStartY = _ref6.gaugeStartY;
1963
+
1730
1964
  var gaugeWidth = (0, exports.getGaugeWidth)({
1731
1965
  containerWidth: containerWidth,
1732
1966
  orientation: orientation
@@ -1743,6 +1977,7 @@ var getGaugeDimensions = function getGaugeDimensions(_ref5) {
1743
1977
  gaugeHeight: gaugeHeight
1744
1978
  };
1745
1979
  };
1980
+
1746
1981
  exports.getGaugeDimensions = getGaugeDimensions;
1747
1982
  /**
1748
1983
  * if gaugeColor is not specified, auto assign a gauge color to the fill bar
@@ -1750,19 +1985,24 @@ exports.getGaugeDimensions = getGaugeDimensions;
1750
1985
  * @method assignGaugeColor
1751
1986
  * @params
1752
1987
  * */
1988
+
1753
1989
  var assignGaugeColor = function assignGaugeColor(_ref7) {
1754
1990
  var value = _ref7.value,
1755
- min = _ref7.min,
1756
- max = _ref7.max;
1991
+ min = _ref7.min,
1992
+ max = _ref7.max;
1757
1993
  var rate = (value - min) / (max - min);
1994
+
1758
1995
  if (rate <= 0.3) {
1759
1996
  return colorConstants_1.SEMANTIC_SUCCESS;
1760
1997
  }
1998
+
1761
1999
  if (rate > 0.3 && rate <= 0.6) {
1762
2000
  return colorConstants_1.SEMANTIC_WARNING;
1763
2001
  }
2002
+
1764
2003
  return colorConstants_1.SEMANTIC_ERROR;
1765
2004
  };
2005
+
1766
2006
  exports.assignGaugeColor = assignGaugeColor;
1767
2007
  /**
1768
2008
  * get inner bar length in gauge
@@ -1774,22 +2014,28 @@ exports.assignGaugeColor = assignGaugeColor;
1774
2014
  * @param {Number} input.max
1775
2015
  * @return {Number} gaugeBarLength
1776
2016
  */
2017
+
1777
2018
  var getGaugeBarLength = function getGaugeBarLength(_ref8) {
1778
2019
  var gaugeLength = _ref8.gaugeLength,
1779
- value = _ref8.value,
1780
- min = _ref8.min,
1781
- max = _ref8.max;
2020
+ value = _ref8.value,
2021
+ min = _ref8.min,
2022
+ max = _ref8.max;
2023
+
1782
2024
  if (max < min) {
1783
2025
  return null;
1784
2026
  }
2027
+
1785
2028
  if (value >= max) {
1786
2029
  return gaugeLength;
1787
2030
  }
2031
+
1788
2032
  if (value < min) {
1789
2033
  return 0;
1790
2034
  }
2035
+
1791
2036
  return gaugeLength * (value - min) / (max - min);
1792
2037
  };
2038
+
1793
2039
  exports.getGaugeBarLength = getGaugeBarLength;
1794
2040
  /**
1795
2041
  * get x and y position for rendering inner bar in gauge
@@ -1805,26 +2051,30 @@ exports.getGaugeBarLength = getGaugeBarLength;
1805
2051
  * @return {Number} position.gaugeBarX
1806
2052
  * @return {Number} position.gaugeBarY
1807
2053
  */
2054
+
1808
2055
  var getGaugeBarStartPositions = function getGaugeBarStartPositions(_ref9) {
1809
2056
  var gaugeStartX = _ref9.gaugeStartX,
1810
- gaugeStartY = _ref9.gaugeStartY,
1811
- gaugeWidth = _ref9.gaugeWidth,
1812
- gaugeHeight = _ref9.gaugeHeight,
1813
- gaugeBarLength = _ref9.gaugeBarLength,
1814
- orientation = _ref9.orientation;
2057
+ gaugeStartY = _ref9.gaugeStartY,
2058
+ gaugeWidth = _ref9.gaugeWidth,
2059
+ gaugeHeight = _ref9.gaugeHeight,
2060
+ gaugeBarLength = _ref9.gaugeBarLength,
2061
+ orientation = _ref9.orientation;
1815
2062
  var gaugeBarX = gaugeStartX;
1816
2063
  var gaugeBarY = gaugeStartY;
2064
+
1817
2065
  if (orientation === 'vertical') {
1818
2066
  gaugeBarX += (gaugeWidth - exports.FILL_THICKNESS) / 2;
1819
2067
  gaugeBarY += gaugeHeight - gaugeBarLength;
1820
2068
  } else {
1821
2069
  gaugeBarY += (gaugeHeight - exports.FILL_THICKNESS) / 2;
1822
2070
  }
2071
+
1823
2072
  return {
1824
2073
  gaugeBarX: gaugeBarX,
1825
2074
  gaugeBarY: gaugeBarY
1826
2075
  };
1827
2076
  };
2077
+
1828
2078
  exports.getGaugeBarStartPositions = getGaugeBarStartPositions;
1829
2079
  /**
1830
2080
  * get width of inner bar in gauge
@@ -1834,11 +2084,13 @@ exports.getGaugeBarStartPositions = getGaugeBarStartPositions;
1834
2084
  * @param {String} orientation
1835
2085
  * @return {Number} gaugeBarWidth
1836
2086
  */
2087
+
1837
2088
  var getGaugeBarWidth = function getGaugeBarWidth(_ref10) {
1838
2089
  var gaugeBarLength = _ref10.gaugeBarLength,
1839
- orientation = _ref10.orientation;
2090
+ orientation = _ref10.orientation;
1840
2091
  return orientation === 'vertical' ? exports.FILL_THICKNESS : gaugeBarLength;
1841
2092
  };
2093
+
1842
2094
  exports.getGaugeBarWidth = getGaugeBarWidth;
1843
2095
  /**
1844
2096
  * get height of inner bar in gauge
@@ -1848,11 +2100,13 @@ exports.getGaugeBarWidth = getGaugeBarWidth;
1848
2100
  * @param {String} orientation
1849
2101
  * @return {Number} gaugeBarHeight
1850
2102
  */
2103
+
1851
2104
  var getGaugeBarHeight = function getGaugeBarHeight(_ref11) {
1852
2105
  var gaugeBarLength = _ref11.gaugeBarLength,
1853
- orientation = _ref11.orientation;
2106
+ orientation = _ref11.orientation;
1854
2107
  return orientation === 'vertical' ? gaugeBarLength : exports.FILL_THICKNESS;
1855
2108
  };
2109
+
1856
2110
  exports.getGaugeBarHeight = getGaugeBarHeight;
1857
2111
  /**
1858
2112
  * get dimensions for the fill bar in the gauge
@@ -1874,32 +2128,35 @@ exports.getGaugeBarHeight = getGaugeBarHeight;
1874
2128
  * @return {Number} fillBarDimensions.fillBarWidth
1875
2129
  * @return {Number} fillBarDimensions.fillBarHeight
1876
2130
  */
2131
+
1877
2132
  var getFillBarDimensions = function getFillBarDimensions(_ref12) {
1878
2133
  var gaugeLength = _ref12.gaugeLength,
1879
- gaugeStartX = _ref12.gaugeStartX,
1880
- gaugeStartY = _ref12.gaugeStartY,
1881
- gaugeWidth = _ref12.gaugeWidth,
1882
- gaugeHeight = _ref12.gaugeHeight,
1883
- value = _ref12.value,
1884
- min = _ref12.min,
1885
- max = _ref12.max,
1886
- orientation = _ref12.orientation;
2134
+ gaugeStartX = _ref12.gaugeStartX,
2135
+ gaugeStartY = _ref12.gaugeStartY,
2136
+ gaugeWidth = _ref12.gaugeWidth,
2137
+ gaugeHeight = _ref12.gaugeHeight,
2138
+ value = _ref12.value,
2139
+ min = _ref12.min,
2140
+ max = _ref12.max,
2141
+ orientation = _ref12.orientation;
1887
2142
  var gaugeBarLength = (0, exports.getGaugeBarLength)({
1888
2143
  gaugeLength: gaugeLength,
1889
2144
  value: value,
1890
2145
  max: max,
1891
2146
  min: min
1892
2147
  });
2148
+
1893
2149
  var _ref13 = (0, exports.getGaugeBarStartPositions)({
1894
- gaugeStartX: gaugeStartX,
1895
- gaugeStartY: gaugeStartY,
1896
- gaugeWidth: gaugeWidth,
1897
- gaugeHeight: gaugeHeight,
1898
- gaugeBarLength: gaugeBarLength,
1899
- orientation: orientation
1900
- }),
1901
- fillBarX = _ref13.gaugeBarX,
1902
- fillBarY = _ref13.gaugeBarY;
2150
+ gaugeStartX: gaugeStartX,
2151
+ gaugeStartY: gaugeStartY,
2152
+ gaugeWidth: gaugeWidth,
2153
+ gaugeHeight: gaugeHeight,
2154
+ gaugeBarLength: gaugeBarLength,
2155
+ orientation: orientation
2156
+ }),
2157
+ fillBarX = _ref13.gaugeBarX,
2158
+ fillBarY = _ref13.gaugeBarY;
2159
+
1903
2160
  var fillBarWidth = (0, exports.getGaugeBarWidth)({
1904
2161
  gaugeBarLength: gaugeBarLength,
1905
2162
  orientation: orientation
@@ -1916,6 +2173,7 @@ var getFillBarDimensions = function getFillBarDimensions(_ref12) {
1916
2173
  fillBarHeight: fillBarHeight
1917
2174
  };
1918
2175
  };
2176
+
1919
2177
  exports.getFillBarDimensions = getFillBarDimensions;
1920
2178
  /**
1921
2179
  * get position x and y for value marker in filler gauge
@@ -1929,24 +2187,28 @@ exports.getFillBarDimensions = getFillBarDimensions;
1929
2187
  * @return {Number} position.valueMarkerX
1930
2188
  * @return {Number} position.valueMarkerY
1931
2189
  */
2190
+
1932
2191
  var getFillerGaugeValueMarkerPositions = function getFillerGaugeValueMarkerPositions(_ref14) {
1933
2192
  var fillBarX = _ref14.fillBarX,
1934
- fillBarY = _ref14.fillBarY,
1935
- fillBarLength = _ref14.fillBarLength,
1936
- orientation = _ref14.orientation;
2193
+ fillBarY = _ref14.fillBarY,
2194
+ fillBarLength = _ref14.fillBarLength,
2195
+ orientation = _ref14.orientation;
1937
2196
  var valueMarkerX = fillBarX;
1938
2197
  var valueMarkerY = fillBarY;
2198
+
1939
2199
  if (orientation === 'vertical') {
1940
2200
  valueMarkerX -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
1941
2201
  } else {
1942
2202
  valueMarkerX += fillBarLength;
1943
2203
  valueMarkerY -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
1944
2204
  }
2205
+
1945
2206
  return {
1946
2207
  valueMarkerX: valueMarkerX,
1947
2208
  valueMarkerY: valueMarkerY
1948
2209
  };
1949
2210
  };
2211
+
1950
2212
  exports.getFillerGaugeValueMarkerPositions = getFillerGaugeValueMarkerPositions;
1951
2213
  /**
1952
2214
  * get dimensions for the marker bar in the gauge
@@ -1965,24 +2227,27 @@ exports.getFillerGaugeValueMarkerPositions = getFillerGaugeValueMarkerPositions;
1965
2227
  * @return {Number} markerBarDimensions.markerBarWidth
1966
2228
  * @return {Number} markerBarDimensions.markerBarHeight
1967
2229
  */
2230
+
1968
2231
  var getMarkerBarDimensions = function getMarkerBarDimensions(_ref15) {
1969
2232
  var gaugeLength = _ref15.gaugeLength,
1970
- gaugeStartX = _ref15.gaugeStartX,
1971
- gaugeStartY = _ref15.gaugeStartY,
1972
- gaugeWidth = _ref15.gaugeWidth,
1973
- gaugeHeight = _ref15.gaugeHeight,
1974
- orientation = _ref15.orientation;
2233
+ gaugeStartX = _ref15.gaugeStartX,
2234
+ gaugeStartY = _ref15.gaugeStartY,
2235
+ gaugeWidth = _ref15.gaugeWidth,
2236
+ gaugeHeight = _ref15.gaugeHeight,
2237
+ orientation = _ref15.orientation;
1975
2238
  var gaugeBarLength = gaugeLength; // For marker gauge, inner marker bar spans the entire gauge
2239
+
1976
2240
  var _ref16 = (0, exports.getGaugeBarStartPositions)({
1977
- gaugeStartX: gaugeStartX,
1978
- gaugeStartY: gaugeStartY,
1979
- gaugeWidth: gaugeWidth,
1980
- gaugeHeight: gaugeHeight,
1981
- gaugeBarLength: gaugeBarLength,
1982
- orientation: orientation
1983
- }),
1984
- markerBarX = _ref16.gaugeBarX,
1985
- markerBarY = _ref16.gaugeBarY;
2241
+ gaugeStartX: gaugeStartX,
2242
+ gaugeStartY: gaugeStartY,
2243
+ gaugeWidth: gaugeWidth,
2244
+ gaugeHeight: gaugeHeight,
2245
+ gaugeBarLength: gaugeBarLength,
2246
+ orientation: orientation
2247
+ }),
2248
+ markerBarX = _ref16.gaugeBarX,
2249
+ markerBarY = _ref16.gaugeBarY;
2250
+
1986
2251
  var markerBarWidth = (0, exports.getGaugeBarWidth)({
1987
2252
  gaugeBarLength: gaugeBarLength,
1988
2253
  orientation: orientation
@@ -1999,6 +2264,7 @@ var getMarkerBarDimensions = function getMarkerBarDimensions(_ref15) {
1999
2264
  markerBarHeight: markerBarHeight
2000
2265
  };
2001
2266
  };
2267
+
2002
2268
  exports.getMarkerBarDimensions = getMarkerBarDimensions;
2003
2269
  /**
2004
2270
  * get position x and y for value marker in marker gauge
@@ -2016,17 +2282,19 @@ exports.getMarkerBarDimensions = getMarkerBarDimensions;
2016
2282
  * @return {Number} position.valueMarkerX
2017
2283
  * @return {Number} position.valueMarkerY
2018
2284
  */
2285
+
2019
2286
  var getMarkerGaugeValueMarkerPositions = function getMarkerGaugeValueMarkerPositions(_ref17) {
2020
2287
  var markerBarX = _ref17.markerBarX,
2021
- markerBarY = _ref17.markerBarY,
2022
- markerBarHeight = _ref17.markerBarHeight,
2023
- gaugeLength = _ref17.markerBarLength,
2024
- orientation = _ref17.orientation,
2025
- value = _ref17.value,
2026
- min = _ref17.min,
2027
- max = _ref17.max;
2288
+ markerBarY = _ref17.markerBarY,
2289
+ markerBarHeight = _ref17.markerBarHeight,
2290
+ gaugeLength = _ref17.markerBarLength,
2291
+ orientation = _ref17.orientation,
2292
+ value = _ref17.value,
2293
+ min = _ref17.min,
2294
+ max = _ref17.max;
2028
2295
  var valueMarkerX = markerBarX;
2029
2296
  var valueMarkerY = markerBarY;
2297
+
2030
2298
  if (orientation === 'vertical') {
2031
2299
  valueMarkerY += markerBarHeight - (0, exports.getGaugeBarLength)({
2032
2300
  gaugeLength: gaugeLength,
@@ -2044,11 +2312,13 @@ var getMarkerGaugeValueMarkerPositions = function getMarkerGaugeValueMarkerPosit
2044
2312
  });
2045
2313
  valueMarkerY -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
2046
2314
  }
2315
+
2047
2316
  return {
2048
2317
  valueMarkerX: valueMarkerX,
2049
2318
  valueMarkerY: valueMarkerY
2050
2319
  };
2051
2320
  };
2321
+
2052
2322
  exports.getMarkerGaugeValueMarkerPositions = getMarkerGaugeValueMarkerPositions;
2053
2323
  /**
2054
2324
  * sort the ranges in ascending order
@@ -2056,11 +2326,13 @@ exports.getMarkerGaugeValueMarkerPositions = getMarkerGaugeValueMarkerPositions;
2056
2326
  * @param {Array} ranges
2057
2327
  * @return {Array} sortedRanges
2058
2328
  */
2329
+
2059
2330
  var getSortedRanges = function getSortedRanges(ranges) {
2060
2331
  return ranges.sort(function (a, b) {
2061
2332
  return a.from - b.from;
2062
2333
  });
2063
2334
  };
2335
+
2064
2336
  exports.getSortedRanges = getSortedRanges;
2065
2337
  /**
2066
2338
  * validate whether ranges prop is valid - continuous ranges, range.to < range.from, range.from != range.to
@@ -2068,29 +2340,35 @@ exports.getSortedRanges = getSortedRanges;
2068
2340
  * @param {Array} ranges
2069
2341
  * @return {String} error
2070
2342
  */
2343
+
2071
2344
  var validateRanges = function validateRanges(ranges) {
2072
2345
  if (!ranges.length) {
2073
2346
  return (0, i18n_1._)('Prop "ranges" is missing entries');
2074
- }
2075
- // check whether a range has "from" >= "to" eg: 10 - 10, 100 - 10, -20 - -10 are invalid
2347
+ } // check whether a range has "from" >= "to" eg: 10 - 10, 100 - 10, -20 - -10 are invalid
2348
+
2349
+
2076
2350
  if (ranges.some(function (range) {
2077
2351
  return range.from >= range.to;
2078
2352
  })) {
2079
2353
  return (0, i18n_1._)('Prop "ranges" has invalid entries: invalid range');
2080
- }
2081
- // check whether ranges have duplicate "from/to" eg: 0 - 50, 25 - 50
2354
+ } // check whether ranges have duplicate "from/to" eg: 0 - 50, 25 - 50
2355
+
2356
+
2082
2357
  if (ranges.length !== (0, lodash_1.uniqBy)(ranges, 'to').length || ranges.length !== (0, lodash_1.uniqBy)(ranges, 'from').length) {
2083
2358
  return (0, i18n_1._)('Prop "ranges" has invalid entries: duplicate values');
2084
2359
  }
2085
- var sortedRanges = (0, exports.getSortedRanges)(ranges);
2086
- // check whether ranges are continuous eg: 0 - 10, 10 - 20, 20 - 30
2360
+
2361
+ var sortedRanges = (0, exports.getSortedRanges)(ranges); // check whether ranges are continuous eg: 0 - 10, 10 - 20, 20 - 30
2362
+
2087
2363
  for (var i = 1; i < sortedRanges.length; i += 1) {
2088
2364
  if (sortedRanges[i].from !== sortedRanges[i - 1].to) {
2089
2365
  return (0, i18n_1._)('Prop "ranges" has invalid entries: discontinuous ranges');
2090
2366
  }
2091
2367
  }
2368
+
2092
2369
  return null;
2093
2370
  };
2371
+
2094
2372
  exports.validateRanges = validateRanges;
2095
2373
  /**
2096
2374
  * calculate min and max value of gauge
@@ -2100,6 +2378,7 @@ exports.validateRanges = validateRanges;
2100
2378
  * @return {Number} gaugeRange.min
2101
2379
  * @return {Number} gaugeRange.max
2102
2380
  */
2381
+
2103
2382
  var getGaugeRange = function getGaugeRange(ranges) {
2104
2383
  var min = Math.min.apply(Math, _toConsumableArray(ranges.map(function (range) {
2105
2384
  return range.from;
@@ -2112,6 +2391,7 @@ var getGaugeRange = function getGaugeRange(ranges) {
2112
2391
  max: max
2113
2392
  };
2114
2393
  };
2394
+
2115
2395
  exports.getGaugeRange = getGaugeRange;
2116
2396
  /**
2117
2397
  * calculate stop offsets for linear gradient
@@ -2120,17 +2400,20 @@ exports.getGaugeRange = getGaugeRange;
2120
2400
  * @param {String} orientation
2121
2401
  * @return {Array} cumulativeOffsets
2122
2402
  */
2403
+
2123
2404
  var getGradientStopOffsets = function getGradientStopOffsets(_ref18) {
2124
2405
  var ranges = _ref18.ranges,
2125
- orientation = _ref18.orientation;
2406
+ orientation = _ref18.orientation;
2407
+
2126
2408
  var _ref19 = (0, exports.getGaugeRange)(ranges),
2127
- min = _ref19.min,
2128
- max = _ref19.max;
2409
+ min = _ref19.min,
2410
+ max = _ref19.max;
2411
+
2129
2412
  var offsetScale = (GRADIENT_STOP_OFFSET_MAX - GRADIENT_STOP_OFFSET_MIN) / (max - min);
2130
2413
  var offsets = ranges.map(function (range) {
2131
2414
  return Math.abs(range.from - range.to) * offsetScale;
2132
- });
2133
- // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
2415
+ }); // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
2416
+
2134
2417
  offsets = orientation === 'vertical' ? offsets.reverse() : offsets;
2135
2418
  var cumulativeOffsets = [];
2136
2419
  offsets.reduce(function (accumulator, currentValue, idx) {
@@ -2139,6 +2422,7 @@ var getGradientStopOffsets = function getGradientStopOffsets(_ref18) {
2139
2422
  }, 0);
2140
2423
  return cumulativeOffsets;
2141
2424
  };
2425
+
2142
2426
  exports.getGradientStopOffsets = getGradientStopOffsets;
2143
2427
  /**
2144
2428
  * calculate stop colors for linear gradient
@@ -2147,15 +2431,17 @@ exports.getGradientStopOffsets = getGradientStopOffsets;
2147
2431
  * @param {String} orientation
2148
2432
  * @return {Array} stopColors
2149
2433
  */
2434
+
2150
2435
  var getGradientStopColors = function getGradientStopColors(_ref20) {
2151
2436
  var ranges = _ref20.ranges,
2152
- orientation = _ref20.orientation;
2437
+ orientation = _ref20.orientation;
2153
2438
  var stopColors = ranges.map(function (range) {
2154
2439
  return range.value;
2155
- });
2156
- // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
2440
+ }); // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
2441
+
2157
2442
  return orientation === 'vertical' ? stopColors.reverse() : stopColors;
2158
2443
  };
2444
+
2159
2445
  exports.getGradientStopColors = getGradientStopColors;
2160
2446
  /**
2161
2447
  * calculate linear gradient stops from ranges
@@ -2165,9 +2451,10 @@ exports.getGradientStopColors = getGradientStopColors;
2165
2451
  * @param {String} orientation
2166
2452
  * @return {Array} stops
2167
2453
  */
2454
+
2168
2455
  var getGradientStops = function getGradientStops(_ref21) {
2169
2456
  var ranges = _ref21.ranges,
2170
- orientation = _ref21.orientation;
2457
+ orientation = _ref21.orientation;
2171
2458
  var stops = [];
2172
2459
  var offsets = (0, exports.getGradientStopOffsets)({
2173
2460
  ranges: ranges,
@@ -2176,13 +2463,13 @@ var getGradientStops = function getGradientStops(_ref21) {
2176
2463
  var stopColors = (0, exports.getGradientStopColors)({
2177
2464
  ranges: ranges,
2178
2465
  orientation: orientation
2179
- });
2180
- // Initialize stops with the first color stop
2466
+ }); // Initialize stops with the first color stop
2467
+
2181
2468
  stops.push({
2182
2469
  offset: "".concat(offsets[0], "%"),
2183
2470
  stopColor: stopColors[0]
2184
- });
2185
- // Add the remaining color stops with gradient change at each stop
2471
+ }); // Add the remaining color stops with gradient change at each stop
2472
+
2186
2473
  for (var i = 1; i < ranges.length; i += 1) {
2187
2474
  stops.push({
2188
2475
  offset: "".concat(offsets[i - 1], "%"),
@@ -2193,8 +2480,10 @@ var getGradientStops = function getGradientStops(_ref21) {
2193
2480
  stopColor: stopColors[i]
2194
2481
  });
2195
2482
  }
2483
+
2196
2484
  return stops;
2197
2485
  };
2486
+
2198
2487
  exports.getGradientStops = getGradientStops;
2199
2488
  /**
2200
2489
  * calculate linear gradient dimensions
@@ -2206,6 +2495,7 @@ exports.getGradientStops = getGradientStops;
2206
2495
  * @return {String} dimensions.x2
2207
2496
  * @return {String} dimensions.y2
2208
2497
  */
2498
+
2209
2499
  var getGradientDimensions = function getGradientDimensions(orientation) {
2210
2500
  var x1 = '0%';
2211
2501
  var y1 = '0%';
@@ -2218,8 +2508,9 @@ var getGradientDimensions = function getGradientDimensions(orientation) {
2218
2508
  y2: y2
2219
2509
  };
2220
2510
  };
2221
- exports.getGradientDimensions = getGradientDimensions;
2222
- // map for new options names to old option names
2511
+
2512
+ exports.getGradientDimensions = getGradientDimensions; // map for new options names to old option names
2513
+
2223
2514
  var gaugeOptionsMapping = {
2224
2515
  majorTickInterval: 'majorUnit',
2225
2516
  gaugeRanges: 'ranges'
@@ -2230,11 +2521,13 @@ var gaugeOptionsMapping = {
2230
2521
  * @param {Object} options
2231
2522
  * @returns {Object}
2232
2523
  */
2524
+
2233
2525
  var mapToOldKey = function mapToOldKey(options) {
2234
2526
  return (0, lodash_1.mapKeys)(options, function (val, key) {
2235
2527
  return gaugeOptionsMapping[key] ? gaugeOptionsMapping[key] : key;
2236
2528
  });
2237
2529
  };
2530
+
2238
2531
  exports.mapToOldKey = mapToOldKey;
2239
2532
  /**
2240
2533
  * Helper method to map labelDisplay and valueDisplay options to pure component option names
@@ -2243,12 +2536,14 @@ exports.mapToOldKey = mapToOldKey;
2243
2536
  * @param {Object} options
2244
2537
  * @returns {Object}
2245
2538
  */
2539
+
2246
2540
  var mapValueLabelDisplay = function mapValueLabelDisplay(labelOrValue, options) {
2247
2541
  var rangeOrValue = labelOrValue === 'value' ? 'Value' : 'Range';
2248
2542
  var showKey = labelOrValue === 'value' ? 'showValue' : 'showLabels';
2249
2543
  var percentKey = "usePercentage".concat(rangeOrValue);
2250
2544
  var optionString = "".concat(labelOrValue, "Display");
2251
2545
  var newOptions = Object.assign({}, options);
2546
+
2252
2547
  if (newOptions[optionString]) {
2253
2548
  if (newOptions[optionString] === 'number') {
2254
2549
  newOptions[showKey] = true;
@@ -2261,8 +2556,10 @@ var mapValueLabelDisplay = function mapValueLabelDisplay(labelOrValue, options)
2261
2556
  newOptions[percentKey] = false;
2262
2557
  }
2263
2558
  }
2559
+
2264
2560
  return (0, lodash_1.omit)(newOptions, [optionString]);
2265
2561
  };
2562
+
2266
2563
  exports.mapValueLabelDisplay = mapValueLabelDisplay;
2267
2564
  /**
2268
2565
  * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that pure component accepts
@@ -2271,6 +2568,7 @@ exports.mapValueLabelDisplay = mapValueLabelDisplay;
2271
2568
  * @param {Object} originalOptions
2272
2569
  * @returns {Object}
2273
2570
  */
2571
+
2274
2572
  var convertToGaugeProperties = function convertToGaugeProperties(originalOptions) {
2275
2573
  return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru(function (options) {
2276
2574
  return (0, exports.mapValueLabelDisplay)('label', options);
@@ -2278,6 +2576,7 @@ var convertToGaugeProperties = function convertToGaugeProperties(originalOptions
2278
2576
  return (0, exports.mapValueLabelDisplay)('value', options);
2279
2577
  }).value();
2280
2578
  };
2579
+
2281
2580
  exports.convertToGaugeProperties = convertToGaugeProperties;
2282
2581
 
2283
2582
  /***/ }),
@@ -2317,7 +2616,9 @@ exports.convertToGaugeProperties = convertToGaugeProperties;
2317
2616
  Object.defineProperty(exports, "__esModule", {
2318
2617
  value: true
2319
2618
  });
2619
+
2320
2620
  var i18n_1 = __webpack_require__(2);
2621
+
2321
2622
  var gauge = {
2322
2623
  label: (0, i18n_1._)('Data display'),
2323
2624
  layout: [[{
@@ -2411,16 +2712,16 @@ var MajorTickLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.te
2411
2712
  });
2412
2713
  var MajorTick = function MajorTick(_ref) {
2413
2714
  var index = _ref.index,
2414
- x1 = _ref.x1,
2415
- y1 = _ref.y1,
2416
- x2 = _ref.x2,
2417
- y2 = _ref.y2,
2418
- showLabels = _ref.showLabels,
2419
- label = _ref.label,
2420
- labelX = _ref.labelX,
2421
- labelY = _ref.labelY,
2422
- majorTickStrokeColor = _ref.majorTickStrokeColor,
2423
- majorTickFillColor = _ref.majorTickFillColor;
2715
+ x1 = _ref.x1,
2716
+ y1 = _ref.y1,
2717
+ x2 = _ref.x2,
2718
+ y2 = _ref.y2,
2719
+ showLabels = _ref.showLabels,
2720
+ label = _ref.label,
2721
+ labelX = _ref.labelX,
2722
+ labelY = _ref.labelY,
2723
+ majorTickStrokeColor = _ref.majorTickStrokeColor,
2724
+ majorTickFillColor = _ref.majorTickFillColor;
2424
2725
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLine, {
2425
2726
  index: index,
2426
2727
  x1: x1,
@@ -2450,7 +2751,6 @@ MajorTick.propTypes = {
2450
2751
  majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
2451
2752
  majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
2452
2753
  };
2453
-
2454
2754
  /**
2455
2755
  * calculate position for each major tick
2456
2756
  * @method positionMajorTick
@@ -2464,20 +2764,22 @@ MajorTick.propTypes = {
2464
2764
  * @param {Number} input.i index of major tick
2465
2765
  * @return {Object} MajorTick positions
2466
2766
  */
2767
+
2467
2768
  var positionMajorTick = function positionMajorTick(_ref2) {
2468
2769
  var width = _ref2.width,
2469
- height = _ref2.height,
2470
- startX = _ref2.startX,
2471
- startY = _ref2.startY,
2472
- orientation = _ref2.orientation,
2473
- numOfTicks = _ref2.numOfTicks,
2474
- i = _ref2.i;
2770
+ height = _ref2.height,
2771
+ startX = _ref2.startX,
2772
+ startY = _ref2.startY,
2773
+ orientation = _ref2.orientation,
2774
+ numOfTicks = _ref2.numOfTicks,
2775
+ i = _ref2.i;
2475
2776
  var x1 = startX;
2476
2777
  var y1 = startY;
2477
2778
  var x2 = startX;
2478
2779
  var y2 = startY;
2479
2780
  var labelX = startX;
2480
2781
  var labelY;
2782
+
2481
2783
  if (orientation === 'vertical') {
2482
2784
  var y = height / numOfTicks * (numOfTicks - i) + startY;
2483
2785
  x1 -= TICK_LENGTH_DELTA;
@@ -2495,6 +2797,7 @@ var positionMajorTick = function positionMajorTick(_ref2) {
2495
2797
  labelX = x;
2496
2798
  labelY = y2 + 16;
2497
2799
  }
2800
+
2498
2801
  return {
2499
2802
  x1: x1,
2500
2803
  y1: y1,
@@ -2504,39 +2807,43 @@ var positionMajorTick = function positionMajorTick(_ref2) {
2504
2807
  labelY: labelY
2505
2808
  };
2506
2809
  };
2810
+
2507
2811
  var MajorTicks = function MajorTicks(_ref3) {
2508
2812
  var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
2813
+
2509
2814
  var width = props.width,
2510
- height = props.height,
2511
- startX = props.startX,
2512
- startY = props.startY,
2513
- min = props.min,
2514
- max = props.max,
2515
- majorUnit = props.majorUnit,
2516
- orientation = props.orientation,
2517
- showLabels = props.showLabels,
2518
- usePercentageRange = props.usePercentageRange,
2519
- majorTickFillColor = props.majorTickFillColor,
2520
- majorTickStrokeColor = props.majorTickStrokeColor;
2815
+ height = props.height,
2816
+ startX = props.startX,
2817
+ startY = props.startY,
2818
+ min = props.min,
2819
+ max = props.max,
2820
+ majorUnit = props.majorUnit,
2821
+ orientation = props.orientation,
2822
+ showLabels = props.showLabels,
2823
+ usePercentageRange = props.usePercentageRange,
2824
+ majorTickFillColor = props.majorTickFillColor,
2825
+ majorTickStrokeColor = props.majorTickStrokeColor;
2521
2826
  var range = max - min;
2522
2827
  var numOfTicks = majorUnit === 'auto' || Number.isNaN(Number(majorUnit)) || majorUnit <= 0 ? DEFAULT_NUM_OF_TICKS : range / majorUnit;
2523
2828
  var majorTicks = [];
2829
+
2524
2830
  for (var i = 0; i <= numOfTicks; i += 1) {
2525
2831
  var _positionMajorTick = positionMajorTick({
2526
- width: width,
2527
- height: height,
2528
- startX: startX,
2529
- startY: startY,
2530
- orientation: orientation,
2531
- numOfTicks: numOfTicks,
2532
- i: i
2533
- }),
2534
- x1 = _positionMajorTick.x1,
2535
- y1 = _positionMajorTick.y1,
2536
- x2 = _positionMajorTick.x2,
2537
- y2 = _positionMajorTick.y2,
2538
- labelX = _positionMajorTick.labelX,
2539
- labelY = _positionMajorTick.labelY;
2832
+ width: width,
2833
+ height: height,
2834
+ startX: startX,
2835
+ startY: startY,
2836
+ orientation: orientation,
2837
+ numOfTicks: numOfTicks,
2838
+ i: i
2839
+ }),
2840
+ x1 = _positionMajorTick.x1,
2841
+ y1 = _positionMajorTick.y1,
2842
+ x2 = _positionMajorTick.x2,
2843
+ y2 = _positionMajorTick.y2,
2844
+ labelX = _positionMajorTick.labelX,
2845
+ labelY = _positionMajorTick.labelY;
2846
+
2540
2847
  var label = usePercentageRange ? "".concat(parseInt((i / numOfTicks - min / range) * 100, 10), "%") : parseInt(min + range / numOfTicks * i, 10);
2541
2848
  majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
2542
2849
  key: i,
@@ -2552,26 +2859,28 @@ var MajorTicks = function MajorTicks(_ref3) {
2552
2859
  majorTickFillColor: majorTickFillColor,
2553
2860
  majorTickStrokeColor: majorTickStrokeColor
2554
2861
  }));
2555
- }
2862
+ } // if the gauge is not divided evenly, put the last tick at the end of the gauge
2863
+
2556
2864
 
2557
- // if the gauge is not divided evenly, put the last tick at the end of the gauge
2558
2865
  if (!Number.isInteger(numOfTicks)) {
2559
2866
  var extraNumOfTicks = Math.ceil(numOfTicks);
2867
+
2560
2868
  var _positionMajorTick2 = positionMajorTick({
2561
- width: width,
2562
- height: height,
2563
- startX: startX,
2564
- startY: startY,
2565
- orientation: orientation,
2566
- numOfTicks: extraNumOfTicks,
2567
- i: extraNumOfTicks
2568
- }),
2569
- _x = _positionMajorTick2.x1,
2570
- _y = _positionMajorTick2.y1,
2571
- _x2 = _positionMajorTick2.x2,
2572
- _y2 = _positionMajorTick2.y2,
2573
- _labelX = _positionMajorTick2.labelX,
2574
- _labelY = _positionMajorTick2.labelY;
2869
+ width: width,
2870
+ height: height,
2871
+ startX: startX,
2872
+ startY: startY,
2873
+ orientation: orientation,
2874
+ numOfTicks: extraNumOfTicks,
2875
+ i: extraNumOfTicks
2876
+ }),
2877
+ _x = _positionMajorTick2.x1,
2878
+ _y = _positionMajorTick2.y1,
2879
+ _x2 = _positionMajorTick2.x2,
2880
+ _y2 = _positionMajorTick2.y2,
2881
+ _labelX = _positionMajorTick2.labelX,
2882
+ _labelY = _positionMajorTick2.labelY;
2883
+
2575
2884
  majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
2576
2885
  key: extraNumOfTicks,
2577
2886
  id: extraNumOfTicks,
@@ -2587,8 +2896,10 @@ var MajorTicks = function MajorTicks(_ref3) {
2587
2896
  majorTickStrokeColor: majorTickStrokeColor
2588
2897
  }));
2589
2898
  }
2899
+
2590
2900
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, majorTicks);
2591
2901
  };
2902
+
2592
2903
  MajorTicks.propTypes = {
2593
2904
  width: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2594
2905
  height: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
@@ -2660,7 +2971,6 @@ var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.
2660
2971
  })(["fill:", ";font-size:14px;font-family:Splunk Platform Sans,sans-serif;line-height:16px;text-anchor:middle;text-align:center;dominant-baseline:middle;"], function (props) {
2661
2972
  return props.valueMarkerLabelFillColor;
2662
2973
  });
2663
-
2664
2974
  /**
2665
2975
  * calculate the path of Value Marker shape
2666
2976
  * @method positionValueMarkerRect
@@ -2671,13 +2981,14 @@ var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.
2671
2981
  * @param {Number} input.valueMarkerRectLength
2672
2982
  * @return {String} d containing a series of path commands that define the path to be
2673
2983
  */
2984
+
2674
2985
  var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
2675
2986
  var x = _ref.x,
2676
- y = _ref.y,
2677
- orientation = _ref.orientation,
2678
- valueMarkerRectLength = _ref.valueMarkerRectLength,
2679
- _ref$alignCenter = _ref.alignCenter,
2680
- alignCenter = _ref$alignCenter === void 0 ? false : _ref$alignCenter;
2987
+ y = _ref.y,
2988
+ orientation = _ref.orientation,
2989
+ valueMarkerRectLength = _ref.valueMarkerRectLength,
2990
+ _ref$alignCenter = _ref.alignCenter,
2991
+ alignCenter = _ref$alignCenter === void 0 ? false : _ref$alignCenter;
2681
2992
  var hLength = MARKER_THICKNESS;
2682
2993
  var vLength = valueMarkerRectLength;
2683
2994
  var markerStartX = alignCenter ? x - MARKER_THICKNESS / 2 : x - MARKER_THICKNESS;
@@ -2686,6 +2997,7 @@ var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
2686
2997
  var innerVLength = MARKER_INNER_LENGTH;
2687
2998
  var innerStartX = markerStartX + innerHLength;
2688
2999
  var innerStartY = markerStartY + 7;
3000
+
2689
3001
  if (orientation === 'vertical') {
2690
3002
  hLength = valueMarkerRectLength;
2691
3003
  vLength = MARKER_THICKNESS;
@@ -2696,9 +3008,9 @@ var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
2696
3008
  innerStartX = markerStartX + 7;
2697
3009
  innerStartY = markerStartY + innerVLength;
2698
3010
  }
3011
+
2699
3012
  return "M".concat(markerStartX, ",").concat(markerStartY, "h").concat(hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(RADIUS, "v").concat(vLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(RADIUS, "h").concat(-hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(-RADIUS, "v").concat(2 * RADIUS - vLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(-RADIUS, "z") + "M".concat(innerStartX, ",").concat(innerStartY, "v").concat(innerVLength - RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(RADIUS, "h").concat(innerHLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(-RADIUS, "v").concat(RADIUS - innerVLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(-RADIUS, "h").concat(2 * RADIUS - innerHLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(RADIUS, "z");
2700
3013
  };
2701
-
2702
3014
  /**
2703
3015
  * calculate the position of value marker label
2704
3016
  * @method positionLabel
@@ -2713,20 +3025,23 @@ var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
2713
3025
  * @return {Number} positions.labelX x of value marker label text
2714
3026
  * @return {Number} positions.labelY y of value marker label text
2715
3027
  */
3028
+
2716
3029
  var positionLabel = function positionLabel(_ref2) {
2717
3030
  var x = _ref2.x,
2718
- y = _ref2.y,
2719
- length = _ref2.length,
2720
- orientation = _ref2.orientation,
2721
- _ref2$alignCenter = _ref2.alignCenter,
2722
- alignCenter = _ref2$alignCenter === void 0 ? false : _ref2$alignCenter;
2723
- // for horizontal view
3031
+ y = _ref2.y,
3032
+ length = _ref2.length,
3033
+ orientation = _ref2.orientation,
3034
+ _ref2$alignCenter = _ref2.alignCenter,
3035
+ alignCenter = _ref2$alignCenter === void 0 ? false : _ref2$alignCenter; // for horizontal view
3036
+
2724
3037
  var labelRectX = alignCenter ? x - MARKER_LABEL_WIDTH / 2 : x - MARKER_THICKNESS / 2 - MARKER_LABEL_WIDTH / 2;
2725
3038
  var labelRectY = y + length;
3039
+
2726
3040
  if (orientation === 'vertical') {
2727
3041
  labelRectX = x + length;
2728
3042
  labelRectY = alignCenter ? y - MARKER_LABEL_HEIGHT / 2 : y - (MARKER_LABEL_HEIGHT - MARKER_THICKNESS) / 2;
2729
3043
  }
3044
+
2730
3045
  var labelX = labelRectX + MARKER_LABEL_WIDTH / 2;
2731
3046
  var labelY = labelRectY + MARKER_LABEL_HEIGHT / 2;
2732
3047
  return {
@@ -2736,32 +3051,36 @@ var positionLabel = function positionLabel(_ref2) {
2736
3051
  labelY: labelY
2737
3052
  };
2738
3053
  };
3054
+
2739
3055
  var ValueMarker = function ValueMarker(_ref3) {
2740
3056
  var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
3057
+
2741
3058
  var x = props.x,
2742
- y = props.y,
2743
- length = props.length,
2744
- min = props.min,
2745
- max = props.max,
2746
- value = props.value,
2747
- orientation = props.orientation,
2748
- showValue = props.showValue,
2749
- usePercentageValue = props.usePercentageValue,
2750
- valueMarkerFillColor = props.valueMarkerFillColor,
2751
- valueMarkerLabelFillColor = props.valueMarkerLabelFillColor,
2752
- alignCenter = props.alignCenter;
3059
+ y = props.y,
3060
+ length = props.length,
3061
+ min = props.min,
3062
+ max = props.max,
3063
+ value = props.value,
3064
+ orientation = props.orientation,
3065
+ showValue = props.showValue,
3066
+ usePercentageValue = props.usePercentageValue,
3067
+ valueMarkerFillColor = props.valueMarkerFillColor,
3068
+ valueMarkerLabelFillColor = props.valueMarkerLabelFillColor,
3069
+ alignCenter = props.alignCenter;
2753
3070
  var valueMarkerRectLength = length + DELTA_LENGTH;
3071
+
2754
3072
  var _positionLabel = positionLabel({
2755
- x: x,
2756
- y: y,
2757
- length: length,
2758
- orientation: orientation,
2759
- alignCenter: alignCenter
2760
- }),
2761
- labelRectX = _positionLabel.labelRectX,
2762
- labelRectY = _positionLabel.labelRectY,
2763
- labelX = _positionLabel.labelX,
2764
- labelY = _positionLabel.labelY;
3073
+ x: x,
3074
+ y: y,
3075
+ length: length,
3076
+ orientation: orientation,
3077
+ alignCenter: alignCenter
3078
+ }),
3079
+ labelRectX = _positionLabel.labelRectX,
3080
+ labelRectY = _positionLabel.labelRectY,
3081
+ labelX = _positionLabel.labelX,
3082
+ labelY = _positionLabel.labelY;
3083
+
2765
3084
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerRect, {
2766
3085
  "data-test": "value-marker-rect",
2767
3086
  d: positionValueMarkerRect({
@@ -2791,6 +3110,7 @@ var ValueMarker = function ValueMarker(_ref3) {
2791
3110
  useTrendUnits: true
2792
3111
  }))));
2793
3112
  };
3113
+
2794
3114
  ValueMarker.propTypes = {
2795
3115
  x: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2796
3116
  y: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
@@ -2909,28 +3229,39 @@ ValueMarker.defaultProps = {
2909
3229
 
2910
3230
  var __rest = this && this.__rest || function (s, e) {
2911
3231
  var t = {};
3232
+
2912
3233
  for (var p in s) {
2913
3234
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2914
3235
  }
3236
+
2915
3237
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2916
3238
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2917
3239
  }
2918
3240
  return t;
2919
3241
  };
3242
+
2920
3243
  Object.defineProperty(exports, "__esModule", {
2921
3244
  value: true
2922
3245
  });
2923
3246
  exports.themes = exports.computeVizProps = exports.PureFillerGauge = exports.config = void 0;
3247
+
2924
3248
  var lodash_1 = __webpack_require__(3);
3249
+
2925
3250
  var config_1 = __webpack_require__(215);
2926
- var withDashboardViz_1 = __webpack_require__(36);
3251
+
3252
+ var withDashboardViz_1 = __webpack_require__(37);
3253
+
2927
3254
  var FillerGauge_1 = __webpack_require__(219);
3255
+
2928
3256
  var gaugeUtils_1 = __webpack_require__(98);
3257
+
2929
3258
  exports.config = config_1.default;
2930
3259
  exports.PureFillerGauge = FillerGauge_1.default;
2931
3260
  var validOptions = Object.keys(exports.config.optionsSchema);
3261
+
2932
3262
  var computeVizProps = function computeVizProps(_a) {
2933
3263
  var props = __rest(_a, []);
3264
+
2934
3265
  var options = (0, lodash_1.chain)(props).pick(validOptions).thru(gaugeUtils_1.convertToGaugeProperties).value();
2935
3266
  var defaultColors = {
2936
3267
  backgroundBarFillColor: exports.config.themes.defaultBackgroundBarFillColor(props),
@@ -2941,6 +3272,7 @@ var computeVizProps = function computeVizProps(_a) {
2941
3272
  };
2942
3273
  return Object.assign(Object.assign({}, options), defaultColors);
2943
3274
  };
3275
+
2944
3276
  exports.computeVizProps = computeVizProps;
2945
3277
  var viz = (0, withDashboardViz_1.default)({
2946
3278
  ReactViz: FillerGauge_1.default,
@@ -2960,21 +3292,37 @@ exports.default = viz;
2960
3292
  Object.defineProperty(exports, "__esModule", {
2961
3293
  value: true
2962
3294
  });
3295
+
2963
3296
  var i18n_1 = __webpack_require__(2);
3297
+
2964
3298
  var schemaUtils_1 = __webpack_require__(16);
3299
+
2965
3300
  var pick_1 = __webpack_require__(23);
3301
+
2966
3302
  var variables_1 = __webpack_require__(11);
3303
+
2967
3304
  var visualization_color_palettes_1 = __webpack_require__(51);
3305
+
2968
3306
  var PresetPalettes_1 = __webpack_require__(61);
3307
+
2969
3308
  var GaugeFiller_1 = __webpack_require__(216);
3309
+
2970
3310
  var placeholders_1 = __webpack_require__(50);
3311
+
2971
3312
  var VizBehavior_1 = __webpack_require__(6);
2972
- var VizCategory_1 = __webpack_require__(35);
3313
+
3314
+ var VizCategory_1 = __webpack_require__(36);
3315
+
2973
3316
  var configUtils_1 = __webpack_require__(20);
3317
+
2974
3318
  var Gauge_1 = __webpack_require__(126);
3319
+
2975
3320
  var BackgroundColor_1 = __webpack_require__(53);
3321
+
2976
3322
  var DynamicGaugeColorEditor_1 = __webpack_require__(217);
3323
+
2977
3324
  var StaticGaugeColorEditor_1 = __webpack_require__(218);
3325
+
2978
3326
  var dataContract = {
2979
3327
  requiredDataSources: [{
2980
3328
  name: 'primary',
@@ -3078,12 +3426,13 @@ var themes = {
3078
3426
  enterprise: {
3079
3427
  light: variables_1.default.gray30(props),
3080
3428
  dark: variables_1.default.textGray(props) // was #D7DAE0
3081
- },
3082
3429
 
3430
+ },
3083
3431
  prisma: {
3084
3432
  // TODO: missed colors :(
3085
3433
  light: variables_1.default.neutral100(props),
3086
3434
  dark: variables_1.default.contentColorMuted(props) // was #D7DAE0; contentColor
3435
+
3087
3436
  }
3088
3437
  })(props);
3089
3438
  },
@@ -3171,7 +3520,7 @@ var editorConfig = [{
3171
3520
  presets: presets,
3172
3521
  value: function value(_ref) {
3173
3522
  var context = _ref.context,
3174
- options = _ref.options;
3523
+ options = _ref.options;
3175
3524
  var initialPreset = (0, configUtils_1.getInitialPreset)(context, options, presets);
3176
3525
  return initialPreset && initialPreset.label || null;
3177
3526
  }
@@ -3190,16 +3539,19 @@ var editorConfig = [{
3190
3539
  /**
3191
3540
  * visualization configuration
3192
3541
  */
3542
+
3193
3543
  var config = {
3194
3544
  /**
3195
3545
  * unique viz key
3196
3546
  */
3197
3547
  key: 'splunk.fillergauge',
3548
+
3198
3549
  /**
3199
3550
  * viz name
3200
3551
  */
3201
3552
  name: (0, i18n_1._)('Filler gauge'),
3202
3553
  category: VizCategory_1.VizCategory.GAUGE,
3554
+
3203
3555
  /**
3204
3556
  * viz icon
3205
3557
  */
@@ -3232,11 +3584,14 @@ Object.defineProperty(exports, "__esModule", {
3232
3584
  value: true
3233
3585
  });
3234
3586
  exports.getDynamicGaugeColorEditor = void 0;
3587
+
3235
3588
  var i18n_1 = __webpack_require__(2);
3589
+
3236
3590
  var configUtils_1 = __webpack_require__(22);
3591
+
3237
3592
  var getDynamicGaugeColorEditor = function getDynamicGaugeColorEditor(_ref) {
3238
3593
  var defaultContext = _ref.defaultContext,
3239
- defaultPalettesConfig = _ref.defaultPalettesConfig;
3594
+ defaultPalettesConfig = _ref.defaultPalettesConfig;
3240
3595
  return {
3241
3596
  label: (0, i18n_1._)('Gauge'),
3242
3597
  option: 'gaugeColor',
@@ -3264,6 +3619,7 @@ var getDynamicGaugeColorEditor = function getDynamicGaugeColorEditor(_ref) {
3264
3619
  }
3265
3620
  };
3266
3621
  };
3622
+
3267
3623
  exports.getDynamicGaugeColorEditor = getDynamicGaugeColorEditor;
3268
3624
 
3269
3625
  /***/ }),
@@ -3276,8 +3632,11 @@ exports.getDynamicGaugeColorEditor = getDynamicGaugeColorEditor;
3276
3632
  Object.defineProperty(exports, "__esModule", {
3277
3633
  value: true
3278
3634
  });
3635
+
3279
3636
  var i18n_1 = __webpack_require__(2);
3637
+
3280
3638
  var configUtils_1 = __webpack_require__(22);
3639
+
3281
3640
  var StaticGaugeColorEditor = {
3282
3641
  label: (0, i18n_1._)('Gauge'),
3283
3642
  option: 'gaugeColor',
@@ -3298,29 +3657,44 @@ exports.default = StaticGaugeColorEditor;
3298
3657
 
3299
3658
  var __rest = this && this.__rest || function (s, e) {
3300
3659
  var t = {};
3660
+
3301
3661
  for (var p in s) {
3302
3662
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
3303
3663
  }
3664
+
3304
3665
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3305
3666
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
3306
3667
  }
3307
3668
  return t;
3308
3669
  };
3670
+
3309
3671
  Object.defineProperty(exports, "__esModule", {
3310
3672
  value: true
3311
3673
  });
3312
3674
  exports.AXIS_ORIENTATION_TYPES = void 0;
3675
+
3313
3676
  var React = __webpack_require__(1);
3677
+
3314
3678
  var T = __webpack_require__(0);
3679
+
3315
3680
  var styled_components_1 = __webpack_require__(4);
3681
+
3316
3682
  var lodash_1 = __webpack_require__(3);
3683
+
3317
3684
  var i18n_1 = __webpack_require__(2);
3685
+
3318
3686
  var style_1 = __webpack_require__(14);
3687
+
3319
3688
  var SizeAwareWrapper_1 = __webpack_require__(19);
3689
+
3320
3690
  var Message_1 = __webpack_require__(10);
3691
+
3321
3692
  var gaugeUtils_1 = __webpack_require__(98);
3693
+
3322
3694
  var GaugeMajorTicks_1 = __webpack_require__(127);
3695
+
3323
3696
  var GaugeValueMarker_1 = __webpack_require__(128);
3697
+
3324
3698
  var Container = styled_components_1.default.div.withConfig({
3325
3699
  displayName: "FillerGauge__Container",
3326
3700
  componentId: "u356pd-0"
@@ -3368,33 +3742,38 @@ var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
3368
3742
  var MIN_HORIZONTAL_CONTAINER_WIDTH = 200;
3369
3743
  var MIN_HORIZONTAL_CONTAINER_HEIGHT = 100;
3370
3744
  var AXIS_ORIENTATION_TYPES;
3745
+
3371
3746
  (function (AXIS_ORIENTATION_TYPES) {
3372
3747
  AXIS_ORIENTATION_TYPES["VERTICAL"] = "vertical";
3373
3748
  AXIS_ORIENTATION_TYPES["HORIZONTAL"] = "horizontal";
3374
3749
  })(AXIS_ORIENTATION_TYPES = exports.AXIS_ORIENTATION_TYPES || (exports.AXIS_ORIENTATION_TYPES = {}));
3750
+
3375
3751
  var FillerGauge = function FillerGauge(_a) {
3376
3752
  var props = __rest(_a, []);
3753
+
3377
3754
  var width = props.width,
3378
- height = props.height,
3379
- value = props.value,
3380
- gaugeColor = props.gaugeColor,
3381
- min = props.min,
3382
- max = props.max,
3383
- orientation = props.orientation,
3384
- majorUnit = props.majorUnit,
3385
- showLabels = props.showLabels,
3386
- showValue = props.showValue,
3387
- usePercentageRange = props.usePercentageRange,
3388
- usePercentageValue = props.usePercentageValue,
3389
- backgroundColor = props.backgroundColor,
3390
- backgroundBarFillColor = props.backgroundBarFillColor,
3391
- majorTickFillColor = props.majorTickFillColor,
3392
- majorTickStrokeColor = props.majorTickStrokeColor,
3393
- valueMarkerFillColor = props.valueMarkerFillColor,
3394
- valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
3755
+ height = props.height,
3756
+ value = props.value,
3757
+ gaugeColor = props.gaugeColor,
3758
+ min = props.min,
3759
+ max = props.max,
3760
+ orientation = props.orientation,
3761
+ majorUnit = props.majorUnit,
3762
+ showLabels = props.showLabels,
3763
+ showValue = props.showValue,
3764
+ usePercentageRange = props.usePercentageRange,
3765
+ usePercentageValue = props.usePercentageValue,
3766
+ backgroundColor = props.backgroundColor,
3767
+ backgroundBarFillColor = props.backgroundBarFillColor,
3768
+ majorTickFillColor = props.majorTickFillColor,
3769
+ majorTickStrokeColor = props.majorTickStrokeColor,
3770
+ valueMarkerFillColor = props.valueMarkerFillColor,
3771
+ valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
3772
+
3395
3773
  var renderVisualization = function renderVisualization(_ref) {
3396
3774
  var containerWidth = _ref.width,
3397
- containerHeight = _ref.height;
3775
+ containerHeight = _ref.height;
3776
+
3398
3777
  // todo: need change the size when get design for smaller space
3399
3778
  // 58 is the title & description header height in dashboard visualization
3400
3779
  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') {
@@ -3405,40 +3784,44 @@ var FillerGauge = function FillerGauge(_a) {
3405
3784
  level: "info"
3406
3785
  });
3407
3786
  }
3787
+
3408
3788
  var _ref2 = (0, gaugeUtils_1.getGaugeDimensions)({
3409
- containerWidth: containerWidth,
3410
- containerHeight: containerHeight,
3411
- orientation: orientation
3412
- }),
3413
- gaugeLength = _ref2.gaugeLength,
3414
- gaugeStartX = _ref2.gaugeStartX,
3415
- gaugeStartY = _ref2.gaugeStartY,
3416
- gaugeWidth = _ref2.gaugeWidth,
3417
- gaugeHeight = _ref2.gaugeHeight;
3789
+ containerWidth: containerWidth,
3790
+ containerHeight: containerHeight,
3791
+ orientation: orientation
3792
+ }),
3793
+ gaugeLength = _ref2.gaugeLength,
3794
+ gaugeStartX = _ref2.gaugeStartX,
3795
+ gaugeStartY = _ref2.gaugeStartY,
3796
+ gaugeWidth = _ref2.gaugeWidth,
3797
+ gaugeHeight = _ref2.gaugeHeight;
3798
+
3418
3799
  var _ref3 = (0, gaugeUtils_1.getFillBarDimensions)({
3419
- gaugeLength: gaugeLength,
3420
- gaugeStartX: gaugeStartX,
3421
- gaugeStartY: gaugeStartY,
3422
- gaugeWidth: gaugeWidth,
3423
- gaugeHeight: gaugeHeight,
3424
- value: value,
3425
- min: min,
3426
- max: max,
3427
- orientation: orientation
3428
- }),
3429
- fillBarLength = _ref3.fillBarLength,
3430
- fillBarX = _ref3.fillBarX,
3431
- fillBarY = _ref3.fillBarY,
3432
- fillBarWidth = _ref3.fillBarWidth,
3433
- fillBarHeight = _ref3.fillBarHeight;
3800
+ gaugeLength: gaugeLength,
3801
+ gaugeStartX: gaugeStartX,
3802
+ gaugeStartY: gaugeStartY,
3803
+ gaugeWidth: gaugeWidth,
3804
+ gaugeHeight: gaugeHeight,
3805
+ value: value,
3806
+ min: min,
3807
+ max: max,
3808
+ orientation: orientation
3809
+ }),
3810
+ fillBarLength = _ref3.fillBarLength,
3811
+ fillBarX = _ref3.fillBarX,
3812
+ fillBarY = _ref3.fillBarY,
3813
+ fillBarWidth = _ref3.fillBarWidth,
3814
+ fillBarHeight = _ref3.fillBarHeight;
3815
+
3434
3816
  var _ref4 = (0, gaugeUtils_1.getFillerGaugeValueMarkerPositions)({
3435
- fillBarX: fillBarX,
3436
- fillBarY: fillBarY,
3437
- fillBarLength: fillBarLength,
3438
- orientation: orientation
3439
- }),
3440
- valueMarkerX = _ref4.valueMarkerX,
3441
- valueMarkerY = _ref4.valueMarkerY;
3817
+ fillBarX: fillBarX,
3818
+ fillBarY: fillBarY,
3819
+ fillBarLength: fillBarLength,
3820
+ orientation: orientation
3821
+ }),
3822
+ valueMarkerX = _ref4.valueMarkerX,
3823
+ valueMarkerY = _ref4.valueMarkerY;
3824
+
3442
3825
  return React.createElement(FillerGaugeWrapper, {
3443
3826
  backgroundColor: backgroundColor,
3444
3827
  "data-test": "FillerGaugeWrapper"
@@ -3495,6 +3878,7 @@ var FillerGauge = function FillerGauge(_a) {
3495
3878
  valueMarkerLabelFillColor: valueMarkerLabelFillColor
3496
3879
  }))));
3497
3880
  };
3881
+
3498
3882
  return React.createElement(Container, {
3499
3883
  width: width,
3500
3884
  height: height,
@@ -3503,6 +3887,7 @@ var FillerGauge = function FillerGauge(_a) {
3503
3887
  return renderVisualization(containerDimension);
3504
3888
  }));
3505
3889
  };
3890
+
3506
3891
  var propTypes = {
3507
3892
  width: T.oneOfType([T.string, T.number]),
3508
3893
  height: T.oneOfType([T.string, T.number]),