@splunk/visualizations 26.0.0 → 26.1.1

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 (152) hide show
  1. package/Area.config.js +103 -19
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +646 -243
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +105 -21
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +653 -237
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +95 -21
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +635 -229
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +66 -15
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +589 -211
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +104 -19
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +666 -239
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +83 -18
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +444 -156
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +101 -19
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +792 -322
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +97 -28
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +786 -390
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +63 -19
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +439 -164
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +107 -23
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +841 -456
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +73 -23
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +653 -230
  44. package/LinkGraph.js.map +1 -1
  45. package/MIGRATION.md +1082 -0
  46. package/Map.config.js +244 -99
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +1223 -612
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +71 -21
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +477 -202
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +80 -22
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +819 -418
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +73 -19
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +870 -491
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +76 -23
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +643 -233
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +82 -30
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +863 -387
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +86 -20
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +449 -159
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +85 -23
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +895 -349
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +97 -23
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +639 -234
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +95 -25
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +1198 -656
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +287 -226
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +93 -23
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +991 -522
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +100 -27
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +1185 -624
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +127 -68
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +74 -21
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +827 -329
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +152 -69
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +25 -14
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/DocExampleWithVizSandbox.js +530 -0
  107. package/common/DocExampleWithVizSandbox.js.map +1 -0
  108. package/common/EventsDoc.js +139 -104
  109. package/common/EventsDoc.js.map +1 -1
  110. package/common/GaugeMajorTicks.js +79 -69
  111. package/common/GaugeMajorTicks.js.map +1 -1
  112. package/common/GaugeValueMarker.js +54 -45
  113. package/common/GaugeValueMarker.js.map +1 -1
  114. package/common/OptionsDoc.js +178 -87
  115. package/common/OptionsDoc.js.map +1 -1
  116. package/common/OverviewDoc.js +530 -68
  117. package/common/OverviewDoc.js.map +1 -1
  118. package/common/SplunkVisualization.js +47 -20
  119. package/common/SplunkVisualization.js.map +1 -1
  120. package/common/SplunkVisualizationApi.js +15 -9
  121. package/common/SplunkVisualizationApi.js.map +1 -1
  122. package/common/ThemesDoc.js +57 -44
  123. package/common/ThemesDoc.js.map +1 -1
  124. package/common/chartingUtils.js +52 -20
  125. package/common/chartingUtils.js.map +1 -1
  126. package/common/docUtils.js +139 -7
  127. package/common/docUtils.js.map +1 -1
  128. package/common/gaugeUtils.js +185 -102
  129. package/common/gaugeUtils.js.map +1 -1
  130. package/common/shapeUtils.js +28 -16
  131. package/common/shapeUtils.js.map +1 -1
  132. package/common/utils/configUtils.js +50 -15
  133. package/common/utils/configUtils.js.map +1 -1
  134. package/common/utils/dataUtils.js +8 -3
  135. package/common/utils/dataUtils.js.map +1 -1
  136. package/common/utils/hocUtils.js +4 -2
  137. package/common/utils/hocUtils.js.map +1 -1
  138. package/common/utils/layoutUtils.js +2 -1
  139. package/common/utils/layoutUtils.js.map +1 -1
  140. package/common/utils/mapUtils.js +288 -128
  141. package/common/utils/mapUtils.js.map +1 -1
  142. package/common/utils/singleValueUtils.js +242 -197
  143. package/common/utils/singleValueUtils.js.map +1 -1
  144. package/common/utils/testHelper.js +10 -1
  145. package/common/utils/testHelper.js.map +1 -1
  146. package/common/utils/trellisUtils.js +62 -1
  147. package/common/utils/trellisUtils.js.map +1 -1
  148. package/common/utils/urlUtils.js +3 -1
  149. package/common/utils/urlUtils.js.map +1 -1
  150. package/common/withDashboardViz.js +389 -192
  151. package/common/withDashboardViz.js.map +1 -1
  152. package/package.json +18 -26
package/SingleValue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2018 Splunk Inc.
2
+ * Copyright © 2024 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
5
  */
@@ -127,7 +127,7 @@ __webpack_require__.r(__webpack_exports__);
127
127
 
128
128
  var getDynamicTrendColorEditor = function getDynamicTrendColorEditor(_ref) {
129
129
  var defaultContext = _ref.defaultContext,
130
- defaultPalettesConfig = _ref.defaultPalettesConfig;
130
+ defaultPalettesConfig = _ref.defaultPalettesConfig;
131
131
  return {
132
132
  label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Trend value'),
133
133
  option: 'trendColor',
@@ -172,7 +172,7 @@ __webpack_require__.r(__webpack_exports__);
172
172
 
173
173
  var getDynamicBackgroundColorEditor = function getDynamicBackgroundColorEditor(_ref) {
174
174
  var defaultContext = _ref.defaultContext,
175
- defaultPalettesConfig = _ref.defaultPalettesConfig;
175
+ defaultPalettesConfig = _ref.defaultPalettesConfig;
176
176
  return {
177
177
  label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background'),
178
178
  option: 'backgroundColor',
@@ -326,11 +326,17 @@ Object.defineProperty(exports, "__esModule", {
326
326
  value: true
327
327
  });
328
328
  exports.TrellisBackgroundColorEditor = exports.TrellisEditorConfig = void 0;
329
+
329
330
  var React = __webpack_require__(1);
331
+
330
332
  var i18n_1 = __webpack_require__(2);
333
+
331
334
  var FeatureFlagContext_1 = __webpack_require__(21);
335
+
332
336
  var layoutUtils_1 = __webpack_require__(58);
333
337
  /* eslint-disable react-hooks/rules-of-hooks */
338
+
339
+
334
340
  exports.TrellisEditorConfig = [[{
335
341
  label: (0, i18n_1._)('Trellis layout'),
336
342
  option: 'splitByLayout',
@@ -428,37 +434,60 @@ exports.TrellisBackgroundColorEditor = {
428
434
 
429
435
 
430
436
  var _slicedToArray = __webpack_require__(17);
437
+
431
438
  var __rest = this && this.__rest || function (s, e) {
432
439
  var t = {};
440
+
433
441
  for (var p in s) {
434
442
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
435
443
  }
444
+
436
445
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
437
446
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
438
447
  }
439
448
  return t;
440
449
  };
450
+
441
451
  Object.defineProperty(exports, "__esModule", {
442
452
  value: true
443
453
  });
454
+
444
455
  var React = __webpack_require__(1);
456
+
445
457
  var react_1 = __webpack_require__(1);
458
+
446
459
  var lodash_1 = __webpack_require__(3);
460
+
447
461
  var styled_components_1 = __webpack_require__(4);
448
- var Paginator_1 = __webpack_require__(93);
462
+
463
+ var Paginator_1 = __webpack_require__(94);
464
+
449
465
  var i18n_1 = __webpack_require__(2);
466
+
450
467
  var themes_1 = __webpack_require__(60);
451
- var useSplunkTheme_1 = __webpack_require__(57);
468
+
469
+ var useSplunkTheme_1 = __webpack_require__(56);
470
+
452
471
  var FeatureFlagContext_1 = __webpack_require__(21);
472
+
453
473
  var SizeAwareWrapper_1 = __webpack_require__(19);
474
+
454
475
  var style_1 = __webpack_require__(14);
476
+
455
477
  var Message_1 = __webpack_require__(10);
456
- var trellisUtils_1 = __webpack_require__(83);
478
+
479
+ var trellisUtils_1 = __webpack_require__(84);
480
+
457
481
  var hocUtils_1 = __webpack_require__(27);
482
+
458
483
  var JSONSchemaUtils_1 = __webpack_require__(28);
484
+
459
485
  var Options_1 = __webpack_require__(30);
486
+
460
487
  var trellisUtils_2 = __webpack_require__(107);
488
+
461
489
  var layoutUtils_1 = __webpack_require__(58);
490
+
462
491
  var TrellisContainer = styled_components_1.default.div.withConfig({
463
492
  displayName: "withTrellis__TrellisContainer",
464
493
  componentId: "pjmeig-0"
@@ -479,6 +508,7 @@ var TrellisContainerGrid = styled_components_1.default.div.withConfig({
479
508
  }, function (props) {
480
509
  return "".concat(props.rowHeight, "px");
481
510
  });
511
+
482
512
  var showErrorMessage = function showErrorMessage(errorCode, width, height) {
483
513
  if (errorCode === 'INVALID_SPLIT_BY_FIELD') {
484
514
  return React.createElement(Message_1.default, {
@@ -488,6 +518,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
488
518
  level: "info"
489
519
  });
490
520
  }
521
+
491
522
  if (errorCode === 'UNKNOWN_DATA_SPLIT_MODE') {
492
523
  return React.createElement(Message_1.default, {
493
524
  width: width,
@@ -496,6 +527,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
496
527
  level: "info"
497
528
  });
498
529
  }
530
+
499
531
  return React.createElement(Message_1.default, {
500
532
  width: width,
501
533
  height: height,
@@ -503,33 +535,38 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
503
535
  level: "info"
504
536
  });
505
537
  };
538
+
506
539
  var withTrellis = function withTrellis(Viz) {
507
540
  var VizWithTrellis = function VizWithTrellis(opts) {
508
541
  var _opts$options = opts.options,
509
- options = _opts$options === void 0 ? {} : _opts$options,
510
- height = opts.height,
511
- width = opts.width,
512
- otherProps = __rest(opts, ["options", "height", "width"]);
542
+ options = _opts$options === void 0 ? {} : _opts$options,
543
+ height = opts.height,
544
+ width = opts.width,
545
+ otherProps = __rest(opts, ["options", "height", "width"]);
546
+
513
547
  var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(Viz.config.optionsSchema, 'default');
514
548
  var mergedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
515
549
  var trellisColumns = mergedOptions.trellisColumns,
516
- trellisPageCount = mergedOptions.trellisPageCount,
517
- trellisMinColumnWidth = mergedOptions.trellisMinColumnWidth,
518
- trellisRowHeight = mergedOptions.trellisRowHeight,
519
- splitByLayout = mergedOptions.splitByLayout,
520
- trellisSplitBy = mergedOptions.trellisSplitBy;
550
+ trellisPageCount = mergedOptions.trellisPageCount,
551
+ trellisMinColumnWidth = mergedOptions.trellisMinColumnWidth,
552
+ trellisRowHeight = mergedOptions.trellisRowHeight,
553
+ splitByLayout = mergedOptions.splitByLayout,
554
+ trellisSplitBy = mergedOptions.trellisSplitBy;
521
555
  var colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
522
556
  var pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
523
557
  var colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
524
558
  var rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
559
+
525
560
  var _ref = (0, react_1.useState)(1),
526
- _ref2 = _slicedToArray(_ref, 2),
527
- pageNum = _ref2[0],
528
- setPageNum = _ref2[1];
561
+ _ref2 = _slicedToArray(_ref, 2),
562
+ pageNum = _ref2[0],
563
+ setPageNum = _ref2[1];
564
+
529
565
  var _ref3 = (0, react_1.useState)(null),
530
- _ref4 = _slicedToArray(_ref3, 2),
531
- pagedData = _ref4[0],
532
- setPagedData = _ref4[1];
566
+ _ref4 = _slicedToArray(_ref3, 2),
567
+ pagedData = _ref4[0],
568
+ setPagedData = _ref4[1];
569
+
533
570
  var splitByKeys = [];
534
571
  var totalPages = 0;
535
572
  var showPaginator = false;
@@ -537,21 +574,25 @@ var withTrellis = function withTrellis(Viz) {
537
574
  var theme = {
538
575
  splunkThemeV1: (0, useSplunkTheme_1.default)()
539
576
  };
577
+
540
578
  var _ref5 = (0, themes_1.getSettingsFromThemedProps)({
541
- theme: theme
542
- }),
543
- currentThemeFamily = _ref5.family,
544
- currentThemeColorScheme = _ref5.colorScheme,
545
- currentThemeDensity = _ref5.density;
579
+ theme: theme
580
+ }),
581
+ currentThemeFamily = _ref5.family,
582
+ currentThemeColorScheme = _ref5.colorScheme,
583
+ currentThemeDensity = _ref5.density;
584
+
546
585
  var trellisBackgroundColor = (0, react_1.useMemo)(function () {
547
586
  var themeFunc = function themeFunc(themeVar) {
548
587
  var _a, _b;
588
+
549
589
  return (_b = (_a = Viz.config.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, {
550
590
  trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
551
591
  theme: theme
552
592
  });
553
- };
554
- // trellisBackgroundColor option supports only static coloring and DSL option evaluation derived from the themes level only.
593
+ }; // trellisBackgroundColor option supports only static coloring and DSL option evaluation derived from the themes level only.
594
+
595
+
555
596
  var evaluated = Options_1.Options.evaluate({
556
597
  context: Viz.config.context,
557
598
  options: {
@@ -564,6 +605,7 @@ var withTrellis = function withTrellis(Viz) {
564
605
  var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields', undefined);
565
606
  var noColumns = columns === undefined;
566
607
  var noFields = fields === undefined;
608
+
567
609
  var updateDataDisplay = function updateDataDisplay(currPage) {
568
610
  if (!showPaginator) {
569
611
  setPagedData(splitByKeys);
@@ -574,6 +616,7 @@ var withTrellis = function withTrellis(Viz) {
574
616
  setPagedData(paged);
575
617
  }
576
618
  };
619
+
577
620
  (0, react_1.useEffect)(function () {
578
621
  setPageNum(1);
579
622
  updateDataDisplay(1);
@@ -587,9 +630,11 @@ var withTrellis = function withTrellis(Viz) {
587
630
  }, [pageNum, pagedData]);
588
631
  var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
589
632
  var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
633
+
590
634
  if (!isTrellisFeatureFlagOn || !splitByLayout || splitByLayout !== layoutUtils_1.LAYOUT_TYPE.Trellis) {
591
635
  return React.createElement(Viz, Object.assign({}, opts));
592
636
  }
637
+
593
638
  if (splitByLayout === layoutUtils_1.LAYOUT_TYPE.Trellis) {
594
639
  if (noColumns || noFields) {
595
640
  return React.createElement(Message_1.default, {
@@ -598,27 +643,34 @@ var withTrellis = function withTrellis(Viz) {
598
643
  message: (0, i18n_1._)('Loading'),
599
644
  level: "info"
600
645
  });
601
- }
602
- // If no trellisSplitBy value is passed in, assign default trellisSplitBy
646
+ } // If no trellisSplitBy value is passed in, assign default trellisSplitBy
603
647
  // The default value will be the first value in the individual splitBy field list or 'aggregations'
648
+
649
+
604
650
  var currTrellisSplitBy = trellisSplitBy;
651
+
605
652
  if (!trellisSplitBy || trellisSplitBy.length === 0) {
606
653
  var splitByPossibleFields = (0, trellisUtils_1.getAllPossibleSplitByFields)(fields);
607
654
  currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : trellisUtils_2.AGGREGATIONS;
608
655
  }
656
+
609
657
  var splitMode = (0, trellisUtils_1.getTrellisDataSplitterMode)(fields);
610
658
  var dataSplitResult = (0, trellisUtils_2.getTrellisDataSourcesBySplitMode)(splitMode, dataSources, currTrellisSplitBy);
611
659
  var modifiedDataSourceBySplitBy = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.splitDataSources;
612
660
  var dataSplitErrorCode = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.errorCode;
661
+
613
662
  if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
614
663
  return showErrorMessage(dataSplitErrorCode, width, height);
615
664
  }
665
+
616
666
  var splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
667
+
617
668
  if (splitByKeysModified) {
618
669
  showPaginator = splitByKeysModified.length > pageCount;
619
670
  splitByKeys = splitByKeysModified;
620
671
  totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
621
672
  }
673
+
622
674
  return React.createElement(TrellisContainer, {
623
675
  height: height,
624
676
  width: width,
@@ -635,8 +687,8 @@ var withTrellis = function withTrellis(Viz) {
635
687
  key: "div-child-".concat(idx.toString())
636
688
  }, React.createElement(SizeAwareWrapper_1.default, null, function (_ref7) {
637
689
  var childWidth = _ref7.childWidth,
638
- _ref7$childHeight = _ref7.childHeight,
639
- childHeight = _ref7$childHeight === void 0 ? rowHeight : _ref7$childHeight;
690
+ _ref7$childHeight = _ref7.childHeight,
691
+ childHeight = _ref7$childHeight === void 0 ? rowHeight : _ref7$childHeight;
640
692
  return React.createElement(Viz, Object.assign({}, otherProps, {
641
693
  trellisKey: splitByKey,
642
694
  trellisSplitBy: currTrellisSplitBy,
@@ -654,13 +706,16 @@ var withTrellis = function withTrellis(Viz) {
654
706
  totalPages: totalPages
655
707
  }));
656
708
  }
709
+
657
710
  return null;
658
711
  };
712
+
659
713
  VizWithTrellis.propTypes = Viz.proptypes;
660
714
  VizWithTrellis.defaultProps = Viz.defaultProps;
661
715
  VizWithTrellis.config = Viz.config;
662
716
  return VizWithTrellis;
663
717
  };
718
+
664
719
  exports.default = withTrellis;
665
720
 
666
721
  /***/ }),
@@ -672,12 +727,16 @@ exports.default = withTrellis;
672
727
 
673
728
 
674
729
  var _toConsumableArray = __webpack_require__(8);
730
+
675
731
  Object.defineProperty(exports, "__esModule", {
676
732
  value: true
677
733
  });
678
734
  exports.getTrellisDataSourcesBySplitMode = exports.dataSourcesSplitByModeStatsorUnknown = exports.dataSourcesSplitByModeChart = exports.dataSourcesSplitByModeTimechart = exports.dataSourcesSplitByAggregationsStats = exports.dataSourcesSplitByAggregationsTimechartAndChart = exports.dataSourcesSplitByAggregationsUnknown = exports.AGGREGATIONS = void 0;
735
+
679
736
  var lodash_1 = __webpack_require__(3);
680
- var trellisUtils_1 = __webpack_require__(83);
737
+
738
+ var trellisUtils_1 = __webpack_require__(84);
739
+
681
740
  exports.AGGREGATIONS = 'aggregations';
682
741
  /**
683
742
  * There can be certain SPL cmds that can produce dataSource without a specific field meta info (like group_by_rank, split_by_field etc),
@@ -687,16 +746,21 @@ exports.AGGREGATIONS = 'aggregations';
687
746
  * Example3:- `index = "_internal" | stats count`
688
747
  * Example4:- `index=_internal | stats avg(count), max(count)`
689
748
  */
749
+
690
750
  var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregationsUnknown(dataSource) {
691
751
  var _a, _b, _c, _d;
752
+
692
753
  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
693
754
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
694
755
  var splitDataSources = null;
695
756
  var errorCode = null;
757
+
696
758
  if (fields && fields.length) {
697
759
  splitDataSources = {};
760
+
698
761
  for (var i = 0; i < fields.length; i += 1) {
699
762
  var fieldName = fields[i].name;
763
+
700
764
  if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
701
765
  splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
702
766
  splitDataSources[fieldName].primary.data.fields = [fields[i]];
@@ -706,22 +770,28 @@ var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregati
706
770
  } else {
707
771
  errorCode = 'INVALID_SPLIT_BY_FIELD';
708
772
  }
773
+
709
774
  return {
710
775
  splitDataSources: splitDataSources,
711
776
  errorCode: errorCode
712
777
  };
713
778
  };
779
+
714
780
  exports.dataSourcesSplitByAggregationsUnknown = dataSourcesSplitByAggregationsUnknown;
781
+
715
782
  var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitByAggregationsTimechartAndChart(dataSource) {
716
783
  var _a, _b, _c, _d;
784
+
717
785
  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
718
786
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
719
787
  var splitDataSources = null;
720
788
  var splitByFields = [];
721
789
  var errorCode = null;
790
+
722
791
  if (typeof fields[0] !== 'string') {
723
792
  splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
724
793
  }
794
+
725
795
  if (splitByFields && splitByFields.length > 0) {
726
796
  splitDataSources = {};
727
797
  splitByFields.forEach(function (splitByField) {
@@ -730,6 +800,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
730
800
  splitDataSources[splitByField].primary.data.columns = [columns[0]];
731
801
  fields.forEach(function (field, idx) {
732
802
  var fieldName = field === null || field === void 0 ? void 0 : field.name;
803
+
733
804
  if (fieldName !== '_time' && !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_')) && field.data_source === splitByField) {
734
805
  splitDataSources[splitByField].primary.data.fields.push(field);
735
806
  splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
@@ -741,8 +812,10 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
741
812
  // example1 :- index=_internal | timechart count
742
813
  // example2 :- index=_internal | timechart max(count) avg(count)
743
814
  splitDataSources = {};
815
+
744
816
  for (var i = 1; i < fields.length; i += 1) {
745
817
  var fieldName = fields[i].name;
818
+
746
819
  if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
747
820
  splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
748
821
  splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
@@ -752,22 +825,28 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
752
825
  } else {
753
826
  errorCode = 'INVALID_SPLIT_BY_FIELD';
754
827
  }
828
+
755
829
  return {
756
830
  splitDataSources: splitDataSources,
757
831
  errorCode: errorCode
758
832
  };
759
833
  };
834
+
760
835
  exports.dataSourcesSplitByAggregationsTimechartAndChart = dataSourcesSplitByAggregationsTimechartAndChart;
836
+
761
837
  var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregationsStats(dataSource) {
762
838
  var _a, _b, _c, _d;
839
+
763
840
  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
764
841
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
765
842
  var splitDataSources = null;
766
843
  var splitByFields = [];
767
844
  var errorCode = null;
845
+
768
846
  if (typeof fields[0] !== 'string') {
769
847
  splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysStats)(fields);
770
848
  }
849
+
771
850
  if (splitByFields && splitByFields.length > 0) {
772
851
  splitDataSources = {};
773
852
  splitByFields.forEach(function (splitByField) {
@@ -777,6 +856,7 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
777
856
  var idx = fields.findIndex(function (field) {
778
857
  return field.name === splitByField;
779
858
  });
859
+
780
860
  if (idx > 0) {
781
861
  splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
782
862
  splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
@@ -785,32 +865,40 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
785
865
  } else {
786
866
  errorCode = 'INVALID_SPLIT_BY_FIELD';
787
867
  }
868
+
788
869
  return {
789
870
  splitDataSources: splitDataSources,
790
871
  errorCode: errorCode
791
872
  };
792
873
  };
874
+
793
875
  exports.dataSourcesSplitByAggregationsStats = dataSourcesSplitByAggregationsStats;
876
+
794
877
  var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(dataSource, splitBy) {
795
878
  var _a, _b, _c, _d, _e;
879
+
796
880
  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
797
881
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
798
882
  var splitDataSources = null;
799
883
  var splitByFields = [];
800
884
  var errorCode = null;
885
+
801
886
  if (typeof fields[0] !== 'string') {
802
887
  splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
803
888
  }
889
+
804
890
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
805
891
  splitDataSources = {};
806
892
  var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
807
893
  var valueKeys = [];
894
+
808
895
  for (var i = 1; i < fields.length; i += 1) {
809
896
  // not including internal fields
810
897
  if (!((_e = fields[i].name) === null || _e === void 0 ? void 0 : _e.startsWith('_'))) {
811
898
  valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
812
899
  }
813
900
  }
901
+
814
902
  valueKeys.forEach(function (val) {
815
903
  splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
816
904
  splitDataSources[val].primary.data.fields = [{
@@ -832,22 +920,28 @@ var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(d
832
920
  } else {
833
921
  errorCode = 'INVALID_SPLIT_BY_FIELD';
834
922
  }
923
+
835
924
  return {
836
925
  splitDataSources: splitDataSources,
837
926
  errorCode: errorCode
838
927
  };
839
928
  };
929
+
840
930
  exports.dataSourcesSplitByModeTimechart = dataSourcesSplitByModeTimechart;
931
+
841
932
  var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSource, splitBy) {
842
933
  var _a, _b, _c, _d;
934
+
843
935
  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
844
936
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
845
937
  var splitDataSources = null;
846
938
  var splitByFields = [];
847
939
  var errorCode = null;
940
+
848
941
  if (typeof fields[0] !== 'string') {
849
942
  splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
850
943
  }
944
+
851
945
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
852
946
  splitDataSources = {};
853
947
  var splitByFieldIdx = splitByFields.findIndex(function (f) {
@@ -858,6 +952,7 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
858
952
  });
859
953
  var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
860
954
  var nonDataSourceAggregations = [];
955
+
861
956
  if (!dataSourceKeys.length && fields[0].groupby_rank === '0' && fields.length && !fields[1].groupby_rank) {
862
957
  /* check for another aggregation scenario where no key 'data_source' will be returned (applies for both chart and stats cmd)
863
958
  For example :-
@@ -882,12 +977,14 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
882
977
  nonDataSourceAggregations.push(fields[i].name);
883
978
  }
884
979
  }
980
+
885
981
  if (splitByFieldIdx === 0) {
886
982
  // if splitBy is the first field, split row wise
887
983
  var valueKeys = (0, lodash_1.cloneDeep)(columns[0]);
888
984
  valueKeys.forEach(function (val, idx) {
889
985
  splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
890
986
  splitDataSources[val].primary.data.fields = [];
987
+
891
988
  if (otherSplitBy.length) {
892
989
  splitDataSources[val].primary.data.fields = [{
893
990
  name: otherSplitBy[0]
@@ -959,16 +1056,20 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
959
1056
  columnValues[1] = ['1','10','100']
960
1057
  columnValues[2] = ['5', '50', '500']
961
1058
  */
1059
+
962
1060
  var _loop = function _loop(_i) {
963
1061
  columnValues[0].push(fields[_i].splitby_value ? fields[_i].splitby_value : fields[_i].name);
964
1062
  dataSourceKeys.forEach(function (dskey, dsIndx) {
965
1063
  var mul = (fields.length - 1) / dataSourceKeys.length; // This line does the index calculation
1064
+
966
1065
  columnValues[dsIndx + 1].push(columns[_i + dsIndx * mul][idx]);
967
1066
  });
968
1067
  };
1068
+
969
1069
  for (var _i = 1; _i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); _i += 1) {
970
1070
  _loop(_i);
971
1071
  }
1072
+
972
1073
  splitDataSources[val].primary.data.columns = columnValues;
973
1074
  })();
974
1075
  } else if (nonDataSourceAggregations.length) {
@@ -990,9 +1091,11 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
990
1091
  } else {
991
1092
  // split column wise
992
1093
  var _valueKeys = [];
1094
+
993
1095
  for (var _i2 = 1; _i2 < fields.length; _i2 += 1) {
994
1096
  _valueKeys.push(fields[_i2].splitby_value ? fields[_i2].splitby_value : fields[_i2].name);
995
1097
  }
1098
+
996
1099
  _valueKeys.forEach(function (val) {
997
1100
  splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
998
1101
  splitDataSources[val].primary.data.fields = [{
@@ -1015,29 +1118,36 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
1015
1118
  } else {
1016
1119
  errorCode = 'INVALID_SPLIT_BY_FIELD';
1017
1120
  }
1121
+
1018
1122
  return {
1019
1123
  splitDataSources: splitDataSources,
1020
1124
  errorCode: errorCode
1021
1125
  };
1022
1126
  };
1127
+
1023
1128
  exports.dataSourcesSplitByModeChart = dataSourcesSplitByModeChart;
1024
1129
  /**
1025
1130
  * This method does datasplitting for 'stats' and generic cmds('makeresults','table' etc - categoried as 'unknown' splitMode).
1026
1131
  * The main difference is for 'stats' cmd possible splitBy fields have 'group_by_rank' in field meta info, whereas for 'unknown' cmd it can be any fieldnames
1027
1132
  */
1133
+
1028
1134
  var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatsorUnknown(dataSource, splitBy, splitMode) {
1029
1135
  var _a, _b, _c, _d, _e, _f;
1136
+
1030
1137
  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
1031
1138
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
1032
1139
  var splitDataSources = null;
1033
1140
  var splitByFields = [];
1034
1141
  var errorCode = null;
1142
+
1035
1143
  if (typeof fields[0] !== 'string') {
1036
1144
  splitByFields = splitMode !== trellisUtils_1.UNKNOWN ? (0, trellisUtils_1.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_1.extractSplitByFieldsForUnknown)(fields);
1037
1145
  }
1146
+
1038
1147
  var splitByIndex = fields === null || fields === void 0 ? void 0 : fields.findIndex(function (field) {
1039
1148
  return field === splitBy || field.name === splitBy;
1040
1149
  });
1150
+
1041
1151
  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
1042
1152
  var splitByColumn = (_f = (_e = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.columns[splitByIndex];
1043
1153
  splitDataSources = {};
@@ -1068,14 +1178,18 @@ var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatso
1068
1178
  } else {
1069
1179
  errorCode = 'INVALID_SPLIT_BY_FIELD';
1070
1180
  }
1181
+
1071
1182
  return {
1072
1183
  splitDataSources: splitDataSources,
1073
1184
  errorCode: errorCode
1074
1185
  };
1075
1186
  };
1187
+
1076
1188
  exports.dataSourcesSplitByModeStatsorUnknown = dataSourcesSplitByModeStatsorUnknown;
1189
+
1077
1190
  var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode(splitMode, dataSources, trellisSplitBy) {
1078
1191
  var result = null;
1192
+
1079
1193
  try {
1080
1194
  if (splitMode === trellisUtils_1.TIMECHART) {
1081
1195
  result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsTimechartAndChart)(dataSources) : (0, exports.dataSourcesSplitByModeTimechart)(dataSources, trellisSplitBy);
@@ -1093,8 +1207,10 @@ var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode
1093
1207
  errorCode: 'UNKNOWN'
1094
1208
  };
1095
1209
  }
1210
+
1096
1211
  return result;
1097
1212
  };
1213
+
1098
1214
  exports.getTrellisDataSourcesBySplitMode = getTrellisDataSourcesBySplitMode;
1099
1215
 
1100
1216
  /***/ }),
@@ -1136,11 +1252,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
1136
1252
  Object.defineProperty(exports, "__esModule", {
1137
1253
  value: true
1138
1254
  });
1255
+
1139
1256
  var React = __webpack_require__(1);
1257
+
1140
1258
  var styled_components_1 = __webpack_require__(4);
1259
+
1141
1260
  var SizeAwareWrapper_1 = __webpack_require__(19);
1261
+
1142
1262
  var style_1 = __webpack_require__(14);
1263
+
1143
1264
  var colorUtils_1 = __webpack_require__(12);
1265
+
1144
1266
  var Item = styled_components_1.default.div.attrs(function (_ref) {
1145
1267
  var width = _ref.width;
1146
1268
  return {
@@ -1153,11 +1275,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
1153
1275
  componentId: "sc-1yhgpod-0"
1154
1276
  })(["position:relative;background-color:", "};"], function (props) {
1155
1277
  return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
1156
- });
1157
- // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
1278
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
1279
+
1158
1280
  var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
1159
1281
  var width = _ref2.width,
1160
- height = _ref2.height;
1282
+ height = _ref2.height;
1161
1283
  return {
1162
1284
  style: Object.assign(Object.assign({}, width && {
1163
1285
  width: (0, style_1.toPx)(width)
@@ -1179,11 +1301,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
1179
1301
  displayName: "FixedSizeContainer__FixSizeItemContent",
1180
1302
  componentId: "sc-1yhgpod-3"
1181
1303
  })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
1304
+
1182
1305
  var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
1183
1306
  var FixedSizeContainer = function FixedSizeContainer(props) {
1184
1307
  var width = props.width,
1185
- height = props.height,
1186
- backgroundColor = props.backgroundColor;
1308
+ height = props.height,
1309
+ backgroundColor = props.backgroundColor;
1310
+
1187
1311
  if (!height) {
1188
1312
  return React.createElement(Item, {
1189
1313
  "data-test": "item",
@@ -1191,24 +1315,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
1191
1315
  backgroundColor: backgroundColor
1192
1316
  }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
1193
1317
  }
1318
+
1194
1319
  return React.createElement(FixSizeItem, {
1195
1320
  "data-test": "fix-size-item",
1196
- "data-splunk-visualization-version": "26.0.0 - 2f7458907",
1321
+ "data-splunk-visualization-version": "26.1.1 - b6df0a015",
1197
1322
  width: width,
1198
1323
  height: height,
1199
1324
  backgroundColor: backgroundColor
1200
1325
  }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
1201
1326
  var newWidth = _ref3.width,
1202
- newHeight = _ref3.height;
1327
+ newHeight = _ref3.height;
1203
1328
  return React.createElement(Viz, Object.assign({}, props, {
1204
1329
  width: newWidth,
1205
1330
  height: newHeight
1206
1331
  }));
1207
1332
  })));
1208
1333
  };
1334
+
1209
1335
  FixedSizeContainer.displayName = 'withFixedSizeContainer';
1210
1336
  return FixedSizeContainer;
1211
1337
  };
1338
+
1212
1339
  exports.default = withFixedSizeContainer;
1213
1340
 
1214
1341
  /***/ }),
@@ -1272,7 +1399,7 @@ __webpack_require__.r(__webpack_exports__);
1272
1399
 
1273
1400
  var getDynamicMajorColorEditor = function getDynamicMajorColorEditor(_ref) {
1274
1401
  var defaultContext = _ref.defaultContext,
1275
- defaultPalettesConfig = _ref.defaultPalettesConfig;
1402
+ defaultPalettesConfig = _ref.defaultPalettesConfig;
1276
1403
  return {
1277
1404
  label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Major value'),
1278
1405
  option: 'majorColor',
@@ -1332,9 +1459,10 @@ exports.extendStaticWrapperProps = void 0;
1332
1459
  * @param {DashboardVizType} props.Wrapper
1333
1460
  * @param {DashboardVizType} props.Visualization
1334
1461
  */
1462
+
1335
1463
  var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
1336
1464
  var Wrapper = _ref.Wrapper,
1337
- Visualization = _ref.Visualization;
1465
+ Visualization = _ref.Visualization;
1338
1466
  var extendProperties = ['propTypes', 'defaultProps', 'config'];
1339
1467
  extendProperties.forEach(function (prop) {
1340
1468
  if (Visualization[prop]) {
@@ -1343,6 +1471,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
1343
1471
  }
1344
1472
  });
1345
1473
  };
1474
+
1346
1475
  exports.extendStaticWrapperProps = extendStaticWrapperProps;
1347
1476
 
1348
1477
  /***/ }),
@@ -1389,24 +1518,33 @@ module.exports = require("@splunk/ui-utils/i18n");
1389
1518
 
1390
1519
 
1391
1520
  var _toConsumableArray = __webpack_require__(8);
1521
+
1392
1522
  var _defineProperty = __webpack_require__(7);
1523
+
1393
1524
  var __rest = this && this.__rest || function (s, e) {
1394
1525
  var t = {};
1526
+
1395
1527
  for (var p in s) {
1396
1528
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1397
1529
  }
1530
+
1398
1531
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1399
1532
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1400
1533
  }
1401
1534
  return t;
1402
1535
  };
1536
+
1403
1537
  Object.defineProperty(exports, "__esModule", {
1404
1538
  value: true
1405
1539
  });
1406
1540
  exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
1541
+
1407
1542
  var lodash_1 = __webpack_require__(3);
1543
+
1408
1544
  var schemaUtils_1 = __webpack_require__(16);
1545
+
1409
1546
  var VizBehavior_1 = __webpack_require__(6);
1547
+
1410
1548
  var dynamicOptionsDSLType = {
1411
1549
  type: 'string',
1412
1550
  pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
@@ -1416,20 +1554,22 @@ var dynamicOptionsDSLType = {
1416
1554
  * @param optionsSchema a visualization's options schema
1417
1555
  * @returns an updated options schema that additionally allows strings starting with > for each option
1418
1556
  */
1557
+
1419
1558
  function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
1420
1559
  var enhancedOptionsSchema = {};
1421
1560
  Object.keys(optionsSchema).forEach(function (key) {
1422
1561
  var _a = optionsSchema[key],
1423
- title = _a.title,
1424
- description = _a.description,
1425
- readOnly = _a.readOnly,
1426
- writeOnly = _a.writeOnly,
1427
- examples = _a.examples,
1428
- defaultValue = _a.default,
1429
- type = _a.type,
1430
- properties = _a.properties,
1431
- patternProperties = _a.patternProperties,
1432
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
1562
+ title = _a.title,
1563
+ description = _a.description,
1564
+ readOnly = _a.readOnly,
1565
+ writeOnly = _a.writeOnly,
1566
+ examples = _a.examples,
1567
+ defaultValue = _a.default,
1568
+ type = _a.type,
1569
+ properties = _a.properties,
1570
+ patternProperties = _a.patternProperties,
1571
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
1572
+
1433
1573
  var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
1434
1574
  title: title
1435
1575
  }), description !== undefined && {
@@ -1443,12 +1583,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
1443
1583
  }), defaultValue !== undefined && {
1444
1584
  default: defaultValue
1445
1585
  });
1586
+
1446
1587
  if (type === 'object') {
1447
1588
  enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
1448
1589
  type: type
1449
1590
  }), properties && {
1450
1591
  properties: enhanceOptionsSchemaWithDynamicOptions(properties)
1451
1592
  });
1593
+
1452
1594
  if (patternProperties) {
1453
1595
  var enhancedPatternProperties = {};
1454
1596
  Object.keys(patternProperties).forEach(function (opt) {
@@ -1466,6 +1608,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
1466
1608
  });
1467
1609
  return enhancedOptionsSchema;
1468
1610
  }
1611
+
1469
1612
  exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
1470
1613
  /**
1471
1614
  * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
@@ -1474,11 +1617,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
1474
1617
  * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
1475
1618
  * and containing `open: false` for all editor panels in editorConfig
1476
1619
  */
1620
+
1477
1621
  function enhanceConfig(vizConfig) {
1478
1622
  var enhancedConfig = Object.assign({}, vizConfig);
1623
+
1479
1624
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
1480
1625
  enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
1481
1626
  }
1627
+
1482
1628
  enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
1483
1629
  return Object.assign(Object.assign({}, config), {
1484
1630
  open: config.open || false
@@ -1486,6 +1632,7 @@ function enhanceConfig(vizConfig) {
1486
1632
  });
1487
1633
  return enhancedConfig;
1488
1634
  }
1635
+
1489
1636
  exports.enhanceConfig = enhanceConfig;
1490
1637
  /**
1491
1638
  * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
@@ -1493,6 +1640,7 @@ exports.enhanceConfig = enhanceConfig;
1493
1640
  * @param vizConfig a Visualization Config
1494
1641
  * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
1495
1642
  */
1643
+
1496
1644
  function uncollapseEditorConfig(vizConfig) {
1497
1645
  var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
1498
1646
  editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
@@ -1502,13 +1650,16 @@ function uncollapseEditorConfig(vizConfig) {
1502
1650
  });
1503
1651
  return editorPanelUncollapsedConfig;
1504
1652
  }
1653
+
1505
1654
  exports.uncollapseEditorConfig = uncollapseEditorConfig;
1655
+
1506
1656
  function isDynamicOption(option) {
1507
1657
  return option && typeof option === 'string' && option.trim().startsWith('>') || false;
1508
1658
  }
1509
- exports.isDynamicOption = isDynamicOption;
1510
- // private helpers to improve readability of getInitialPreset
1659
+
1660
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
1511
1661
  // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
1662
+
1512
1663
  /**
1513
1664
  * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
1514
1665
  * 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
@@ -1517,6 +1668,7 @@ exports.isDynamicOption = isDynamicOption;
1517
1668
  *
1518
1669
  * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
1519
1670
  */
1671
+
1520
1672
  function hasCompatibleContexts(vizContext, presetContext) {
1521
1673
  var presetContextKeys = Object.keys(presetContext);
1522
1674
  return presetContextKeys.every(function (contextKey) {
@@ -1526,6 +1678,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
1526
1678
  /**
1527
1679
  * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
1528
1680
  */
1681
+
1682
+
1529
1683
  function hasCompatibleOptions(vizOptions, presetOptions) {
1530
1684
  var presetOptionKeys = Object.keys(presetOptions);
1531
1685
  return presetOptionKeys.every(function (optionKey) {
@@ -1540,18 +1694,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
1540
1694
  * @param {Object} vizOptions - the current vizOptions definition
1541
1695
  * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
1542
1696
  */
1697
+
1698
+
1543
1699
  function getInitialPreset(vizContext, vizOptions, presets) {
1544
1700
  return presets.find(function (preset) {
1545
1701
  var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
1546
1702
  var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
1547
1703
  var presetContextKeys = Object.keys(presetContext);
1548
- var presetOptionKeys = Object.keys(presetOptions);
1549
- // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
1704
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
1550
1705
  // if not, then the preset is invalid in config.ts
1706
+
1551
1707
  if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
1552
1708
  return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
1553
1709
  });
1554
1710
  }
1711
+
1555
1712
  exports.getInitialPreset = getInitialPreset;
1556
1713
  /**
1557
1714
  * generates number precision values for a Select editor
@@ -1559,6 +1716,7 @@ exports.getInitialPreset = getInitialPreset;
1559
1716
  * @param {Number} numPrecisionValues - number of integer precision values to generate
1560
1717
  * @returns {{ label: string; value; string }[]} array of { label, value } tuples
1561
1718
  */
1719
+
1562
1720
  function generatePrecisionValues(numPrecisionValues) {
1563
1721
  return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
1564
1722
  return {
@@ -1567,6 +1725,7 @@ function generatePrecisionValues(numPrecisionValues) {
1567
1725
  };
1568
1726
  });
1569
1727
  }
1728
+
1570
1729
  exports.generatePrecisionValues = generatePrecisionValues;
1571
1730
  /**
1572
1731
  * insert layout in layout array, return a new layout array instead of updating the original
@@ -1576,12 +1735,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
1576
1735
  * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
1577
1736
  * @returns {EditorLayoutConfig[][]} new editor layout with insertion
1578
1737
  */
1738
+
1579
1739
  var insertLayout = function insertLayout(layout, index) {
1580
1740
  for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1581
1741
  layoutItems[_key - 2] = arguments[_key];
1582
1742
  }
1743
+
1583
1744
  return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
1584
1745
  };
1746
+
1585
1747
  exports.insertLayout = insertLayout;
1586
1748
 
1587
1749
  /***/ }),
@@ -1655,25 +1817,38 @@ __webpack_require__.r(__webpack_exports__);
1655
1817
  /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(49);
1656
1818
  /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
1657
1819
 
1820
+
1658
1821
  function ownKeys(object, enumerableOnly) {
1659
1822
  var keys = Object.keys(object);
1823
+
1660
1824
  if (Object.getOwnPropertySymbols) {
1661
1825
  var symbols = Object.getOwnPropertySymbols(object);
1662
- enumerableOnly && (symbols = symbols.filter(function (sym) {
1826
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
1663
1827
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1664
- })), keys.push.apply(keys, symbols);
1828
+ });
1829
+ keys.push.apply(keys, symbols);
1665
1830
  }
1831
+
1666
1832
  return keys;
1667
1833
  }
1834
+
1668
1835
  function _objectSpread(target) {
1669
1836
  for (var i = 1; i < arguments.length; i++) {
1670
- var source = null != arguments[i] ? arguments[i] : {};
1671
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
1672
- _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
1673
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
1674
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1675
- });
1837
+ var source = arguments[i] != null ? arguments[i] : {};
1838
+
1839
+ if (i % 2) {
1840
+ ownKeys(Object(source), true).forEach(function (key) {
1841
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
1842
+ });
1843
+ } else if (Object.getOwnPropertyDescriptors) {
1844
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1845
+ } else {
1846
+ ownKeys(Object(source)).forEach(function (key) {
1847
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1848
+ });
1849
+ }
1676
1850
  }
1851
+
1677
1852
  return target;
1678
1853
  }
1679
1854
 
@@ -1681,6 +1856,7 @@ function _objectSpread(target) {
1681
1856
 
1682
1857
 
1683
1858
 
1859
+
1684
1860
  var DEFAULT_FONT = 12;
1685
1861
  var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
1686
1862
  var SVR_PADDING = {
@@ -1689,28 +1865,27 @@ var SVR_PADDING = {
1689
1865
  left: 16,
1690
1866
  right: 16
1691
1867
  };
1692
-
1693
1868
  /**
1694
1869
  * @method shouldShowTrend
1695
1870
  * @param {String} trendDisplay
1696
1871
  * @returns {Bool}
1697
1872
  */
1873
+
1698
1874
  var shouldShowTrend = function shouldShowTrend(trendDisplay) {
1699
1875
  return trendDisplay === 'absolute' || trendDisplay === 'percent';
1700
1876
  };
1701
-
1702
1877
  /**
1703
1878
  * @method isLoadingOrNoColumns
1704
1879
  * @param {Object} dataSources
1705
1880
  * @param {Boolean} loading
1706
1881
  * @returns {Boolean} return true if loading or without columns in dataSources
1707
1882
  */
1883
+
1708
1884
  var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
1709
1885
  var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
1710
1886
  var noColumns = data === undefined;
1711
1887
  return loading || noColumns;
1712
1888
  };
1713
-
1714
1889
  /**
1715
1890
  * Retrieve the valid formatted color
1716
1891
  * @method getFormattedColor
@@ -1718,30 +1893,30 @@ var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
1718
1893
  * @param {String} defaultColor
1719
1894
  * @returns {String} the formatted color
1720
1895
  */
1896
+
1721
1897
  var getFormattedColor = function getFormattedColor(color, defaultColor) {
1722
1898
  return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
1723
1899
  };
1724
-
1725
1900
  /**
1726
1901
  * Determines if there is a background color
1727
1902
  * @method hasBackground
1728
1903
  * @param {String} backgroundColor
1729
1904
  * @returns true for non-transparent background color
1730
1905
  */
1906
+
1731
1907
  var hasBackground = function hasBackground(backgroundColor) {
1732
1908
  return !!backgroundColor && backgroundColor !== 'transparent';
1733
1909
  };
1734
-
1735
1910
  /**
1736
1911
  * @method isIdenticalColor
1737
1912
  * @param {String} colorA
1738
1913
  * @param {String} colorB
1739
1914
  * @returns {Boolean}
1740
1915
  */
1916
+
1741
1917
  var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
1742
1918
  return !!colorA && !!colorB && Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorA.toLowerCase()) === Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorB.toLowerCase());
1743
1919
  };
1744
-
1745
1920
  /*
1746
1921
  * @method getDefaultColorWithBg
1747
1922
  * @param {Object} props
@@ -1750,13 +1925,13 @@ var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
1750
1925
  * @param {String} props.defaultBlockFontColor
1751
1926
  * @returns {String} defaultColor
1752
1927
  */
1928
+
1753
1929
  var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
1754
1930
  var backgroundColor = _ref.backgroundColor,
1755
- defaultFontColor = _ref.defaultFontColor,
1756
- defaultBlockFontColor = _ref.defaultBlockFontColor;
1931
+ defaultFontColor = _ref.defaultFontColor,
1932
+ defaultBlockFontColor = _ref.defaultBlockFontColor;
1757
1933
  return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
1758
1934
  };
1759
-
1760
1935
  /*
1761
1936
  * @method getMajorColor
1762
1937
  * return formatted majorColor.
@@ -1767,15 +1942,16 @@ var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
1767
1942
  * @param {String} props.defaultBlockFontColor
1768
1943
  * @returns {String} majorColor
1769
1944
  */
1945
+
1770
1946
  var getMajorColor = function getMajorColor(_ref2) {
1771
1947
  var majorColor = _ref2.majorColor,
1772
- backgroundColor = _ref2.backgroundColor,
1773
- defaultFontColor = _ref2.defaultFontColor,
1774
- defaultBlockFontColor = _ref2.defaultBlockFontColor;
1775
- // If backgroundColor is set, but no majorColor,
1948
+ backgroundColor = _ref2.backgroundColor,
1949
+ defaultFontColor = _ref2.defaultFontColor,
1950
+ defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
1776
1951
  // the default majorColor will turn to be defaultBlockFontColor.
1777
1952
  // eg: major color will turn to be white in enterprise mode.
1778
1953
  // however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
1954
+
1779
1955
  if (hasBackground(backgroundColor) && !majorColor) {
1780
1956
  return getDefaultColorWithBg({
1781
1957
  backgroundColor: backgroundColor,
@@ -1783,9 +1959,9 @@ var getMajorColor = function getMajorColor(_ref2) {
1783
1959
  defaultBlockFontColor: defaultBlockFontColor
1784
1960
  });
1785
1961
  }
1962
+
1786
1963
  return getFormattedColor(majorColor, defaultFontColor);
1787
1964
  };
1788
-
1789
1965
  /**
1790
1966
  * Get the color for the trend components
1791
1967
  * @method getTrendColor
@@ -1798,35 +1974,41 @@ var getMajorColor = function getMajorColor(_ref2) {
1798
1974
  * @param {Object} defaultColors
1799
1975
  * @returns {String} trendColor
1800
1976
  */
1977
+
1801
1978
  var getTrendColor = function getTrendColor(_ref3) {
1802
1979
  var trendColor = _ref3.trendColor,
1803
- trendValue = _ref3.trendValue,
1804
- majorValue = _ref3.majorValue,
1805
- customizedBgColor = _ref3.customizedBgColor,
1806
- trendDisplay = _ref3.trendDisplay,
1807
- defaultColors = _ref3.defaultColors;
1980
+ trendValue = _ref3.trendValue,
1981
+ majorValue = _ref3.majorValue,
1982
+ customizedBgColor = _ref3.customizedBgColor,
1983
+ trendDisplay = _ref3.trendDisplay,
1984
+ defaultColors = _ref3.defaultColors;
1985
+
1808
1986
  if (trendColor) {
1809
1987
  return trendColor;
1810
1988
  }
1989
+
1811
1990
  if (Number.isNaN(Number(trendValue))) {
1812
1991
  return undefined;
1813
1992
  }
1993
+
1814
1994
  var defaultFontColor = defaultColors.defaultFontColor,
1815
- defaultBlockFontColor = defaultColors.defaultBlockFontColor,
1816
- defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
1995
+ defaultBlockFontColor = defaultColors.defaultBlockFontColor,
1996
+ defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
1997
+
1817
1998
  if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
1818
1999
  return defaultBlockFontColor;
1819
- }
1820
-
1821
- // if trendDisplay is percent, and trendValue === value
2000
+ } // if trendDisplay is percent, and trendValue === value
1822
2001
  // the trend percent = trendValue / (value - trendValue) will return Infinity
2002
+
2003
+
1823
2004
  var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
2005
+
1824
2006
  if (trendValue === 0 || isInvalidTrend) {
1825
2007
  return defaultFontColor;
1826
2008
  }
2009
+
1827
2010
  return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
1828
2011
  };
1829
-
1830
2012
  /**
1831
2013
  * Computes visualization properties for display component
1832
2014
  * @method computeColors
@@ -1839,6 +2021,7 @@ var getTrendColor = function getTrendColor(_ref3) {
1839
2021
  * @returns {String} trendColor
1840
2022
  * @returns {String} underLabelColor
1841
2023
  */
2024
+
1842
2025
  var computeColors = function computeColors(props, defaultColors) {
1843
2026
  var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
1844
2027
  var backgroundEnabled = hasBackground(backgroundColor);
@@ -1855,8 +2038,8 @@ var computeColors = function computeColors(props, defaultColors) {
1855
2038
  customizedBgColor: props.backgroundColor,
1856
2039
  trendDisplay: props.trendDisplay,
1857
2040
  defaultColors: defaultColors
1858
- });
1859
- // todo: need change it to not depend on majorColor
2041
+ }); // todo: need change it to not depend on majorColor
2042
+
1860
2043
  var underLabelColor = majorColor;
1861
2044
  return {
1862
2045
  backgroundColor: backgroundColor,
@@ -1866,7 +2049,6 @@ var computeColors = function computeColors(props, defaultColors) {
1866
2049
  underLabelColor: underLabelColor
1867
2050
  };
1868
2051
  };
1869
-
1870
2052
  /**
1871
2053
  * Format and return the value (major/trend)
1872
2054
  * @method computeText
@@ -1877,21 +2059,21 @@ var computeColors = function computeColors(props, defaultColors) {
1877
2059
  * @param {Bool} props.shouldAbbreviateTrendValue
1878
2060
  * @returns {Number} major or trend text
1879
2061
  */
2062
+
1880
2063
  var computeText = function computeText(_ref4) {
1881
2064
  var value = _ref4.value,
1882
- numberPrecision = _ref4.numberPrecision,
1883
- shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
1884
- shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
2065
+ numberPrecision = _ref4.numberPrecision,
2066
+ shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
2067
+ shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
1885
2068
  var text = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(value) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["formatNumber"])(value, numberPrecision, {
1886
2069
  useThousandSeparators: shouldUseThousandSeparators,
1887
2070
  // todo: need update formatNumber
1888
2071
  useTrendUnits: shouldAbbreviateTrendValue
1889
- }) : value;
1890
- // When text is undefined, return empty string
2072
+ }) : value; // When text is undefined, return empty string
2073
+
1891
2074
  text = text || '';
1892
2075
  return text;
1893
2076
  };
1894
-
1895
2077
  /*
1896
2078
  * @method getMajorText
1897
2079
  * @param {Object} props
@@ -1900,10 +2082,11 @@ var computeText = function computeText(_ref4) {
1900
2082
  * @param {Bool} props.shouldUseThousandSeparators
1901
2083
  * @returns {String} majorText
1902
2084
  */
2085
+
1903
2086
  var getMajorText = function getMajorText(_ref5) {
1904
2087
  var majorValue = _ref5.majorValue,
1905
- numberPrecision = _ref5.numberPrecision,
1906
- shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
2088
+ numberPrecision = _ref5.numberPrecision,
2089
+ shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
1907
2090
  return computeText({
1908
2091
  value: majorValue === null ? 'N/A' : majorValue,
1909
2092
  // if majorValue is null, use `N/A`.
@@ -1912,7 +2095,6 @@ var getMajorText = function getMajorText(_ref5) {
1912
2095
  shouldAbbreviateTrendValue: false
1913
2096
  });
1914
2097
  };
1915
-
1916
2098
  /*
1917
2099
  * @method getTrendText
1918
2100
  * @param {Object} props
@@ -1924,13 +2106,15 @@ var getMajorText = function getMajorText(_ref5) {
1924
2106
  * @param {Bool} props.shouldAbbreviateTrendValue
1925
2107
  * @returns {String} trendText
1926
2108
  */
2109
+
1927
2110
  var getTrendText = function getTrendText(_ref6) {
1928
2111
  var majorValue = _ref6.majorValue,
1929
- trendValue = _ref6.trendValue,
1930
- trendDisplay = _ref6.trendDisplay,
1931
- numberPrecision = _ref6.numberPrecision,
1932
- shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
1933
- shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
2112
+ trendValue = _ref6.trendValue,
2113
+ trendDisplay = _ref6.trendDisplay,
2114
+ numberPrecision = _ref6.numberPrecision,
2115
+ shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
2116
+ shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
2117
+
1934
2118
  var compute = function compute(value) {
1935
2119
  return computeText({
1936
2120
  value: value,
@@ -1939,25 +2123,31 @@ var getTrendText = function getTrendText(_ref6) {
1939
2123
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
1940
2124
  });
1941
2125
  };
2126
+
1942
2127
  if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
1943
2128
  return '';
1944
2129
  }
2130
+
1945
2131
  var showPercent = trendDisplay === 'percent';
2132
+
1946
2133
  if (!showPercent) {
1947
2134
  return compute(trendValue);
1948
2135
  }
2136
+
1949
2137
  var diff = Math.abs(trendValue - majorValue);
1950
2138
  var val = Math.round(trendValue / diff * 100);
2139
+
1951
2140
  if (trendValue === 0 && diff === 0) {
1952
2141
  val = 0;
1953
2142
  }
2143
+
1954
2144
  if (!Number.isFinite(val)) {
1955
2145
  return 'N/A';
1956
2146
  }
2147
+
1957
2148
  var text = compute(val);
1958
2149
  return "".concat(text, "%");
1959
2150
  };
1960
-
1961
2151
  /**
1962
2152
  * Helper to determine the font size for an element
1963
2153
  * @method computeFontSize
@@ -1969,16 +2159,16 @@ var getTrendText = function getTrendText(_ref6) {
1969
2159
  * @param {String} [fontWeight='normal'] Boldness of font
1970
2160
  * @returns {Number} The size to use for fontSize styles
1971
2161
  */
2162
+
1972
2163
  var computeFontSize = function computeFontSize(text, _ref7) {
1973
2164
  var width = _ref7.width,
1974
- height = _ref7.height;
2165
+ height = _ref7.height;
1975
2166
  var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
1976
2167
  var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
1977
2168
  var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
1978
2169
  var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
1979
2170
  return parseInt(fontSize, 10);
1980
2171
  };
1981
-
1982
2172
  /*
1983
2173
  * @method getMajorFontSize
1984
2174
  * @param {Object} props
@@ -1989,20 +2179,20 @@ var computeFontSize = function computeFontSize(text, _ref7) {
1989
2179
  * @param {Number} props.spaceRatio
1990
2180
  * @returns {Number} majorFontSize
1991
2181
  */
2182
+
1992
2183
  var getMajorFontSize = function getMajorFontSize(_ref8) {
1993
2184
  var width = _ref8.width,
1994
- height = _ref8.height,
1995
- unit = _ref8.unit,
1996
- majorText = _ref8.majorText,
1997
- _ref8$spaceRatio = _ref8.spaceRatio,
1998
- spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
2185
+ height = _ref8.height,
2186
+ unit = _ref8.unit,
2187
+ majorText = _ref8.majorText,
2188
+ _ref8$spaceRatio = _ref8.spaceRatio,
2189
+ spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
1999
2190
  var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
2000
2191
  return computeFontSize(majorTextCalc, {
2001
2192
  width: width * spaceRatio,
2002
2193
  height: height
2003
2194
  });
2004
2195
  };
2005
-
2006
2196
  /*
2007
2197
  * @method getTrendFontSize
2008
2198
  * @param {Object} props
@@ -2012,13 +2202,15 @@ var getMajorFontSize = function getMajorFontSize(_ref8) {
2012
2202
  * @param {Number} props.spaceRatio
2013
2203
  * @returns {Number} trendFontSize
2014
2204
  */
2205
+
2015
2206
  var getTrendFontSize = function getTrendFontSize(_ref9) {
2016
2207
  var width = _ref9.width,
2017
- height = _ref9.height,
2018
- trendText = _ref9.trendText,
2019
- _ref9$spaceRatio = _ref9.spaceRatio,
2020
- spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
2208
+ height = _ref9.height,
2209
+ trendText = _ref9.trendText,
2210
+ _ref9$spaceRatio = _ref9.spaceRatio,
2211
+ spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
2021
2212
  var trendFontSize = 12;
2213
+
2022
2214
  if (spaceRatio > 0) {
2023
2215
  trendFontSize = computeFontSize(trendText, {
2024
2216
  width: width * spaceRatio,
@@ -2026,18 +2218,18 @@ var getTrendFontSize = function getTrendFontSize(_ref9) {
2026
2218
  });
2027
2219
  trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
2028
2220
  }
2221
+
2029
2222
  return trendFontSize;
2030
2223
  };
2031
-
2032
2224
  /*
2033
2225
  * The height of underLabel should no more than 12px
2034
2226
  * @param {Number} height
2035
2227
  * @return {Number} height || DEFAULT_FONT
2036
2228
  */
2229
+
2037
2230
  var getUnderLabelHeight = function getUnderLabelHeight(height) {
2038
2231
  return height > DEFAULT_FONT ? DEFAULT_FONT : height;
2039
2232
  };
2040
-
2041
2233
  /*
2042
2234
  * @param {Object} config
2043
2235
  * @param {String} underLabel
@@ -2045,19 +2237,18 @@ var getUnderLabelHeight = function getUnderLabelHeight(height) {
2045
2237
  * @param {Number} height height of underLabel
2046
2238
  * @param {Number} fond size of underLabel
2047
2239
  */
2240
+
2048
2241
  var getUnderLabel = function getUnderLabel(_ref10) {
2049
2242
  var underLabel = _ref10.underLabel,
2050
- width = _ref10.width,
2051
- height = _ref10.height;
2052
- return (
2053
- // todo: may need truncate underLabel later
2243
+ width = _ref10.width,
2244
+ height = _ref10.height;
2245
+ return (// todo: may need truncate underLabel later
2054
2246
  computeFontSize(underLabel, {
2055
2247
  width: width,
2056
2248
  height: height
2057
2249
  })
2058
2250
  );
2059
2251
  };
2060
-
2061
2252
  /**
2062
2253
  * Compute value and font size for major and trend
2063
2254
  * @method getMajorAndTrend
@@ -2075,18 +2266,19 @@ var getUnderLabel = function getUnderLabel(_ref10) {
2075
2266
  * @param {Bool} props.shouldAbbreviateTrendValue
2076
2267
  * @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
2077
2268
  */
2269
+
2078
2270
  var getMajorAndTrend = function getMajorAndTrend(_ref11) {
2079
2271
  var width = _ref11.width,
2080
- height = _ref11.height,
2081
- majorValue = _ref11.majorValue,
2082
- trendValue = _ref11.trendValue,
2083
- majorFontSize = _ref11.majorFontSize,
2084
- trendFontSize = _ref11.trendFontSize,
2085
- trendDisplay = _ref11.trendDisplay,
2086
- unit = _ref11.unit,
2087
- numberPrecision = _ref11.numberPrecision,
2088
- shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
2089
- shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
2272
+ height = _ref11.height,
2273
+ majorValue = _ref11.majorValue,
2274
+ trendValue = _ref11.trendValue,
2275
+ majorFontSize = _ref11.majorFontSize,
2276
+ trendFontSize = _ref11.trendFontSize,
2277
+ trendDisplay = _ref11.trendDisplay,
2278
+ unit = _ref11.unit,
2279
+ numberPrecision = _ref11.numberPrecision,
2280
+ shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
2281
+ shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
2090
2282
  var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
2091
2283
  var textContentWidth = width * 0.9;
2092
2284
  var textContentHeight = height * 0.9;
@@ -2123,7 +2315,6 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
2123
2315
  trendTextFontSize: trendTextFontSize
2124
2316
  };
2125
2317
  };
2126
-
2127
2318
  /*
2128
2319
  * @method updateVizInSmallSpace
2129
2320
  * @param {Object} props
@@ -2143,25 +2334,26 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
2143
2334
  * @returns {Object} results.newMajorAndTrend
2144
2335
  * @returns {Object} results.updatedProps
2145
2336
  */
2337
+
2146
2338
  var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
2147
2339
  var width = _ref12.width,
2148
- height = _ref12.height,
2149
- toRemoveList = _ref12.toRemoveList,
2150
- majorValue = _ref12.majorValue,
2151
- trendValue = _ref12.trendValue,
2152
- majorFontSize = _ref12.majorFontSize,
2153
- trendFontSize = _ref12.trendFontSize,
2154
- majorTextFontSize = _ref12.majorTextFontSize,
2155
- unit = _ref12.unit,
2156
- numberPrecision = _ref12.numberPrecision,
2157
- shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
2158
- shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
2340
+ height = _ref12.height,
2341
+ toRemoveList = _ref12.toRemoveList,
2342
+ majorValue = _ref12.majorValue,
2343
+ trendValue = _ref12.trendValue,
2344
+ majorFontSize = _ref12.majorFontSize,
2345
+ trendFontSize = _ref12.trendFontSize,
2346
+ majorTextFontSize = _ref12.majorTextFontSize,
2347
+ unit = _ref12.unit,
2348
+ numberPrecision = _ref12.numberPrecision,
2349
+ shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
2350
+ shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
2159
2351
  var removeIndex = 0;
2160
2352
  var newProps = {}; // options need to be updated
2353
+
2161
2354
  var newMajorAndTrend = {};
2162
- var newTextSize = majorTextFontSize;
2355
+ var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
2163
2356
 
2164
- // remove info on viz to make textFontSize >= 12px;
2165
2357
  while (newTextSize < 12 && removeIndex < toRemoveList.length) {
2166
2358
  var toRemove = toRemoveList[removeIndex];
2167
2359
  newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
@@ -2179,9 +2371,9 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
2179
2371
  }, newProps));
2180
2372
  newTextSize = newMajorAndTrend.majorTextFontSize;
2181
2373
  removeIndex += 1;
2182
- }
2374
+ } // truncate text if textFontSize is still less than 12
2375
+
2183
2376
 
2184
- // truncate text if textFontSize is still less than 12
2185
2377
  if (newTextSize < 12) {
2186
2378
  var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
2187
2379
  newMajorAndTrend = getMajorAndTrend(_objectSpread({
@@ -2197,12 +2389,12 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
2197
2389
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
2198
2390
  }, newProps));
2199
2391
  }
2392
+
2200
2393
  return {
2201
2394
  newMajorAndTrend: newMajorAndTrend,
2202
2395
  updatedProps: newProps
2203
2396
  };
2204
2397
  };
2205
-
2206
2398
  /*
2207
2399
  * @method computeSingleValueContent
2208
2400
  * @param {Object} props
@@ -2228,67 +2420,71 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
2228
2420
  * @returns {String} results.majorValueTitle
2229
2421
  * @returns {Object} results.smallVizProps
2230
2422
  */
2423
+
2231
2424
  var computeSingleValueContent = function computeSingleValueContent(_ref13) {
2232
2425
  var contentWidth = _ref13.contentWidth,
2233
- contentHeight = _ref13.contentHeight,
2234
- containerWidth = _ref13.containerWidth,
2235
- containerHeight = _ref13.containerHeight,
2236
- majorValue = _ref13.majorValue,
2237
- trendValue = _ref13.trendValue,
2238
- majorFontSize = _ref13.majorFontSize,
2239
- trendFontSize = _ref13.trendFontSize,
2240
- trendDisplay = _ref13.trendDisplay,
2241
- unit = _ref13.unit,
2242
- numberPrecision = _ref13.numberPrecision,
2243
- shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
2244
- shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
2245
- toRemoveList = _ref13.toRemoveList;
2426
+ contentHeight = _ref13.contentHeight,
2427
+ containerWidth = _ref13.containerWidth,
2428
+ containerHeight = _ref13.containerHeight,
2429
+ majorValue = _ref13.majorValue,
2430
+ trendValue = _ref13.trendValue,
2431
+ majorFontSize = _ref13.majorFontSize,
2432
+ trendFontSize = _ref13.trendFontSize,
2433
+ trendDisplay = _ref13.trendDisplay,
2434
+ unit = _ref13.unit,
2435
+ numberPrecision = _ref13.numberPrecision,
2436
+ shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
2437
+ shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
2438
+ toRemoveList = _ref13.toRemoveList;
2439
+
2246
2440
  var _getMajorAndTrend = getMajorAndTrend({
2247
- majorValue: majorValue,
2441
+ majorValue: majorValue,
2442
+ trendValue: trendValue,
2443
+ majorFontSize: majorFontSize,
2444
+ trendFontSize: trendFontSize,
2445
+ trendDisplay: trendDisplay,
2446
+ width: contentWidth,
2447
+ height: contentHeight,
2448
+ unit: unit,
2449
+ numberPrecision: numberPrecision,
2450
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
2451
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
2452
+ }),
2453
+ majorText = _getMajorAndTrend.majorText,
2454
+ trendText = _getMajorAndTrend.trendText,
2455
+ majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
2456
+ trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
2457
+
2458
+ var majorValueTitle = majorText;
2459
+ var smallVizProps = {}; // update viz in small space
2460
+ // if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
2461
+ // or truncate major value to make the major font size >= 12
2462
+
2463
+ if (majorTextFontSize < 12) {
2464
+ var _updateVizInSmallSpac = updateVizInSmallSpace({
2465
+ width: containerWidth,
2466
+ height: containerHeight,
2467
+ toRemoveList: toRemoveList,
2468
+ majorValue: majorValue,
2248
2469
  trendValue: trendValue,
2249
2470
  majorFontSize: majorFontSize,
2250
2471
  trendFontSize: trendFontSize,
2251
- trendDisplay: trendDisplay,
2252
- width: contentWidth,
2253
- height: contentHeight,
2472
+ majorTextFontSize: majorTextFontSize,
2254
2473
  unit: unit,
2255
2474
  numberPrecision: numberPrecision,
2256
2475
  shouldUseThousandSeparators: shouldUseThousandSeparators,
2257
2476
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
2258
2477
  }),
2259
- majorText = _getMajorAndTrend.majorText,
2260
- trendText = _getMajorAndTrend.trendText,
2261
- majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
2262
- trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
2263
- var majorValueTitle = majorText;
2264
- var smallVizProps = {};
2478
+ newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
2479
+ updatedProps = _updateVizInSmallSpac.updatedProps;
2265
2480
 
2266
- // update viz in small space
2267
- // if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
2268
- // or truncate major value to make the major font size >= 12
2269
- if (majorTextFontSize < 12) {
2270
- var _updateVizInSmallSpac = updateVizInSmallSpace({
2271
- width: containerWidth,
2272
- height: containerHeight,
2273
- toRemoveList: toRemoveList,
2274
- majorValue: majorValue,
2275
- trendValue: trendValue,
2276
- majorFontSize: majorFontSize,
2277
- trendFontSize: trendFontSize,
2278
- majorTextFontSize: majorTextFontSize,
2279
- unit: unit,
2280
- numberPrecision: numberPrecision,
2281
- shouldUseThousandSeparators: shouldUseThousandSeparators,
2282
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
2283
- }),
2284
- newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
2285
- updatedProps = _updateVizInSmallSpac.updatedProps;
2286
2481
  majorText = newMajorAndTrend.majorText;
2287
2482
  trendText = newMajorAndTrend.trendText;
2288
2483
  majorTextFontSize = newMajorAndTrend.majorTextFontSize;
2289
2484
  trendTextFontSize = newMajorAndTrend.trendTextFontSize;
2290
2485
  smallVizProps = updatedProps;
2291
2486
  }
2487
+
2292
2488
  return {
2293
2489
  majorText: majorText,
2294
2490
  trendText: trendText,
@@ -2300,17 +2496,17 @@ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
2300
2496
  };
2301
2497
  var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
2302
2498
  var text = _ref14.text,
2303
- _ref14$fontSize = _ref14.fontSize,
2304
- fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
2305
- _ref14$fontFamily = _ref14.fontFamily,
2306
- fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
2307
- _ref14$fontWeight = _ref14.fontWeight,
2308
- fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
2309
- containerWidth = _ref14.containerWidth;
2499
+ _ref14$fontSize = _ref14.fontSize,
2500
+ fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
2501
+ _ref14$fontFamily = _ref14.fontFamily,
2502
+ fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
2503
+ _ref14$fontWeight = _ref14.fontWeight,
2504
+ fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
2505
+ containerWidth = _ref14.containerWidth;
2310
2506
  var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
2311
2507
  var modifiedText = text;
2312
- var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
2313
- // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.
2508
+ var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily)); // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.
2509
+
2314
2510
  if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
2315
2511
  // Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
2316
2512
  // `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
@@ -2319,11 +2515,12 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
2319
2515
  modifiedText = modifiedText.substring(0, modifiedText.length - 1);
2320
2516
  textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
2321
2517
  }
2518
+
2322
2519
  modifiedText = "".concat(modifiedText, "...");
2323
2520
  }
2521
+
2324
2522
  return modifiedText;
2325
2523
  };
2326
-
2327
2524
  /*
2328
2525
  * @method computeSingleValueRadialContent
2329
2526
  * @param {Object} props
@@ -2350,44 +2547,46 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
2350
2547
  * @returns {String} results.majorValueTitle
2351
2548
  * @returns {Object} results.smallVizProps
2352
2549
  */
2550
+
2353
2551
  var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
2354
2552
  var contentWidth = _ref15.contentWidth,
2355
- contentHeight = _ref15.contentHeight,
2356
- containerWidth = _ref15.containerWidth,
2357
- containerHeight = _ref15.containerHeight,
2358
- majorValue = _ref15.majorValue,
2359
- trendValue = _ref15.trendValue,
2360
- majorFontSize = _ref15.majorFontSize,
2361
- trendFontSize = _ref15.trendFontSize,
2362
- trendDisplay = _ref15.trendDisplay,
2363
- unit = _ref15.unit,
2364
- numberPrecision = _ref15.numberPrecision,
2365
- shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
2366
- shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
2367
- smallViz = _ref15.smallViz;
2553
+ contentHeight = _ref15.contentHeight,
2554
+ containerWidth = _ref15.containerWidth,
2555
+ containerHeight = _ref15.containerHeight,
2556
+ majorValue = _ref15.majorValue,
2557
+ trendValue = _ref15.trendValue,
2558
+ majorFontSize = _ref15.majorFontSize,
2559
+ trendFontSize = _ref15.trendFontSize,
2560
+ trendDisplay = _ref15.trendDisplay,
2561
+ unit = _ref15.unit,
2562
+ numberPrecision = _ref15.numberPrecision,
2563
+ shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
2564
+ shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
2565
+ smallViz = _ref15.smallViz;
2566
+
2368
2567
  var _getMajorAndTrend2 = getMajorAndTrend({
2369
- majorValue: majorValue,
2370
- trendValue: trendValue,
2371
- majorFontSize: majorFontSize,
2372
- trendFontSize: trendFontSize,
2373
- trendDisplay: trendDisplay,
2374
- width: contentWidth,
2375
- height: contentHeight,
2376
- unit: unit,
2377
- numberPrecision: numberPrecision,
2378
- shouldUseThousandSeparators: shouldUseThousandSeparators,
2379
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
2380
- }),
2381
- majorText = _getMajorAndTrend2.majorText,
2382
- trendText = _getMajorAndTrend2.trendText,
2383
- majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
2384
- trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
2385
- var majorValueTitle = majorText;
2386
- var smallVizProps = {};
2568
+ majorValue: majorValue,
2569
+ trendValue: trendValue,
2570
+ majorFontSize: majorFontSize,
2571
+ trendFontSize: trendFontSize,
2572
+ trendDisplay: trendDisplay,
2573
+ width: contentWidth,
2574
+ height: contentHeight,
2575
+ unit: unit,
2576
+ numberPrecision: numberPrecision,
2577
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
2578
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
2579
+ }),
2580
+ majorText = _getMajorAndTrend2.majorText,
2581
+ trendText = _getMajorAndTrend2.trendText,
2582
+ majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
2583
+ trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
2387
2584
 
2388
- // custom logic for viz in small space
2585
+ var majorValueTitle = majorText;
2586
+ var smallVizProps = {}; // custom logic for viz in small space
2389
2587
  // if not showing the radial graph (if `smallViz` is true), then compute truncated major value
2390
2588
  // and font sizes
2589
+
2391
2590
  if (smallViz) {
2392
2591
  var truncateValue = minimallyTruncateStringToWidth({
2393
2592
  text: majorValue,
@@ -2395,6 +2594,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
2395
2594
  fontSize: 12,
2396
2595
  containerWidth: containerWidth
2397
2596
  });
2597
+
2398
2598
  var _getMajorAndTrend3 = getMajorAndTrend({
2399
2599
  majorValue: truncateValue,
2400
2600
  trendValue: trendValue,
@@ -2408,6 +2608,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
2408
2608
  shouldUseThousandSeparators: shouldUseThousandSeparators,
2409
2609
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
2410
2610
  });
2611
+
2411
2612
  majorText = _getMajorAndTrend3.majorText;
2412
2613
  trendText = _getMajorAndTrend3.trendText;
2413
2614
  majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
@@ -2417,6 +2618,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
2417
2618
  unit: unit
2418
2619
  };
2419
2620
  }
2621
+
2420
2622
  return {
2421
2623
  majorText: majorText,
2422
2624
  trendText: trendText,
@@ -2426,7 +2628,6 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
2426
2628
  smallVizProps: smallVizProps
2427
2629
  };
2428
2630
  };
2429
-
2430
2631
  /**
2431
2632
  * Get the colors for a graph
2432
2633
  *
@@ -2439,21 +2640,22 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
2439
2640
  * @returns {Object} { background, stroke } colors
2440
2641
  * @private
2441
2642
  */
2643
+
2442
2644
  var getGraphColors = function getGraphColors(_ref16) {
2443
2645
  var backgroundEnabled = _ref16.backgroundEnabled,
2444
- backgroundColor = _ref16.backgroundColor,
2445
- defaultColors = _ref16.defaultColors,
2446
- customColorFormatter = _ref16.customColorFormatter;
2447
- // Only do custom colors in block mode
2646
+ backgroundColor = _ref16.backgroundColor,
2647
+ defaultColors = _ref16.defaultColors,
2648
+ customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
2649
+
2448
2650
  if (backgroundEnabled) {
2449
2651
  // Check if the user defined colors to use
2450
2652
  if (backgroundColor && typeof customColorFormatter === 'function') {
2451
2653
  return customColorFormatter(backgroundColor);
2452
2654
  }
2453
2655
  }
2656
+
2454
2657
  return defaultColors.none;
2455
2658
  };
2456
-
2457
2659
  /**
2458
2660
  * Adjust rgb value if it equals to 0 or 255
2459
2661
  * @method adjustRGB
@@ -2462,16 +2664,18 @@ var getGraphColors = function getGraphColors(_ref16) {
2462
2664
  * @returns {Number} adjusted rgb
2463
2665
  * @private
2464
2666
  */
2667
+
2465
2668
  var adjustRGB = function adjustRGB(rgb, delta) {
2466
2669
  if (rgb === 255) {
2467
2670
  return rgb - delta;
2468
2671
  }
2672
+
2469
2673
  if (rgb === 0) {
2470
2674
  return rgb + delta;
2471
2675
  }
2676
+
2472
2677
  return rgb;
2473
2678
  };
2474
-
2475
2679
  /**
2476
2680
  * Modifies colors by multiplying by a given ratio
2477
2681
  * @method changeColor
@@ -2480,18 +2684,16 @@ var adjustRGB = function adjustRGB(rgb, delta) {
2480
2684
  * @returns {String} new color
2481
2685
  * @private
2482
2686
  */
2687
+
2483
2688
  var changeColor = function changeColor(color, ratio) {
2484
2689
  var hex = color.replace(/(0x|#)/, '');
2485
2690
  var r = parseInt(hex.substr(0, 2), 16);
2486
2691
  var g = parseInt(hex.substr(2, 2), 16);
2487
- var b = parseInt(hex.substr(4, 2), 16);
2692
+ var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
2488
2693
 
2489
- // Multiply by given ratio, make sure is between 0 and 255;
2490
2694
  var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
2491
2695
  var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
2492
- var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);
2493
-
2494
- // If the color is not changed
2696
+ var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
2495
2697
  // case 1: the color is (0, 0 0)
2496
2698
  // lighten color (80, 80, 80)
2497
2699
  // darken color (40, 40, 40)
@@ -2500,6 +2702,7 @@ var changeColor = function changeColor(color, ratio) {
2500
2702
  // darken color (175, 175, 175)
2501
2703
  // case 3: the color is e.g. (0, 255, 0)
2502
2704
  // new color (20, 235, 20)
2705
+
2503
2706
  if (newR === r && newG === g && newB === b) {
2504
2707
  if (newR === 0 && newG === 0 && newB === 0) {
2505
2708
  if (ratio > 1) {
@@ -2527,9 +2730,9 @@ var changeColor = function changeColor(color, ratio) {
2527
2730
  newB = adjustRGB(newB, 20);
2528
2731
  }
2529
2732
  }
2733
+
2530
2734
  return "#".concat(newR.toString(16).padStart(2, 0)) + "".concat(newG.toString(16).padStart(2, 0)) + "".concat(newB.toString(16).padStart(2, 0));
2531
2735
  };
2532
-
2533
2736
  /**
2534
2737
  * Lighten a given color
2535
2738
  * @method lighten
@@ -2537,10 +2740,11 @@ var changeColor = function changeColor(color, ratio) {
2537
2740
  * @returns {String}
2538
2741
  * @private
2539
2742
  */
2743
+
2744
+
2540
2745
  var lighten = function lighten(color) {
2541
2746
  return changeColor(color, 1.3);
2542
2747
  };
2543
-
2544
2748
  /**
2545
2749
  * Darkens a given color
2546
2750
  * @method darken
@@ -2548,10 +2752,10 @@ var lighten = function lighten(color) {
2548
2752
  * @returns {String}
2549
2753
  * @private
2550
2754
  */
2755
+
2551
2756
  var darken = function darken(color) {
2552
2757
  return changeColor(color, 0.5);
2553
2758
  };
2554
-
2555
2759
  /** consistent token structure: handle callback to add value and name in event payload
2556
2760
  * @method handleValueClickCallback
2557
2761
  * @param {Object} ev
@@ -2560,6 +2764,7 @@ var darken = function darken(color) {
2560
2764
  * @param {Number} trendValue
2561
2765
  * @param {Function} onValueClick
2562
2766
  */
2767
+
2563
2768
  var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
2564
2769
  var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
2565
2770
  var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
@@ -2569,12 +2774,14 @@ var handleValueClickCallback = function handleValueClickCallback(ev, majorValue,
2569
2774
  value: majorValue,
2570
2775
  name: majorValueField
2571
2776
  };
2777
+
2572
2778
  if (trellisEnabled) {
2573
2779
  payload = _objectSpread(_objectSpread({}, payload), {}, {
2574
2780
  'trellis.name': trellisSplityBy,
2575
2781
  'trellis.value': trellisKey
2576
2782
  });
2577
2783
  }
2784
+
2578
2785
  return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
2579
2786
  payload: payload
2580
2787
  }));
@@ -2648,11 +2855,17 @@ Object.defineProperty(exports, "__esModule", {
2648
2855
  value: true
2649
2856
  });
2650
2857
  exports.shouldShowIconPlaceholder = void 0;
2858
+
2651
2859
  var React = __webpack_require__(1);
2860
+
2652
2861
  var T = __webpack_require__(0);
2862
+
2653
2863
  var lodash_1 = __webpack_require__(3);
2864
+
2654
2865
  var i18n_1 = __webpack_require__(2);
2866
+
2655
2867
  var Message_1 = __webpack_require__(10);
2868
+
2656
2869
  var FixedSizeContainer_1 = __webpack_require__(13);
2657
2870
  /**
2658
2871
  * @method shouldShowIconPlaceholder
@@ -2660,6 +2873,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
2660
2873
  * @param {boolean} loading
2661
2874
  * @returns {boolean}
2662
2875
  */
2876
+
2877
+
2663
2878
  var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
2664
2879
  var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2665
2880
  var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
@@ -2668,6 +2883,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
2668
2883
  var noFields = fields === undefined;
2669
2884
  return loading || noData || noFields;
2670
2885
  };
2886
+
2671
2887
  exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
2672
2888
  var propTypes = {
2673
2889
  icon: T.func,
@@ -2682,11 +2898,13 @@ var propTypes = {
2682
2898
  * @param {IconPlaceholderProps} props
2683
2899
  * @returns {React.ReactElement}
2684
2900
  */
2901
+
2685
2902
  var IconPlaceholder = function IconPlaceholder(props) {
2686
2903
  var width = props.width,
2687
- height = props.height,
2688
- icon = props.icon,
2689
- iconColor = props.iconColor;
2904
+ height = props.height,
2905
+ icon = props.icon,
2906
+ iconColor = props.iconColor;
2907
+
2690
2908
  if (icon) {
2691
2909
  return React.createElement(icon, {
2692
2910
  style: {
@@ -2698,9 +2916,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
2698
2916
  transform: 'translate(-50%, -50%)'
2699
2917
  },
2700
2918
  width: '50%',
2701
- height: '50%'
2919
+ height: '50%',
2920
+ 'data-test': 'icon-placeholder'
2702
2921
  });
2703
2922
  }
2923
+
2704
2924
  return React.createElement(Message_1.default, {
2705
2925
  width: width,
2706
2926
  height: height,
@@ -2708,6 +2928,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
2708
2928
  message: (0, i18n_1._)('No DataSource Connected')
2709
2929
  });
2710
2930
  };
2931
+
2711
2932
  IconPlaceholder.propTypes = propTypes;
2712
2933
  IconPlaceholder.defaultProps = {
2713
2934
  width: '100%',
@@ -2724,21 +2945,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
2724
2945
 
2725
2946
 
2726
2947
  var _defineProperty = __webpack_require__(7);
2948
+
2727
2949
  Object.defineProperty(exports, "__esModule", {
2728
2950
  value: true
2729
2951
  });
2730
2952
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
2953
+
2731
2954
  var T = __webpack_require__(0);
2955
+
2732
2956
  var lodash_1 = __webpack_require__(3);
2733
- var DataSource_1 = __webpack_require__(43);
2957
+
2958
+ var DataSource_1 = __webpack_require__(34);
2959
+
2734
2960
  exports.SortParamsPropTypes = T.shape({
2735
2961
  currentSortKey: T.string,
2736
2962
  currentSortDir: T.oneOf(DataSource_1.validSortDirs),
2737
2963
  onSort: T.func
2738
2964
  });
2965
+
2739
2966
  var getSortingParams = function getSortingParams(_ref) {
2740
2967
  var requestParams = _ref.requestParams,
2741
- onRequestParamsChange = _ref.onRequestParamsChange;
2968
+ onRequestParamsChange = _ref.onRequestParamsChange;
2742
2969
  var currentSortKey;
2743
2970
  var currentSortDir;
2744
2971
  var nextSortDirMap = {
@@ -2747,15 +2974,18 @@ var getSortingParams = function getSortingParams(_ref) {
2747
2974
  none: 'asc'
2748
2975
  };
2749
2976
  var onSort;
2977
+
2750
2978
  if (typeof onRequestParamsChange === 'function') {
2751
2979
  if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
2752
2980
  currentSortKey = Object.keys(requestParams.sort).shift();
2753
2981
  currentSortDir = requestParams.sort[currentSortKey];
2754
- }
2755
- // undid memoization since there is a dependency on requestParams, which is a deeply nested object
2982
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
2983
+
2984
+
2756
2985
  onSort = function onSort(e, _ref2) {
2757
2986
  var sortKey = _ref2.sortKey,
2758
- sortDir = _ref2.sortDir;
2987
+ sortDir = _ref2.sortDir;
2988
+
2759
2989
  if (typeof sortKey === 'string') {
2760
2990
  var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
2761
2991
  onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
@@ -2767,12 +2997,14 @@ var getSortingParams = function getSortingParams(_ref) {
2767
2997
  }
2768
2998
  };
2769
2999
  }
3000
+
2770
3001
  return {
2771
3002
  currentSortKey: currentSortKey,
2772
3003
  currentSortDir: currentSortDir,
2773
3004
  onSort: onSort
2774
3005
  };
2775
3006
  };
3007
+
2776
3008
  exports.getSortingParams = getSortingParams;
2777
3009
 
2778
3010
  /***/ }),
@@ -2783,43 +3015,69 @@ exports.getSortingParams = getSortingParams;
2783
3015
  "use strict";
2784
3016
 
2785
3017
 
3018
+ Object.defineProperty(exports, "__esModule", {
3019
+ value: true
3020
+ });
3021
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
3022
+ exports.validSortDirs = ['asc', 'desc', 'none'];
3023
+ exports.validSegmentationModes = ['none', 'inner'];
3024
+ exports.validOutputModes = ['json_cols', 'json'];
3025
+
3026
+ /***/ }),
3027
+
3028
+ /***/ 35:
3029
+ /***/ (function(module, exports, __webpack_require__) {
3030
+
3031
+ "use strict";
3032
+
3033
+
2786
3034
  Object.defineProperty(exports, "__esModule", {
2787
3035
  value: true
2788
3036
  });
2789
3037
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
3038
+
2790
3039
  var T = __webpack_require__(0);
3040
+
2791
3041
  var lodash_1 = __webpack_require__(3);
3042
+
2792
3043
  exports.PaginatorParamsPropTypes = T.shape({
2793
3044
  isPaging: T.bool,
2794
3045
  current: T.number,
2795
3046
  totalPages: T.number,
2796
3047
  onChange: T.func
2797
3048
  });
3049
+
2798
3050
  var getPaginationParams = function getPaginationParams(_ref) {
2799
3051
  var requestParams = _ref.requestParams,
2800
- meta = _ref.meta,
2801
- onRequestParamsChange = _ref.onRequestParamsChange;
3052
+ meta = _ref.meta,
3053
+ onRequestParamsChange = _ref.onRequestParamsChange;
2802
3054
  var totalCount = meta && meta.totalCount || 0;
2803
3055
  var offset = requestParams && requestParams.offset || 0;
2804
3056
  var count = requestParams && requestParams.count;
2805
3057
  var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
2806
3058
  var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
2807
3059
  var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
3060
+
2808
3061
  var onChangeHandler = function onChangeHandler(e, _ref2) {
2809
3062
  var page = _ref2.page,
2810
- countArg = _ref2.count;
3063
+ countArg = _ref2.count;
2811
3064
  var newParams = (0, lodash_1.cloneDeep)(requestParams);
3065
+
2812
3066
  if (typeof countArg === 'number') {
2813
3067
  newParams.count = countArg;
2814
3068
  newParams.offset = 0;
2815
3069
  }
3070
+
2816
3071
  var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
3072
+
2817
3073
  if (typeof page === 'number' && page > 0) {
2818
3074
  newParams.count = pageCount;
2819
3075
  newParams.offset = (page - 1) * pageCount;
2820
3076
  }
3077
+
2821
3078
  onRequestParamsChange(newParams);
2822
3079
  };
3080
+
2823
3081
  return {
2824
3082
  isPaging: isPaging,
2825
3083
  current: current,
@@ -2827,11 +3085,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
2827
3085
  onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
2828
3086
  };
2829
3087
  };
3088
+
2830
3089
  exports.getPaginationParams = getPaginationParams;
2831
3090
 
2832
3091
  /***/ }),
2833
3092
 
2834
- /***/ 35:
3093
+ /***/ 36:
2835
3094
  /***/ (function(module, exports, __webpack_require__) {
2836
3095
 
2837
3096
  "use strict";
@@ -2842,6 +3101,7 @@ Object.defineProperty(exports, "__esModule", {
2842
3101
  });
2843
3102
  exports.VizCategory = void 0;
2844
3103
  var VizCategory;
3104
+
2845
3105
  (function (VizCategory) {
2846
3106
  VizCategory["SINGLE_VALUE"] = "Single Value";
2847
3107
  VizCategory["TRENDS"] = "Trends";
@@ -2859,67 +3119,96 @@ var VizCategory;
2859
3119
 
2860
3120
  /***/ }),
2861
3121
 
2862
- /***/ 36:
3122
+ /***/ 37:
2863
3123
  /***/ (function(module, exports, __webpack_require__) {
2864
3124
 
2865
3125
  "use strict";
2866
3126
 
2867
3127
 
2868
3128
  var _slicedToArray = __webpack_require__(17);
3129
+
2869
3130
  Object.defineProperty(exports, "__esModule", {
2870
3131
  value: true
2871
3132
  });
3133
+
2872
3134
  var React = __webpack_require__(1);
3135
+
2873
3136
  var lodash_1 = __webpack_require__(3);
2874
- var getSettingsFromThemedProps_1 = __webpack_require__(37);
3137
+
3138
+ var getSettingsFromThemedProps_1 = __webpack_require__(38);
3139
+
2875
3140
  var Options_1 = __webpack_require__(30);
2876
- var SanitizeProps_1 = __webpack_require__(38);
3141
+
3142
+ var SanitizeProps_1 = __webpack_require__(39);
3143
+
2877
3144
  var TimezoneContext_1 = __webpack_require__(26);
2878
- var moment_1 = __webpack_require__(39);
3145
+
3146
+ var moment_1 = __webpack_require__(40);
3147
+
2879
3148
  var FeatureFlagContext_1 = __webpack_require__(21);
3149
+
2880
3150
  var styled_components_1 = __webpack_require__(4);
3151
+
2881
3152
  var hocUtils_1 = __webpack_require__(27);
3153
+
2882
3154
  var JSONSchemaUtils_1 = __webpack_require__(28);
2883
- var async_dynamic_options_evaluator_1 = __webpack_require__(40);
3155
+
3156
+ var async_dynamic_options_evaluator_1 = __webpack_require__(41);
3157
+
2884
3158
  var id_1 = __webpack_require__(25);
2885
- var SplunkVisualization_1 = __webpack_require__(41);
3159
+
3160
+ var SplunkVisualization_1 = __webpack_require__(42);
3161
+
2886
3162
  var VizBehavior_1 = __webpack_require__(6);
3163
+
2887
3164
  var getSorting_1 = __webpack_require__(33);
2888
- var getPagination_1 = __webpack_require__(34);
3165
+
3166
+ var getPagination_1 = __webpack_require__(35);
3167
+
2889
3168
  var useDeepMemo_1 = __webpack_require__(44);
3169
+
2890
3170
  var MissingPropsMessage_1 = __webpack_require__(45);
3171
+
2891
3172
  var withEditModeCover_1 = __webpack_require__(46);
3173
+
2892
3174
  var withPlaceholder_1 = __webpack_require__(47);
2893
3175
  /**
2894
3176
  * hoc that wraps a pure react visualization in a Dashboard visualization
2895
3177
  * @param {DashboardVizOpts} opts
2896
3178
  * @returns {HOC}
2897
3179
  */
3180
+
3181
+
2898
3182
  var withDashboardViz = function withDashboardViz(opts) {
2899
3183
  var ReactViz = opts.ReactViz,
2900
- vizConfig = opts.vizConfig,
2901
- _opts$computeVizProps = opts.computeVizProps,
2902
- computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
2903
- disableEditModeCover = opts.disableEditModeCover,
2904
- useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
3184
+ vizConfig = opts.vizConfig,
3185
+ _opts$computeVizProps = opts.computeVizProps,
3186
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
3187
+ disableEditModeCover = opts.disableEditModeCover,
3188
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
3189
+
2905
3190
  var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
2906
3191
  var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
3192
+
2907
3193
  var DashboardViz = function DashboardViz(props) {
2908
3194
  var _a;
3195
+
2909
3196
  var mode = props.mode,
2910
- hasEventHandlers = props.hasEventHandlers,
2911
- dataSources = props.dataSources,
2912
- options = props.options,
2913
- _props$context = props.context,
2914
- context = _props$context === void 0 ? {} : _props$context,
2915
- width = props.width,
2916
- height = props.height,
2917
- onComputedProps = props.onComputedProps,
2918
- onEventTrigger = props.onEventTrigger,
2919
- theme = props.theme,
2920
- onRequestParamsChange = props.onRequestParamsChange;
3197
+ hasEventHandlers = props.hasEventHandlers,
3198
+ dataSources = props.dataSources,
3199
+ options = props.options,
3200
+ _props$context = props.context,
3201
+ context = _props$context === void 0 ? {} : _props$context,
3202
+ width = props.width,
3203
+ height = props.height,
3204
+ onComputedProps = props.onComputedProps,
3205
+ onEventTrigger = props.onEventTrigger,
3206
+ theme = props.theme,
3207
+ onRequestParamsChange = props.onRequestParamsChange;
3208
+
2921
3209
  var _React$useContext = React.useContext(TimezoneContext_1.default),
2922
- serializedTimezone = _React$useContext.serializedTimezone;
3210
+ serializedTimezone = _React$useContext.serializedTimezone;
3211
+
2923
3212
  if (serializedTimezone) {
2924
3213
  /*
2925
3214
  @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
@@ -2933,38 +3222,51 @@ var withDashboardViz = function withDashboardViz(opts) {
2933
3222
  moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
2934
3223
  }
2935
3224
  }
3225
+
2936
3226
  var themeFunc = function themeFunc(themeVar) {
2937
3227
  var _a, _b;
3228
+
2938
3229
  return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
2939
3230
  };
3231
+
2940
3232
  var bgColorFromTheme = themeFunc('defaultBackgroundColor');
3233
+
2941
3234
  var _ref = (0, getSettingsFromThemedProps_1.default)({
2942
- theme: theme
2943
- }),
2944
- currentThemeFamily = _ref.family,
2945
- currentThemeColorScheme = _ref.colorScheme,
2946
- currentThemeDensity = _ref.density;
3235
+ theme: theme
3236
+ }),
3237
+ currentThemeFamily = _ref.family,
3238
+ currentThemeColorScheme = _ref.colorScheme,
3239
+ currentThemeDensity = _ref.density;
3240
+
2947
3241
  var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
3242
+
2948
3243
  var _React$useState = React.useState({}),
2949
- _React$useState2 = _slicedToArray(_React$useState, 2),
2950
- evaluatedOptionsAsync = _React$useState2[0],
2951
- setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
3244
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3245
+ evaluatedOptionsAsync = _React$useState2[0],
3246
+ setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
3247
+
3248
+
2952
3249
  var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
3250
+
2953
3251
  var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
2954
- _React$useState4 = _slicedToArray(_React$useState3, 1),
2955
- visualizationID = _React$useState4[0];
3252
+ _React$useState4 = _slicedToArray(_React$useState3, 1),
3253
+ visualizationID = _React$useState4[0];
3254
+
2956
3255
  var _React$useState5 = React.useState({}),
2957
- _React$useState6 = _slicedToArray(_React$useState5, 2),
2958
- dataSourcesInState = _React$useState6[0],
2959
- setDataSourcesInState = _React$useState6[1];
3256
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
3257
+ dataSourcesInState = _React$useState6[0],
3258
+ setDataSourcesInState = _React$useState6[1];
3259
+
2960
3260
  var _React$useState7 = React.useState(),
2961
- _React$useState8 = _slicedToArray(_React$useState7, 2),
2962
- dataFramesInState = _React$useState8[0],
2963
- setDataFramesInState = _React$useState8[1];
3261
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
3262
+ dataFramesInState = _React$useState8[0],
3263
+ setDataFramesInState = _React$useState8[1];
3264
+
2964
3265
  var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
2965
- _React$useState10 = _slicedToArray(_React$useState9, 2),
2966
- useAsyncEvaluatedOptions = _React$useState10[0],
2967
- setUseAsyncEvaluatedOptions = _React$useState10[1];
3266
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
3267
+ useAsyncEvaluatedOptions = _React$useState10[0],
3268
+ setUseAsyncEvaluatedOptions = _React$useState10[1];
3269
+
2968
3270
  var isMounted = React.useRef(true);
2969
3271
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
2970
3272
  try {
@@ -2989,11 +3291,13 @@ var withDashboardViz = function withDashboardViz(opts) {
2989
3291
  });
2990
3292
  } else {
2991
3293
  var dataFrames = dataFramesInState;
3294
+
2992
3295
  if (dataSources !== dataSourcesInState) {
2993
3296
  setDataSourcesInState(dataSources);
2994
3297
  dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
2995
3298
  setDataFramesInState(dataFrames);
2996
3299
  }
3300
+
2997
3301
  return Options_1.Options.evaluate({
2998
3302
  context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
2999
3303
  options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
@@ -3004,21 +3308,24 @@ var withDashboardViz = function withDashboardViz(opts) {
3004
3308
  console.error("unexpected error evaluating options: ".concat(e.message));
3005
3309
  return {};
3006
3310
  }
3311
+
3007
3312
  return {};
3008
3313
  }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
3009
- var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
3010
- // trellis specific backgroundColor update for onComputedProps
3314
+ var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
3011
3315
  // 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
3012
3316
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
3317
+
3013
3318
  var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
3014
3319
  var clonedEvaluatedOptions = evaluatedOptionsToUse;
3320
+
3015
3321
  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) {
3016
3322
  clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
3017
3323
  backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
3018
3324
  });
3019
- }
3020
- // useEffect hook needs to be initialized before any early returns
3325
+ } // useEffect hook needs to be initialized before any early returns
3021
3326
  // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
3327
+
3328
+
3022
3329
  React.useEffect(function () {
3023
3330
  onComputedProps(clonedEvaluatedOptions);
3024
3331
  });
@@ -3028,53 +3335,68 @@ var withDashboardViz = function withDashboardViz(opts) {
3028
3335
  isMounted.current = false;
3029
3336
  async_dynamic_options_evaluator_1.default.reset(visualizationID);
3030
3337
  }
3031
- };
3032
- // eslint-disable-next-line react-hooks/exhaustive-deps
3033
- }, []);
3034
- // present warning message if any required props are missing
3338
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
3339
+ }, []); // present warning message if any required props are missing
3340
+
3035
3341
  var _vizConfig$requiredPr = vizConfig.requiredProps,
3036
- requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
3037
- supports = vizConfig.supports;
3342
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
3343
+ supports = vizConfig.supports;
3038
3344
  var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
3345
+
3039
3346
  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
3040
3347
  ) {
3041
- return React.createElement(MissingPropsMessage_1.default, {
3042
- "data-test": "missing-props-message",
3043
- width: width,
3044
- height: height,
3045
- missingProps: missing,
3046
- backgroundColor: bgColorFromTheme
3047
- });
3048
- }
3049
- // events
3348
+ return React.createElement(MissingPropsMessage_1.default, {
3349
+ "data-test": "missing-props-message",
3350
+ width: width,
3351
+ height: height,
3352
+ missingProps: missing,
3353
+ backgroundColor: bgColorFromTheme
3354
+ });
3355
+ } // events
3356
+
3357
+
3050
3358
  var eventCallbackProps = {};
3359
+
3051
3360
  if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
3052
3361
  var supportedEvents = vizConfig.events;
3053
3362
  Object.keys(supportedEvents).forEach(function (eventName) {
3054
- var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
3055
- eventCallbackProps[eventCallbackPropName] = null;
3056
- // todo: refactor single value and single value icon to send payload from viz
3363
+ var _supportedEvents$even = supportedEvents[eventName],
3364
+ parentKeys = _supportedEvents$even.parentKeys,
3365
+ payloadKeys = _supportedEvents$even.payloadKeys;
3366
+ var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
3057
3367
  // then remove these lines
3058
- var payloadKeys = supportedEvents[eventName].payloadKeys;
3368
+
3059
3369
  var payload = {};
3370
+
3060
3371
  if (Array.isArray(payloadKeys) && payloadKeys.length) {
3061
3372
  payloadKeys.forEach(function (p) {
3062
3373
  payload[p] = evaluatedOptionsToUse[p];
3063
3374
  });
3064
3375
  }
3376
+
3065
3377
  eventCallbackProps[eventCallbackPropName] = function (ev) {
3066
3378
  if (ev && ev.payload) {
3067
3379
  payload = ev.payload;
3068
3380
  }
3381
+
3069
3382
  return onEventTrigger({
3070
3383
  originalEvent: ev,
3071
3384
  payload: payload,
3072
3385
  type: eventName
3073
3386
  });
3074
3387
  };
3388
+
3389
+ if (parentKeys) {
3390
+ for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
3391
+ var newObject = {};
3392
+ newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
3393
+ eventCallbackProps[eventCallbackPropName] = newObject;
3394
+ }
3395
+ }
3075
3396
  });
3076
- }
3077
- // compute pure viz props which are not from options
3397
+ } // compute pure viz props which are not from options
3398
+
3399
+
3078
3400
  var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
3079
3401
  themeFunc: themeFunc
3080
3402
  }));
@@ -3092,15 +3414,19 @@ var withDashboardViz = function withDashboardViz(opts) {
3092
3414
  * In future, we could automatically detect which all datasources are being used
3093
3415
  * and bind those magically to pagination/sorting behavior.
3094
3416
  */
3417
+
3095
3418
  var dataSourceMetadata = {};
3096
3419
  var OptionKey = 'paginateDataSourceKey';
3097
3420
  var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
3421
+
3098
3422
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
3099
3423
  var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
3100
3424
  var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
3425
+
3101
3426
  var handleRequestParamsChange = function handleRequestParamsChange(payload) {
3102
3427
  return onRequestParamsChange(paginateDataSourceKey, payload);
3103
3428
  };
3429
+
3104
3430
  var sortParams = (0, getSorting_1.getSortingParams)({
3105
3431
  requestParams: requestParams,
3106
3432
  meta: meta,
@@ -3115,115 +3441,132 @@ var withDashboardViz = function withDashboardViz(opts) {
3115
3441
  sortParams: sortParams,
3116
3442
  paginatorParams: paginatorParams
3117
3443
  };
3118
- }
3119
- // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
3444
+ } // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
3445
+
3446
+
3120
3447
  if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
3121
3448
  return null;
3122
3449
  }
3450
+
3123
3451
  return React.createElement(SanitizedReactViz, Object.assign({
3124
3452
  mode: mode,
3125
3453
  width: width,
3126
3454
  height: height
3127
3455
  }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
3128
3456
  };
3457
+
3129
3458
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
3130
3459
  DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
3131
3460
  // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
3132
3461
  theme: {}
3133
- });
3134
- // attach viz config
3135
- DashboardViz.config = vizConfig;
3136
- // @ts-ignore: TODO fix sc upgrade TS issues
3462
+ }); // attach viz config
3463
+
3464
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
3465
+
3137
3466
  return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
3138
3467
  };
3468
+
3139
3469
  exports.default = withDashboardViz;
3140
3470
 
3141
3471
  /***/ }),
3142
3472
 
3143
- /***/ 37:
3473
+ /***/ 38:
3144
3474
  /***/ (function(module, exports) {
3145
3475
 
3146
3476
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
3147
3477
 
3148
3478
  /***/ }),
3149
3479
 
3150
- /***/ 38:
3480
+ /***/ 39:
3151
3481
  /***/ (function(module, exports) {
3152
3482
 
3153
3483
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
3154
3484
 
3155
3485
  /***/ }),
3156
3486
 
3157
- /***/ 39:
3487
+ /***/ 4:
3158
3488
  /***/ (function(module, exports) {
3159
3489
 
3160
- module.exports = require("@splunk/moment");
3490
+ module.exports = require("styled-components");
3161
3491
 
3162
3492
  /***/ }),
3163
3493
 
3164
- /***/ 4:
3494
+ /***/ 40:
3165
3495
  /***/ (function(module, exports) {
3166
3496
 
3167
- module.exports = require("styled-components");
3497
+ module.exports = require("@splunk/moment");
3168
3498
 
3169
3499
  /***/ }),
3170
3500
 
3171
- /***/ 40:
3501
+ /***/ 41:
3172
3502
  /***/ (function(module, exports) {
3173
3503
 
3174
3504
  module.exports = require("@splunk/async-dynamic-options-evaluator");
3175
3505
 
3176
3506
  /***/ }),
3177
3507
 
3178
- /***/ 41:
3508
+ /***/ 42:
3179
3509
  /***/ (function(module, exports, __webpack_require__) {
3180
3510
 
3181
3511
  "use strict";
3182
3512
 
3183
3513
 
3184
3514
  var _classCallCheck = __webpack_require__(9);
3515
+
3185
3516
  Object.defineProperty(exports, "__esModule", {
3186
3517
  value: true
3187
3518
  });
3188
3519
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
3189
3520
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
3521
+
3190
3522
  var T = __webpack_require__(0);
3523
+
3191
3524
  var lodash_1 = __webpack_require__(3);
3192
- var VizActionHandler_1 = __webpack_require__(42);
3193
- // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
3525
+
3526
+ var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
3527
+
3528
+
3194
3529
  exports.INITIAL_WIDTH = 250;
3195
3530
  exports.INITIAL_HEIGHT = 250;
3196
3531
  /**
3197
3532
  * A Splunk visualization
3198
3533
  */
3534
+
3199
3535
  var SplunkVisualization = function SplunkVisualization() {
3200
3536
  _classCallCheck(this, SplunkVisualization);
3201
3537
  };
3538
+
3202
3539
  SplunkVisualization.propTypes = {
3203
3540
  /**
3204
3541
  * display mode
3205
3542
  */
3206
3543
  mode: T.oneOf(['view', 'edit', 'export']).isRequired,
3544
+
3207
3545
  /**
3208
3546
  * width in pixel or string, defaults to 100%
3209
3547
  */
3210
3548
  width: T.oneOfType([T.string, T.number]).isRequired,
3549
+
3211
3550
  /**
3212
3551
  * height in pixel or string
3213
3552
  */
3214
3553
  height: T.oneOfType([T.string, T.number]).isRequired,
3554
+
3215
3555
  /**
3216
3556
  * visualization context used for dynamic option evaluation
3217
3557
  */
3218
3558
  context: T.object,
3559
+
3219
3560
  /**
3220
3561
  * visualization formatting options
3221
3562
  */
3222
3563
  options: T.object,
3564
+
3223
3565
  /**
3224
3566
  * A callback to update formatting options
3225
3567
  */
3226
3568
  onOptionsChange: T.func,
3569
+
3227
3570
  /**
3228
3571
  * datasource state which include data and request params, object key indicate the datasource type.
3229
3572
  */
@@ -3232,6 +3575,7 @@ SplunkVisualization.propTypes = {
3232
3575
  * current request params
3233
3576
  */
3234
3577
  requestParams: T.object,
3578
+
3235
3579
  /**
3236
3580
  * current dataset
3237
3581
  */
@@ -3239,6 +3583,7 @@ SplunkVisualization.propTypes = {
3239
3583
  fields: T.array,
3240
3584
  columns: T.array
3241
3585
  }),
3586
+
3242
3587
  /**
3243
3588
  * error
3244
3589
  */
@@ -3246,29 +3591,35 @@ SplunkVisualization.propTypes = {
3246
3591
  level: T.string,
3247
3592
  message: T.string
3248
3593
  }),
3594
+
3249
3595
  /**
3250
3596
  * meta data that came with the dataset
3251
3597
  */
3252
3598
  meta: T.object
3253
3599
  })),
3600
+
3254
3601
  /**
3255
3602
  * A callback to trigger event
3256
3603
  */
3257
3604
  onEventTrigger: T.func,
3605
+
3258
3606
  /**
3259
3607
  * Inform viz if there are handlers listening to events
3260
3608
  */
3261
3609
  hasEventHandlers: T.bool,
3610
+
3262
3611
  /**
3263
3612
  * A callback to communicate computed props to a consumer
3264
3613
  */
3265
3614
  onComputedProps: T.func,
3615
+
3266
3616
  /**
3267
3617
  * A callback to obtain visualization api
3268
3618
  */
3269
3619
  vizActionHandlerRef: T.func,
3270
3620
  loading: T.bool,
3271
3621
  theme: T.object,
3622
+
3272
3623
  /**
3273
3624
  * A callback to request new data with updated request params
3274
3625
  */
@@ -3277,6 +3628,7 @@ SplunkVisualization.propTypes = {
3277
3628
  /**
3278
3629
  *
3279
3630
  */
3631
+
3280
3632
  SplunkVisualization.defaultProps = {
3281
3633
  // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
3282
3634
  width: '100%',
@@ -3305,26 +3657,29 @@ exports.default = SplunkVisualization;
3305
3657
 
3306
3658
  /***/ }),
3307
3659
 
3308
- /***/ 42:
3660
+ /***/ 43:
3309
3661
  /***/ (function(module, exports, __webpack_require__) {
3310
3662
 
3311
3663
  "use strict";
3312
3664
 
3313
3665
 
3314
3666
  var _classCallCheck = __webpack_require__(9);
3667
+
3315
3668
  var _createClass = __webpack_require__(18);
3669
+
3316
3670
  Object.defineProperty(exports, "__esModule", {
3317
3671
  value: true
3318
3672
  });
3319
3673
  exports.DefaultVizActionHandler = void 0;
3674
+
3320
3675
  var DefaultVizActionHandler = /*#__PURE__*/function () {
3321
3676
  function DefaultVizActionHandler() {
3322
3677
  _classCallCheck(this, DefaultVizActionHandler);
3323
3678
  }
3679
+
3324
3680
  _createClass(DefaultVizActionHandler, [{
3325
3681
  key: "focus",
3326
- value: function focus() {
3327
- // noop
3682
+ value: function focus() {// noop
3328
3683
  }
3329
3684
  }, {
3330
3685
  key: "snapshot",
@@ -3332,23 +3687,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
3332
3687
  return null; // noop
3333
3688
  }
3334
3689
  }]);
3690
+
3335
3691
  return DefaultVizActionHandler;
3336
3692
  }();
3337
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
3338
-
3339
- /***/ }),
3340
3693
 
3341
- /***/ 43:
3342
- /***/ (function(module, exports, __webpack_require__) {
3343
-
3344
- "use strict";
3345
-
3346
-
3347
- Object.defineProperty(exports, "__esModule", {
3348
- value: true
3349
- });
3350
- exports.validSortDirs = void 0;
3351
- exports.validSortDirs = ['asc', 'desc', 'none'];
3694
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
3352
3695
 
3353
3696
  /***/ }),
3354
3697
 
@@ -3362,7 +3705,9 @@ Object.defineProperty(exports, "__esModule", {
3362
3705
  value: true
3363
3706
  });
3364
3707
  exports.useDeepMemo = void 0;
3708
+
3365
3709
  var react_1 = __webpack_require__(1);
3710
+
3366
3711
  var lodash_1 = __webpack_require__(3);
3367
3712
  /**
3368
3713
  * This hook evaluates and stores the result of a passed function and only
@@ -3377,16 +3722,21 @@ var lodash_1 = __webpack_require__(3);
3377
3722
  * @param fn the function to be executed and
3378
3723
  * @param dependencies an array of dependencies
3379
3724
  */
3725
+
3726
+
3380
3727
  var useDeepMemo = function useDeepMemo(fn, dependencies) {
3381
3728
  var ref = (0, react_1.useRef)();
3729
+
3382
3730
  if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
3383
3731
  ref.current = {
3384
3732
  dependencies: dependencies,
3385
3733
  value: fn()
3386
3734
  };
3387
3735
  }
3736
+
3388
3737
  return ref.current.value;
3389
3738
  };
3739
+
3390
3740
  exports.useDeepMemo = useDeepMemo;
3391
3741
 
3392
3742
  /***/ }),
@@ -3401,19 +3751,27 @@ Object.defineProperty(exports, "__esModule", {
3401
3751
  value: true
3402
3752
  });
3403
3753
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
3754
+
3404
3755
  var React = __webpack_require__(1);
3756
+
3405
3757
  var T = __webpack_require__(0);
3758
+
3406
3759
  var i18n_1 = __webpack_require__(2);
3760
+
3407
3761
  var Message_1 = __webpack_require__(10);
3762
+
3408
3763
  var FixedSizeContainer_1 = __webpack_require__(13);
3409
3764
  /**
3410
3765
  * @method isMissing
3411
3766
  * @param {any} v
3412
3767
  * @returns {boolean} true if the input value === null or undefined
3413
3768
  */
3769
+
3770
+
3414
3771
  var isMissing = function isMissing(v) {
3415
3772
  return v === null || v === undefined;
3416
3773
  };
3774
+
3417
3775
  exports.isMissing = isMissing;
3418
3776
  /**
3419
3777
  * @method misskingKeys
@@ -3421,11 +3779,13 @@ exports.isMissing = isMissing;
3421
3779
  * @param {object} target
3422
3780
  * @returns {string[]} the keys of missing required props
3423
3781
  */
3782
+
3424
3783
  var missingKeys = function missingKeys(keys, target) {
3425
3784
  return keys.filter(function (k) {
3426
3785
  return (0, exports.isMissing)(target[k]);
3427
3786
  });
3428
3787
  };
3788
+
3429
3789
  exports.missingKeys = missingKeys;
3430
3790
  var propTypes = {
3431
3791
  width: T.oneOfType([T.string, T.number]),
@@ -3439,10 +3799,11 @@ var propTypes = {
3439
3799
  * @param {MissingPropsProps} props
3440
3800
  * @returns {React.ReactElement}
3441
3801
  */
3802
+
3442
3803
  var MissingPropsMessage = function MissingPropsMessage(props) {
3443
3804
  var width = props.width,
3444
- height = props.height,
3445
- missingProps = props.missingProps;
3805
+ height = props.height,
3806
+ missingProps = props.missingProps;
3446
3807
  return React.createElement(Message_1.default, {
3447
3808
  "data-test": "message",
3448
3809
  width: width,
@@ -3450,6 +3811,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
3450
3811
  message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
3451
3812
  });
3452
3813
  };
3814
+
3453
3815
  exports.MissingPropsMessage = MissingPropsMessage;
3454
3816
  exports.MissingPropsMessage.propTypes = propTypes;
3455
3817
  exports.MissingPropsMessage.defaultProps = {
@@ -3469,15 +3831,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
3469
3831
  Object.defineProperty(exports, "__esModule", {
3470
3832
  value: true
3471
3833
  });
3834
+
3472
3835
  var React = __webpack_require__(1);
3836
+
3473
3837
  var styled_components_1 = __webpack_require__(4);
3838
+
3474
3839
  var hocUtils_1 = __webpack_require__(15);
3840
+
3475
3841
  var Cover = styled_components_1.default.div.withConfig({
3476
3842
  displayName: "withEditModeCover__Cover",
3477
3843
  componentId: "sc-1gsbnxb-0"
3478
3844
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
3479
3845
  var Blocker = styled_components_1.default.div.attrs({
3480
- 'data-splunk-visualization-version': "26.0.0 - 2f7458907"
3846
+ 'data-splunk-visualization-version': "26.1.1 - b6df0a015"
3481
3847
  }).withConfig({
3482
3848
  displayName: "withEditModeCover__Blocker",
3483
3849
  componentId: "sc-1gsbnxb-1"
@@ -3488,6 +3854,7 @@ var Blocker = styled_components_1.default.div.attrs({
3488
3854
  * @param {ExtendedDashViz} Visualization
3489
3855
  * @returns {ExtendedDashViz} Wrapper
3490
3856
  */
3857
+
3491
3858
  var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
3492
3859
  var Wrapper = function Wrapper(props) {
3493
3860
  var mode = props.mode;
@@ -3496,12 +3863,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
3496
3863
  "data-test": "edit-mode-cover"
3497
3864
  }));
3498
3865
  };
3866
+
3499
3867
  (0, hocUtils_1.extendStaticWrapperProps)({
3500
3868
  Wrapper: Wrapper,
3501
3869
  Visualization: Visualization
3502
3870
  });
3503
3871
  return Wrapper;
3504
3872
  };
3873
+
3505
3874
  exports.default = withEditModeCover;
3506
3875
 
3507
3876
  /***/ }),
@@ -3514,45 +3883,59 @@ exports.default = withEditModeCover;
3514
3883
 
3515
3884
  var __rest = this && this.__rest || function (s, e) {
3516
3885
  var t = {};
3886
+
3517
3887
  for (var p in s) {
3518
3888
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
3519
3889
  }
3890
+
3520
3891
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3521
3892
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
3522
3893
  }
3523
3894
  return t;
3524
3895
  };
3896
+
3525
3897
  Object.defineProperty(exports, "__esModule", {
3526
3898
  value: true
3527
3899
  });
3528
3900
  exports.themes = exports.computeVizProps = exports.PureSingleValue = exports.config = void 0;
3901
+
3529
3902
  var SingleValue_1 = __webpack_require__(489);
3530
- var withDashboardViz_1 = __webpack_require__(36);
3903
+
3904
+ var withDashboardViz_1 = __webpack_require__(37);
3905
+
3531
3906
  var singleValueUtils_1 = __webpack_require__(24);
3907
+
3532
3908
  var config_1 = __webpack_require__(468);
3909
+
3533
3910
  var withTrellis_1 = __webpack_require__(106);
3911
+
3534
3912
  exports.config = config_1.default;
3535
3913
  exports.PureSingleValue = SingleValue_1.default;
3914
+
3536
3915
  var computeVizProps = function computeVizProps(_a) {
3537
3916
  var themeFunc = _a.themeFunc,
3538
- props = __rest(_a, ["themeFunc"]);
3917
+ props = __rest(_a, ["themeFunc"]);
3918
+
3539
3919
  var defaultThemeColorVariables = ['defaultFontColor', 'defaultBackgroundColor', 'defaultBlockFontColor', 'defaultSparklineStrokeColor', 'sparklineSeverityColors'];
3540
3920
  var defaultThemeColors = {};
3541
3921
  defaultThemeColorVariables.forEach(function (variable) {
3542
3922
  defaultThemeColors[variable] = themeFunc(variable);
3543
3923
  });
3924
+
3544
3925
  if (typeof defaultThemeColors.sparklineSeverityColors === 'string') {
3545
3926
  // sparkline severity color defaults are stored as a stringified object inside platformViz themes, since @splunk/themes/pick does not accept objects for theme variable values
3546
3927
  // convert stringified object into object if using platformviz themes
3547
3928
  try {
3548
3929
  defaultThemeColors.sparklineSeverityColors = JSON.parse(defaultThemeColors.sparklineSeverityColors);
3549
3930
  } catch (e) {} // eslint-disable-line no-empty
3931
+
3550
3932
  }
3551
3933
 
3552
3934
  return Object.assign({
3553
3935
  defaultThemeColors: defaultThemeColors
3554
3936
  }, props);
3555
3937
  };
3938
+
3556
3939
  exports.computeVizProps = computeVizProps;
3557
3940
  var viz = (0, withTrellis_1.default)((0, withDashboardViz_1.default)({
3558
3941
  ReactViz: SingleValue_1.default,
@@ -3574,30 +3957,53 @@ exports.default = viz;
3574
3957
 
3575
3958
 
3576
3959
  var _toConsumableArray = __webpack_require__(8);
3960
+
3577
3961
  Object.defineProperty(exports, "__esModule", {
3578
3962
  value: true
3579
3963
  });
3964
+
3580
3965
  var i18n_1 = __webpack_require__(2);
3966
+
3581
3967
  var schemaUtils_1 = __webpack_require__(16);
3968
+
3582
3969
  var PresetPalettes_1 = __webpack_require__(61);
3970
+
3583
3971
  var variables_1 = __webpack_require__(469);
3972
+
3584
3973
  var pick_1 = __webpack_require__(23);
3974
+
3585
3975
  var variables_2 = __webpack_require__(11);
3976
+
3586
3977
  var visualization_icons_1 = __webpack_require__(52);
3978
+
3587
3979
  var placeholders_1 = __webpack_require__(50);
3980
+
3588
3981
  var singleValueContext_1 = __webpack_require__(135);
3982
+
3589
3983
  var VizBehavior_1 = __webpack_require__(6);
3984
+
3590
3985
  var DynamicMajorColorEditor_1 = __webpack_require__(136);
3986
+
3591
3987
  var DynamicTrendColorEditor_1 = __webpack_require__(100);
3988
+
3592
3989
  var DynamicBackgroundColorEditor_1 = __webpack_require__(101);
3990
+
3593
3991
  var StaticMajorAndTrendLayout_1 = __webpack_require__(102);
3992
+
3594
3993
  var StaticMajorColorEditor_1 = __webpack_require__(103);
3994
+
3595
3995
  var StaticTrendColorEditor_1 = __webpack_require__(104);
3596
- var StaticBackgroundColorEditor_1 = __webpack_require__(90);
3996
+
3997
+ var StaticBackgroundColorEditor_1 = __webpack_require__(91);
3998
+
3597
3999
  var configUtils_1 = __webpack_require__(20);
4000
+
3598
4001
  var TrellisEditors_1 = __webpack_require__(105);
3599
- var VizCategory_1 = __webpack_require__(35);
4002
+
4003
+ var VizCategory_1 = __webpack_require__(36);
4004
+
3600
4005
  var layoutUtils_1 = __webpack_require__(58);
4006
+
3601
4007
  var dataContract = {
3602
4008
  requiredDataSources: [{
3603
4009
  name: 'primary',
@@ -3855,10 +4261,10 @@ var presets = [{
3855
4261
  backgroundColor: '> majorValue | rangeValue(backgroundColorEditorConfig)'
3856
4262
  })
3857
4263
  }
3858
- }];
3859
- // @TODO(pwied):
4264
+ }]; // @TODO(pwied):
3860
4265
  // remove once react-visualizations/SV was deprecated
3861
4266
  // including unused sparklineFillColor
4267
+
3862
4268
  var LIGHTMODE_SPARKLINE_AREA_COLOR = '#171D21';
3863
4269
  var DARKMODE_SPARKLINE_AREA_COLOR = '#FFFFFF';
3864
4270
  var themes = {
@@ -4066,7 +4472,7 @@ var editorConfig = [{
4066
4472
  presets: presets,
4067
4473
  value: function value(_ref3) {
4068
4474
  var context = _ref3.context,
4069
- options = _ref3.options;
4475
+ options = _ref3.options;
4070
4476
  var initialPreset = (0, configUtils_1.getInitialPreset)(context, options, presets);
4071
4477
  return initialPreset && initialPreset.label || null;
4072
4478
  }
@@ -4129,16 +4535,19 @@ var editorConfig = [{
4129
4535
  /**
4130
4536
  * visualization configuration
4131
4537
  */
4538
+
4132
4539
  var config = {
4133
4540
  /**
4134
4541
  * unique viz key
4135
4542
  */
4136
4543
  key: 'splunk.singlevalue',
4544
+
4137
4545
  /**
4138
4546
  * viz name
4139
4547
  */
4140
4548
  name: (0, i18n_1._)('Single value'),
4141
4549
  category: VizCategory_1.VizCategory.SINGLE_VALUE,
4550
+
4142
4551
  /**
4143
4552
  * viz icon
4144
4553
  */
@@ -4179,27 +4588,37 @@ module.exports = require("@splunk/visualization-themes/variables");
4179
4588
  Object.defineProperty(exports, "__esModule", {
4180
4589
  value: true
4181
4590
  });
4591
+
4182
4592
  var React = __webpack_require__(1);
4593
+
4183
4594
  var colorUtils_1 = __webpack_require__(12);
4595
+
4184
4596
  var variables_1 = __webpack_require__(11);
4597
+
4185
4598
  var IconPlaceholder_1 = __webpack_require__(32);
4599
+
4186
4600
  var VizBehavior_1 = __webpack_require__(6);
4601
+
4187
4602
  var hocUtils_1 = __webpack_require__(15);
4603
+
4188
4604
  var withPlaceholder = function withPlaceholder(Visualization) {
4189
4605
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
4190
4606
  var config = Visualization.config;
4191
4607
  var themes = config.themes;
4608
+
4192
4609
  var Wrapper = function Wrapper(props) {
4193
4610
  var _a, _b;
4611
+
4194
4612
  var dataSources = props.dataSources,
4195
- loading = props.loading,
4196
- options = props.options,
4197
- height = props.height,
4198
- width = props.width;
4613
+ loading = props.loading,
4614
+ options = props.options,
4615
+ height = props.height,
4616
+ width = props.width;
4199
4617
  var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
4200
4618
  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);
4201
4619
  var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
4202
4620
  var iconColor = variables_1.default.contentColorActive(props);
4621
+
4203
4622
  if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
4204
4623
  return React.createElement(IconPlaceholder_1.default, {
4205
4624
  "data-test": "icon-placeholder",
@@ -4210,14 +4629,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
4210
4629
  iconColor: iconColor
4211
4630
  });
4212
4631
  }
4632
+
4213
4633
  return React.createElement(Visualization, Object.assign({}, props));
4214
4634
  };
4635
+
4215
4636
  (0, hocUtils_1.extendStaticWrapperProps)({
4216
4637
  Wrapper: Wrapper,
4217
4638
  Visualization: Visualization
4218
4639
  });
4219
4640
  return Wrapper;
4220
4641
  };
4642
+
4221
4643
  exports.default = withPlaceholder;
4222
4644
 
4223
4645
  /***/ }),
@@ -4302,22 +4724,23 @@ var SparkLine = __webpack_require__(95);
4302
4724
 
4303
4725
 
4304
4726
 
4727
+
4305
4728
  var SingleValueSparkline_SingleValueSparkline = function SingleValueSparkline(_ref) {
4306
4729
  var width = _ref.width,
4307
- height = _ref.height,
4308
- data = _ref.data,
4309
- fill = _ref.fill,
4310
- _ref$fillOpacity = _ref.fillOpacity,
4311
- fillOpacity = _ref$fillOpacity === void 0 ? 0.2 : _ref$fillOpacity,
4312
- stroke = _ref.stroke,
4313
- showTooltip = _ref.showTooltip,
4314
- isArea = _ref.isArea,
4315
- _ref$lineLength = _ref.lineLength,
4316
- lineLength = _ref$lineLength === void 0 ? 0 : _ref$lineLength,
4317
- _ref$endDotCount = _ref.endDotCount,
4318
- endDotCount = _ref$endDotCount === void 0 ? 0 : _ref$endDotCount,
4319
- _ref$acceptNull = _ref.acceptNull,
4320
- acceptNull = _ref$acceptNull === void 0 ? true : _ref$acceptNull;
4730
+ height = _ref.height,
4731
+ data = _ref.data,
4732
+ fill = _ref.fill,
4733
+ _ref$fillOpacity = _ref.fillOpacity,
4734
+ fillOpacity = _ref$fillOpacity === void 0 ? 0.2 : _ref$fillOpacity,
4735
+ stroke = _ref.stroke,
4736
+ showTooltip = _ref.showTooltip,
4737
+ isArea = _ref.isArea,
4738
+ _ref$lineLength = _ref.lineLength,
4739
+ lineLength = _ref$lineLength === void 0 ? 0 : _ref$lineLength,
4740
+ _ref$endDotCount = _ref.endDotCount,
4741
+ endDotCount = _ref$endDotCount === void 0 ? 0 : _ref$endDotCount,
4742
+ _ref$acceptNull = _ref.acceptNull,
4743
+ acceptNull = _ref$acceptNull === void 0 ? true : _ref$acceptNull;
4321
4744
  return /*#__PURE__*/external_react_default.a.createElement(SparkLine["default"], {
4322
4745
  lineColor: Object(propUtils_["formatColor"])(stroke),
4323
4746
  fillColor: Object(propUtils_["formatColor"])(fill),
@@ -4342,6 +4765,7 @@ var SingleValueSparkline_SingleValueSparkline = function SingleValueSparkline(_r
4342
4765
  }
4343
4766
  });
4344
4767
  };
4768
+
4345
4769
  SingleValueSparkline_SingleValueSparkline.propTypes = {
4346
4770
  acceptNull: external_prop_types_default.a.bool,
4347
4771
  data: external_prop_types_default.a.arrayOf(external_prop_types_default.a.number),
@@ -4373,7 +4797,6 @@ var CONTENT_NEXT_TO_SPARKLINE_WIDTH_ALLOCATION_RATIO = 0.4;
4373
4797
  var LINEHEIGHT_FACTOR = 1.2;
4374
4798
  var CONTENT_SPARKLINE_SPACING = 16;
4375
4799
  var VALID_SPARKLINE_POSITIONS = ['below', 'before', 'after', 'off'];
4376
-
4377
4800
  /*
4378
4801
  * @method getUnderLabelHeight
4379
4802
  * @param {Object} props
@@ -4381,12 +4804,12 @@ var VALID_SPARKLINE_POSITIONS = ['below', 'before', 'after', 'off'];
4381
4804
  * @param {Number} underLabelFontSize
4382
4805
  * @returns {Number} underLabelHeight
4383
4806
  */
4807
+
4384
4808
  var getUnderLabelHeight = function getUnderLabelHeight(_ref) {
4385
4809
  var underLabel = _ref.underLabel,
4386
- underLabelFontSize = _ref.underLabelFontSize;
4810
+ underLabelFontSize = _ref.underLabelFontSize;
4387
4811
  return underLabel && underLabel.length ? underLabelFontSize * LINEHEIGHT_FACTOR : 0;
4388
4812
  };
4389
-
4390
4813
  /**
4391
4814
  * Get the available width for the Single Value content part
4392
4815
  * @method getAvailableContentWidth
@@ -4397,18 +4820,20 @@ var getUnderLabelHeight = function getUnderLabelHeight(_ref) {
4397
4820
  * @param {Number} config.overflowArea
4398
4821
  * @returns {Number} available content width to use
4399
4822
  */
4823
+
4400
4824
  var getAvailableContentWidth = function getAvailableContentWidth(_ref2) {
4401
4825
  var hasSparkline = _ref2.hasSparkline,
4402
- isSparklinePositionBelow = _ref2.isSparklinePositionBelow,
4403
- containerWidth = _ref2.containerWidth,
4404
- overflowArea = _ref2.overflowArea;
4826
+ isSparklinePositionBelow = _ref2.isSparklinePositionBelow,
4827
+ containerWidth = _ref2.containerWidth,
4828
+ overflowArea = _ref2.overflowArea;
4405
4829
  var overflowTotalArea = 2 * overflowArea; // left and right overflow
4830
+
4406
4831
  if (hasSparkline && !isSparklinePositionBelow) {
4407
4832
  return CONTENT_NEXT_TO_SPARKLINE_WIDTH_ALLOCATION_RATIO * containerWidth - overflowTotalArea;
4408
4833
  }
4834
+
4409
4835
  return containerWidth - overflowTotalArea;
4410
4836
  };
4411
-
4412
4837
  /*
4413
4838
  * @method getAvailableContentHeight
4414
4839
  * @param {Object} props
@@ -4419,49 +4844,52 @@ var getAvailableContentWidth = function getAvailableContentWidth(_ref2) {
4419
4844
  * @param {Number} props.underLabelHeight
4420
4845
  * @returns {Number} contentHeight
4421
4846
  */
4847
+
4422
4848
  var getAvailableContentHeight = function getAvailableContentHeight(_ref3) {
4423
4849
  var height = _ref3.height,
4424
- hasSparkline = _ref3.hasSparkline,
4425
- isSparklinePositionBelow = _ref3.isSparklinePositionBelow,
4426
- majorTextFontSize = _ref3.majorTextFontSize,
4427
- _ref3$underLabelHeigh = _ref3.underLabelHeight,
4428
- underLabelHeight = _ref3$underLabelHeigh === void 0 ? 0 : _ref3$underLabelHeigh;
4850
+ hasSparkline = _ref3.hasSparkline,
4851
+ isSparklinePositionBelow = _ref3.isSparklinePositionBelow,
4852
+ majorTextFontSize = _ref3.majorTextFontSize,
4853
+ _ref3$underLabelHeigh = _ref3.underLabelHeight,
4854
+ underLabelHeight = _ref3$underLabelHeigh === void 0 ? 0 : _ref3$underLabelHeigh;
4855
+
4429
4856
  if (hasSparkline && !isSparklinePositionBelow) {
4430
4857
  return height;
4431
4858
  }
4859
+
4432
4860
  return majorTextFontSize + CONTENT_SPARKLINE_SPACING + underLabelHeight;
4433
4861
  };
4434
-
4435
4862
  /*
4436
4863
  * @method isValidPosition
4437
4864
  * @param {String} sparklinePosition
4438
4865
  * @param {Bool} isValid
4439
4866
  */
4867
+
4440
4868
  var isValidPosition = function isValidPosition(sparklinePosition) {
4441
4869
  return VALID_SPARKLINE_POSITIONS.indexOf(sparklinePosition) > -1;
4442
4870
  };
4443
-
4444
4871
  /**
4445
4872
  * Sanitize sparklineValues, convert all values to numbers
4446
4873
  * @method parseSparklineValues
4447
4874
  * @params {Array} sparklineValues
4448
4875
  * @params {Array}
4449
4876
  */
4877
+
4450
4878
  var displayUtils_parseSparklineValues = function parseSparklineValues(_ref4) {
4451
4879
  var sparklineValues = _ref4.sparklineValues;
4452
- return (
4453
- // todo: need this function to maitain the behavior for dashboard-viz and react-viz.
4880
+ return (// todo: need this function to maitain the behavior for dashboard-viz and react-viz.
4454
4881
  // can refactor it after we discard dashboard-viz and react-viz repo
4455
4882
  Array.isArray(sparklineValues) ? sparklineValues.map(function (v) {
4456
4883
  var numV = Object(numberUtils_["parseNumber"])(v);
4884
+
4457
4885
  if (numV === 0) {
4458
4886
  return null;
4459
4887
  }
4888
+
4460
4889
  return numV || v;
4461
4890
  }) : undefined
4462
4891
  );
4463
4892
  };
4464
-
4465
4893
  /**
4466
4894
  * Determine if a sparkline graph should be displayed
4467
4895
  * @method shouldShowSparkline
@@ -4470,9 +4898,10 @@ var displayUtils_parseSparklineValues = function parseSparklineValues(_ref4) {
4470
4898
  * @param {Array} props.sparklineValues List of values to display in graph
4471
4899
  * @returns {Bool} true if flag is on and sparklineValues has data to show
4472
4900
  */
4901
+
4473
4902
  var displayUtils_shouldShowSparkline = function shouldShowSparkline(_ref5) {
4474
4903
  var showSparkline = _ref5.showSparkline,
4475
- sparklineValues = _ref5.sparklineValues;
4904
+ sparklineValues = _ref5.sparklineValues;
4476
4905
  return showSparkline && Array.isArray(sparklineValues) && sparklineValues.length > 1 && sparklineValues.every(function (v) {
4477
4906
  return v === null || !Number.isNaN(Object(numberUtils_["parseNumber"])(v));
4478
4907
  }) && sparklineValues.filter(function (v) {
@@ -4487,13 +4916,13 @@ var displayUtils_shouldShowSparkline = function shouldShowSparkline(_ref5) {
4487
4916
  * @param {Bool} props.isSparklinePositionBelow
4488
4917
  * @returns {Number} sparklineWidth
4489
4918
  */
4919
+
4490
4920
  var getSparklineWidth = function getSparklineWidth(_ref6) {
4491
4921
  var width = _ref6.width,
4492
- isSparklinePositionBelow = _ref6.isSparklinePositionBelow;
4922
+ isSparklinePositionBelow = _ref6.isSparklinePositionBelow;
4493
4923
  var spaceRatio = isSparklinePositionBelow ? 1 : 0.6;
4494
4924
  return width * spaceRatio;
4495
4925
  };
4496
-
4497
4926
  /*
4498
4927
  * getSparklineHeight
4499
4928
  * @param {Object} props
@@ -4502,15 +4931,15 @@ var getSparklineWidth = function getSparklineWidth(_ref6) {
4502
4931
  * @param {Bool} props.isSparklinePositionBelow
4503
4932
  * @returns {Number} sparklineHeight
4504
4933
  */
4934
+
4505
4935
  var getSparklineHeight = function getSparklineHeight(_ref7) {
4506
4936
  var height = _ref7.height,
4507
- contentHeight = _ref7.contentHeight,
4508
- isSparklinePositionBelow = _ref7.isSparklinePositionBelow;
4937
+ contentHeight = _ref7.contentHeight,
4938
+ isSparklinePositionBelow = _ref7.isSparklinePositionBelow;
4509
4939
  var belowPositionHeight = height - contentHeight;
4510
4940
  var sanitizedBelowPositionHeight = belowPositionHeight < 0 ? 0 : belowPositionHeight;
4511
4941
  return isSparklinePositionBelow ? sanitizedBelowPositionHeight : height;
4512
4942
  };
4513
-
4514
4943
  /*
4515
4944
  * getSparklineSegments
4516
4945
  * @param {Object} props
@@ -4518,12 +4947,12 @@ var getSparklineHeight = function getSparklineHeight(_ref7) {
4518
4947
  * @param {Number} props.sparklineHighlightSegments
4519
4948
  * @returns {Number} sparkline segments
4520
4949
  */
4950
+
4521
4951
  var getSparklineSegments = function getSparklineSegments(_ref8) {
4522
4952
  var hasSparkline = _ref8.hasSparkline,
4523
- sparklineHighlightSegments = _ref8.sparklineHighlightSegments;
4953
+ sparklineHighlightSegments = _ref8.sparklineHighlightSegments;
4524
4954
  return hasSparkline && typeof sparklineHighlightSegments === 'number' && sparklineHighlightSegments > 0 ? sparklineHighlightSegments + 1 : 0;
4525
4955
  };
4526
-
4527
4956
  /*
4528
4957
  * getEndDots
4529
4958
  * @param {Object} props
@@ -4531,12 +4960,12 @@ var getSparklineSegments = function getSparklineSegments(_ref8) {
4531
4960
  * @param {Number} props.sparklineHighlightDots
4532
4961
  * @returns {Number} sparkline end dots
4533
4962
  */
4963
+
4534
4964
  var getEndDots = function getEndDots(_ref9) {
4535
4965
  var hasSparkline = _ref9.hasSparkline,
4536
- sparklineHighlightDots = _ref9.sparklineHighlightDots;
4966
+ sparklineHighlightDots = _ref9.sparklineHighlightDots;
4537
4967
  return !hasSparkline || typeof sparklineHighlightDots === 'string' || sparklineHighlightDots < 0 ? 0 : sparklineHighlightDots;
4538
4968
  };
4539
-
4540
4969
  /**
4541
4970
  * Get the colors for a sparkline graph based on severity
4542
4971
  * @method getSparklineColors
@@ -4546,10 +4975,11 @@ var getEndDots = function getEndDots(_ref9) {
4546
4975
  * @param {Object} props.sparklineSeverityColors
4547
4976
  * @returns {Object} { background, stroke } colors
4548
4977
  */
4978
+
4549
4979
  var displayUtils_getSparklineColors = function getSparklineColors(_ref10) {
4550
4980
  var backgroundEnabled = _ref10.backgroundEnabled,
4551
- backgroundColor = _ref10.backgroundColor,
4552
- sparklineSeverityColors = _ref10.sparklineSeverityColors;
4981
+ backgroundColor = _ref10.backgroundColor,
4982
+ sparklineSeverityColors = _ref10.sparklineSeverityColors;
4553
4983
  return Object(singleValueUtils["getGraphColors"])({
4554
4984
  backgroundEnabled: backgroundEnabled,
4555
4985
  backgroundColor: backgroundColor,
@@ -4558,6 +4988,7 @@ var displayUtils_getSparklineColors = function getSparklineColors(_ref10) {
4558
4988
  if (color === colorConstants_["SPARKLINE_WHITE"]) {
4559
4989
  return sparklineSeverityColors.none;
4560
4990
  }
4991
+
4561
4992
  return {
4562
4993
  background: Object(singleValueUtils["darken"])(color),
4563
4994
  stroke: colorConstants_["SPARKLINE_WHITE"]
@@ -4565,7 +4996,6 @@ var displayUtils_getSparklineColors = function getSparklineColors(_ref10) {
4565
4996
  }
4566
4997
  });
4567
4998
  };
4568
-
4569
4999
  /*
4570
5000
  * getSparklines
4571
5001
  * @param {Object} props
@@ -4578,14 +5008,15 @@ var displayUtils_getSparklineColors = function getSparklineColors(_ref10) {
4578
5008
  * @param {Number} props.sparklineHighlightDots
4579
5009
  * @returns {Object} { sparklineWidth, sparklineHeight, sparklineSegments, endDots }
4580
5010
  */
5011
+
4581
5012
  var getSparklines = function getSparklines(_ref11) {
4582
5013
  var width = _ref11.width,
4583
- height = _ref11.height,
4584
- contentHeight = _ref11.contentHeight,
4585
- hasSparkline = _ref11.hasSparkline,
4586
- isSparklinePositionBelow = _ref11.isSparklinePositionBelow,
4587
- sparklineHighlightSegments = _ref11.sparklineHighlightSegments,
4588
- sparklineHighlightDots = _ref11.sparklineHighlightDots;
5014
+ height = _ref11.height,
5015
+ contentHeight = _ref11.contentHeight,
5016
+ hasSparkline = _ref11.hasSparkline,
5017
+ isSparklinePositionBelow = _ref11.isSparklinePositionBelow,
5018
+ sparklineHighlightSegments = _ref11.sparklineHighlightSegments,
5019
+ sparklineHighlightDots = _ref11.sparklineHighlightDots;
4589
5020
  var sparklineWidth = getSparklineWidth({
4590
5021
  width: width,
4591
5022
  isSparklinePositionBelow: isSparklinePositionBelow
@@ -4613,25 +5044,38 @@ var getSparklines = function getSparklines(_ref11) {
4613
5044
  // CONCATENATED MODULE: ./src/SingleValue/PureSingleValue/StandardLayout.jsx
4614
5045
 
4615
5046
 
5047
+
4616
5048
  function ownKeys(object, enumerableOnly) {
4617
5049
  var keys = Object.keys(object);
5050
+
4618
5051
  if (Object.getOwnPropertySymbols) {
4619
5052
  var symbols = Object.getOwnPropertySymbols(object);
4620
- enumerableOnly && (symbols = symbols.filter(function (sym) {
5053
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
4621
5054
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
4622
- })), keys.push.apply(keys, symbols);
5055
+ });
5056
+ keys.push.apply(keys, symbols);
4623
5057
  }
5058
+
4624
5059
  return keys;
4625
5060
  }
5061
+
4626
5062
  function _objectSpread(target) {
4627
5063
  for (var i = 1; i < arguments.length; i++) {
4628
- var source = null != arguments[i] ? arguments[i] : {};
4629
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
4630
- defineProperty_default()(target, key, source[key]);
4631
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
4632
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4633
- });
5064
+ var source = arguments[i] != null ? arguments[i] : {};
5065
+
5066
+ if (i % 2) {
5067
+ ownKeys(Object(source), true).forEach(function (key) {
5068
+ defineProperty_default()(target, key, source[key]);
5069
+ });
5070
+ } else if (Object.getOwnPropertyDescriptors) {
5071
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5072
+ } else {
5073
+ ownKeys(Object(source)).forEach(function (key) {
5074
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5075
+ });
5076
+ }
4634
5077
  }
5078
+
4635
5079
  return target;
4636
5080
  }
4637
5081
 
@@ -4640,6 +5084,7 @@ function _objectSpread(target) {
4640
5084
 
4641
5085
 
4642
5086
 
5087
+
4643
5088
  var CONTENT_OVERFLOW_FADEOUT_AREA_PX = 16;
4644
5089
  var Column = external_styled_components_default.a.div.withConfig({
4645
5090
  displayName: "StandardLayout__Column",
@@ -4667,37 +5112,40 @@ var OverflowWrapper = external_styled_components_default.a.div.attrs(function ()
4667
5112
  }, function (props) {
4668
5113
  return props.overflowBackgroundColor;
4669
5114
  });
5115
+
4670
5116
  var StandardLayout_SingleValueContent = function SingleValueContent(_ref) {
4671
5117
  var props = extends_default()({}, _ref);
5118
+
4672
5119
  var backgroundColor = props.backgroundColor,
4673
- contentHeight = props.contentHeight,
4674
- majorColor = props.majorColor,
4675
- majorText = props.majorText,
4676
- majorTextFontSize = props.majorTextFontSize,
4677
- majorValueTitle = props.majorValueTitle,
4678
- trendColor = props.trendColor,
4679
- trendText = props.trendText,
4680
- trendTextFontSize = props.trendTextFontSize,
4681
- showTrendIndicator = props.showTrendIndicator,
4682
- unit = props.unit,
4683
- unitPosition = props.unitPosition,
4684
- underLabel = props.underLabel,
4685
- underLabelFontSize = props.underLabelFontSize,
4686
- underLabelColor = props.underLabelColor,
4687
- onValueClick = props.onValueClick,
4688
- showSparkline = props.showSparkline,
4689
- sparklinePosition = props.sparklinePosition,
4690
- sparklineWidth = props.sparklineWidth,
4691
- sparklineHeight = props.sparklineHeight,
4692
- sparklineValues = props.sparklineValues,
4693
- sparklineAreaColor = props.sparklineAreaColor,
4694
- sparklineStrokeColor = props.sparklineStrokeColor,
4695
- showSparklineTooltip = props.showSparklineTooltip,
4696
- showSparklineAreaGraph = props.showSparklineAreaGraph,
4697
- shouldSparklineAcceptNullData = props.shouldSparklineAcceptNullData,
4698
- sparklineSegments = props.sparklineSegments,
4699
- endDots = props.endDots;
5120
+ contentHeight = props.contentHeight,
5121
+ majorColor = props.majorColor,
5122
+ majorText = props.majorText,
5123
+ majorTextFontSize = props.majorTextFontSize,
5124
+ majorValueTitle = props.majorValueTitle,
5125
+ trendColor = props.trendColor,
5126
+ trendText = props.trendText,
5127
+ trendTextFontSize = props.trendTextFontSize,
5128
+ showTrendIndicator = props.showTrendIndicator,
5129
+ unit = props.unit,
5130
+ unitPosition = props.unitPosition,
5131
+ underLabel = props.underLabel,
5132
+ underLabelFontSize = props.underLabelFontSize,
5133
+ underLabelColor = props.underLabelColor,
5134
+ onValueClick = props.onValueClick,
5135
+ showSparkline = props.showSparkline,
5136
+ sparklinePosition = props.sparklinePosition,
5137
+ sparklineWidth = props.sparklineWidth,
5138
+ sparklineHeight = props.sparklineHeight,
5139
+ sparklineValues = props.sparklineValues,
5140
+ sparklineAreaColor = props.sparklineAreaColor,
5141
+ sparklineStrokeColor = props.sparklineStrokeColor,
5142
+ showSparklineTooltip = props.showSparklineTooltip,
5143
+ showSparklineAreaGraph = props.showSparklineAreaGraph,
5144
+ shouldSparklineAcceptNullData = props.shouldSparklineAcceptNullData,
5145
+ sparklineSegments = props.sparklineSegments,
5146
+ endDots = props.endDots;
4700
5147
  var sparkline = null;
5148
+
4701
5149
  if (displayUtils_shouldShowSparkline({
4702
5150
  showSparkline: showSparkline,
4703
5151
  sparklineValues: sparklineValues
@@ -4715,6 +5163,7 @@ var StandardLayout_SingleValueContent = function SingleValueContent(_ref) {
4715
5163
  endDotCount: endDots
4716
5164
  });
4717
5165
  }
5166
+
4718
5167
  return /*#__PURE__*/external_react_default.a.createElement(Column, null, /*#__PURE__*/external_react_default.a.createElement(Row, null, sparklinePosition === 'before' && sparkline, /*#__PURE__*/external_react_default.a.createElement(OverflowWrapper, {
4719
5168
  overflowBackgroundColor: backgroundColor,
4720
5169
  height: contentHeight
@@ -4735,6 +5184,7 @@ var StandardLayout_SingleValueContent = function SingleValueContent(_ref) {
4735
5184
  onValueClick: onValueClick
4736
5185
  })), sparklinePosition === 'after' && sparkline), sparklinePosition === 'below' && sparkline);
4737
5186
  };
5187
+
4738
5188
  StandardLayout_SingleValueContent.propTypes = _objectSpread(_objectSpread({}, SingleValueBasic["default"].propTypes), {}, {
4739
5189
  contentHeight: external_prop_types_default.a.number,
4740
5190
  backgroundColor: external_prop_types_default.a.string,
@@ -4802,42 +5252,44 @@ var Container = external_styled_components_default.a.div.withConfig({
4802
5252
  })(["overflow:hidden;", ";"], function (props) {
4803
5253
  return Object(style_["toDimension"])(pick_default()(props, ['width', 'height']));
4804
5254
  });
5255
+
4805
5256
  var SingleValue_SingleValue = function SingleValue(_ref) {
4806
5257
  var props = extends_default()({}, _ref);
5258
+
4807
5259
  var width = props.width,
4808
- _props$height = props.height,
4809
- height = _props$height === void 0 ? 250 : _props$height,
4810
- hasEventHandlers = props.hasEventHandlers,
4811
- style = props.style,
4812
- majorFontSize = props.majorFontSize,
4813
- majorValue = props.majorValue,
4814
- majorValueField = props.majorValueField,
4815
- trendValue = props.trendValue,
4816
- trendFontSize = props.trendFontSize,
4817
- unitPosition = props.unitPosition,
4818
- underLabelFontSize = props.underLabelFontSize,
4819
- numberPrecision = props.numberPrecision,
4820
- shouldUseThousandSeparators = props.shouldUseThousandSeparators,
4821
- shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
4822
- sparklineValues = props.sparklineValues,
4823
- sparklineHighlightSegments = props.sparklineHighlightSegments,
4824
- sparklineHighlightDots = props.sparklineHighlightDots,
4825
- showSparklineAreaGraph = props.showSparklineAreaGraph,
4826
- showSparklineTooltip = props.showSparklineTooltip,
4827
- shouldSparklineAcceptNullData = props.shouldSparklineAcceptNullData,
4828
- onValueClick = props.onValueClick,
4829
- defaultFontColor = props.defaultFontColor,
4830
- defaultBackgroundColor = props.defaultBackgroundColor,
4831
- defaultBlockFontColor = props.defaultBlockFontColor,
4832
- _props$sparklineSever = props.sparklineSeverityColors,
4833
- sparklineSeverityColors = _props$sparklineSever === void 0 ? DEFAULT_SPARKLINE_SEVERITY_COLORS : _props$sparklineSever,
4834
- sparklineAreaColor = props.sparklineAreaColor,
4835
- defaultThemeColors = props.defaultThemeColors,
4836
- splitByLayout = props.splitByLayout,
4837
- _props$trellisKey = props.trellisKey,
4838
- trellisKey = _props$trellisKey === void 0 ? '' : _props$trellisKey,
4839
- _props$trellisSplitBy = props.trellisSplitBy,
4840
- trellisSplitBy = _props$trellisSplitBy === void 0 ? '' : _props$trellisSplitBy;
5260
+ _props$height = props.height,
5261
+ height = _props$height === void 0 ? 250 : _props$height,
5262
+ hasEventHandlers = props.hasEventHandlers,
5263
+ style = props.style,
5264
+ majorFontSize = props.majorFontSize,
5265
+ majorValue = props.majorValue,
5266
+ majorValueField = props.majorValueField,
5267
+ trendValue = props.trendValue,
5268
+ trendFontSize = props.trendFontSize,
5269
+ unitPosition = props.unitPosition,
5270
+ underLabelFontSize = props.underLabelFontSize,
5271
+ numberPrecision = props.numberPrecision,
5272
+ shouldUseThousandSeparators = props.shouldUseThousandSeparators,
5273
+ shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
5274
+ sparklineValues = props.sparklineValues,
5275
+ sparklineHighlightSegments = props.sparklineHighlightSegments,
5276
+ sparklineHighlightDots = props.sparklineHighlightDots,
5277
+ showSparklineAreaGraph = props.showSparklineAreaGraph,
5278
+ showSparklineTooltip = props.showSparklineTooltip,
5279
+ shouldSparklineAcceptNullData = props.shouldSparklineAcceptNullData,
5280
+ onValueClick = props.onValueClick,
5281
+ defaultFontColor = props.defaultFontColor,
5282
+ defaultBackgroundColor = props.defaultBackgroundColor,
5283
+ defaultBlockFontColor = props.defaultBlockFontColor,
5284
+ _props$sparklineSever = props.sparklineSeverityColors,
5285
+ sparklineSeverityColors = _props$sparklineSever === void 0 ? DEFAULT_SPARKLINE_SEVERITY_COLORS : _props$sparklineSever,
5286
+ sparklineAreaColor = props.sparklineAreaColor,
5287
+ defaultThemeColors = props.defaultThemeColors,
5288
+ splitByLayout = props.splitByLayout,
5289
+ _props$trellisKey = props.trellisKey,
5290
+ trellisKey = _props$trellisKey === void 0 ? '' : _props$trellisKey,
5291
+ _props$trellisSplitBy = props.trellisSplitBy,
5292
+ trellisSplitBy = _props$trellisSplitBy === void 0 ? '' : _props$trellisSplitBy;
4841
5293
  var defaultColors = {
4842
5294
  defaultFontColor: defaultFontColor,
4843
5295
  defaultBackgroundColor: defaultBackgroundColor,
@@ -4849,56 +5301,58 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
4849
5301
  var trellisEnabled = isTrellisFeatureFlagOn && splitByLayout === layoutUtils["LAYOUT_TYPE"].Trellis;
4850
5302
  var handleValueClick = Object(external_react_["useCallback"])(function (ev) {
4851
5303
  return Object(singleValueUtils["handleValueClickCallback"])(ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled, trellisSplitBy, trellisKey);
4852
- }, [onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]);
4853
-
4854
- // FIXME todo 'compute colors' is not pure, it must be lifted into behavior or DSL
5304
+ }, [onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]); // FIXME todo 'compute colors' is not pure, it must be lifted into behavior or DSL
4855
5305
  // compute colors
5306
+
4856
5307
  var _computeColors = Object(singleValueUtils["computeColors"])(props, defaultColors),
4857
- backgroundEnabled = _computeColors.backgroundEnabled,
4858
- backgroundColor = _computeColors.backgroundColor,
4859
- majorColor = _computeColors.majorColor,
4860
- trendColor = _computeColors.trendColor,
4861
- underLabelColor = _computeColors.underLabelColor; // TODO(fkurniawan): possibly remove getSparklineColors, since for the new viz package,
5308
+ backgroundEnabled = _computeColors.backgroundEnabled,
5309
+ backgroundColor = _computeColors.backgroundColor,
5310
+ majorColor = _computeColors.majorColor,
5311
+ trendColor = _computeColors.trendColor,
5312
+ underLabelColor = _computeColors.underLabelColor; // TODO(fkurniawan): possibly remove getSparklineColors, since for the new viz package,
4862
5313
  // the default is obtained from > themes.defaultSparklineStrokeColor
5314
+
5315
+
4863
5316
  var sparklineStrokeColor = props.sparklineStrokeColor || displayUtils_getSparklineColors({
4864
5317
  backgroundEnabled: backgroundEnabled,
4865
5318
  backgroundColor: backgroundColor,
4866
5319
  sparklineSeverityColors: sparklineSeverityColors
4867
5320
  }).stroke;
5321
+
4868
5322
  var renderVisualization = function renderVisualization(_ref2) {
4869
5323
  var containerWidth = _ref2.width,
4870
- containerHeight = _ref2.height;
4871
- // will update later based on text size
5324
+ containerHeight = _ref2.height; // will update later based on text size
5325
+
4872
5326
  var _props$sparklineDispl = props.sparklineDisplay,
4873
- sparklineDisplay = _props$sparklineDispl === void 0 ? 'below' : _props$sparklineDispl,
4874
- _props$trendDisplay = props.trendDisplay,
4875
- trendDisplay = _props$trendDisplay === void 0 ? 'absolute' : _props$trendDisplay,
4876
- unit = props.unit,
4877
- underLabel = props.underLabel; // todo: need this function to maitain the behavior for dashboard-viz and react-viz.
5327
+ sparklineDisplay = _props$sparklineDispl === void 0 ? 'below' : _props$sparklineDispl,
5328
+ _props$trendDisplay = props.trendDisplay,
5329
+ trendDisplay = _props$trendDisplay === void 0 ? 'absolute' : _props$trendDisplay,
5330
+ unit = props.unit,
5331
+ underLabel = props.underLabel; // todo: need this function to maitain the behavior for dashboard-viz and react-viz.
4878
5332
  // can refactor it after we discard dashboard-viz and react-viz repo
5333
+
4879
5334
  var parsedSparklineValues = displayUtils_parseSparklineValues({
4880
5335
  sparklineValues: sparklineValues
4881
5336
  });
4882
5337
  var hasSparkline = displayUtils_shouldShowSparkline({
4883
5338
  showSparkline: isValidPosition(sparklineDisplay) && sparklineDisplay !== 'off',
4884
5339
  sparklineValues: parsedSparklineValues
4885
- });
5340
+ }); // by default, the sparkline position is always below
4886
5341
 
4887
- // by default, the sparkline position is always below
4888
5342
  if (hasSparkline) {
4889
5343
  if (!isValidPosition(sparklineDisplay)) {
4890
5344
  sparklineDisplay = 'below';
4891
5345
  }
4892
5346
  }
5347
+
4893
5348
  var isSparklinePositionBelow = hasSparkline && sparklineDisplay === 'below';
4894
5349
  var contentWidth = getAvailableContentWidth({
4895
5350
  hasSparkline: hasSparkline,
4896
5351
  isSparklinePositionBelow: isSparklinePositionBelow,
4897
5352
  containerWidth: containerWidth,
4898
5353
  overflowArea: SingleValue_CONTENT_OVERFLOW_FADEOUT_AREA_PX
4899
- });
5354
+ }); // calculate major and trend text and font size
4900
5355
 
4901
- // calculate major and trend text and font size
4902
5356
  var toRemoveList = [{
4903
5357
  key: 'sparklineDisplay',
4904
5358
  value: 'off'
@@ -4912,28 +5366,30 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
4912
5366
  key: 'unit',
4913
5367
  value: ''
4914
5368
  }];
5369
+
4915
5370
  var _computeSingleValueCo = Object(singleValueUtils["computeSingleValueContent"])({
4916
- majorValue: majorValue,
4917
- trendValue: trendValue,
4918
- majorFontSize: majorFontSize,
4919
- trendFontSize: trendFontSize,
4920
- trendDisplay: trendDisplay,
4921
- contentWidth: contentWidth,
4922
- contentHeight: containerHeight * DEFAULT_CONTENT_HEIGHT_ALLOCATION_RATIO,
4923
- containerWidth: containerWidth,
4924
- containerHeight: containerHeight,
4925
- unit: unit,
4926
- numberPrecision: numberPrecision,
4927
- shouldUseThousandSeparators: shouldUseThousandSeparators,
4928
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
4929
- toRemoveList: toRemoveList
4930
- }),
4931
- majorText = _computeSingleValueCo.majorText,
4932
- trendText = _computeSingleValueCo.trendText,
4933
- majorTextFontSize = _computeSingleValueCo.majorTextFontSize,
4934
- trendTextFontSize = _computeSingleValueCo.trendTextFontSize,
4935
- majorValueTitle = _computeSingleValueCo.majorValueTitle,
4936
- smallVizProps = _computeSingleValueCo.smallVizProps;
5371
+ majorValue: majorValue,
5372
+ trendValue: trendValue,
5373
+ majorFontSize: majorFontSize,
5374
+ trendFontSize: trendFontSize,
5375
+ trendDisplay: trendDisplay,
5376
+ contentWidth: contentWidth,
5377
+ contentHeight: containerHeight * DEFAULT_CONTENT_HEIGHT_ALLOCATION_RATIO,
5378
+ containerWidth: containerWidth,
5379
+ containerHeight: containerHeight,
5380
+ unit: unit,
5381
+ numberPrecision: numberPrecision,
5382
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
5383
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
5384
+ toRemoveList: toRemoveList
5385
+ }),
5386
+ majorText = _computeSingleValueCo.majorText,
5387
+ trendText = _computeSingleValueCo.trendText,
5388
+ majorTextFontSize = _computeSingleValueCo.majorTextFontSize,
5389
+ trendTextFontSize = _computeSingleValueCo.trendTextFontSize,
5390
+ majorValueTitle = _computeSingleValueCo.majorValueTitle,
5391
+ smallVizProps = _computeSingleValueCo.smallVizProps;
5392
+
4937
5393
  if (!isEmpty_default()(smallVizProps)) {
4938
5394
  sparklineDisplay = smallVizProps.sparklineDisplay;
4939
5395
  trendDisplay = smallVizProps.trendDisplay;
@@ -4944,6 +5400,7 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
4944
5400
  sparklineValues: parsedSparklineValues
4945
5401
  });
4946
5402
  }
5403
+
4947
5404
  var contentHeight = getAvailableContentHeight({
4948
5405
  height: containerHeight,
4949
5406
  hasSparkline: hasSparkline,
@@ -4953,22 +5410,22 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
4953
5410
  underLabel: underLabel,
4954
5411
  underLabelFontSize: underLabelFontSize
4955
5412
  })
4956
- });
5413
+ }); // calculate sparkline size and positions
4957
5414
 
4958
- // calculate sparkline size and positions
4959
5415
  var _getSparklines = getSparklines({
4960
- width: containerWidth,
4961
- height: containerHeight,
4962
- contentHeight: contentHeight,
4963
- hasSparkline: hasSparkline,
4964
- isSparklinePositionBelow: isSparklinePositionBelow,
4965
- sparklineHighlightSegments: sparklineHighlightSegments,
4966
- sparklineHighlightDots: sparklineHighlightDots
4967
- }),
4968
- sparklineWidth = _getSparklines.sparklineWidth,
4969
- sparklineHeight = _getSparklines.sparklineHeight,
4970
- sparklineSegments = _getSparklines.sparklineSegments,
4971
- endDots = _getSparklines.endDots;
5416
+ width: containerWidth,
5417
+ height: containerHeight,
5418
+ contentHeight: contentHeight,
5419
+ hasSparkline: hasSparkline,
5420
+ isSparklinePositionBelow: isSparklinePositionBelow,
5421
+ sparklineHighlightSegments: sparklineHighlightSegments,
5422
+ sparklineHighlightDots: sparklineHighlightDots
5423
+ }),
5424
+ sparklineWidth = _getSparklines.sparklineWidth,
5425
+ sparklineHeight = _getSparklines.sparklineHeight,
5426
+ sparklineSegments = _getSparklines.sparklineSegments,
5427
+ endDots = _getSparklines.endDots;
5428
+
4972
5429
  return /*#__PURE__*/external_react_default.a.createElement(VizStyleWrapper["default"], {
4973
5430
  backgroundColor: backgroundColor,
4974
5431
  style: style,
@@ -5005,6 +5462,7 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
5005
5462
  endDots: endDots
5006
5463
  }));
5007
5464
  };
5465
+
5008
5466
  if (trellisEnabled) {
5009
5467
  return /*#__PURE__*/external_react_default.a.createElement(external_react_default.a.Fragment, null, /*#__PURE__*/external_react_default.a.createElement(TrellisTitle["TrellisTitle"], {
5010
5468
  fontColor: defaultThemeColors === null || defaultThemeColors === void 0 ? void 0 : defaultThemeColors.defaultFontColor,
@@ -5017,6 +5475,7 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
5017
5475
  return renderVisualization(containerDimension);
5018
5476
  })));
5019
5477
  }
5478
+
5020
5479
  return /*#__PURE__*/external_react_default.a.createElement(Container, {
5021
5480
  width: width,
5022
5481
  height: height
@@ -5024,6 +5483,7 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
5024
5483
  return renderVisualization(containerDimension);
5025
5484
  }));
5026
5485
  };
5486
+
5027
5487
  SingleValue_SingleValue.propTypes = {
5028
5488
  width: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
5029
5489
  height: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
@@ -5084,11 +5544,10 @@ SingleValue_SingleValue.defaultProps = {
5084
5544
  hasEventHandlers: false,
5085
5545
  onValueClick: function onValueClick() {},
5086
5546
  trellisKey: '',
5087
- trellisSplitBy: ''
5088
- // fixme todo: a pure viz should not be passed a map of severity colors! This should be resolved
5547
+ trellisSplitBy: '' // fixme todo: a pure viz should not be passed a map of severity colors! This should be resolved
5089
5548
  // by behaviors or DSL in future. Pure viz does not understand concepts such as severity.
5090
- };
5091
5549
 
5550
+ };
5092
5551
  /* harmony default export */ var PureSingleValue_SingleValue = __webpack_exports__["default"] = (SingleValue_SingleValue);
5093
5552
 
5094
5553
  /***/ }),
@@ -5121,7 +5580,7 @@ module.exports = require("@splunk/visualizations-shared/domUtils");
5121
5580
 
5122
5581
  /***/ }),
5123
5582
 
5124
- /***/ 57:
5583
+ /***/ 56:
5125
5584
  /***/ (function(module, exports) {
5126
5585
 
5127
5586
  module.exports = require("@splunk/themes/useSplunkTheme");
@@ -5139,6 +5598,7 @@ Object.defineProperty(exports, "__esModule", {
5139
5598
  });
5140
5599
  exports.LAYOUT_TYPE = void 0;
5141
5600
  var LAYOUT_TYPE;
5601
+
5142
5602
  (function (LAYOUT_TYPE) {
5143
5603
  LAYOUT_TYPE["Off"] = "off";
5144
5604
  LAYOUT_TYPE["Trellis"] = "trellis";
@@ -5157,6 +5617,7 @@ Object.defineProperty(exports, "__esModule", {
5157
5617
  });
5158
5618
  exports.VizBehavior = void 0;
5159
5619
  var VizBehavior;
5620
+
5160
5621
  (function (VizBehavior) {
5161
5622
  /**
5162
5623
  * Dynamic Options Behavior.
@@ -5176,6 +5637,7 @@ var VizBehavior;
5176
5637
  * missing.
5177
5638
  * @type {string}
5178
5639
  */
5640
+
5179
5641
  VizBehavior["PLACEHOLDER"] = "placeholder";
5180
5642
  VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
5181
5643
  VizBehavior["TRELLIS"] = "trellis";
@@ -5267,8 +5729,11 @@ Object.defineProperty(exports, "__esModule", {
5267
5729
  value: true
5268
5730
  });
5269
5731
  exports.TrellisTitle = exports.TRELLIS_TITLE_HEIGHT = void 0;
5732
+
5270
5733
  var React = __webpack_require__(1);
5734
+
5271
5735
  var styled_components_1 = __webpack_require__(4);
5736
+
5272
5737
  exports.TRELLIS_TITLE_HEIGHT = 28;
5273
5738
  var TrellisTitleText = styled_components_1.default.div.withConfig({
5274
5739
  displayName: "TrellisTitle__TrellisTitleText",
@@ -5284,6 +5749,7 @@ var TrellisTitleDiv = styled_components_1.default.div.withConfig({
5284
5749
  }, function (props) {
5285
5750
  return props.backgroundColor;
5286
5751
  });
5752
+
5287
5753
  var TrellisTitle = function TrellisTitle(props) {
5288
5754
  var titleText = String(props.trellisKey).toString();
5289
5755
  return React.createElement(TrellisTitleDiv, {
@@ -5293,6 +5759,7 @@ var TrellisTitle = function TrellisTitle(props) {
5293
5759
  title: titleText
5294
5760
  }, React.createElement(TrellisTitleText, null, titleText));
5295
5761
  };
5762
+
5296
5763
  exports.TrellisTitle = TrellisTitle;
5297
5764
 
5298
5765
  /***/ }),
@@ -5334,11 +5801,11 @@ var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(exte
5334
5801
  var singleValueUtils = __webpack_require__(24);
5335
5802
 
5336
5803
  // EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowUp"
5337
- var ArrowUp_ = __webpack_require__(84);
5804
+ var ArrowUp_ = __webpack_require__(85);
5338
5805
  var ArrowUp_default = /*#__PURE__*/__webpack_require__.n(ArrowUp_);
5339
5806
 
5340
5807
  // EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowDown"
5341
- var ArrowDown_ = __webpack_require__(85);
5808
+ var ArrowDown_ = __webpack_require__(86);
5342
5809
  var ArrowDown_default = /*#__PURE__*/__webpack_require__.n(ArrowDown_);
5343
5810
 
5344
5811
  // EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
@@ -5376,13 +5843,15 @@ var Text = external_styled_components_default.a.div.withConfig({
5376
5843
  }, function (props) {
5377
5844
  return props.size ? "margin-left: ".concat(parseInt(props.size, 10) * 0.2 || 5, "px;") : '';
5378
5845
  });
5846
+
5379
5847
  var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
5380
5848
  var fontSize = _ref.fontSize,
5381
- color = _ref.color,
5382
- value = _ref.value,
5383
- text = _ref.text;
5849
+ color = _ref.color,
5850
+ value = _ref.value,
5851
+ text = _ref.text;
5384
5852
  var TrendIndicator = false;
5385
5853
  var ariaLabel = false;
5854
+
5386
5855
  if (parseFloat(value, 10) > 0) {
5387
5856
  TrendIndicator = ArrowUp_default.a;
5388
5857
  ariaLabel = Object(i18n_["_"])('increase');
@@ -5390,6 +5859,7 @@ var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
5390
5859
  TrendIndicator = ArrowDown_default.a;
5391
5860
  ariaLabel = Object(i18n_["_"])('decrease');
5392
5861
  }
5862
+
5393
5863
  return /*#__PURE__*/external_react_default.a.createElement(Column, {
5394
5864
  justify: "flex-end",
5395
5865
  size: fontSize
@@ -5405,6 +5875,7 @@ var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
5405
5875
  color: color
5406
5876
  }, "".concat(text)));
5407
5877
  };
5878
+
5408
5879
  TrendValue_SingleValueContent.propTypes = {
5409
5880
  fontSize: external_prop_types_default.a.number,
5410
5881
  color: external_prop_types_default.a.string,
@@ -5413,7 +5884,7 @@ TrendValue_SingleValueContent.propTypes = {
5413
5884
  };
5414
5885
  /* harmony default export */ var TrendValue = (TrendValue_SingleValueContent);
5415
5886
  // EXTERNAL MODULE: external "cssesc"
5416
- var external_cssesc_ = __webpack_require__(86);
5887
+ var external_cssesc_ = __webpack_require__(87);
5417
5888
  var external_cssesc_default = /*#__PURE__*/__webpack_require__.n(external_cssesc_);
5418
5889
 
5419
5890
  // CONCATENATED MODULE: ./src/SingleValueBasic/MajorValue.jsx
@@ -5445,37 +5916,44 @@ var MajorValue_Text = external_styled_components_default.a.div.withConfig({
5445
5916
  if (!props.pseudoContent || !props.pseudoContentPosition) {
5446
5917
  return '';
5447
5918
  }
5919
+
5448
5920
  return "&:".concat(props.pseudoContentPosition, " {\n // by default this pseudo element would inherit text-decoration from main element\n // and text-decoration could not be overwritten.\n // adding display: inline-block makes text decoration independent from main element.\n // => the unit will not be underlined if a user hovers over the main value\n display: inline-block;\n font-size: ").concat(props.pseudoContentFontSize, "px;\n position: relative;\n font-weight: normal;\n content: ").concat(props.pseudoContent, ";\n }");
5449
5921
  });
5450
5922
  var validUnitPositions = ['before', 'after'];
5923
+
5451
5924
  var MajorValue_SingleValueContent = function SingleValueContent(_ref) {
5452
5925
  var color = _ref.color,
5453
- fontSize = _ref.fontSize,
5454
- unitPosition = _ref.unitPosition,
5455
- title = _ref.title,
5456
- value = _ref.value,
5457
- onValueClick = _ref.onValueClick,
5458
- unit = _ref.unit;
5926
+ fontSize = _ref.fontSize,
5927
+ unitPosition = _ref.unitPosition,
5928
+ title = _ref.title,
5929
+ value = _ref.value,
5930
+ onValueClick = _ref.onValueClick,
5931
+ unit = _ref.unit;
5459
5932
  var sanitizedUnit;
5460
5933
  var sanitizedUnitPosition;
5934
+
5461
5935
  if (typeof unit === 'string') {
5462
5936
  sanitizedUnit = external_cssesc_default()(unit, {
5463
5937
  wrap: true,
5464
5938
  quotes: 'double'
5465
5939
  });
5940
+
5466
5941
  if (typeof unitPosition === 'string' && validUnitPositions.includes(unitPosition)) {
5467
5942
  sanitizedUnitPosition = unitPosition;
5468
5943
  } else {
5469
5944
  sanitizedUnitPosition = 'after';
5470
5945
  }
5471
5946
  }
5947
+
5472
5948
  var handleKeyDown = function handleKeyDown(e) {
5473
5949
  if (e.keyCode !== 13) {
5474
5950
  return;
5475
5951
  }
5952
+
5476
5953
  e.preventDefault();
5477
5954
  onValueClick(e);
5478
5955
  };
5956
+
5479
5957
  return /*#__PURE__*/external_react_default.a.createElement(Row, {
5480
5958
  size: fontSize
5481
5959
  }, /*#__PURE__*/external_react_default.a.createElement(MajorValue_Text, {
@@ -5495,6 +5973,7 @@ var MajorValue_SingleValueContent = function SingleValueContent(_ref) {
5495
5973
  onKeyDown: handleKeyDown
5496
5974
  }, value));
5497
5975
  };
5976
+
5498
5977
  MajorValue_SingleValueContent.propTypes = {
5499
5978
  color: external_prop_types_default.a.string,
5500
5979
  fontSize: external_prop_types_default.a.number,
@@ -5533,22 +6012,24 @@ var SingleValueBasic_Text = external_styled_components_default.a.div.withConfig(
5533
6012
  }, singleValueUtils["DEFAULT_FONT_FAMILY"], function (props) {
5534
6013
  return props.size || 12;
5535
6014
  });
6015
+
5536
6016
  var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
5537
6017
  var props = extends_default()({}, _ref);
6018
+
5538
6019
  var majorColor = props.majorColor,
5539
- majorTextFontSize = props.majorTextFontSize,
5540
- majorText = props.majorText,
5541
- majorValueTitle = props.majorValueTitle,
5542
- trendColor = props.trendColor,
5543
- trendTextFontSize = props.trendTextFontSize,
5544
- trendText = props.trendText,
5545
- showTrendIndicator = props.showTrendIndicator,
5546
- unit = props.unit,
5547
- unitPosition = props.unitPosition,
5548
- underLabel = props.underLabel,
5549
- underLabelFontSize = props.underLabelFontSize,
5550
- underLabelColor = props.underLabelColor,
5551
- onValueClick = props.onValueClick;
6020
+ majorTextFontSize = props.majorTextFontSize,
6021
+ majorText = props.majorText,
6022
+ majorValueTitle = props.majorValueTitle,
6023
+ trendColor = props.trendColor,
6024
+ trendTextFontSize = props.trendTextFontSize,
6025
+ trendText = props.trendText,
6026
+ showTrendIndicator = props.showTrendIndicator,
6027
+ unit = props.unit,
6028
+ unitPosition = props.unitPosition,
6029
+ underLabel = props.underLabel,
6030
+ underLabelFontSize = props.underLabelFontSize,
6031
+ underLabelColor = props.underLabelColor,
6032
+ onValueClick = props.onValueClick;
5552
6033
  var trendIndicatorEnabled = trendText !== '' && showTrendIndicator;
5553
6034
  return /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Column, null, /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Row, {
5554
6035
  align: "baseline"
@@ -5561,7 +6042,8 @@ var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
5561
6042
  value: majorText,
5562
6043
  title: majorValueTitle,
5563
6044
  onValueClick: onValueClick
5564
- }), trendIndicatorEnabled && /*#__PURE__*/
6045
+ }), trendIndicatorEnabled &&
6046
+ /*#__PURE__*/
5565
6047
  // Passing the same value for value and text is a temporary hold until completion of https://jira.splunk.com/browse/SCP-21371
5566
6048
  external_react_default.a.createElement(TrendValue, {
5567
6049
  "data-test": "TrendIndicator",
@@ -5577,6 +6059,7 @@ var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
5577
6059
  color: underLabelColor
5578
6060
  }, underLabel)));
5579
6061
  };
6062
+
5580
6063
  SingleValueBasic_SingleValueBasic.propTypes = {
5581
6064
  majorText: external_prop_types_default.a.string,
5582
6065
  majorColor: external_prop_types_default.a.string,
@@ -5598,35 +6081,35 @@ var SingleValueTrendValue = TrendValue;
5598
6081
 
5599
6082
  /***/ }),
5600
6083
 
5601
- /***/ 83:
6084
+ /***/ 84:
5602
6085
  /***/ (function(module, exports) {
5603
6086
 
5604
6087
  module.exports = require("@splunk/visualizations-shared/trellisUtils");
5605
6088
 
5606
6089
  /***/ }),
5607
6090
 
5608
- /***/ 84:
6091
+ /***/ 85:
5609
6092
  /***/ (function(module, exports) {
5610
6093
 
5611
6094
  module.exports = require("@splunk/react-icons/enterprise/ArrowUp");
5612
6095
 
5613
6096
  /***/ }),
5614
6097
 
5615
- /***/ 85:
6098
+ /***/ 86:
5616
6099
  /***/ (function(module, exports) {
5617
6100
 
5618
6101
  module.exports = require("@splunk/react-icons/enterprise/ArrowDown");
5619
6102
 
5620
6103
  /***/ }),
5621
6104
 
5622
- /***/ 86:
6105
+ /***/ 87:
5623
6106
  /***/ (function(module, exports) {
5624
6107
 
5625
6108
  module.exports = require("cssesc");
5626
6109
 
5627
6110
  /***/ }),
5628
6111
 
5629
- /***/ 87:
6112
+ /***/ 88:
5630
6113
  /***/ (function(module, exports) {
5631
6114
 
5632
6115
  module.exports = require("@babel/runtime/helpers/assertThisInitialized");
@@ -5640,7 +6123,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
5640
6123
 
5641
6124
  /***/ }),
5642
6125
 
5643
- /***/ 90:
6126
+ /***/ 91:
5644
6127
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5645
6128
 
5646
6129
  "use strict";
@@ -5664,7 +6147,7 @@ var StaticBackgroundColorEditor = {
5664
6147
 
5665
6148
  /***/ }),
5666
6149
 
5667
- /***/ 93:
6150
+ /***/ 94:
5668
6151
  /***/ (function(module, exports) {
5669
6152
 
5670
6153
  module.exports = require("@splunk/react-ui/Paginator");
@@ -5682,7 +6165,7 @@ __webpack_require__.r(__webpack_exports__);
5682
6165
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
5683
6166
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
5684
6167
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
5685
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87);
6168
+ /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(88);
5686
6169
  /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__);
5687
6170
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71);
5688
6171
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);
@@ -5714,24 +6197,31 @@ __webpack_require__.r(__webpack_exports__);
5714
6197
 
5715
6198
 
5716
6199
 
6200
+
5717
6201
  function _createSuper(Derived) {
5718
6202
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
6203
+
5719
6204
  return function _createSuperInternal() {
5720
6205
  var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived),
5721
- result;
6206
+ result;
6207
+
5722
6208
  if (hasNativeReflectConstruct) {
5723
6209
  var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;
6210
+
5724
6211
  result = Reflect.construct(Super, arguments, NewTarget);
5725
6212
  } else {
5726
6213
  result = Super.apply(this, arguments);
5727
6214
  }
6215
+
5728
6216
  return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, result);
5729
6217
  };
5730
6218
  }
6219
+
5731
6220
  function _isNativeReflectConstruct() {
5732
6221
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
5733
6222
  if (Reflect.construct.sham) return false;
5734
6223
  if (typeof Proxy === "function") return true;
6224
+
5735
6225
  try {
5736
6226
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
5737
6227
  return true;
@@ -5746,6 +6236,7 @@ function _isNativeReflectConstruct() {
5746
6236
 
5747
6237
 
5748
6238
 
6239
+
5749
6240
  var StyledSvg = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.svg.withConfig({
5750
6241
  displayName: "SparkLine__StyledSvg",
5751
6242
  componentId: "sc-5oplra-0"
@@ -5754,21 +6245,29 @@ var StyledTooltip = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.di
5754
6245
  displayName: "SparkLine__StyledTooltip",
5755
6246
  componentId: "sc-5oplra-1"
5756
6247
  })(["padding:3px 8px;font-size:12px;"]);
6248
+
5757
6249
  var SparkLine = /*#__PURE__*/function (_Component) {
5758
6250
  _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(SparkLine, _Component);
6251
+
5759
6252
  var _super = _createSuper(SparkLine);
6253
+
5760
6254
  function SparkLine(props) {
5761
6255
  var _this;
6256
+
5762
6257
  _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SparkLine);
6258
+
5763
6259
  for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5764
6260
  rest[_key - 1] = arguments[_key];
5765
6261
  }
6262
+
5766
6263
  _this = _super.call.apply(_super, [this, props].concat(rest));
6264
+
5767
6265
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this), "handleCursorMount", function (el) {
5768
6266
  _this.setState({
5769
6267
  anchor: el
5770
6268
  });
5771
6269
  });
6270
+
5772
6271
  _this.state = {
5773
6272
  anchor: null,
5774
6273
  currentPointX: null,
@@ -5779,69 +6278,75 @@ var SparkLine = /*#__PURE__*/function (_Component) {
5779
6278
  _this.titleId = Object(_splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__["createDOMID"])();
5780
6279
  return _this;
5781
6280
  }
6281
+
5782
6282
  _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(SparkLine, [{
5783
6283
  key: "getMax",
5784
6284
  value: function getMax() {
5785
6285
  var _this2 = this;
6286
+
5786
6287
  var _this$props = this.props,
5787
- data = _this$props.data,
5788
- acceptNull = _this$props.acceptNull,
5789
- yMax = _this$props.yMax;
6288
+ data = _this$props.data,
6289
+ acceptNull = _this$props.acceptNull,
6290
+ yMax = _this$props.yMax;
6291
+
5790
6292
  var dataMax = function dataMax() {
5791
6293
  return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(_this2.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(data);
5792
6294
  };
6295
+
5793
6296
  return yMax !== undefined ? yMax : dataMax();
5794
6297
  }
5795
6298
  }, {
5796
6299
  key: "getMin",
5797
6300
  value: function getMin() {
5798
6301
  var _this3 = this;
6302
+
5799
6303
  var _this$props2 = this.props,
5800
- data = _this$props2.data,
5801
- acceptNull = _this$props2.acceptNull,
5802
- yMin = _this$props2.yMin;
6304
+ data = _this$props2.data,
6305
+ acceptNull = _this$props2.acceptNull,
6306
+ yMin = _this$props2.yMin;
6307
+
5803
6308
  var dataMin = function dataMin() {
5804
6309
  return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(_this3.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(data);
5805
6310
  };
6311
+
5806
6312
  return yMin !== undefined ? yMin : dataMin();
5807
6313
  }
5808
-
5809
6314
  /**
5810
6315
  * Gets unit value of x axis.
5811
6316
  * @param {Number} xMargin - margin of x axis.
5812
6317
  * @return {Number} unit value of x axis.
5813
6318
  * @private
5814
6319
  */
6320
+
5815
6321
  }, {
5816
6322
  key: "getXUnit",
5817
6323
  value: function getXUnit(xMargin) {
5818
6324
  var _this$props3 = this.props,
5819
- data = _this$props3.data,
5820
- width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
6325
+ data = _this$props3.data,
6326
+ width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
6327
+
5821
6328
  var xUnit = (width - xMargin * 2) / (data.length > 1 ? data.length - 1 : 1);
5822
6329
  return Math.max(0, xUnit);
5823
6330
  }
5824
-
5825
6331
  /**
5826
6332
  * Gets unit value of y axis.
5827
6333
  * @param {String} yMargin - margin of y axis.
5828
6334
  * @return {Number} unit value of y axis.
5829
6335
  * @private
5830
6336
  */
6337
+
5831
6338
  }, {
5832
6339
  key: "getYUnit",
5833
6340
  value: function getYUnit(yMargin) {
5834
6341
  var height = this.props.height;
5835
6342
  var maxValue = this.getMax();
5836
- var minValue = this.getMin();
5837
-
5838
- // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
6343
+ var minValue = this.getMin(); // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
5839
6344
  // if the maxValue equals minValue, means all values in data are the same, then, we need to set the YUnit at the mid value of Height.
5840
6345
  // So, draws sparkline right in the mid of the container.
6346
+
5841
6347
  var yUnit = (height - yMargin * 2) / (maxValue - minValue || 2);
5842
6348
  return Math.max(0, yUnit);
5843
6349
  }
5844
-
5845
6350
  /**
5846
6351
  * Get a list of arrays of points for drawing lines, based on acceptNull property
5847
6352
  * @method getSegmentSets
@@ -5849,6 +6354,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
5849
6354
  * @param {Array} points
5850
6355
  * @returns {Array} List of datapoint sets used for drawing lines
5851
6356
  */
6357
+
5852
6358
  }, {
5853
6359
  key: "getSegmentSets",
5854
6360
  value: function getSegmentSets(data, points) {
@@ -5861,19 +6367,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
5861
6367
  // need at least 2 points to draw a segment
5862
6368
  if (currentLine.length > 1) {
5863
6369
  lines.push(currentLine);
5864
- }
5865
- // reset for the next segment
6370
+ } // reset for the next segment
6371
+
6372
+
5866
6373
  currentLine = [];
5867
6374
  } else {
5868
6375
  // data is good, add point data
5869
6376
  currentLine.push(points[idx]);
5870
6377
  }
5871
- });
6378
+ }); // Add the last line
5872
6379
 
5873
- // Add the last line
5874
6380
  if (currentLine.length > 1) {
5875
6381
  lines.push(currentLine);
5876
6382
  }
6383
+
5877
6384
  return lines;
5878
6385
  }
5879
6386
  }, {
@@ -5889,7 +6396,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
5889
6396
  return value === null ? 0 : value;
5890
6397
  });
5891
6398
  }
5892
-
5893
6399
  /**
5894
6400
  * Converts data to points in svg
5895
6401
  * @param {Number} xMargin - margin of x axis.
@@ -5897,6 +6403,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
5897
6403
  * @return {Array} points coordination.
5898
6404
  * @private
5899
6405
  */
6406
+
5900
6407
  }, {
5901
6408
  key: "dataToPoints",
5902
6409
  value: function dataToPoints(xMargin, yMargin) {
@@ -5914,7 +6421,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
5914
6421
  return [p.x, p.y];
5915
6422
  });
5916
6423
  }
5917
-
5918
6424
  /**
5919
6425
  * Renders rect area for helping figure out which is the nearest point so that
5920
6426
  * render related cursor and tooltip.
@@ -5923,16 +6429,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
5923
6429
  * @return {Array} array of svg rect objects
5924
6430
  * @private
5925
6431
  */
6432
+
5926
6433
  }, {
5927
6434
  key: "renderRect",
5928
6435
  value: function renderRect(points, xMargin) {
5929
6436
  var _this4 = this;
6437
+
5930
6438
  var _this$props4 = this.props,
5931
- data = _this$props4.data,
5932
- height = _this$props4.height;
6439
+ data = _this$props4.data,
6440
+ height = _this$props4.height;
5933
6441
  var xUnit = this.getXUnit(xMargin);
5934
6442
  return points.map(function (p, i) {
5935
- return /*#__PURE__*/(
6443
+ return (
6444
+ /*#__PURE__*/
6445
+
5936
6446
  /* eslint-disable react/no-array-index-key */
5937
6447
  react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("rect", {
5938
6448
  // eslint-disable-line jsx-a11y/mouse-events-have-key-events
@@ -5955,33 +6465,32 @@ var SparkLine = /*#__PURE__*/function (_Component) {
5955
6465
  }
5956
6466
  })
5957
6467
  /* eslint-enable react/no-array-index-key */
6468
+
5958
6469
  );
5959
6470
  });
5960
- }
6471
+ } // Renders area chart
5961
6472
 
5962
- // Renders area chart
5963
6473
  }, {
5964
6474
  key: "renderArea",
5965
6475
  value: function renderArea(points) {
5966
6476
  var _this$props5 = this.props,
5967
- data = _this$props5.data,
5968
- fillColor = _this$props5.fillColor,
5969
- fillOpacity = _this$props5.fillOpacity,
5970
- height = _this$props5.height,
5971
- isArea = _this$props5.isArea;
6477
+ data = _this$props5.data,
6478
+ fillColor = _this$props5.fillColor,
6479
+ fillOpacity = _this$props5.fillOpacity,
6480
+ height = _this$props5.height,
6481
+ isArea = _this$props5.isArea;
6482
+
5972
6483
  if (!isArea || points.length === 0) {
5973
6484
  return null;
5974
6485
  }
6486
+
5975
6487
  var segments = this.getSegmentSets(data, points);
5976
6488
  segments = segments.map(function (s) {
5977
- return s.concat([[s[s.length - 1][0], height],
5978
- // down to bottom of graph
5979
- [s[0][0], height],
5980
- // over to below first data point
6489
+ return s.concat([[s[s.length - 1][0], height], // down to bottom of graph
6490
+ [s[0][0], height], // over to below first data point
5981
6491
  s[0] // up to first data point to close the box
5982
6492
  ]);
5983
6493
  });
5984
-
5985
6494
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
5986
6495
  "data-test": "area"
5987
6496
  }, segments.map(function (s) {
@@ -6001,11 +6510,11 @@ var SparkLine = /*#__PURE__*/function (_Component) {
6001
6510
  key: "renderCursor",
6002
6511
  value: function renderCursor() {
6003
6512
  var _this$props6 = this.props,
6004
- cursorStroke = _this$props6.cursorStroke,
6005
- cursorStrokeWidth = _this$props6.cursorStrokeWidth,
6006
- cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
6007
- cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
6008
- height = _this$props6.height;
6513
+ cursorStroke = _this$props6.cursorStroke,
6514
+ cursorStrokeWidth = _this$props6.cursorStrokeWidth,
6515
+ cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
6516
+ cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
6517
+ height = _this$props6.height;
6009
6518
  return this.state.rectArea !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("line", {
6010
6519
  "data-test": "cursor",
6011
6520
  ref: this.handleCursorMount,
@@ -6034,7 +6543,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
6034
6543
  animation: false
6035
6544
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(StyledTooltip, null, this.state.anchor !== null ? this.state.tooltip : undefined));
6036
6545
  }
6037
-
6038
6546
  /**
6039
6547
  * Renders one or more svg circles to highlight values on the sparkline
6040
6548
  * @method renderEndDots
@@ -6044,14 +6552,15 @@ var SparkLine = /*#__PURE__*/function (_Component) {
6044
6552
  * @returns {Object} React representation of SVG group
6045
6553
  * @private
6046
6554
  */
6555
+
6047
6556
  }, {
6048
6557
  key: "renderEndDots",
6049
6558
  value: function renderEndDots(points, dotsToShow, xMargin) {
6050
6559
  var _this$props7 = this.props,
6051
- endDotFillColor = _this$props7.endDotFillColor,
6052
- endDotRadius = _this$props7.endDotRadius,
6053
- endDotStroke = _this$props7.endDotStroke,
6054
- endDotStrokeWidth = _this$props7.endDotStrokeWidth;
6560
+ endDotFillColor = _this$props7.endDotFillColor,
6561
+ endDotRadius = _this$props7.endDotRadius,
6562
+ endDotStroke = _this$props7.endDotStroke,
6563
+ endDotStrokeWidth = _this$props7.endDotStrokeWidth;
6055
6564
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, points.slice(-dotsToShow).map(function (point) {
6056
6565
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("circle", {
6057
6566
  key: "end-dot".concat(point[0]).concat(point[1]),
@@ -6067,21 +6576,21 @@ var SparkLine = /*#__PURE__*/function (_Component) {
6067
6576
  });
6068
6577
  }));
6069
6578
  }
6070
-
6071
6579
  /**
6072
6580
  * Renders the line(s) above the area graph
6073
6581
  * @method renderPolyline
6074
6582
  * @param {Array} points
6075
6583
  * @returns {Object} SVG Group of polylines
6076
6584
  */
6585
+
6077
6586
  }, {
6078
6587
  key: "renderPolyline",
6079
6588
  value: function renderPolyline(points) {
6080
6589
  var _this$props8 = this.props,
6081
- data = _this$props8.data,
6082
- lineColor = _this$props8.lineColor,
6083
- lineLength = _this$props8.lineLength,
6084
- lineStrokeWidth = _this$props8.lineStrokeWidth;
6590
+ data = _this$props8.data,
6591
+ lineColor = _this$props8.lineColor,
6592
+ lineLength = _this$props8.lineLength,
6593
+ lineStrokeWidth = _this$props8.lineStrokeWidth;
6085
6594
  var linePoints = Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(lineLength) && lineLength > 0 ? lineLength : points.length;
6086
6595
  var lines = this.getSegmentSets(data.slice(-linePoints), points.slice(-linePoints));
6087
6596
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
@@ -6105,24 +6614,26 @@ var SparkLine = /*#__PURE__*/function (_Component) {
6105
6614
  key: "render",
6106
6615
  value: function render() {
6107
6616
  var _this5 = this;
6617
+
6108
6618
  var _this$props9 = this.props,
6109
- data = _this$props9.data,
6110
- elementRef = _this$props9.elementRef,
6111
- showTooltip = _this$props9.showTooltip,
6112
- showEndDot = _this$props9.showEndDot,
6113
- endDotRadius = _this$props9.endDotRadius,
6114
- endDotStrokeWidth = _this$props9.endDotStrokeWidth,
6115
- endDotCount = _this$props9.endDotCount,
6116
- height = _this$props9.height,
6117
- isArea = _this$props9.isArea,
6118
- lineStrokeWidth = _this$props9.lineStrokeWidth,
6119
- width = _this$props9.width,
6120
- title = _this$props9.title;
6619
+ data = _this$props9.data,
6620
+ elementRef = _this$props9.elementRef,
6621
+ showTooltip = _this$props9.showTooltip,
6622
+ showEndDot = _this$props9.showEndDot,
6623
+ endDotRadius = _this$props9.endDotRadius,
6624
+ endDotStrokeWidth = _this$props9.endDotStrokeWidth,
6625
+ endDotCount = _this$props9.endDotCount,
6626
+ height = _this$props9.height,
6627
+ isArea = _this$props9.isArea,
6628
+ lineStrokeWidth = _this$props9.lineStrokeWidth,
6629
+ width = _this$props9.width,
6630
+ title = _this$props9.title;
6631
+
6121
6632
  if (data.length === 0) {
6122
6633
  return null;
6123
- }
6634
+ } // Calculate horizontal and vertical margin so that fit line or end dot.
6635
+
6124
6636
 
6125
- // Calculate horizontal and vertical margin so that fit line or end dot.
6126
6637
  var xMargin = endDotRadius + endDotStrokeWidth / 2;
6127
6638
  var yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
6128
6639
  var points = this.dataToPoints(xMargin, yMargin);
@@ -6152,84 +6663,114 @@ var SparkLine = /*#__PURE__*/function (_Component) {
6152
6663
  }, title || Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__["_"])('Source count over time sparkline trend')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, this.renderCursor(), this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, showTooltip ? this.renderRect(points, xMargin) : null, showTooltip ? this.renderTooltip() : null)));
6153
6664
  }
6154
6665
  }]);
6666
+
6155
6667
  return SparkLine;
6156
6668
  }(react__WEBPACK_IMPORTED_MODULE_9__["Component"]);
6669
+
6157
6670
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "propTypes", {
6158
6671
  /**
6159
6672
  * If true, data can contain `null` as a value and is treated as `0`. If false, this throws error when data contains `null`.
6160
6673
  */
6161
6674
  acceptNull: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
6675
+
6162
6676
  /** Array of numbers. These data numbers are converted to points and show on sparkline. */
6163
6677
  data: function data(props) {
6164
6678
  if (!Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isArray"])(props.data)) {
6165
6679
  return new Error('Data provided to Sparkline must be an array.');
6166
6680
  }
6681
+
6167
6682
  if (props.acceptNull && !props.data.every(function (value) {
6168
6683
  return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isNull"])(value) || Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
6169
6684
  })) {
6170
6685
  return new Error('Data provided to Sparkline must be finite numbers or null.');
6171
6686
  }
6687
+
6172
6688
  if (!props.acceptNull && !props.data.every(function (value) {
6173
6689
  return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
6174
6690
  })) {
6175
6691
  return new Error('Data provided to Sparkline must be finite numbers.');
6176
6692
  }
6693
+
6177
6694
  return null;
6178
6695
  },
6696
+
6179
6697
  /** A React ref which is set to the DOM element when the component mounts and `null` when it unmounts. */
6180
6698
  elementRef: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.object]),
6699
+
6181
6700
  /** Sets the number of end dots to display. When showEndDot is set to `true`, endDotCount is at least 1. If set to a positive value, this overrides showEndDot. */
6182
6701
  endDotCount: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
6702
+
6183
6703
  /** Fills color to the end dot. */
6184
6704
  endDotFillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
6705
+
6185
6706
  /**
6186
6707
  * Sets end dot radius. End dot radius must be less than or equal to the margin. By default, its value equals the margin.
6187
6708
  */
6188
6709
  endDotRadius: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
6710
+
6189
6711
  /** Sets end dot circle stroke color. */
6190
6712
  endDotStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
6713
+
6191
6714
  /** Sets end dot circle stroke width in pixels. */
6192
6715
  endDotStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
6716
+
6193
6717
  /** Fills color to area. */
6194
6718
  fillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
6719
+
6195
6720
  /** Fills opacity to area. Value must be in 0 ~ 1. */
6196
6721
  fillOpacity: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
6722
+
6197
6723
  /** Sets cursor stroke color. */
6198
6724
  cursorStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
6725
+
6199
6726
  /** Sets cursor stroke width in pixels. */
6200
6727
  cursorStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
6728
+
6201
6729
  /** Sets cursor line cap style. */
6202
6730
  cursorStrokeLinecap: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOf(['butt', 'round', 'square']),
6731
+
6203
6732
  /** Sets cursor dash array style. */
6204
6733
  cursorStrokeDasharray: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
6734
+
6205
6735
  /**
6206
6736
  * Container height. If this value is specified, sparkline calculates the size using this height. If height isn't specified,
6207
6737
  * sparkline figures out the container height by itself.
6208
6738
  */
6209
6739
  height: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
6740
+
6210
6741
  /** When set to `true`, sparkline shows as area. */
6211
6742
  isArea: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
6743
+
6212
6744
  /** The sparkline line color. */
6213
6745
  lineColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
6746
+
6214
6747
  /** Allows user to draw only the last data points for the line. */
6215
6748
  lineLength: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
6749
+
6216
6750
  /** The sparkline line stroke width in pixels. */
6217
6751
  lineStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
6752
+
6218
6753
  /** Enable to show end dot. */
6219
6754
  showEndDot: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
6755
+
6220
6756
  /** Enable to show tooltip. */
6221
6757
  showTooltip: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
6758
+
6222
6759
  /** Sets the data value range and maximum value shown on sparkline. */
6223
6760
  yMax: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
6761
+
6224
6762
  /** Sets the data value range and minimum value shown on sparkline. */
6225
6763
  yMin: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
6764
+
6226
6765
  /**
6227
6766
  * The width of the container.
6228
6767
  */
6229
6768
  width: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
6769
+
6230
6770
  /** Sets the a11y title text on sparkline. */
6231
6771
  title: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string
6232
6772
  });
6773
+
6233
6774
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "defaultProps", {
6234
6775
  acceptNull: false,
6235
6776
  data: [],
@@ -6250,6 +6791,7 @@ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(Spa
6250
6791
  lineColor: '#65a637',
6251
6792
  lineStrokeWidth: 1
6252
6793
  });
6794
+
6253
6795
  /* harmony default export */ __webpack_exports__["default"] = (SparkLine);
6254
6796
 
6255
6797
  /***/ })