@splunk/visualizations 26.0.0 → 26.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/Area.config.js +102 -18
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +618 -221
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +104 -20
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +624 -219
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +94 -20
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +606 -211
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +65 -14
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +550 -183
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +103 -18
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +637 -221
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +82 -17
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +425 -148
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +100 -18
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +752 -293
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +96 -27
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +759 -374
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +62 -18
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +419 -154
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +106 -22
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +631 -223
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +72 -22
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +632 -219
  44. package/LinkGraph.js.map +1 -1
  45. package/MIGRATION.md +1082 -0
  46. package/Map.config.js +241 -97
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +1195 -595
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +70 -20
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +460 -195
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +79 -21
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +802 -411
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +72 -18
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +853 -484
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +75 -22
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +612 -212
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +81 -29
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +844 -379
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +85 -19
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +432 -152
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +84 -22
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +878 -342
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +96 -22
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +607 -212
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +94 -24
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +1182 -650
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +286 -225
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +92 -22
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +965 -506
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +99 -26
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +1167 -616
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +126 -67
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +73 -20
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +810 -322
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +107 -35
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +18 -7
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/EventsDoc.js +76 -22
  107. package/common/EventsDoc.js.map +1 -1
  108. package/common/GaugeMajorTicks.js +68 -58
  109. package/common/GaugeMajorTicks.js.map +1 -1
  110. package/common/GaugeValueMarker.js +43 -34
  111. package/common/GaugeValueMarker.js.map +1 -1
  112. package/common/OptionsDoc.js +156 -65
  113. package/common/OptionsDoc.js.map +1 -1
  114. package/common/OverviewDoc.js +33 -5
  115. package/common/OverviewDoc.js.map +1 -1
  116. package/common/SplunkVisualization.js +31 -4
  117. package/common/SplunkVisualization.js.map +1 -1
  118. package/common/SplunkVisualizationApi.js +8 -2
  119. package/common/SplunkVisualizationApi.js.map +1 -1
  120. package/common/ThemesDoc.js +27 -14
  121. package/common/ThemesDoc.js.map +1 -1
  122. package/common/chartingUtils.js +44 -12
  123. package/common/chartingUtils.js.map +1 -1
  124. package/common/docUtils.js +11 -1
  125. package/common/docUtils.js.map +1 -1
  126. package/common/gaugeUtils.js +173 -90
  127. package/common/gaugeUtils.js.map +1 -1
  128. package/common/shapeUtils.js +14 -2
  129. package/common/shapeUtils.js.map +1 -1
  130. package/common/utils/configUtils.js +49 -14
  131. package/common/utils/configUtils.js.map +1 -1
  132. package/common/utils/dataUtils.js +7 -2
  133. package/common/utils/dataUtils.js.map +1 -1
  134. package/common/utils/hocUtils.js +3 -1
  135. package/common/utils/hocUtils.js.map +1 -1
  136. package/common/utils/layoutUtils.js +1 -0
  137. package/common/utils/layoutUtils.js.map +1 -1
  138. package/common/utils/mapUtils.js +287 -127
  139. package/common/utils/mapUtils.js.map +1 -1
  140. package/common/utils/singleValueUtils.js +241 -196
  141. package/common/utils/singleValueUtils.js.map +1 -1
  142. package/common/utils/testHelper.js +9 -0
  143. package/common/utils/testHelper.js.map +1 -1
  144. package/common/utils/trellisUtils.js +61 -0
  145. package/common/utils/trellisUtils.js.map +1 -1
  146. package/common/utils/urlUtils.js +2 -0
  147. package/common/utils/urlUtils.js.map +1 -1
  148. package/common/withDashboardViz.js +274 -95
  149. package/common/withDashboardViz.js.map +1 -1
  150. package/package.json +16 -18
@@ -136,11 +136,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
136
136
  Object.defineProperty(exports, "__esModule", {
137
137
  value: true
138
138
  });
139
+
139
140
  var React = __webpack_require__(1);
141
+
140
142
  var styled_components_1 = __webpack_require__(4);
143
+
141
144
  var SizeAwareWrapper_1 = __webpack_require__(19);
145
+
142
146
  var style_1 = __webpack_require__(14);
147
+
143
148
  var colorUtils_1 = __webpack_require__(12);
149
+
144
150
  var Item = styled_components_1.default.div.attrs(function (_ref) {
145
151
  var width = _ref.width;
146
152
  return {
@@ -153,11 +159,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
153
159
  componentId: "sc-1yhgpod-0"
154
160
  })(["position:relative;background-color:", "};"], function (props) {
155
161
  return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
156
- });
157
- // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
162
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
163
+
158
164
  var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
159
165
  var width = _ref2.width,
160
- height = _ref2.height;
166
+ height = _ref2.height;
161
167
  return {
162
168
  style: Object.assign(Object.assign({}, width && {
163
169
  width: (0, style_1.toPx)(width)
@@ -179,11 +185,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
179
185
  displayName: "FixedSizeContainer__FixSizeItemContent",
180
186
  componentId: "sc-1yhgpod-3"
181
187
  })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
188
+
182
189
  var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
183
190
  var FixedSizeContainer = function FixedSizeContainer(props) {
184
191
  var width = props.width,
185
- height = props.height,
186
- backgroundColor = props.backgroundColor;
192
+ height = props.height,
193
+ backgroundColor = props.backgroundColor;
194
+
187
195
  if (!height) {
188
196
  return React.createElement(Item, {
189
197
  "data-test": "item",
@@ -191,24 +199,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
191
199
  backgroundColor: backgroundColor
192
200
  }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
193
201
  }
202
+
194
203
  return React.createElement(FixSizeItem, {
195
204
  "data-test": "fix-size-item",
196
- "data-splunk-visualization-version": "26.0.0 - 2f7458907",
205
+ "data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
197
206
  width: width,
198
207
  height: height,
199
208
  backgroundColor: backgroundColor
200
209
  }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
201
210
  var newWidth = _ref3.width,
202
- newHeight = _ref3.height;
211
+ newHeight = _ref3.height;
203
212
  return React.createElement(Viz, Object.assign({}, props, {
204
213
  width: newWidth,
205
214
  height: newHeight
206
215
  }));
207
216
  })));
208
217
  };
218
+
209
219
  FixedSizeContainer.displayName = 'withFixedSizeContainer';
210
220
  return FixedSizeContainer;
211
221
  };
222
+
212
223
  exports.default = withFixedSizeContainer;
213
224
 
214
225
  /***/ }),
@@ -236,9 +247,10 @@ exports.extendStaticWrapperProps = void 0;
236
247
  * @param {DashboardVizType} props.Wrapper
237
248
  * @param {DashboardVizType} props.Visualization
238
249
  */
250
+
239
251
  var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
240
252
  var Wrapper = _ref.Wrapper,
241
- Visualization = _ref.Visualization;
253
+ Visualization = _ref.Visualization;
242
254
  var extendProperties = ['propTypes', 'defaultProps', 'config'];
243
255
  extendProperties.forEach(function (prop) {
244
256
  if (Visualization[prop]) {
@@ -247,6 +259,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
247
259
  }
248
260
  });
249
261
  };
262
+
250
263
  exports.extendStaticWrapperProps = extendStaticWrapperProps;
251
264
 
252
265
  /***/ }),
@@ -300,24 +313,33 @@ module.exports = require("@splunk/ui-utils/i18n");
300
313
 
301
314
 
302
315
  var _toConsumableArray = __webpack_require__(8);
316
+
303
317
  var _defineProperty = __webpack_require__(7);
318
+
304
319
  var __rest = this && this.__rest || function (s, e) {
305
320
  var t = {};
321
+
306
322
  for (var p in s) {
307
323
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
308
324
  }
325
+
309
326
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
310
327
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
311
328
  }
312
329
  return t;
313
330
  };
331
+
314
332
  Object.defineProperty(exports, "__esModule", {
315
333
  value: true
316
334
  });
317
335
  exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
336
+
318
337
  var lodash_1 = __webpack_require__(3);
338
+
319
339
  var schemaUtils_1 = __webpack_require__(16);
340
+
320
341
  var VizBehavior_1 = __webpack_require__(6);
342
+
321
343
  var dynamicOptionsDSLType = {
322
344
  type: 'string',
323
345
  pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
@@ -327,20 +349,22 @@ var dynamicOptionsDSLType = {
327
349
  * @param optionsSchema a visualization's options schema
328
350
  * @returns an updated options schema that additionally allows strings starting with > for each option
329
351
  */
352
+
330
353
  function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
331
354
  var enhancedOptionsSchema = {};
332
355
  Object.keys(optionsSchema).forEach(function (key) {
333
356
  var _a = optionsSchema[key],
334
- title = _a.title,
335
- description = _a.description,
336
- readOnly = _a.readOnly,
337
- writeOnly = _a.writeOnly,
338
- examples = _a.examples,
339
- defaultValue = _a.default,
340
- type = _a.type,
341
- properties = _a.properties,
342
- patternProperties = _a.patternProperties,
343
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
357
+ title = _a.title,
358
+ description = _a.description,
359
+ readOnly = _a.readOnly,
360
+ writeOnly = _a.writeOnly,
361
+ examples = _a.examples,
362
+ defaultValue = _a.default,
363
+ type = _a.type,
364
+ properties = _a.properties,
365
+ patternProperties = _a.patternProperties,
366
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
367
+
344
368
  var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
345
369
  title: title
346
370
  }), description !== undefined && {
@@ -354,12 +378,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
354
378
  }), defaultValue !== undefined && {
355
379
  default: defaultValue
356
380
  });
381
+
357
382
  if (type === 'object') {
358
383
  enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
359
384
  type: type
360
385
  }), properties && {
361
386
  properties: enhanceOptionsSchemaWithDynamicOptions(properties)
362
387
  });
388
+
363
389
  if (patternProperties) {
364
390
  var enhancedPatternProperties = {};
365
391
  Object.keys(patternProperties).forEach(function (opt) {
@@ -377,6 +403,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
377
403
  });
378
404
  return enhancedOptionsSchema;
379
405
  }
406
+
380
407
  exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
381
408
  /**
382
409
  * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
@@ -385,11 +412,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
385
412
  * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
386
413
  * and containing `open: false` for all editor panels in editorConfig
387
414
  */
415
+
388
416
  function enhanceConfig(vizConfig) {
389
417
  var enhancedConfig = Object.assign({}, vizConfig);
418
+
390
419
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
391
420
  enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
392
421
  }
422
+
393
423
  enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
394
424
  return Object.assign(Object.assign({}, config), {
395
425
  open: config.open || false
@@ -397,6 +427,7 @@ function enhanceConfig(vizConfig) {
397
427
  });
398
428
  return enhancedConfig;
399
429
  }
430
+
400
431
  exports.enhanceConfig = enhanceConfig;
401
432
  /**
402
433
  * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
@@ -404,6 +435,7 @@ exports.enhanceConfig = enhanceConfig;
404
435
  * @param vizConfig a Visualization Config
405
436
  * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
406
437
  */
438
+
407
439
  function uncollapseEditorConfig(vizConfig) {
408
440
  var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
409
441
  editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
@@ -413,13 +445,16 @@ function uncollapseEditorConfig(vizConfig) {
413
445
  });
414
446
  return editorPanelUncollapsedConfig;
415
447
  }
448
+
416
449
  exports.uncollapseEditorConfig = uncollapseEditorConfig;
450
+
417
451
  function isDynamicOption(option) {
418
452
  return option && typeof option === 'string' && option.trim().startsWith('>') || false;
419
453
  }
420
- exports.isDynamicOption = isDynamicOption;
421
- // private helpers to improve readability of getInitialPreset
454
+
455
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
422
456
  // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
457
+
423
458
  /**
424
459
  * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
425
460
  * 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
@@ -428,6 +463,7 @@ exports.isDynamicOption = isDynamicOption;
428
463
  *
429
464
  * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
430
465
  */
466
+
431
467
  function hasCompatibleContexts(vizContext, presetContext) {
432
468
  var presetContextKeys = Object.keys(presetContext);
433
469
  return presetContextKeys.every(function (contextKey) {
@@ -437,6 +473,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
437
473
  /**
438
474
  * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
439
475
  */
476
+
477
+
440
478
  function hasCompatibleOptions(vizOptions, presetOptions) {
441
479
  var presetOptionKeys = Object.keys(presetOptions);
442
480
  return presetOptionKeys.every(function (optionKey) {
@@ -451,18 +489,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
451
489
  * @param {Object} vizOptions - the current vizOptions definition
452
490
  * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
453
491
  */
492
+
493
+
454
494
  function getInitialPreset(vizContext, vizOptions, presets) {
455
495
  return presets.find(function (preset) {
456
496
  var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
457
497
  var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
458
498
  var presetContextKeys = Object.keys(presetContext);
459
- var presetOptionKeys = Object.keys(presetOptions);
460
- // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
499
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
461
500
  // if not, then the preset is invalid in config.ts
501
+
462
502
  if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
463
503
  return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
464
504
  });
465
505
  }
506
+
466
507
  exports.getInitialPreset = getInitialPreset;
467
508
  /**
468
509
  * generates number precision values for a Select editor
@@ -470,6 +511,7 @@ exports.getInitialPreset = getInitialPreset;
470
511
  * @param {Number} numPrecisionValues - number of integer precision values to generate
471
512
  * @returns {{ label: string; value; string }[]} array of { label, value } tuples
472
513
  */
514
+
473
515
  function generatePrecisionValues(numPrecisionValues) {
474
516
  return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
475
517
  return {
@@ -478,6 +520,7 @@ function generatePrecisionValues(numPrecisionValues) {
478
520
  };
479
521
  });
480
522
  }
523
+
481
524
  exports.generatePrecisionValues = generatePrecisionValues;
482
525
  /**
483
526
  * insert layout in layout array, return a new layout array instead of updating the original
@@ -487,12 +530,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
487
530
  * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
488
531
  * @returns {EditorLayoutConfig[][]} new editor layout with insertion
489
532
  */
533
+
490
534
  var insertLayout = function insertLayout(layout, index) {
491
535
  for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
492
536
  layoutItems[_key - 2] = arguments[_key];
493
537
  }
538
+
494
539
  return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
495
540
  };
541
+
496
542
  exports.insertLayout = insertLayout;
497
543
 
498
544
  /***/ }),
@@ -559,25 +605,38 @@ __webpack_require__.r(__webpack_exports__);
559
605
  /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(49);
560
606
  /* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
561
607
 
608
+
562
609
  function ownKeys(object, enumerableOnly) {
563
610
  var keys = Object.keys(object);
611
+
564
612
  if (Object.getOwnPropertySymbols) {
565
613
  var symbols = Object.getOwnPropertySymbols(object);
566
- enumerableOnly && (symbols = symbols.filter(function (sym) {
614
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
567
615
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
568
- })), keys.push.apply(keys, symbols);
616
+ });
617
+ keys.push.apply(keys, symbols);
569
618
  }
619
+
570
620
  return keys;
571
621
  }
622
+
572
623
  function _objectSpread(target) {
573
624
  for (var i = 1; i < arguments.length; i++) {
574
- var source = null != arguments[i] ? arguments[i] : {};
575
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
576
- _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
577
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
578
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
579
- });
625
+ var source = arguments[i] != null ? arguments[i] : {};
626
+
627
+ if (i % 2) {
628
+ ownKeys(Object(source), true).forEach(function (key) {
629
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
630
+ });
631
+ } else if (Object.getOwnPropertyDescriptors) {
632
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
633
+ } else {
634
+ ownKeys(Object(source)).forEach(function (key) {
635
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
636
+ });
637
+ }
580
638
  }
639
+
581
640
  return target;
582
641
  }
583
642
 
@@ -585,6 +644,7 @@ function _objectSpread(target) {
585
644
 
586
645
 
587
646
 
647
+
588
648
  var DEFAULT_FONT = 12;
589
649
  var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
590
650
  var SVR_PADDING = {
@@ -593,28 +653,27 @@ var SVR_PADDING = {
593
653
  left: 16,
594
654
  right: 16
595
655
  };
596
-
597
656
  /**
598
657
  * @method shouldShowTrend
599
658
  * @param {String} trendDisplay
600
659
  * @returns {Bool}
601
660
  */
661
+
602
662
  var shouldShowTrend = function shouldShowTrend(trendDisplay) {
603
663
  return trendDisplay === 'absolute' || trendDisplay === 'percent';
604
664
  };
605
-
606
665
  /**
607
666
  * @method isLoadingOrNoColumns
608
667
  * @param {Object} dataSources
609
668
  * @param {Boolean} loading
610
669
  * @returns {Boolean} return true if loading or without columns in dataSources
611
670
  */
671
+
612
672
  var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
613
673
  var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
614
674
  var noColumns = data === undefined;
615
675
  return loading || noColumns;
616
676
  };
617
-
618
677
  /**
619
678
  * Retrieve the valid formatted color
620
679
  * @method getFormattedColor
@@ -622,30 +681,30 @@ var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
622
681
  * @param {String} defaultColor
623
682
  * @returns {String} the formatted color
624
683
  */
684
+
625
685
  var getFormattedColor = function getFormattedColor(color, defaultColor) {
626
686
  return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
627
687
  };
628
-
629
688
  /**
630
689
  * Determines if there is a background color
631
690
  * @method hasBackground
632
691
  * @param {String} backgroundColor
633
692
  * @returns true for non-transparent background color
634
693
  */
694
+
635
695
  var hasBackground = function hasBackground(backgroundColor) {
636
696
  return !!backgroundColor && backgroundColor !== 'transparent';
637
697
  };
638
-
639
698
  /**
640
699
  * @method isIdenticalColor
641
700
  * @param {String} colorA
642
701
  * @param {String} colorB
643
702
  * @returns {Boolean}
644
703
  */
704
+
645
705
  var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
646
706
  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());
647
707
  };
648
-
649
708
  /*
650
709
  * @method getDefaultColorWithBg
651
710
  * @param {Object} props
@@ -654,13 +713,13 @@ var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
654
713
  * @param {String} props.defaultBlockFontColor
655
714
  * @returns {String} defaultColor
656
715
  */
716
+
657
717
  var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
658
718
  var backgroundColor = _ref.backgroundColor,
659
- defaultFontColor = _ref.defaultFontColor,
660
- defaultBlockFontColor = _ref.defaultBlockFontColor;
719
+ defaultFontColor = _ref.defaultFontColor,
720
+ defaultBlockFontColor = _ref.defaultBlockFontColor;
661
721
  return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
662
722
  };
663
-
664
723
  /*
665
724
  * @method getMajorColor
666
725
  * return formatted majorColor.
@@ -671,15 +730,16 @@ var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
671
730
  * @param {String} props.defaultBlockFontColor
672
731
  * @returns {String} majorColor
673
732
  */
733
+
674
734
  var getMajorColor = function getMajorColor(_ref2) {
675
735
  var majorColor = _ref2.majorColor,
676
- backgroundColor = _ref2.backgroundColor,
677
- defaultFontColor = _ref2.defaultFontColor,
678
- defaultBlockFontColor = _ref2.defaultBlockFontColor;
679
- // If backgroundColor is set, but no majorColor,
736
+ backgroundColor = _ref2.backgroundColor,
737
+ defaultFontColor = _ref2.defaultFontColor,
738
+ defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
680
739
  // the default majorColor will turn to be defaultBlockFontColor.
681
740
  // eg: major color will turn to be white in enterprise mode.
682
741
  // however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
742
+
683
743
  if (hasBackground(backgroundColor) && !majorColor) {
684
744
  return getDefaultColorWithBg({
685
745
  backgroundColor: backgroundColor,
@@ -687,9 +747,9 @@ var getMajorColor = function getMajorColor(_ref2) {
687
747
  defaultBlockFontColor: defaultBlockFontColor
688
748
  });
689
749
  }
750
+
690
751
  return getFormattedColor(majorColor, defaultFontColor);
691
752
  };
692
-
693
753
  /**
694
754
  * Get the color for the trend components
695
755
  * @method getTrendColor
@@ -702,35 +762,41 @@ var getMajorColor = function getMajorColor(_ref2) {
702
762
  * @param {Object} defaultColors
703
763
  * @returns {String} trendColor
704
764
  */
765
+
705
766
  var getTrendColor = function getTrendColor(_ref3) {
706
767
  var trendColor = _ref3.trendColor,
707
- trendValue = _ref3.trendValue,
708
- majorValue = _ref3.majorValue,
709
- customizedBgColor = _ref3.customizedBgColor,
710
- trendDisplay = _ref3.trendDisplay,
711
- defaultColors = _ref3.defaultColors;
768
+ trendValue = _ref3.trendValue,
769
+ majorValue = _ref3.majorValue,
770
+ customizedBgColor = _ref3.customizedBgColor,
771
+ trendDisplay = _ref3.trendDisplay,
772
+ defaultColors = _ref3.defaultColors;
773
+
712
774
  if (trendColor) {
713
775
  return trendColor;
714
776
  }
777
+
715
778
  if (Number.isNaN(Number(trendValue))) {
716
779
  return undefined;
717
780
  }
781
+
718
782
  var defaultFontColor = defaultColors.defaultFontColor,
719
- defaultBlockFontColor = defaultColors.defaultBlockFontColor,
720
- defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
783
+ defaultBlockFontColor = defaultColors.defaultBlockFontColor,
784
+ defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
785
+
721
786
  if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
722
787
  return defaultBlockFontColor;
723
- }
724
-
725
- // if trendDisplay is percent, and trendValue === value
788
+ } // if trendDisplay is percent, and trendValue === value
726
789
  // the trend percent = trendValue / (value - trendValue) will return Infinity
790
+
791
+
727
792
  var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
793
+
728
794
  if (trendValue === 0 || isInvalidTrend) {
729
795
  return defaultFontColor;
730
796
  }
797
+
731
798
  return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
732
799
  };
733
-
734
800
  /**
735
801
  * Computes visualization properties for display component
736
802
  * @method computeColors
@@ -743,6 +809,7 @@ var getTrendColor = function getTrendColor(_ref3) {
743
809
  * @returns {String} trendColor
744
810
  * @returns {String} underLabelColor
745
811
  */
812
+
746
813
  var computeColors = function computeColors(props, defaultColors) {
747
814
  var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
748
815
  var backgroundEnabled = hasBackground(backgroundColor);
@@ -759,8 +826,8 @@ var computeColors = function computeColors(props, defaultColors) {
759
826
  customizedBgColor: props.backgroundColor,
760
827
  trendDisplay: props.trendDisplay,
761
828
  defaultColors: defaultColors
762
- });
763
- // todo: need change it to not depend on majorColor
829
+ }); // todo: need change it to not depend on majorColor
830
+
764
831
  var underLabelColor = majorColor;
765
832
  return {
766
833
  backgroundColor: backgroundColor,
@@ -770,7 +837,6 @@ var computeColors = function computeColors(props, defaultColors) {
770
837
  underLabelColor: underLabelColor
771
838
  };
772
839
  };
773
-
774
840
  /**
775
841
  * Format and return the value (major/trend)
776
842
  * @method computeText
@@ -781,21 +847,21 @@ var computeColors = function computeColors(props, defaultColors) {
781
847
  * @param {Bool} props.shouldAbbreviateTrendValue
782
848
  * @returns {Number} major or trend text
783
849
  */
850
+
784
851
  var computeText = function computeText(_ref4) {
785
852
  var value = _ref4.value,
786
- numberPrecision = _ref4.numberPrecision,
787
- shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
788
- shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
853
+ numberPrecision = _ref4.numberPrecision,
854
+ shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
855
+ shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
789
856
  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, {
790
857
  useThousandSeparators: shouldUseThousandSeparators,
791
858
  // todo: need update formatNumber
792
859
  useTrendUnits: shouldAbbreviateTrendValue
793
- }) : value;
794
- // When text is undefined, return empty string
860
+ }) : value; // When text is undefined, return empty string
861
+
795
862
  text = text || '';
796
863
  return text;
797
864
  };
798
-
799
865
  /*
800
866
  * @method getMajorText
801
867
  * @param {Object} props
@@ -804,10 +870,11 @@ var computeText = function computeText(_ref4) {
804
870
  * @param {Bool} props.shouldUseThousandSeparators
805
871
  * @returns {String} majorText
806
872
  */
873
+
807
874
  var getMajorText = function getMajorText(_ref5) {
808
875
  var majorValue = _ref5.majorValue,
809
- numberPrecision = _ref5.numberPrecision,
810
- shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
876
+ numberPrecision = _ref5.numberPrecision,
877
+ shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
811
878
  return computeText({
812
879
  value: majorValue === null ? 'N/A' : majorValue,
813
880
  // if majorValue is null, use `N/A`.
@@ -816,7 +883,6 @@ var getMajorText = function getMajorText(_ref5) {
816
883
  shouldAbbreviateTrendValue: false
817
884
  });
818
885
  };
819
-
820
886
  /*
821
887
  * @method getTrendText
822
888
  * @param {Object} props
@@ -828,13 +894,15 @@ var getMajorText = function getMajorText(_ref5) {
828
894
  * @param {Bool} props.shouldAbbreviateTrendValue
829
895
  * @returns {String} trendText
830
896
  */
897
+
831
898
  var getTrendText = function getTrendText(_ref6) {
832
899
  var majorValue = _ref6.majorValue,
833
- trendValue = _ref6.trendValue,
834
- trendDisplay = _ref6.trendDisplay,
835
- numberPrecision = _ref6.numberPrecision,
836
- shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
837
- shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
900
+ trendValue = _ref6.trendValue,
901
+ trendDisplay = _ref6.trendDisplay,
902
+ numberPrecision = _ref6.numberPrecision,
903
+ shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
904
+ shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
905
+
838
906
  var compute = function compute(value) {
839
907
  return computeText({
840
908
  value: value,
@@ -843,25 +911,31 @@ var getTrendText = function getTrendText(_ref6) {
843
911
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
844
912
  });
845
913
  };
914
+
846
915
  if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
847
916
  return '';
848
917
  }
918
+
849
919
  var showPercent = trendDisplay === 'percent';
920
+
850
921
  if (!showPercent) {
851
922
  return compute(trendValue);
852
923
  }
924
+
853
925
  var diff = Math.abs(trendValue - majorValue);
854
926
  var val = Math.round(trendValue / diff * 100);
927
+
855
928
  if (trendValue === 0 && diff === 0) {
856
929
  val = 0;
857
930
  }
931
+
858
932
  if (!Number.isFinite(val)) {
859
933
  return 'N/A';
860
934
  }
935
+
861
936
  var text = compute(val);
862
937
  return "".concat(text, "%");
863
938
  };
864
-
865
939
  /**
866
940
  * Helper to determine the font size for an element
867
941
  * @method computeFontSize
@@ -873,16 +947,16 @@ var getTrendText = function getTrendText(_ref6) {
873
947
  * @param {String} [fontWeight='normal'] Boldness of font
874
948
  * @returns {Number} The size to use for fontSize styles
875
949
  */
950
+
876
951
  var computeFontSize = function computeFontSize(text, _ref7) {
877
952
  var width = _ref7.width,
878
- height = _ref7.height;
953
+ height = _ref7.height;
879
954
  var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
880
955
  var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
881
956
  var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
882
957
  var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
883
958
  return parseInt(fontSize, 10);
884
959
  };
885
-
886
960
  /*
887
961
  * @method getMajorFontSize
888
962
  * @param {Object} props
@@ -893,20 +967,20 @@ var computeFontSize = function computeFontSize(text, _ref7) {
893
967
  * @param {Number} props.spaceRatio
894
968
  * @returns {Number} majorFontSize
895
969
  */
970
+
896
971
  var getMajorFontSize = function getMajorFontSize(_ref8) {
897
972
  var width = _ref8.width,
898
- height = _ref8.height,
899
- unit = _ref8.unit,
900
- majorText = _ref8.majorText,
901
- _ref8$spaceRatio = _ref8.spaceRatio,
902
- spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
973
+ height = _ref8.height,
974
+ unit = _ref8.unit,
975
+ majorText = _ref8.majorText,
976
+ _ref8$spaceRatio = _ref8.spaceRatio,
977
+ spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
903
978
  var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
904
979
  return computeFontSize(majorTextCalc, {
905
980
  width: width * spaceRatio,
906
981
  height: height
907
982
  });
908
983
  };
909
-
910
984
  /*
911
985
  * @method getTrendFontSize
912
986
  * @param {Object} props
@@ -916,13 +990,15 @@ var getMajorFontSize = function getMajorFontSize(_ref8) {
916
990
  * @param {Number} props.spaceRatio
917
991
  * @returns {Number} trendFontSize
918
992
  */
993
+
919
994
  var getTrendFontSize = function getTrendFontSize(_ref9) {
920
995
  var width = _ref9.width,
921
- height = _ref9.height,
922
- trendText = _ref9.trendText,
923
- _ref9$spaceRatio = _ref9.spaceRatio,
924
- spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
996
+ height = _ref9.height,
997
+ trendText = _ref9.trendText,
998
+ _ref9$spaceRatio = _ref9.spaceRatio,
999
+ spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
925
1000
  var trendFontSize = 12;
1001
+
926
1002
  if (spaceRatio > 0) {
927
1003
  trendFontSize = computeFontSize(trendText, {
928
1004
  width: width * spaceRatio,
@@ -930,18 +1006,18 @@ var getTrendFontSize = function getTrendFontSize(_ref9) {
930
1006
  });
931
1007
  trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
932
1008
  }
1009
+
933
1010
  return trendFontSize;
934
1011
  };
935
-
936
1012
  /*
937
1013
  * The height of underLabel should no more than 12px
938
1014
  * @param {Number} height
939
1015
  * @return {Number} height || DEFAULT_FONT
940
1016
  */
1017
+
941
1018
  var getUnderLabelHeight = function getUnderLabelHeight(height) {
942
1019
  return height > DEFAULT_FONT ? DEFAULT_FONT : height;
943
1020
  };
944
-
945
1021
  /*
946
1022
  * @param {Object} config
947
1023
  * @param {String} underLabel
@@ -949,19 +1025,18 @@ var getUnderLabelHeight = function getUnderLabelHeight(height) {
949
1025
  * @param {Number} height height of underLabel
950
1026
  * @param {Number} fond size of underLabel
951
1027
  */
1028
+
952
1029
  var getUnderLabel = function getUnderLabel(_ref10) {
953
1030
  var underLabel = _ref10.underLabel,
954
- width = _ref10.width,
955
- height = _ref10.height;
956
- return (
957
- // todo: may need truncate underLabel later
1031
+ width = _ref10.width,
1032
+ height = _ref10.height;
1033
+ return (// todo: may need truncate underLabel later
958
1034
  computeFontSize(underLabel, {
959
1035
  width: width,
960
1036
  height: height
961
1037
  })
962
1038
  );
963
1039
  };
964
-
965
1040
  /**
966
1041
  * Compute value and font size for major and trend
967
1042
  * @method getMajorAndTrend
@@ -979,18 +1054,19 @@ var getUnderLabel = function getUnderLabel(_ref10) {
979
1054
  * @param {Bool} props.shouldAbbreviateTrendValue
980
1055
  * @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
981
1056
  */
1057
+
982
1058
  var getMajorAndTrend = function getMajorAndTrend(_ref11) {
983
1059
  var width = _ref11.width,
984
- height = _ref11.height,
985
- majorValue = _ref11.majorValue,
986
- trendValue = _ref11.trendValue,
987
- majorFontSize = _ref11.majorFontSize,
988
- trendFontSize = _ref11.trendFontSize,
989
- trendDisplay = _ref11.trendDisplay,
990
- unit = _ref11.unit,
991
- numberPrecision = _ref11.numberPrecision,
992
- shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
993
- shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
1060
+ height = _ref11.height,
1061
+ majorValue = _ref11.majorValue,
1062
+ trendValue = _ref11.trendValue,
1063
+ majorFontSize = _ref11.majorFontSize,
1064
+ trendFontSize = _ref11.trendFontSize,
1065
+ trendDisplay = _ref11.trendDisplay,
1066
+ unit = _ref11.unit,
1067
+ numberPrecision = _ref11.numberPrecision,
1068
+ shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
1069
+ shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
994
1070
  var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
995
1071
  var textContentWidth = width * 0.9;
996
1072
  var textContentHeight = height * 0.9;
@@ -1027,7 +1103,6 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
1027
1103
  trendTextFontSize: trendTextFontSize
1028
1104
  };
1029
1105
  };
1030
-
1031
1106
  /*
1032
1107
  * @method updateVizInSmallSpace
1033
1108
  * @param {Object} props
@@ -1047,25 +1122,26 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
1047
1122
  * @returns {Object} results.newMajorAndTrend
1048
1123
  * @returns {Object} results.updatedProps
1049
1124
  */
1125
+
1050
1126
  var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
1051
1127
  var width = _ref12.width,
1052
- height = _ref12.height,
1053
- toRemoveList = _ref12.toRemoveList,
1054
- majorValue = _ref12.majorValue,
1055
- trendValue = _ref12.trendValue,
1056
- majorFontSize = _ref12.majorFontSize,
1057
- trendFontSize = _ref12.trendFontSize,
1058
- majorTextFontSize = _ref12.majorTextFontSize,
1059
- unit = _ref12.unit,
1060
- numberPrecision = _ref12.numberPrecision,
1061
- shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
1062
- shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
1128
+ height = _ref12.height,
1129
+ toRemoveList = _ref12.toRemoveList,
1130
+ majorValue = _ref12.majorValue,
1131
+ trendValue = _ref12.trendValue,
1132
+ majorFontSize = _ref12.majorFontSize,
1133
+ trendFontSize = _ref12.trendFontSize,
1134
+ majorTextFontSize = _ref12.majorTextFontSize,
1135
+ unit = _ref12.unit,
1136
+ numberPrecision = _ref12.numberPrecision,
1137
+ shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
1138
+ shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
1063
1139
  var removeIndex = 0;
1064
1140
  var newProps = {}; // options need to be updated
1141
+
1065
1142
  var newMajorAndTrend = {};
1066
- var newTextSize = majorTextFontSize;
1143
+ var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
1067
1144
 
1068
- // remove info on viz to make textFontSize >= 12px;
1069
1145
  while (newTextSize < 12 && removeIndex < toRemoveList.length) {
1070
1146
  var toRemove = toRemoveList[removeIndex];
1071
1147
  newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
@@ -1083,9 +1159,9 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
1083
1159
  }, newProps));
1084
1160
  newTextSize = newMajorAndTrend.majorTextFontSize;
1085
1161
  removeIndex += 1;
1086
- }
1162
+ } // truncate text if textFontSize is still less than 12
1163
+
1087
1164
 
1088
- // truncate text if textFontSize is still less than 12
1089
1165
  if (newTextSize < 12) {
1090
1166
  var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
1091
1167
  newMajorAndTrend = getMajorAndTrend(_objectSpread({
@@ -1101,12 +1177,12 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
1101
1177
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
1102
1178
  }, newProps));
1103
1179
  }
1180
+
1104
1181
  return {
1105
1182
  newMajorAndTrend: newMajorAndTrend,
1106
1183
  updatedProps: newProps
1107
1184
  };
1108
1185
  };
1109
-
1110
1186
  /*
1111
1187
  * @method computeSingleValueContent
1112
1188
  * @param {Object} props
@@ -1132,67 +1208,71 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
1132
1208
  * @returns {String} results.majorValueTitle
1133
1209
  * @returns {Object} results.smallVizProps
1134
1210
  */
1211
+
1135
1212
  var computeSingleValueContent = function computeSingleValueContent(_ref13) {
1136
1213
  var contentWidth = _ref13.contentWidth,
1137
- contentHeight = _ref13.contentHeight,
1138
- containerWidth = _ref13.containerWidth,
1139
- containerHeight = _ref13.containerHeight,
1140
- majorValue = _ref13.majorValue,
1141
- trendValue = _ref13.trendValue,
1142
- majorFontSize = _ref13.majorFontSize,
1143
- trendFontSize = _ref13.trendFontSize,
1144
- trendDisplay = _ref13.trendDisplay,
1145
- unit = _ref13.unit,
1146
- numberPrecision = _ref13.numberPrecision,
1147
- shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
1148
- shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
1149
- toRemoveList = _ref13.toRemoveList;
1214
+ contentHeight = _ref13.contentHeight,
1215
+ containerWidth = _ref13.containerWidth,
1216
+ containerHeight = _ref13.containerHeight,
1217
+ majorValue = _ref13.majorValue,
1218
+ trendValue = _ref13.trendValue,
1219
+ majorFontSize = _ref13.majorFontSize,
1220
+ trendFontSize = _ref13.trendFontSize,
1221
+ trendDisplay = _ref13.trendDisplay,
1222
+ unit = _ref13.unit,
1223
+ numberPrecision = _ref13.numberPrecision,
1224
+ shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
1225
+ shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
1226
+ toRemoveList = _ref13.toRemoveList;
1227
+
1150
1228
  var _getMajorAndTrend = getMajorAndTrend({
1229
+ majorValue: majorValue,
1230
+ trendValue: trendValue,
1231
+ majorFontSize: majorFontSize,
1232
+ trendFontSize: trendFontSize,
1233
+ trendDisplay: trendDisplay,
1234
+ width: contentWidth,
1235
+ height: contentHeight,
1236
+ unit: unit,
1237
+ numberPrecision: numberPrecision,
1238
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
1239
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
1240
+ }),
1241
+ majorText = _getMajorAndTrend.majorText,
1242
+ trendText = _getMajorAndTrend.trendText,
1243
+ majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
1244
+ trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
1245
+
1246
+ var majorValueTitle = majorText;
1247
+ var smallVizProps = {}; // update viz in small space
1248
+ // if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
1249
+ // or truncate major value to make the major font size >= 12
1250
+
1251
+ if (majorTextFontSize < 12) {
1252
+ var _updateVizInSmallSpac = updateVizInSmallSpace({
1253
+ width: containerWidth,
1254
+ height: containerHeight,
1255
+ toRemoveList: toRemoveList,
1151
1256
  majorValue: majorValue,
1152
1257
  trendValue: trendValue,
1153
1258
  majorFontSize: majorFontSize,
1154
1259
  trendFontSize: trendFontSize,
1155
- trendDisplay: trendDisplay,
1156
- width: contentWidth,
1157
- height: contentHeight,
1260
+ majorTextFontSize: majorTextFontSize,
1158
1261
  unit: unit,
1159
1262
  numberPrecision: numberPrecision,
1160
1263
  shouldUseThousandSeparators: shouldUseThousandSeparators,
1161
1264
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
1162
1265
  }),
1163
- majorText = _getMajorAndTrend.majorText,
1164
- trendText = _getMajorAndTrend.trendText,
1165
- majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
1166
- trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
1167
- var majorValueTitle = majorText;
1168
- var smallVizProps = {};
1266
+ newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
1267
+ updatedProps = _updateVizInSmallSpac.updatedProps;
1169
1268
 
1170
- // update viz in small space
1171
- // if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
1172
- // or truncate major value to make the major font size >= 12
1173
- if (majorTextFontSize < 12) {
1174
- var _updateVizInSmallSpac = updateVizInSmallSpace({
1175
- width: containerWidth,
1176
- height: containerHeight,
1177
- toRemoveList: toRemoveList,
1178
- majorValue: majorValue,
1179
- trendValue: trendValue,
1180
- majorFontSize: majorFontSize,
1181
- trendFontSize: trendFontSize,
1182
- majorTextFontSize: majorTextFontSize,
1183
- unit: unit,
1184
- numberPrecision: numberPrecision,
1185
- shouldUseThousandSeparators: shouldUseThousandSeparators,
1186
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
1187
- }),
1188
- newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
1189
- updatedProps = _updateVizInSmallSpac.updatedProps;
1190
1269
  majorText = newMajorAndTrend.majorText;
1191
1270
  trendText = newMajorAndTrend.trendText;
1192
1271
  majorTextFontSize = newMajorAndTrend.majorTextFontSize;
1193
1272
  trendTextFontSize = newMajorAndTrend.trendTextFontSize;
1194
1273
  smallVizProps = updatedProps;
1195
1274
  }
1275
+
1196
1276
  return {
1197
1277
  majorText: majorText,
1198
1278
  trendText: trendText,
@@ -1204,17 +1284,17 @@ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
1204
1284
  };
1205
1285
  var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
1206
1286
  var text = _ref14.text,
1207
- _ref14$fontSize = _ref14.fontSize,
1208
- fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
1209
- _ref14$fontFamily = _ref14.fontFamily,
1210
- fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
1211
- _ref14$fontWeight = _ref14.fontWeight,
1212
- fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
1213
- containerWidth = _ref14.containerWidth;
1287
+ _ref14$fontSize = _ref14.fontSize,
1288
+ fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
1289
+ _ref14$fontFamily = _ref14.fontFamily,
1290
+ fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
1291
+ _ref14$fontWeight = _ref14.fontWeight,
1292
+ fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
1293
+ containerWidth = _ref14.containerWidth;
1214
1294
  var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
1215
1295
  var modifiedText = text;
1216
- var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
1217
- // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.
1296
+ 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.
1297
+
1218
1298
  if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
1219
1299
  // Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
1220
1300
  // `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
@@ -1223,11 +1303,12 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
1223
1303
  modifiedText = modifiedText.substring(0, modifiedText.length - 1);
1224
1304
  textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
1225
1305
  }
1306
+
1226
1307
  modifiedText = "".concat(modifiedText, "...");
1227
1308
  }
1309
+
1228
1310
  return modifiedText;
1229
1311
  };
1230
-
1231
1312
  /*
1232
1313
  * @method computeSingleValueRadialContent
1233
1314
  * @param {Object} props
@@ -1254,44 +1335,46 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
1254
1335
  * @returns {String} results.majorValueTitle
1255
1336
  * @returns {Object} results.smallVizProps
1256
1337
  */
1338
+
1257
1339
  var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
1258
1340
  var contentWidth = _ref15.contentWidth,
1259
- contentHeight = _ref15.contentHeight,
1260
- containerWidth = _ref15.containerWidth,
1261
- containerHeight = _ref15.containerHeight,
1262
- majorValue = _ref15.majorValue,
1263
- trendValue = _ref15.trendValue,
1264
- majorFontSize = _ref15.majorFontSize,
1265
- trendFontSize = _ref15.trendFontSize,
1266
- trendDisplay = _ref15.trendDisplay,
1267
- unit = _ref15.unit,
1268
- numberPrecision = _ref15.numberPrecision,
1269
- shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
1270
- shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
1271
- smallViz = _ref15.smallViz;
1341
+ contentHeight = _ref15.contentHeight,
1342
+ containerWidth = _ref15.containerWidth,
1343
+ containerHeight = _ref15.containerHeight,
1344
+ majorValue = _ref15.majorValue,
1345
+ trendValue = _ref15.trendValue,
1346
+ majorFontSize = _ref15.majorFontSize,
1347
+ trendFontSize = _ref15.trendFontSize,
1348
+ trendDisplay = _ref15.trendDisplay,
1349
+ unit = _ref15.unit,
1350
+ numberPrecision = _ref15.numberPrecision,
1351
+ shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
1352
+ shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
1353
+ smallViz = _ref15.smallViz;
1354
+
1272
1355
  var _getMajorAndTrend2 = getMajorAndTrend({
1273
- majorValue: majorValue,
1274
- trendValue: trendValue,
1275
- majorFontSize: majorFontSize,
1276
- trendFontSize: trendFontSize,
1277
- trendDisplay: trendDisplay,
1278
- width: contentWidth,
1279
- height: contentHeight,
1280
- unit: unit,
1281
- numberPrecision: numberPrecision,
1282
- shouldUseThousandSeparators: shouldUseThousandSeparators,
1283
- shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
1284
- }),
1285
- majorText = _getMajorAndTrend2.majorText,
1286
- trendText = _getMajorAndTrend2.trendText,
1287
- majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
1288
- trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
1289
- var majorValueTitle = majorText;
1290
- var smallVizProps = {};
1356
+ majorValue: majorValue,
1357
+ trendValue: trendValue,
1358
+ majorFontSize: majorFontSize,
1359
+ trendFontSize: trendFontSize,
1360
+ trendDisplay: trendDisplay,
1361
+ width: contentWidth,
1362
+ height: contentHeight,
1363
+ unit: unit,
1364
+ numberPrecision: numberPrecision,
1365
+ shouldUseThousandSeparators: shouldUseThousandSeparators,
1366
+ shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
1367
+ }),
1368
+ majorText = _getMajorAndTrend2.majorText,
1369
+ trendText = _getMajorAndTrend2.trendText,
1370
+ majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
1371
+ trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
1291
1372
 
1292
- // custom logic for viz in small space
1373
+ var majorValueTitle = majorText;
1374
+ var smallVizProps = {}; // custom logic for viz in small space
1293
1375
  // if not showing the radial graph (if `smallViz` is true), then compute truncated major value
1294
1376
  // and font sizes
1377
+
1295
1378
  if (smallViz) {
1296
1379
  var truncateValue = minimallyTruncateStringToWidth({
1297
1380
  text: majorValue,
@@ -1299,6 +1382,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
1299
1382
  fontSize: 12,
1300
1383
  containerWidth: containerWidth
1301
1384
  });
1385
+
1302
1386
  var _getMajorAndTrend3 = getMajorAndTrend({
1303
1387
  majorValue: truncateValue,
1304
1388
  trendValue: trendValue,
@@ -1312,6 +1396,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
1312
1396
  shouldUseThousandSeparators: shouldUseThousandSeparators,
1313
1397
  shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
1314
1398
  });
1399
+
1315
1400
  majorText = _getMajorAndTrend3.majorText;
1316
1401
  trendText = _getMajorAndTrend3.trendText;
1317
1402
  majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
@@ -1321,6 +1406,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
1321
1406
  unit: unit
1322
1407
  };
1323
1408
  }
1409
+
1324
1410
  return {
1325
1411
  majorText: majorText,
1326
1412
  trendText: trendText,
@@ -1330,7 +1416,6 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
1330
1416
  smallVizProps: smallVizProps
1331
1417
  };
1332
1418
  };
1333
-
1334
1419
  /**
1335
1420
  * Get the colors for a graph
1336
1421
  *
@@ -1343,21 +1428,22 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
1343
1428
  * @returns {Object} { background, stroke } colors
1344
1429
  * @private
1345
1430
  */
1431
+
1346
1432
  var getGraphColors = function getGraphColors(_ref16) {
1347
1433
  var backgroundEnabled = _ref16.backgroundEnabled,
1348
- backgroundColor = _ref16.backgroundColor,
1349
- defaultColors = _ref16.defaultColors,
1350
- customColorFormatter = _ref16.customColorFormatter;
1351
- // Only do custom colors in block mode
1434
+ backgroundColor = _ref16.backgroundColor,
1435
+ defaultColors = _ref16.defaultColors,
1436
+ customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
1437
+
1352
1438
  if (backgroundEnabled) {
1353
1439
  // Check if the user defined colors to use
1354
1440
  if (backgroundColor && typeof customColorFormatter === 'function') {
1355
1441
  return customColorFormatter(backgroundColor);
1356
1442
  }
1357
1443
  }
1444
+
1358
1445
  return defaultColors.none;
1359
1446
  };
1360
-
1361
1447
  /**
1362
1448
  * Adjust rgb value if it equals to 0 or 255
1363
1449
  * @method adjustRGB
@@ -1366,16 +1452,18 @@ var getGraphColors = function getGraphColors(_ref16) {
1366
1452
  * @returns {Number} adjusted rgb
1367
1453
  * @private
1368
1454
  */
1455
+
1369
1456
  var adjustRGB = function adjustRGB(rgb, delta) {
1370
1457
  if (rgb === 255) {
1371
1458
  return rgb - delta;
1372
1459
  }
1460
+
1373
1461
  if (rgb === 0) {
1374
1462
  return rgb + delta;
1375
1463
  }
1464
+
1376
1465
  return rgb;
1377
1466
  };
1378
-
1379
1467
  /**
1380
1468
  * Modifies colors by multiplying by a given ratio
1381
1469
  * @method changeColor
@@ -1384,18 +1472,16 @@ var adjustRGB = function adjustRGB(rgb, delta) {
1384
1472
  * @returns {String} new color
1385
1473
  * @private
1386
1474
  */
1475
+
1387
1476
  var changeColor = function changeColor(color, ratio) {
1388
1477
  var hex = color.replace(/(0x|#)/, '');
1389
1478
  var r = parseInt(hex.substr(0, 2), 16);
1390
1479
  var g = parseInt(hex.substr(2, 2), 16);
1391
- var b = parseInt(hex.substr(4, 2), 16);
1480
+ var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
1392
1481
 
1393
- // Multiply by given ratio, make sure is between 0 and 255;
1394
1482
  var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
1395
1483
  var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
1396
- var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);
1397
-
1398
- // If the color is not changed
1484
+ var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
1399
1485
  // case 1: the color is (0, 0 0)
1400
1486
  // lighten color (80, 80, 80)
1401
1487
  // darken color (40, 40, 40)
@@ -1404,6 +1490,7 @@ var changeColor = function changeColor(color, ratio) {
1404
1490
  // darken color (175, 175, 175)
1405
1491
  // case 3: the color is e.g. (0, 255, 0)
1406
1492
  // new color (20, 235, 20)
1493
+
1407
1494
  if (newR === r && newG === g && newB === b) {
1408
1495
  if (newR === 0 && newG === 0 && newB === 0) {
1409
1496
  if (ratio > 1) {
@@ -1431,9 +1518,9 @@ var changeColor = function changeColor(color, ratio) {
1431
1518
  newB = adjustRGB(newB, 20);
1432
1519
  }
1433
1520
  }
1521
+
1434
1522
  return "#".concat(newR.toString(16).padStart(2, 0)) + "".concat(newG.toString(16).padStart(2, 0)) + "".concat(newB.toString(16).padStart(2, 0));
1435
1523
  };
1436
-
1437
1524
  /**
1438
1525
  * Lighten a given color
1439
1526
  * @method lighten
@@ -1441,10 +1528,11 @@ var changeColor = function changeColor(color, ratio) {
1441
1528
  * @returns {String}
1442
1529
  * @private
1443
1530
  */
1531
+
1532
+
1444
1533
  var lighten = function lighten(color) {
1445
1534
  return changeColor(color, 1.3);
1446
1535
  };
1447
-
1448
1536
  /**
1449
1537
  * Darkens a given color
1450
1538
  * @method darken
@@ -1452,10 +1540,10 @@ var lighten = function lighten(color) {
1452
1540
  * @returns {String}
1453
1541
  * @private
1454
1542
  */
1543
+
1455
1544
  var darken = function darken(color) {
1456
1545
  return changeColor(color, 0.5);
1457
1546
  };
1458
-
1459
1547
  /** consistent token structure: handle callback to add value and name in event payload
1460
1548
  * @method handleValueClickCallback
1461
1549
  * @param {Object} ev
@@ -1464,6 +1552,7 @@ var darken = function darken(color) {
1464
1552
  * @param {Number} trendValue
1465
1553
  * @param {Function} onValueClick
1466
1554
  */
1555
+
1467
1556
  var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
1468
1557
  var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
1469
1558
  var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
@@ -1473,12 +1562,14 @@ var handleValueClickCallback = function handleValueClickCallback(ev, majorValue,
1473
1562
  value: majorValue,
1474
1563
  name: majorValueField
1475
1564
  };
1565
+
1476
1566
  if (trellisEnabled) {
1477
1567
  payload = _objectSpread(_objectSpread({}, payload), {}, {
1478
1568
  'trellis.name': trellisSplityBy,
1479
1569
  'trellis.value': trellisKey
1480
1570
  });
1481
1571
  }
1572
+
1482
1573
  return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
1483
1574
  payload: payload
1484
1575
  }));
@@ -1552,11 +1643,17 @@ Object.defineProperty(exports, "__esModule", {
1552
1643
  value: true
1553
1644
  });
1554
1645
  exports.shouldShowIconPlaceholder = void 0;
1646
+
1555
1647
  var React = __webpack_require__(1);
1648
+
1556
1649
  var T = __webpack_require__(0);
1650
+
1557
1651
  var lodash_1 = __webpack_require__(3);
1652
+
1558
1653
  var i18n_1 = __webpack_require__(2);
1654
+
1559
1655
  var Message_1 = __webpack_require__(10);
1656
+
1560
1657
  var FixedSizeContainer_1 = __webpack_require__(13);
1561
1658
  /**
1562
1659
  * @method shouldShowIconPlaceholder
@@ -1564,6 +1661,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
1564
1661
  * @param {boolean} loading
1565
1662
  * @returns {boolean}
1566
1663
  */
1664
+
1665
+
1567
1666
  var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
1568
1667
  var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1569
1668
  var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
@@ -1572,6 +1671,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
1572
1671
  var noFields = fields === undefined;
1573
1672
  return loading || noData || noFields;
1574
1673
  };
1674
+
1575
1675
  exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
1576
1676
  var propTypes = {
1577
1677
  icon: T.func,
@@ -1586,11 +1686,13 @@ var propTypes = {
1586
1686
  * @param {IconPlaceholderProps} props
1587
1687
  * @returns {React.ReactElement}
1588
1688
  */
1689
+
1589
1690
  var IconPlaceholder = function IconPlaceholder(props) {
1590
1691
  var width = props.width,
1591
- height = props.height,
1592
- icon = props.icon,
1593
- iconColor = props.iconColor;
1692
+ height = props.height,
1693
+ icon = props.icon,
1694
+ iconColor = props.iconColor;
1695
+
1594
1696
  if (icon) {
1595
1697
  return React.createElement(icon, {
1596
1698
  style: {
@@ -1605,6 +1707,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
1605
1707
  height: '50%'
1606
1708
  });
1607
1709
  }
1710
+
1608
1711
  return React.createElement(Message_1.default, {
1609
1712
  width: width,
1610
1713
  height: height,
@@ -1612,6 +1715,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
1612
1715
  message: (0, i18n_1._)('No DataSource Connected')
1613
1716
  });
1614
1717
  };
1718
+
1615
1719
  IconPlaceholder.propTypes = propTypes;
1616
1720
  IconPlaceholder.defaultProps = {
1617
1721
  width: '100%',
@@ -1628,21 +1732,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
1628
1732
 
1629
1733
 
1630
1734
  var _defineProperty = __webpack_require__(7);
1735
+
1631
1736
  Object.defineProperty(exports, "__esModule", {
1632
1737
  value: true
1633
1738
  });
1634
1739
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1740
+
1635
1741
  var T = __webpack_require__(0);
1742
+
1636
1743
  var lodash_1 = __webpack_require__(3);
1637
- var DataSource_1 = __webpack_require__(43);
1744
+
1745
+ var DataSource_1 = __webpack_require__(34);
1746
+
1638
1747
  exports.SortParamsPropTypes = T.shape({
1639
1748
  currentSortKey: T.string,
1640
1749
  currentSortDir: T.oneOf(DataSource_1.validSortDirs),
1641
1750
  onSort: T.func
1642
1751
  });
1752
+
1643
1753
  var getSortingParams = function getSortingParams(_ref) {
1644
1754
  var requestParams = _ref.requestParams,
1645
- onRequestParamsChange = _ref.onRequestParamsChange;
1755
+ onRequestParamsChange = _ref.onRequestParamsChange;
1646
1756
  var currentSortKey;
1647
1757
  var currentSortDir;
1648
1758
  var nextSortDirMap = {
@@ -1651,15 +1761,18 @@ var getSortingParams = function getSortingParams(_ref) {
1651
1761
  none: 'asc'
1652
1762
  };
1653
1763
  var onSort;
1764
+
1654
1765
  if (typeof onRequestParamsChange === 'function') {
1655
1766
  if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
1656
1767
  currentSortKey = Object.keys(requestParams.sort).shift();
1657
1768
  currentSortDir = requestParams.sort[currentSortKey];
1658
- }
1659
- // undid memoization since there is a dependency on requestParams, which is a deeply nested object
1769
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
1770
+
1771
+
1660
1772
  onSort = function onSort(e, _ref2) {
1661
1773
  var sortKey = _ref2.sortKey,
1662
- sortDir = _ref2.sortDir;
1774
+ sortDir = _ref2.sortDir;
1775
+
1663
1776
  if (typeof sortKey === 'string') {
1664
1777
  var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
1665
1778
  onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
@@ -1671,12 +1784,14 @@ var getSortingParams = function getSortingParams(_ref) {
1671
1784
  }
1672
1785
  };
1673
1786
  }
1787
+
1674
1788
  return {
1675
1789
  currentSortKey: currentSortKey,
1676
1790
  currentSortDir: currentSortDir,
1677
1791
  onSort: onSort
1678
1792
  };
1679
1793
  };
1794
+
1680
1795
  exports.getSortingParams = getSortingParams;
1681
1796
 
1682
1797
  /***/ }),
@@ -1687,43 +1802,69 @@ exports.getSortingParams = getSortingParams;
1687
1802
  "use strict";
1688
1803
 
1689
1804
 
1805
+ Object.defineProperty(exports, "__esModule", {
1806
+ value: true
1807
+ });
1808
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
1809
+ exports.validSortDirs = ['asc', 'desc', 'none'];
1810
+ exports.validSegmentationModes = ['none', 'inner'];
1811
+ exports.validOutputModes = ['json_cols', 'json'];
1812
+
1813
+ /***/ }),
1814
+
1815
+ /***/ 35:
1816
+ /***/ (function(module, exports, __webpack_require__) {
1817
+
1818
+ "use strict";
1819
+
1820
+
1690
1821
  Object.defineProperty(exports, "__esModule", {
1691
1822
  value: true
1692
1823
  });
1693
1824
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1825
+
1694
1826
  var T = __webpack_require__(0);
1827
+
1695
1828
  var lodash_1 = __webpack_require__(3);
1829
+
1696
1830
  exports.PaginatorParamsPropTypes = T.shape({
1697
1831
  isPaging: T.bool,
1698
1832
  current: T.number,
1699
1833
  totalPages: T.number,
1700
1834
  onChange: T.func
1701
1835
  });
1836
+
1702
1837
  var getPaginationParams = function getPaginationParams(_ref) {
1703
1838
  var requestParams = _ref.requestParams,
1704
- meta = _ref.meta,
1705
- onRequestParamsChange = _ref.onRequestParamsChange;
1839
+ meta = _ref.meta,
1840
+ onRequestParamsChange = _ref.onRequestParamsChange;
1706
1841
  var totalCount = meta && meta.totalCount || 0;
1707
1842
  var offset = requestParams && requestParams.offset || 0;
1708
1843
  var count = requestParams && requestParams.count;
1709
1844
  var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
1710
1845
  var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
1711
1846
  var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
1847
+
1712
1848
  var onChangeHandler = function onChangeHandler(e, _ref2) {
1713
1849
  var page = _ref2.page,
1714
- countArg = _ref2.count;
1850
+ countArg = _ref2.count;
1715
1851
  var newParams = (0, lodash_1.cloneDeep)(requestParams);
1852
+
1716
1853
  if (typeof countArg === 'number') {
1717
1854
  newParams.count = countArg;
1718
1855
  newParams.offset = 0;
1719
1856
  }
1857
+
1720
1858
  var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
1859
+
1721
1860
  if (typeof page === 'number' && page > 0) {
1722
1861
  newParams.count = pageCount;
1723
1862
  newParams.offset = (page - 1) * pageCount;
1724
1863
  }
1864
+
1725
1865
  onRequestParamsChange(newParams);
1726
1866
  };
1867
+
1727
1868
  return {
1728
1869
  isPaging: isPaging,
1729
1870
  current: current,
@@ -1731,11 +1872,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
1731
1872
  onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
1732
1873
  };
1733
1874
  };
1875
+
1734
1876
  exports.getPaginationParams = getPaginationParams;
1735
1877
 
1736
1878
  /***/ }),
1737
1879
 
1738
- /***/ 35:
1880
+ /***/ 36:
1739
1881
  /***/ (function(module, exports, __webpack_require__) {
1740
1882
 
1741
1883
  "use strict";
@@ -1746,6 +1888,7 @@ Object.defineProperty(exports, "__esModule", {
1746
1888
  });
1747
1889
  exports.VizCategory = void 0;
1748
1890
  var VizCategory;
1891
+
1749
1892
  (function (VizCategory) {
1750
1893
  VizCategory["SINGLE_VALUE"] = "Single Value";
1751
1894
  VizCategory["TRENDS"] = "Trends";
@@ -1763,67 +1906,96 @@ var VizCategory;
1763
1906
 
1764
1907
  /***/ }),
1765
1908
 
1766
- /***/ 36:
1909
+ /***/ 37:
1767
1910
  /***/ (function(module, exports, __webpack_require__) {
1768
1911
 
1769
1912
  "use strict";
1770
1913
 
1771
1914
 
1772
1915
  var _slicedToArray = __webpack_require__(17);
1916
+
1773
1917
  Object.defineProperty(exports, "__esModule", {
1774
1918
  value: true
1775
1919
  });
1920
+
1776
1921
  var React = __webpack_require__(1);
1922
+
1777
1923
  var lodash_1 = __webpack_require__(3);
1778
- var getSettingsFromThemedProps_1 = __webpack_require__(37);
1924
+
1925
+ var getSettingsFromThemedProps_1 = __webpack_require__(38);
1926
+
1779
1927
  var Options_1 = __webpack_require__(30);
1780
- var SanitizeProps_1 = __webpack_require__(38);
1928
+
1929
+ var SanitizeProps_1 = __webpack_require__(39);
1930
+
1781
1931
  var TimezoneContext_1 = __webpack_require__(26);
1782
- var moment_1 = __webpack_require__(39);
1932
+
1933
+ var moment_1 = __webpack_require__(40);
1934
+
1783
1935
  var FeatureFlagContext_1 = __webpack_require__(21);
1936
+
1784
1937
  var styled_components_1 = __webpack_require__(4);
1938
+
1785
1939
  var hocUtils_1 = __webpack_require__(27);
1940
+
1786
1941
  var JSONSchemaUtils_1 = __webpack_require__(28);
1787
- var async_dynamic_options_evaluator_1 = __webpack_require__(40);
1942
+
1943
+ var async_dynamic_options_evaluator_1 = __webpack_require__(41);
1944
+
1788
1945
  var id_1 = __webpack_require__(25);
1789
- var SplunkVisualization_1 = __webpack_require__(41);
1946
+
1947
+ var SplunkVisualization_1 = __webpack_require__(42);
1948
+
1790
1949
  var VizBehavior_1 = __webpack_require__(6);
1950
+
1791
1951
  var getSorting_1 = __webpack_require__(33);
1792
- var getPagination_1 = __webpack_require__(34);
1952
+
1953
+ var getPagination_1 = __webpack_require__(35);
1954
+
1793
1955
  var useDeepMemo_1 = __webpack_require__(44);
1956
+
1794
1957
  var MissingPropsMessage_1 = __webpack_require__(45);
1958
+
1795
1959
  var withEditModeCover_1 = __webpack_require__(46);
1960
+
1796
1961
  var withPlaceholder_1 = __webpack_require__(47);
1797
1962
  /**
1798
1963
  * hoc that wraps a pure react visualization in a Dashboard visualization
1799
1964
  * @param {DashboardVizOpts} opts
1800
1965
  * @returns {HOC}
1801
1966
  */
1967
+
1968
+
1802
1969
  var withDashboardViz = function withDashboardViz(opts) {
1803
1970
  var ReactViz = opts.ReactViz,
1804
- vizConfig = opts.vizConfig,
1805
- _opts$computeVizProps = opts.computeVizProps,
1806
- computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
1807
- disableEditModeCover = opts.disableEditModeCover,
1808
- useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
1971
+ vizConfig = opts.vizConfig,
1972
+ _opts$computeVizProps = opts.computeVizProps,
1973
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
1974
+ disableEditModeCover = opts.disableEditModeCover,
1975
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
1976
+
1809
1977
  var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
1810
1978
  var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
1979
+
1811
1980
  var DashboardViz = function DashboardViz(props) {
1812
1981
  var _a;
1982
+
1813
1983
  var mode = props.mode,
1814
- hasEventHandlers = props.hasEventHandlers,
1815
- dataSources = props.dataSources,
1816
- options = props.options,
1817
- _props$context = props.context,
1818
- context = _props$context === void 0 ? {} : _props$context,
1819
- width = props.width,
1820
- height = props.height,
1821
- onComputedProps = props.onComputedProps,
1822
- onEventTrigger = props.onEventTrigger,
1823
- theme = props.theme,
1824
- onRequestParamsChange = props.onRequestParamsChange;
1984
+ hasEventHandlers = props.hasEventHandlers,
1985
+ dataSources = props.dataSources,
1986
+ options = props.options,
1987
+ _props$context = props.context,
1988
+ context = _props$context === void 0 ? {} : _props$context,
1989
+ width = props.width,
1990
+ height = props.height,
1991
+ onComputedProps = props.onComputedProps,
1992
+ onEventTrigger = props.onEventTrigger,
1993
+ theme = props.theme,
1994
+ onRequestParamsChange = props.onRequestParamsChange;
1995
+
1825
1996
  var _React$useContext = React.useContext(TimezoneContext_1.default),
1826
- serializedTimezone = _React$useContext.serializedTimezone;
1997
+ serializedTimezone = _React$useContext.serializedTimezone;
1998
+
1827
1999
  if (serializedTimezone) {
1828
2000
  /*
1829
2001
  @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
@@ -1837,38 +2009,51 @@ var withDashboardViz = function withDashboardViz(opts) {
1837
2009
  moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
1838
2010
  }
1839
2011
  }
2012
+
1840
2013
  var themeFunc = function themeFunc(themeVar) {
1841
2014
  var _a, _b;
2015
+
1842
2016
  return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
1843
2017
  };
2018
+
1844
2019
  var bgColorFromTheme = themeFunc('defaultBackgroundColor');
2020
+
1845
2021
  var _ref = (0, getSettingsFromThemedProps_1.default)({
1846
- theme: theme
1847
- }),
1848
- currentThemeFamily = _ref.family,
1849
- currentThemeColorScheme = _ref.colorScheme,
1850
- currentThemeDensity = _ref.density;
2022
+ theme: theme
2023
+ }),
2024
+ currentThemeFamily = _ref.family,
2025
+ currentThemeColorScheme = _ref.colorScheme,
2026
+ currentThemeDensity = _ref.density;
2027
+
1851
2028
  var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
2029
+
1852
2030
  var _React$useState = React.useState({}),
1853
- _React$useState2 = _slicedToArray(_React$useState, 2),
1854
- evaluatedOptionsAsync = _React$useState2[0],
1855
- setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
2031
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2032
+ evaluatedOptionsAsync = _React$useState2[0],
2033
+ setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
2034
+
2035
+
1856
2036
  var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
2037
+
1857
2038
  var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
1858
- _React$useState4 = _slicedToArray(_React$useState3, 1),
1859
- visualizationID = _React$useState4[0];
2039
+ _React$useState4 = _slicedToArray(_React$useState3, 1),
2040
+ visualizationID = _React$useState4[0];
2041
+
1860
2042
  var _React$useState5 = React.useState({}),
1861
- _React$useState6 = _slicedToArray(_React$useState5, 2),
1862
- dataSourcesInState = _React$useState6[0],
1863
- setDataSourcesInState = _React$useState6[1];
2043
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
2044
+ dataSourcesInState = _React$useState6[0],
2045
+ setDataSourcesInState = _React$useState6[1];
2046
+
1864
2047
  var _React$useState7 = React.useState(),
1865
- _React$useState8 = _slicedToArray(_React$useState7, 2),
1866
- dataFramesInState = _React$useState8[0],
1867
- setDataFramesInState = _React$useState8[1];
2048
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
2049
+ dataFramesInState = _React$useState8[0],
2050
+ setDataFramesInState = _React$useState8[1];
2051
+
1868
2052
  var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
1869
- _React$useState10 = _slicedToArray(_React$useState9, 2),
1870
- useAsyncEvaluatedOptions = _React$useState10[0],
1871
- setUseAsyncEvaluatedOptions = _React$useState10[1];
2053
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
2054
+ useAsyncEvaluatedOptions = _React$useState10[0],
2055
+ setUseAsyncEvaluatedOptions = _React$useState10[1];
2056
+
1872
2057
  var isMounted = React.useRef(true);
1873
2058
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
1874
2059
  try {
@@ -1893,11 +2078,13 @@ var withDashboardViz = function withDashboardViz(opts) {
1893
2078
  });
1894
2079
  } else {
1895
2080
  var dataFrames = dataFramesInState;
2081
+
1896
2082
  if (dataSources !== dataSourcesInState) {
1897
2083
  setDataSourcesInState(dataSources);
1898
2084
  dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
1899
2085
  setDataFramesInState(dataFrames);
1900
2086
  }
2087
+
1901
2088
  return Options_1.Options.evaluate({
1902
2089
  context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1903
2090
  options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
@@ -1908,21 +2095,24 @@ var withDashboardViz = function withDashboardViz(opts) {
1908
2095
  console.error("unexpected error evaluating options: ".concat(e.message));
1909
2096
  return {};
1910
2097
  }
2098
+
1911
2099
  return {};
1912
2100
  }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1913
- var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
1914
- // trellis specific backgroundColor update for onComputedProps
2101
+ var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
1915
2102
  // 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
1916
2103
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
2104
+
1917
2105
  var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
1918
2106
  var clonedEvaluatedOptions = evaluatedOptionsToUse;
2107
+
1919
2108
  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) {
1920
2109
  clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
1921
2110
  backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
1922
2111
  });
1923
- }
1924
- // useEffect hook needs to be initialized before any early returns
2112
+ } // useEffect hook needs to be initialized before any early returns
1925
2113
  // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
2114
+
2115
+
1926
2116
  React.useEffect(function () {
1927
2117
  onComputedProps(clonedEvaluatedOptions);
1928
2118
  });
@@ -1932,44 +2122,49 @@ var withDashboardViz = function withDashboardViz(opts) {
1932
2122
  isMounted.current = false;
1933
2123
  async_dynamic_options_evaluator_1.default.reset(visualizationID);
1934
2124
  }
1935
- };
1936
- // eslint-disable-next-line react-hooks/exhaustive-deps
1937
- }, []);
1938
- // present warning message if any required props are missing
2125
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
2126
+ }, []); // present warning message if any required props are missing
2127
+
1939
2128
  var _vizConfig$requiredPr = vizConfig.requiredProps,
1940
- requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1941
- supports = vizConfig.supports;
2129
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
2130
+ supports = vizConfig.supports;
1942
2131
  var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
2132
+
1943
2133
  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
1944
2134
  ) {
1945
- return React.createElement(MissingPropsMessage_1.default, {
1946
- "data-test": "missing-props-message",
1947
- width: width,
1948
- height: height,
1949
- missingProps: missing,
1950
- backgroundColor: bgColorFromTheme
1951
- });
1952
- }
1953
- // events
2135
+ return React.createElement(MissingPropsMessage_1.default, {
2136
+ "data-test": "missing-props-message",
2137
+ width: width,
2138
+ height: height,
2139
+ missingProps: missing,
2140
+ backgroundColor: bgColorFromTheme
2141
+ });
2142
+ } // events
2143
+
2144
+
1954
2145
  var eventCallbackProps = {};
2146
+
1955
2147
  if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
1956
2148
  var supportedEvents = vizConfig.events;
1957
2149
  Object.keys(supportedEvents).forEach(function (eventName) {
1958
2150
  var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
1959
- eventCallbackProps[eventCallbackPropName] = null;
1960
- // todo: refactor single value and single value icon to send payload from viz
2151
+ eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
1961
2152
  // then remove these lines
2153
+
1962
2154
  var payloadKeys = supportedEvents[eventName].payloadKeys;
1963
2155
  var payload = {};
2156
+
1964
2157
  if (Array.isArray(payloadKeys) && payloadKeys.length) {
1965
2158
  payloadKeys.forEach(function (p) {
1966
2159
  payload[p] = evaluatedOptionsToUse[p];
1967
2160
  });
1968
2161
  }
2162
+
1969
2163
  eventCallbackProps[eventCallbackPropName] = function (ev) {
1970
2164
  if (ev && ev.payload) {
1971
2165
  payload = ev.payload;
1972
2166
  }
2167
+
1973
2168
  return onEventTrigger({
1974
2169
  originalEvent: ev,
1975
2170
  payload: payload,
@@ -1977,8 +2172,9 @@ var withDashboardViz = function withDashboardViz(opts) {
1977
2172
  });
1978
2173
  };
1979
2174
  });
1980
- }
1981
- // compute pure viz props which are not from options
2175
+ } // compute pure viz props which are not from options
2176
+
2177
+
1982
2178
  var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
1983
2179
  themeFunc: themeFunc
1984
2180
  }));
@@ -1996,15 +2192,19 @@ var withDashboardViz = function withDashboardViz(opts) {
1996
2192
  * In future, we could automatically detect which all datasources are being used
1997
2193
  * and bind those magically to pagination/sorting behavior.
1998
2194
  */
2195
+
1999
2196
  var dataSourceMetadata = {};
2000
2197
  var OptionKey = 'paginateDataSourceKey';
2001
2198
  var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
2199
+
2002
2200
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
2003
2201
  var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
2004
2202
  var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
2203
+
2005
2204
  var handleRequestParamsChange = function handleRequestParamsChange(payload) {
2006
2205
  return onRequestParamsChange(paginateDataSourceKey, payload);
2007
2206
  };
2207
+
2008
2208
  var sortParams = (0, getSorting_1.getSortingParams)({
2009
2209
  requestParams: requestParams,
2010
2210
  meta: meta,
@@ -2019,115 +2219,132 @@ var withDashboardViz = function withDashboardViz(opts) {
2019
2219
  sortParams: sortParams,
2020
2220
  paginatorParams: paginatorParams
2021
2221
  };
2022
- }
2023
- // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
2222
+ } // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
2223
+
2224
+
2024
2225
  if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
2025
2226
  return null;
2026
2227
  }
2228
+
2027
2229
  return React.createElement(SanitizedReactViz, Object.assign({
2028
2230
  mode: mode,
2029
2231
  width: width,
2030
2232
  height: height
2031
2233
  }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
2032
2234
  };
2235
+
2033
2236
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
2034
2237
  DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
2035
2238
  // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
2036
2239
  theme: {}
2037
- });
2038
- // attach viz config
2039
- DashboardViz.config = vizConfig;
2040
- // @ts-ignore: TODO fix sc upgrade TS issues
2240
+ }); // attach viz config
2241
+
2242
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
2243
+
2041
2244
  return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
2042
2245
  };
2246
+
2043
2247
  exports.default = withDashboardViz;
2044
2248
 
2045
2249
  /***/ }),
2046
2250
 
2047
- /***/ 37:
2251
+ /***/ 38:
2048
2252
  /***/ (function(module, exports) {
2049
2253
 
2050
2254
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
2051
2255
 
2052
2256
  /***/ }),
2053
2257
 
2054
- /***/ 38:
2258
+ /***/ 39:
2055
2259
  /***/ (function(module, exports) {
2056
2260
 
2057
2261
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
2058
2262
 
2059
2263
  /***/ }),
2060
2264
 
2061
- /***/ 39:
2265
+ /***/ 4:
2062
2266
  /***/ (function(module, exports) {
2063
2267
 
2064
- module.exports = require("@splunk/moment");
2268
+ module.exports = require("styled-components");
2065
2269
 
2066
2270
  /***/ }),
2067
2271
 
2068
- /***/ 4:
2272
+ /***/ 40:
2069
2273
  /***/ (function(module, exports) {
2070
2274
 
2071
- module.exports = require("styled-components");
2275
+ module.exports = require("@splunk/moment");
2072
2276
 
2073
2277
  /***/ }),
2074
2278
 
2075
- /***/ 40:
2279
+ /***/ 41:
2076
2280
  /***/ (function(module, exports) {
2077
2281
 
2078
2282
  module.exports = require("@splunk/async-dynamic-options-evaluator");
2079
2283
 
2080
2284
  /***/ }),
2081
2285
 
2082
- /***/ 41:
2286
+ /***/ 42:
2083
2287
  /***/ (function(module, exports, __webpack_require__) {
2084
2288
 
2085
2289
  "use strict";
2086
2290
 
2087
2291
 
2088
2292
  var _classCallCheck = __webpack_require__(9);
2293
+
2089
2294
  Object.defineProperty(exports, "__esModule", {
2090
2295
  value: true
2091
2296
  });
2092
2297
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
2093
2298
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
2299
+
2094
2300
  var T = __webpack_require__(0);
2301
+
2095
2302
  var lodash_1 = __webpack_require__(3);
2096
- var VizActionHandler_1 = __webpack_require__(42);
2097
- // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
2303
+
2304
+ var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
2305
+
2306
+
2098
2307
  exports.INITIAL_WIDTH = 250;
2099
2308
  exports.INITIAL_HEIGHT = 250;
2100
2309
  /**
2101
2310
  * A Splunk visualization
2102
2311
  */
2312
+
2103
2313
  var SplunkVisualization = function SplunkVisualization() {
2104
2314
  _classCallCheck(this, SplunkVisualization);
2105
2315
  };
2316
+
2106
2317
  SplunkVisualization.propTypes = {
2107
2318
  /**
2108
2319
  * display mode
2109
2320
  */
2110
2321
  mode: T.oneOf(['view', 'edit', 'export']).isRequired,
2322
+
2111
2323
  /**
2112
2324
  * width in pixel or string, defaults to 100%
2113
2325
  */
2114
2326
  width: T.oneOfType([T.string, T.number]).isRequired,
2327
+
2115
2328
  /**
2116
2329
  * height in pixel or string
2117
2330
  */
2118
2331
  height: T.oneOfType([T.string, T.number]).isRequired,
2332
+
2119
2333
  /**
2120
2334
  * visualization context used for dynamic option evaluation
2121
2335
  */
2122
2336
  context: T.object,
2337
+
2123
2338
  /**
2124
2339
  * visualization formatting options
2125
2340
  */
2126
2341
  options: T.object,
2342
+
2127
2343
  /**
2128
2344
  * A callback to update formatting options
2129
2345
  */
2130
2346
  onOptionsChange: T.func,
2347
+
2131
2348
  /**
2132
2349
  * datasource state which include data and request params, object key indicate the datasource type.
2133
2350
  */
@@ -2136,6 +2353,7 @@ SplunkVisualization.propTypes = {
2136
2353
  * current request params
2137
2354
  */
2138
2355
  requestParams: T.object,
2356
+
2139
2357
  /**
2140
2358
  * current dataset
2141
2359
  */
@@ -2143,6 +2361,7 @@ SplunkVisualization.propTypes = {
2143
2361
  fields: T.array,
2144
2362
  columns: T.array
2145
2363
  }),
2364
+
2146
2365
  /**
2147
2366
  * error
2148
2367
  */
@@ -2150,29 +2369,35 @@ SplunkVisualization.propTypes = {
2150
2369
  level: T.string,
2151
2370
  message: T.string
2152
2371
  }),
2372
+
2153
2373
  /**
2154
2374
  * meta data that came with the dataset
2155
2375
  */
2156
2376
  meta: T.object
2157
2377
  })),
2378
+
2158
2379
  /**
2159
2380
  * A callback to trigger event
2160
2381
  */
2161
2382
  onEventTrigger: T.func,
2383
+
2162
2384
  /**
2163
2385
  * Inform viz if there are handlers listening to events
2164
2386
  */
2165
2387
  hasEventHandlers: T.bool,
2388
+
2166
2389
  /**
2167
2390
  * A callback to communicate computed props to a consumer
2168
2391
  */
2169
2392
  onComputedProps: T.func,
2393
+
2170
2394
  /**
2171
2395
  * A callback to obtain visualization api
2172
2396
  */
2173
2397
  vizActionHandlerRef: T.func,
2174
2398
  loading: T.bool,
2175
2399
  theme: T.object,
2400
+
2176
2401
  /**
2177
2402
  * A callback to request new data with updated request params
2178
2403
  */
@@ -2181,6 +2406,7 @@ SplunkVisualization.propTypes = {
2181
2406
  /**
2182
2407
  *
2183
2408
  */
2409
+
2184
2410
  SplunkVisualization.defaultProps = {
2185
2411
  // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
2186
2412
  width: '100%',
@@ -2209,26 +2435,29 @@ exports.default = SplunkVisualization;
2209
2435
 
2210
2436
  /***/ }),
2211
2437
 
2212
- /***/ 42:
2438
+ /***/ 43:
2213
2439
  /***/ (function(module, exports, __webpack_require__) {
2214
2440
 
2215
2441
  "use strict";
2216
2442
 
2217
2443
 
2218
2444
  var _classCallCheck = __webpack_require__(9);
2445
+
2219
2446
  var _createClass = __webpack_require__(18);
2447
+
2220
2448
  Object.defineProperty(exports, "__esModule", {
2221
2449
  value: true
2222
2450
  });
2223
2451
  exports.DefaultVizActionHandler = void 0;
2452
+
2224
2453
  var DefaultVizActionHandler = /*#__PURE__*/function () {
2225
2454
  function DefaultVizActionHandler() {
2226
2455
  _classCallCheck(this, DefaultVizActionHandler);
2227
2456
  }
2457
+
2228
2458
  _createClass(DefaultVizActionHandler, [{
2229
2459
  key: "focus",
2230
- value: function focus() {
2231
- // noop
2460
+ value: function focus() {// noop
2232
2461
  }
2233
2462
  }, {
2234
2463
  key: "snapshot",
@@ -2236,23 +2465,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
2236
2465
  return null; // noop
2237
2466
  }
2238
2467
  }]);
2468
+
2239
2469
  return DefaultVizActionHandler;
2240
2470
  }();
2241
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
2242
2471
 
2243
- /***/ }),
2244
-
2245
- /***/ 43:
2246
- /***/ (function(module, exports, __webpack_require__) {
2247
-
2248
- "use strict";
2249
-
2250
-
2251
- Object.defineProperty(exports, "__esModule", {
2252
- value: true
2253
- });
2254
- exports.validSortDirs = void 0;
2255
- exports.validSortDirs = ['asc', 'desc', 'none'];
2472
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
2256
2473
 
2257
2474
  /***/ }),
2258
2475
 
@@ -2264,36 +2481,47 @@ exports.validSortDirs = ['asc', 'desc', 'none'];
2264
2481
 
2265
2482
  var __rest = this && this.__rest || function (s, e) {
2266
2483
  var t = {};
2484
+
2267
2485
  for (var p in s) {
2268
2486
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2269
2487
  }
2488
+
2270
2489
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2271
2490
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2272
2491
  }
2273
2492
  return t;
2274
2493
  };
2494
+
2275
2495
  Object.defineProperty(exports, "__esModule", {
2276
2496
  value: true
2277
2497
  });
2278
2498
  exports.themes = exports.computeVizProps = exports.PureParallelCoordinates = exports.config = void 0;
2499
+
2279
2500
  var PureParallelCoordinates_1 = __webpack_require__(432);
2280
- var withDashboardViz_1 = __webpack_require__(36);
2501
+
2502
+ var withDashboardViz_1 = __webpack_require__(37);
2503
+
2281
2504
  var config_1 = __webpack_require__(439);
2505
+
2282
2506
  var singleValueUtils_1 = __webpack_require__(24);
2507
+
2283
2508
  exports.config = config_1.default;
2284
2509
  exports.PureParallelCoordinates = PureParallelCoordinates_1.default;
2510
+
2285
2511
  var computeVizProps = function computeVizProps(_a) {
2286
2512
  var themeFunc = _a.themeFunc,
2287
- props = __rest(_a, ["themeFunc"]);
2513
+ props = __rest(_a, ["themeFunc"]);
2514
+
2288
2515
  var defaultThemeColorVariables = ['defaultBackgroundColor', 'axisLineColor', 'axisLineHighlightColor', 'axisLabelColor', 'axisTitleColor', 'filterButtonDisabledColor', 'filterButtonActiveColor', 'filterTextColor', 'truncatedTextColor', 'filterSelectionColor', 'textShadowColor'];
2289
2516
  var defaultThemeColors = {};
2290
2517
  defaultThemeColorVariables.forEach(function (variable) {
2291
2518
  defaultThemeColors[variable] = themeFunc(variable);
2292
2519
  });
2520
+
2293
2521
  if (props.dataSources) {
2294
2522
  var _props$dataSources$pr = props.dataSources.primary.data,
2295
- fields = _props$dataSources$pr.fields,
2296
- columns = _props$dataSources$pr.columns;
2523
+ fields = _props$dataSources$pr.fields,
2524
+ columns = _props$dataSources$pr.columns;
2297
2525
  return Object.assign({
2298
2526
  fields: fields.map(function (field) {
2299
2527
  return field.name ? field.name : field;
@@ -2301,8 +2529,10 @@ var computeVizProps = function computeVizProps(_a) {
2301
2529
  columns: columns
2302
2530
  }, defaultThemeColors);
2303
2531
  }
2532
+
2304
2533
  return defaultThemeColors;
2305
2534
  };
2535
+
2306
2536
  exports.computeVizProps = computeVizProps;
2307
2537
  var viz = (0, withDashboardViz_1.default)({
2308
2538
  ReactViz: exports.PureParallelCoordinates,
@@ -2324,49 +2554,63 @@ exports.default = viz;
2324
2554
 
2325
2555
 
2326
2556
  var _toConsumableArray = __webpack_require__(8);
2557
+
2327
2558
  var __rest = this && this.__rest || function (s, e) {
2328
2559
  var t = {};
2560
+
2329
2561
  for (var p in s) {
2330
2562
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2331
2563
  }
2564
+
2332
2565
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2333
2566
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2334
2567
  }
2335
2568
  return t;
2336
2569
  };
2570
+
2337
2571
  Object.defineProperty(exports, "__esModule", {
2338
2572
  value: true
2339
2573
  });
2574
+
2340
2575
  var React = __webpack_require__(1);
2576
+
2341
2577
  var d3_array_1 = __webpack_require__(64);
2342
- var d3_scale_1 = __webpack_require__(92);
2578
+
2579
+ var d3_scale_1 = __webpack_require__(93);
2580
+
2343
2581
  var T = __webpack_require__(0);
2582
+
2344
2583
  var i18n_1 = __webpack_require__(2);
2584
+
2345
2585
  var Message_1 = __webpack_require__(10);
2586
+
2346
2587
  var ParallelCoordinatesChart_1 = __webpack_require__(433);
2588
+
2347
2589
  var PureParallelCoordinates = function PureParallelCoordinates(_a) {
2348
2590
  var props = __rest(_a, []);
2591
+
2349
2592
  var width = props.width,
2350
- height = props.height,
2351
- columns = props.columns,
2352
- fields = props.fields,
2353
- showNullAxis = props.showNullAxis,
2354
- lineColor = props.lineColor,
2355
- backgroundColor = props.backgroundColor,
2356
- axisLineHighlightColor = props.axisLineHighlightColor,
2357
- axisLineColor = props.axisLineColor,
2358
- axisTitleColor = props.axisTitleColor,
2359
- axisLabelColor = props.axisLabelColor,
2360
- lineOpacity = props.lineOpacity,
2361
- filterButtonDisabledColor = props.filterButtonDisabledColor,
2362
- filterButtonActiveColor = props.filterButtonActiveColor,
2363
- filterTextColor = props.filterTextColor,
2364
- truncatedTextColor = props.truncatedTextColor,
2365
- filterSelectionColor = props.filterSelectionColor,
2366
- textShadowColor = props.textShadowColor,
2367
- mode = props.mode;
2593
+ height = props.height,
2594
+ columns = props.columns,
2595
+ fields = props.fields,
2596
+ showNullAxis = props.showNullAxis,
2597
+ lineColor = props.lineColor,
2598
+ backgroundColor = props.backgroundColor,
2599
+ axisLineHighlightColor = props.axisLineHighlightColor,
2600
+ axisLineColor = props.axisLineColor,
2601
+ axisTitleColor = props.axisTitleColor,
2602
+ axisLabelColor = props.axisLabelColor,
2603
+ lineOpacity = props.lineOpacity,
2604
+ filterButtonDisabledColor = props.filterButtonDisabledColor,
2605
+ filterButtonActiveColor = props.filterButtonActiveColor,
2606
+ filterTextColor = props.filterTextColor,
2607
+ truncatedTextColor = props.truncatedTextColor,
2608
+ filterSelectionColor = props.filterSelectionColor,
2609
+ textShadowColor = props.textShadowColor,
2610
+ mode = props.mode;
2368
2611
  var minWidth = 200;
2369
2612
  var minHieght = 150;
2613
+
2370
2614
  if (width < minWidth || height < minHieght) {
2371
2615
  return React.createElement(Message_1.default, {
2372
2616
  width: width,
@@ -2375,24 +2619,28 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
2375
2619
  level: "info"
2376
2620
  });
2377
2621
  }
2622
+
2378
2623
  var nullOffsetHeight = 30;
2379
2624
  var axisPadding = 0.3;
2380
2625
  var minLabelHeight = 16;
2381
- var truncatedCategoriesFlag = false;
2382
- // Set up chart margins
2626
+ var truncatedCategoriesFlag = false; // Set up chart margins
2627
+
2383
2628
  var margin = {
2384
2629
  top: 27,
2385
2630
  right: 20,
2386
2631
  bottom: 40,
2387
2632
  left: 40
2388
2633
  };
2634
+
2389
2635
  if (showNullAxis) {
2390
2636
  margin.bottom += nullOffsetHeight;
2391
2637
  }
2638
+
2392
2639
  var chartWidth = +width - margin.left - margin.right;
2393
- var chartHeight = +height - margin.top - margin.bottom;
2394
- // Data processing logic:
2640
+ var chartHeight = +height - margin.top - margin.bottom; // Data processing logic:
2641
+
2395
2642
  var data = [];
2643
+
2396
2644
  var _loop = function _loop(i) {
2397
2645
  var newObj = {};
2398
2646
  fields.forEach(function (field, index) {
@@ -2404,22 +2652,26 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
2404
2652
  });
2405
2653
  data.push(newObj);
2406
2654
  };
2655
+
2407
2656
  for (var i = 0; i < columns[0].length; i += 1) {
2408
2657
  _loop(i);
2409
- }
2410
- // Calculate horizontal and vertical scales
2658
+ } // Calculate horizontal and vertical scales
2659
+
2660
+
2411
2661
  var keys = Object.keys(data[0]);
2412
- var yPositionScale = {};
2413
- // check whether the value is numeric
2662
+ var yPositionScale = {}; // check whether the value is numeric
2663
+
2414
2664
  var quantVal = function quantVal(v) {
2415
2665
  return !Number.isNaN(Number(v)) || v === null;
2416
- };
2417
- // const dimensions = keys.filter(key => key !== 'name');
2666
+ }; // const dimensions = keys.filter(key => key !== 'name');
2667
+
2668
+
2418
2669
  var dimensions = [].concat(keys);
2419
2670
  dimensions.forEach(function (d) {
2420
2671
  var val = data.map(function (p) {
2421
2672
  return p[d];
2422
2673
  });
2674
+
2423
2675
  if (val.every(quantVal)) {
2424
2676
  // set numeric axis scale
2425
2677
  yPositionScale[d] = (0, d3_scale_1.scaleLinear)().domain((0, d3_array_1.extent)(data, function (p) {
@@ -2431,6 +2683,7 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
2431
2683
  return val.indexOf(v) === i;
2432
2684
  });
2433
2685
  var updatedDomain;
2686
+
2434
2687
  if (chartHeight / categoryDomain.length > minLabelHeight) {
2435
2688
  updatedDomain = _toConsumableArray(categoryDomain);
2436
2689
  } else {
@@ -2440,6 +2693,7 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
2440
2693
  return updatedDomain.includes(row[d]);
2441
2694
  });
2442
2695
  }
2696
+
2443
2697
  yPositionScale[d] = (0, d3_scale_1.scalePoint)().domain(updatedDomain).range([chartHeight, 0]);
2444
2698
  }
2445
2699
  });
@@ -2474,6 +2728,7 @@ var PureParallelCoordinates = function PureParallelCoordinates(_a) {
2474
2728
  mode: mode
2475
2729
  });
2476
2730
  };
2731
+
2477
2732
  PureParallelCoordinates.propTypes = {
2478
2733
  backgroundColor: T.string,
2479
2734
  width: T.number,
@@ -2528,28 +2783,42 @@ exports.default = PureParallelCoordinates;
2528
2783
 
2529
2784
 
2530
2785
  var _toConsumableArray = __webpack_require__(8);
2786
+
2531
2787
  var _slicedToArray = __webpack_require__(17);
2788
+
2532
2789
  var __rest = this && this.__rest || function (s, e) {
2533
2790
  var t = {};
2791
+
2534
2792
  for (var p in s) {
2535
2793
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2536
2794
  }
2795
+
2537
2796
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2538
2797
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2539
2798
  }
2540
2799
  return t;
2541
2800
  };
2801
+
2542
2802
  Object.defineProperty(exports, "__esModule", {
2543
2803
  value: true
2544
2804
  });
2805
+
2545
2806
  var React = __webpack_require__(1);
2807
+
2546
2808
  var styled_components_1 = __webpack_require__(4);
2809
+
2547
2810
  var d3_selection_1 = __webpack_require__(434);
2811
+
2548
2812
  var d3_brush_1 = __webpack_require__(435);
2813
+
2549
2814
  var d3_axis_1 = __webpack_require__(436);
2815
+
2550
2816
  var d3_drag_1 = __webpack_require__(437);
2817
+
2551
2818
  var rgb_hex_converter_1 = __webpack_require__(163);
2819
+
2552
2820
  var ParallelCoordinatesCanvas_1 = __webpack_require__(438);
2821
+
2553
2822
  var ChartDiv = styled_components_1.default.div.withConfig({
2554
2823
  displayName: "ParallelCoordinatesChart__ChartDiv",
2555
2824
  componentId: "sc-1oivyc-0"
@@ -2576,112 +2845,129 @@ var FilterButton = styled_components_1.default.button.attrs({
2576
2845
  })(["margin-left:16px;display:flex;border:none;background:none;color:", ";cursor:pointer;font-size:12px;padding-top:0;padding-bottom:0;padding-left:0;"], function (props) {
2577
2846
  return props.filterButtonColor;
2578
2847
  });
2848
+
2579
2849
  var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
2580
2850
  var props = __rest(_a, []);
2851
+
2581
2852
  var width = props.width,
2582
- height = props.height,
2583
- margin = props.margin,
2584
- axisPadding = props.axisPadding,
2585
- data = props.data,
2586
- dimensions = props.dimensions,
2587
- xPositionScale = props.xPositionScale,
2588
- yPositionScale = props.yPositionScale,
2589
- showNullAxis = props.showNullAxis,
2590
- nullOffsetHeight = props.nullOffsetHeight,
2591
- nullAxisScale = props.nullAxisScale,
2592
- lineColor = props.lineColor,
2593
- lineOpacity = props.lineOpacity,
2594
- backgroundColor = props.backgroundColor,
2595
- axisLineHighlightColor = props.axisLineHighlightColor,
2596
- axisLineColor = props.axisLineColor,
2597
- axisTitleColor = props.axisTitleColor,
2598
- axisLabelColor = props.axisLabelColor,
2599
- filterButtonDisabledColor = props.filterButtonDisabledColor,
2600
- filterButtonActiveColor = props.filterButtonActiveColor,
2601
- filterTextColor = props.filterTextColor,
2602
- truncatedCategoriesFlag = props.truncatedCategoriesFlag,
2603
- truncatedTextColor = props.truncatedTextColor,
2604
- filterSelectionColor = props.filterSelectionColor,
2605
- textShadowColor = props.textShadowColor;
2853
+ height = props.height,
2854
+ margin = props.margin,
2855
+ axisPadding = props.axisPadding,
2856
+ data = props.data,
2857
+ dimensions = props.dimensions,
2858
+ xPositionScale = props.xPositionScale,
2859
+ yPositionScale = props.yPositionScale,
2860
+ showNullAxis = props.showNullAxis,
2861
+ nullOffsetHeight = props.nullOffsetHeight,
2862
+ nullAxisScale = props.nullAxisScale,
2863
+ lineColor = props.lineColor,
2864
+ lineOpacity = props.lineOpacity,
2865
+ backgroundColor = props.backgroundColor,
2866
+ axisLineHighlightColor = props.axisLineHighlightColor,
2867
+ axisLineColor = props.axisLineColor,
2868
+ axisTitleColor = props.axisTitleColor,
2869
+ axisLabelColor = props.axisLabelColor,
2870
+ filterButtonDisabledColor = props.filterButtonDisabledColor,
2871
+ filterButtonActiveColor = props.filterButtonActiveColor,
2872
+ filterTextColor = props.filterTextColor,
2873
+ truncatedCategoriesFlag = props.truncatedCategoriesFlag,
2874
+ truncatedTextColor = props.truncatedTextColor,
2875
+ filterSelectionColor = props.filterSelectionColor,
2876
+ textShadowColor = props.textShadowColor;
2606
2877
  var brushWidth = 16;
2607
- var maxStrLength = 7;
2608
- // axis dragging storage variable
2609
- var dragging = {};
2610
- // brushing event handling variables
2878
+ var maxStrLength = 7; // axis dragging storage variable
2879
+
2880
+ var dragging = {}; // brushing event handling variables
2881
+
2611
2882
  var brush = (0, d3_brush_1.brushY)().extent([[-brushWidth / 2, 0], [brushWidth / 2, height]]);
2612
- var updatedTextShadowColor = backgroundColor === 'transparent' ? textShadowColor : backgroundColor;
2613
- // axis dragging feature state declaration
2883
+ var updatedTextShadowColor = backgroundColor === 'transparent' ? textShadowColor : backgroundColor; // axis dragging feature state declaration
2884
+
2614
2885
  var _React$useState = React.useState(dimensions),
2615
- _React$useState2 = _slicedToArray(_React$useState, 2),
2616
- currentDimensions = _React$useState2[0],
2617
- setCurrentDimensions = _React$useState2[1];
2886
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2887
+ currentDimensions = _React$useState2[0],
2888
+ setCurrentDimensions = _React$useState2[1];
2889
+
2618
2890
  var _React$useState3 = React.useState(false),
2619
- _React$useState4 = _slicedToArray(_React$useState3, 2),
2620
- dragStatus = _React$useState4[0],
2621
- setDragStatus = _React$useState4[1]; // brushing feature state declaration
2891
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
2892
+ dragStatus = _React$useState4[0],
2893
+ setDragStatus = _React$useState4[1]; // brushing feature state declaration
2894
+
2895
+
2622
2896
  var _React$useState5 = React.useState(data),
2623
- _React$useState6 = _slicedToArray(_React$useState5, 2),
2624
- selectedData = _React$useState6[0],
2625
- setSelectedData = _React$useState6[1];
2897
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
2898
+ selectedData = _React$useState6[0],
2899
+ setSelectedData = _React$useState6[1];
2900
+
2626
2901
  var _React$useState7 = React.useState(new Map()),
2627
- _React$useState8 = _slicedToArray(_React$useState7, 2),
2628
- selections = _React$useState8[0],
2629
- setSelections = _React$useState8[1];
2902
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
2903
+ selections = _React$useState8[0],
2904
+ setSelections = _React$useState8[1];
2905
+
2630
2906
  var _React$useState9 = React.useState(false),
2631
- _React$useState10 = _slicedToArray(_React$useState9, 2),
2632
- filterPromptState = _React$useState10[0],
2633
- setFilterPromptState = _React$useState10[1];
2907
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
2908
+ filterPromptState = _React$useState10[0],
2909
+ setFilterPromptState = _React$useState10[1];
2910
+
2634
2911
  var _React$useState11 = React.useState(filterButtonDisabledColor),
2635
- _React$useState12 = _slicedToArray(_React$useState11, 2),
2636
- filterButtonColor = _React$useState12[0],
2637
- setFilterButtonColor = _React$useState12[1];
2638
- var svgRef = React.useRef(null);
2639
- // update xPositionScale
2912
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
2913
+ filterButtonColor = _React$useState12[0],
2914
+ setFilterButtonColor = _React$useState12[1];
2915
+
2916
+ var svgRef = React.useRef(null); // update xPositionScale
2917
+
2640
2918
  xPositionScale.domain(currentDimensions);
2641
- nullAxisScale.domain(currentDimensions).range([0, width - 2 * axisPadding * xPositionScale.step()]);
2642
- // axis dragging helper functions
2919
+ nullAxisScale.domain(currentDimensions).range([0, width - 2 * axisPadding * xPositionScale.step()]); // axis dragging helper functions
2920
+
2643
2921
  var position = function position(d) {
2644
2922
  var v = dragging[d];
2645
2923
  return v == null ? xPositionScale(d) : v;
2646
2924
  };
2925
+
2647
2926
  var transition = function transition(g) {
2648
2927
  return g.transition().duration(500);
2649
- };
2650
- // clear filter button
2928
+ }; // clear filter button
2929
+
2930
+
2651
2931
  var clearAllFilters = function clearAllFilters() {
2652
2932
  (0, d3_selection_1.select)(svgRef.current).selectAll('.brush').call(brush.move, null);
2653
2933
  setSelections(new Map());
2654
2934
  setSelectedData(data);
2655
2935
  setFilterPromptState(false);
2656
2936
  setFilterButtonColor(filterButtonDisabledColor);
2657
- };
2658
- // truncated string to a length for categorical axis label
2937
+ }; // truncated string to a length for categorical axis label
2938
+
2939
+
2659
2940
  var truncate = function truncate(str, maxLength) {
2660
2941
  var updatedSuffix = '...';
2661
2942
  var updateStr = str || 'null';
2943
+
2662
2944
  if (Array.isArray(updateStr)) {
2663
2945
  updateStr = updateStr.join(', ');
2664
2946
  }
2947
+
2665
2948
  if (typeof updateStr === 'string' && updateStr.length > maxLength) {
2666
2949
  updateStr = updateStr.substring(0, maxLength - 1);
2667
2950
  updateStr += updatedSuffix;
2668
2951
  }
2952
+
2669
2953
  return updateStr;
2670
2954
  };
2955
+
2671
2956
  React.useEffect(function () {
2672
2957
  // clean svg before drawing
2673
- var svg = (0, d3_selection_1.select)(svgRef.current).html('').attr('height', height + margin.top + margin.bottom).attr('width', width + margin.left + margin.right).append('g').attr('transform', "translate(".concat(margin.left, ",").concat(margin.top, ")"));
2674
- // Add a group element for each dimension
2958
+ var svg = (0, d3_selection_1.select)(svgRef.current).html('').attr('height', height + margin.top + margin.bottom).attr('width', width + margin.left + margin.right).append('g').attr('transform', "translate(".concat(margin.left, ",").concat(margin.top, ")")); // Add a group element for each dimension
2959
+
2675
2960
  var g = svg.selectAll('.dimension').data(currentDimensions).join('g').attr('class', 'dimension').attr('data-test', 'dimension').attr('transform', function (d) {
2676
2961
  return "translate(".concat(xPositionScale(d), ")");
2677
- }).style('cursor', 'ew-resize');
2678
- // axis dragging event handling
2962
+ }).style('cursor', 'ew-resize'); // axis dragging event handling
2963
+
2679
2964
  var dragstarted = function dragstarted(event, d) {
2680
2965
  (0, d3_selection_1.select)(event.sourceEvent.currentTarget).selectAll('.axis path').style('stroke', axisLineHighlightColor);
2681
2966
  (0, d3_selection_1.select)(event.sourceEvent.currentTarget).selectAll('.axis line').style('stroke', axisLineHighlightColor);
2682
2967
  dragging[d] = xPositionScale(d);
2683
2968
  setDragStatus(true);
2684
2969
  };
2970
+
2685
2971
  var dragged = function dragged(event, d) {
2686
2972
  dragging[d] = Math.min(width, Math.max(0, event.x));
2687
2973
  currentDimensions.sort(function (a, b) {
@@ -2693,14 +2979,16 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
2693
2979
  return "translate(".concat(position(p), ")");
2694
2980
  });
2695
2981
  };
2982
+
2696
2983
  function dragended(_event, d) {
2697
2984
  delete dragging[d];
2698
2985
  (0, d3_selection_1.select)(this).select('.axis path').style('stroke', axisLineColor);
2699
2986
  (0, d3_selection_1.select)(this).selectAll('.axis line').style('stroke', axisLineColor);
2700
2987
  transition((0, d3_selection_1.select)(this).attr('transform', "translate(".concat(xPositionScale(d), ")")));
2701
2988
  setDragStatus(false);
2702
- }
2703
- // Add vertical axis and title.
2989
+ } // Add vertical axis and title.
2990
+
2991
+
2704
2992
  g.append('g').attr('class', 'axis vertical-axis').each(function (d, i, nodes) {
2705
2993
  if (yPositionScale[d].ticks) {
2706
2994
  // numerical axis
@@ -2711,8 +2999,7 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
2711
2999
  // categorical axis and truncated long labels
2712
3000
  (0, d3_selection_1.select)(nodes[i]).call((0, d3_axis_1.axisLeft)(yPositionScale[d]).tickFormat(function (p) {
2713
3001
  return truncate(p, maxStrLength);
2714
- }))
2715
- // add title to show full value upon hover
3002
+ })) // add title to show full value upon hover
2716
3003
  .selectAll('text').append('title').text(function (datum) {
2717
3004
  return datum && datum.toString();
2718
3005
  });
@@ -2720,37 +3007,42 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
2720
3007
  }).selectAll('text').attr('fill', axisLabelColor).clone(true).lower().attr('fill', 'none').attr('stroke-width', 2).attr('stroke-linejoin', 'round').attr('stroke', "rgba(".concat((0, rgb_hex_converter_1.convertHexToRgb)(updatedTextShadowColor)[0], ",").concat((0, rgb_hex_converter_1.convertHexToRgb)(updatedTextShadowColor)[1], ",").concat((0, rgb_hex_converter_1.convertHexToRgb)(updatedTextShadowColor)[2], ", ", 0.8, ")"));
2721
3008
  g.append('text').attr('class', 'axisTitle').attr('fill', axisTitleColor).attr('font-size', '12px').attr('text-anchor', 'middle').attr('y', -9).text(function (d) {
2722
3009
  return d;
2723
- });
2724
- // drawing the null axis
3010
+ }); // drawing the null axis
3011
+
2725
3012
  if (showNullAxis) {
2726
- var nullAxisOffsetHeight = yPositionScale[currentDimensions[0]].range()[0] + nullOffsetHeight;
2727
- // append null axis and title
3013
+ var nullAxisOffsetHeight = yPositionScale[currentDimensions[0]].range()[0] + nullOffsetHeight; // append null axis and title
3014
+
2728
3015
  svg.append('g').attr('class', 'axis null-axis').attr('transform', "translate(".concat(xPositionScale.step() * axisPadding, ", ").concat(nullAxisOffsetHeight, ")")).attr('fill', 'none').call((0, d3_axis_1.axisTop)(nullAxisScale).tickFormat(function () {
2729
3016
  return '';
2730
3017
  }));
2731
3018
  svg.append('text').attr('text-anchor', 'end').attr('font-size', '11px').attr('x', axisPadding * xPositionScale.step() - 9).attr('y', height + nullOffsetHeight).text('null').attr('fill', axisLabelColor);
2732
- }
2733
- // customize axis line and ticks based on themes
3019
+ } // customize axis line and ticks based on themes
3020
+
3021
+
2734
3022
  (0, d3_selection_1.selectAll)('.axis .domain').style('stroke', axisLineColor);
2735
- (0, d3_selection_1.selectAll)('.axis line').style('stroke', axisLineColor);
2736
- // added dragging event functions to each dimension
2737
- svg.selectAll('.dimension').call((0, d3_drag_1.drag)().on('start', dragstarted).on('drag', dragged).on('end', dragended));
2738
- // brushing event handling
3023
+ (0, d3_selection_1.selectAll)('.axis line').style('stroke', axisLineColor); // added dragging event functions to each dimension
3024
+
3025
+ svg.selectAll('.dimension').call((0, d3_drag_1.drag)().on('start', dragstarted).on('drag', dragged).on('end', dragended)); // brushing event handling
3026
+
2739
3027
  var brushStart = function brushStart(event) {
2740
3028
  // prevent brushing event trigger clicking event
2741
3029
  if (event.sourceEvent) {
2742
3030
  event.sourceEvent.stopPropagation();
2743
3031
  }
3032
+
2744
3033
  setFilterPromptState(true);
2745
- setFilterButtonColor(filterButtonActiveColor);
2746
- // style filter selection box rect
3034
+ setFilterButtonColor(filterButtonActiveColor); // style filter selection box rect
3035
+
2747
3036
  (0, d3_selection_1.selectAll)('rect.selection').attr('fill', filterSelectionColor).attr('fill-opacity', '0.3').attr('stroke', 'none').attr('rx', '4px');
2748
- };
2749
- // updated selectedData after brushing
3037
+ }; // updated selectedData after brushing
3038
+
3039
+
2750
3040
  var brushed = function brushed(_ref, key) {
2751
3041
  var selection = _ref.selection;
3042
+
2752
3043
  if (selection === null) {
2753
3044
  selections.delete(key);
3045
+
2754
3046
  if (selections.size === 0) {
2755
3047
  setFilterButtonColor(filterButtonDisabledColor);
2756
3048
  setFilterPromptState(false);
@@ -2765,27 +3057,31 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
2765
3057
  // categorical scale (aka scalePoint)
2766
3058
  selections.set(key, [selection[1], selection[0]]);
2767
3059
  }
3060
+
2768
3061
  var selected = [];
2769
3062
  data.forEach(function (d) {
2770
3063
  // Categorical Axis: convert ordinal dimension's values to pixels
2771
3064
  // Numerical Axis: compare numerical values with dataSources
2772
3065
  var active = Array.from(selections).every(function (_ref2) {
2773
3066
  var _ref3 = _slicedToArray(_ref2, 2),
2774
- activeKey = _ref3[0],
2775
- _ref3$ = _slicedToArray(_ref3[1], 2),
2776
- max = _ref3$[0],
2777
- min = _ref3$[1];
3067
+ activeKey = _ref3[0],
3068
+ _ref3$ = _slicedToArray(_ref3[1], 2),
3069
+ max = _ref3$[0],
3070
+ min = _ref3$[1];
3071
+
2778
3072
  var newP = yPositionScale[activeKey].ticks ? d[activeKey] : yPositionScale[activeKey](d[activeKey]);
2779
3073
  return newP >= min && newP <= max;
2780
3074
  });
3075
+
2781
3076
  if (active) {
2782
3077
  selected.push(d);
2783
3078
  }
2784
3079
  });
2785
3080
  setSelectedData(selected);
2786
3081
  };
2787
- brush.on('start', brushStart).on('brush end', brushed);
2788
- // add and store a brush for each axis.
3082
+
3083
+ brush.on('start', brushStart).on('brush end', brushed); // add and store a brush for each axis.
3084
+
2789
3085
  g.append('g').attr('class', 'brush').each(function (_d, i, nodes) {
2790
3086
  (0, d3_selection_1.select)(nodes[i]).call(brush);
2791
3087
  });
@@ -2844,6 +3140,7 @@ var ParallelCoordinatesChart = function ParallelCoordinatesChart(_a) {
2844
3140
  "data-testid": "truncated-data-warning"
2845
3141
  }, "Note: Your data is currently truncated due to a high amount of categorical values"))));
2846
3142
  };
3143
+
2847
3144
  exports.default = ParallelCoordinatesChart;
2848
3145
 
2849
3146
  /***/ }),
@@ -2884,45 +3181,53 @@ module.exports = require("d3-drag");
2884
3181
 
2885
3182
  var __rest = this && this.__rest || function (s, e) {
2886
3183
  var t = {};
3184
+
2887
3185
  for (var p in s) {
2888
3186
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2889
3187
  }
3188
+
2890
3189
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2891
3190
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2892
3191
  }
2893
3192
  return t;
2894
3193
  };
3194
+
2895
3195
  Object.defineProperty(exports, "__esModule", {
2896
3196
  value: true
2897
3197
  });
3198
+
2898
3199
  var React = __webpack_require__(1);
3200
+
2899
3201
  var rgb_hex_converter_1 = __webpack_require__(163);
3202
+
2900
3203
  var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
2901
3204
  var props = __rest(_a, []);
3205
+
2902
3206
  var width = props.width,
2903
- height = props.height,
2904
- margin = props.margin,
2905
- data = props.data,
2906
- selectedData = props.selectedData,
2907
- currentDimensions = props.currentDimensions,
2908
- xPositionScale = props.xPositionScale,
2909
- yPositionScale = props.yPositionScale,
2910
- dragStatus = props.dragStatus,
2911
- showNullAxis = props.showNullAxis,
2912
- nullOffsetHeight = props.nullOffsetHeight,
2913
- lineColor = props.lineColor,
2914
- lineOpacity = props.lineOpacity,
2915
- backgroundColor = props.backgroundColor;
3207
+ height = props.height,
3208
+ margin = props.margin,
3209
+ data = props.data,
3210
+ selectedData = props.selectedData,
3211
+ currentDimensions = props.currentDimensions,
3212
+ xPositionScale = props.xPositionScale,
3213
+ yPositionScale = props.yPositionScale,
3214
+ dragStatus = props.dragStatus,
3215
+ showNullAxis = props.showNullAxis,
3216
+ nullOffsetHeight = props.nullOffsetHeight,
3217
+ lineColor = props.lineColor,
3218
+ lineOpacity = props.lineOpacity,
3219
+ backgroundColor = props.backgroundColor;
2916
3220
  var foregroundRef = React.useRef(null);
2917
- var backgroundRef = React.useRef(null);
2918
- // Get the device pixel ratio, falling back to 1.
2919
- var dpr = window.devicePixelRatio || 1;
2920
- // draw path on two layers of canvas
3221
+ var backgroundRef = React.useRef(null); // Get the device pixel ratio, falling back to 1.
3222
+
3223
+ var dpr = window.devicePixelRatio || 1; // draw path on two layers of canvas
3224
+
2921
3225
  var path = function path(d, ctx, dimensions) {
2922
3226
  if (showNullAxis) {
2923
3227
  ctx.beginPath();
2924
3228
  dimensions.forEach(function (p, i) {
2925
3229
  var updatedYPosition;
3230
+
2926
3231
  if (d[p] == null) {
2927
3232
  // add nullOffsetHeight to the bottom position of each axes and make it as the new yPosition of the null data
2928
3233
  updatedYPosition = yPositionScale[p].range()[0] + nullOffsetHeight;
@@ -2930,6 +3235,7 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
2930
3235
  // otherwise, yPosition stays at the same scale
2931
3236
  updatedYPosition = yPositionScale[p](d[p]);
2932
3237
  }
3238
+
2933
3239
  if (i === 0) {
2934
3240
  ctx.moveTo(xPositionScale(p), updatedYPosition);
2935
3241
  } else {
@@ -2947,6 +3253,7 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
2947
3253
  ctx.lineTo(xPositionScale(p), yPositionScale[p](d[p]));
2948
3254
  ctx.stroke();
2949
3255
  }
3256
+
2950
3257
  if (d[p] !== null) {
2951
3258
  prev = p;
2952
3259
  } else {
@@ -2954,23 +3261,25 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
2954
3261
  }
2955
3262
  });
2956
3263
  }
2957
- };
2958
- // draw all the lines on background canvas
3264
+ }; // draw all the lines on background canvas
3265
+
3266
+
2959
3267
  React.useEffect(function () {
2960
3268
  var backgroundCanvas = backgroundRef.current;
2961
3269
  var background = backgroundCanvas.getContext('2d');
2962
3270
  backgroundCanvas.width = (width + margin.left + margin.right) * dpr;
2963
- backgroundCanvas.height = (height + margin.top + margin.bottom) * dpr;
2964
- // ensure all drawing operations are scaled
3271
+ backgroundCanvas.height = (height + margin.top + margin.bottom) * dpr; // ensure all drawing operations are scaled
3272
+
2965
3273
  background.scale(dpr, dpr);
2966
3274
  background.clearRect(0, 0, width + margin.left + margin.right, height + margin.top + margin.bottom);
2967
3275
  background.translate(margin.left, margin.top);
3276
+
2968
3277
  if (backgroundColor !== 'transparent') {
2969
3278
  background.strokeStyle = "rgba(".concat((0, rgb_hex_converter_1.convertHexToRgb)(lineColor)[0], ", ").concat((0, rgb_hex_converter_1.convertHexToRgb)(lineColor)[1], ", ").concat((0, rgb_hex_converter_1.convertHexToRgb)(lineColor)[2], ", ").concat(lineOpacity, ")");
2970
3279
  data.forEach(function (d) {
2971
3280
  return path(d, background, currentDimensions);
2972
- });
2973
- // backgroundColor-ed or default page color mask btw background and foreground lines
3281
+ }); // backgroundColor-ed or default page color mask btw background and foreground lines
3282
+
2974
3283
  background.globalAlpha = 0.7;
2975
3284
  background.fillStyle = backgroundColor;
2976
3285
  background.fillRect(-10, -10, width + margin.right, height + margin.bottom);
@@ -2981,15 +3290,15 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
2981
3290
  return path(d, background, currentDimensions);
2982
3291
  });
2983
3292
  }
2984
- }, [data, height, margin, width, currentDimensions, showNullAxis, nullOffsetHeight, lineColor, lineOpacity, backgroundColor, dpr]);
2985
- // draw lines on the foreground canvas
3293
+ }, [data, height, margin, width, currentDimensions, showNullAxis, nullOffsetHeight, lineColor, lineOpacity, backgroundColor, dpr]); // draw lines on the foreground canvas
2986
3294
  // when selectedData is updated via brushing, re-draw the foreground canvas
3295
+
2987
3296
  React.useEffect(function () {
2988
3297
  var foregroundCanvas = foregroundRef.current;
2989
3298
  var foreground = foregroundCanvas.getContext('2d');
2990
3299
  foregroundCanvas.width = (width + margin.left + margin.right) * dpr;
2991
- foregroundCanvas.height = (height + margin.top + margin.bottom) * dpr;
2992
- // ensure all drawing operations are scaled
3300
+ foregroundCanvas.height = (height + margin.top + margin.bottom) * dpr; // ensure all drawing operations are scaled
3301
+
2993
3302
  foreground.scale(dpr, dpr);
2994
3303
  foreground.clearRect(0, 0, width + margin.left + margin.right, height + margin.top + margin.bottom);
2995
3304
  foreground.translate(margin.left, margin.top);
@@ -3020,6 +3329,7 @@ var ParallelCoordinatesCanvas = function ParallelCoordinatesCanvas(_a) {
3020
3329
  }
3021
3330
  }));
3022
3331
  };
3332
+
3023
3333
  exports.default = ParallelCoordinatesCanvas;
3024
3334
 
3025
3335
  /***/ }),
@@ -3033,17 +3343,29 @@ exports.default = ParallelCoordinatesCanvas;
3033
3343
  Object.defineProperty(exports, "__esModule", {
3034
3344
  value: true
3035
3345
  });
3346
+
3036
3347
  var i18n_1 = __webpack_require__(2);
3348
+
3037
3349
  var schemaUtils_1 = __webpack_require__(16);
3350
+
3038
3351
  var pick_1 = __webpack_require__(23);
3352
+
3039
3353
  var variables_1 = __webpack_require__(11);
3354
+
3040
3355
  var visualization_color_palettes_1 = __webpack_require__(51);
3356
+
3041
3357
  var visualization_icons_1 = __webpack_require__(52);
3358
+
3042
3359
  var placeholders_1 = __webpack_require__(50);
3360
+
3043
3361
  var VizBehavior_1 = __webpack_require__(6);
3362
+
3044
3363
  var configUtils_1 = __webpack_require__(20);
3045
- var VizCategory_1 = __webpack_require__(35);
3364
+
3365
+ var VizCategory_1 = __webpack_require__(36);
3366
+
3046
3367
  var BackgroundColor_1 = __webpack_require__(53);
3368
+
3047
3369
  var dataContract = {
3048
3370
  requiredDataSources: [{
3049
3371
  name: 'primary',
@@ -3215,17 +3537,20 @@ var editorConfig = [{
3215
3537
  /**
3216
3538
  * visualization configuration
3217
3539
  */
3540
+
3218
3541
  var config = {
3219
3542
  /**
3220
3543
  * unique viz key
3221
3544
  */
3222
3545
  key: 'splunk.parallelcoordinates',
3546
+
3223
3547
  /**
3224
3548
  * viz name
3225
3549
  */
3226
3550
  name: (0, i18n_1._)('Parallel coordinates'),
3227
3551
  category: VizCategory_1.VizCategory.CORRELATION,
3228
3552
  status: 'preview',
3553
+
3229
3554
  /**
3230
3555
  * viz icon
3231
3556
  */
@@ -3254,7 +3579,9 @@ Object.defineProperty(exports, "__esModule", {
3254
3579
  value: true
3255
3580
  });
3256
3581
  exports.useDeepMemo = void 0;
3582
+
3257
3583
  var react_1 = __webpack_require__(1);
3584
+
3258
3585
  var lodash_1 = __webpack_require__(3);
3259
3586
  /**
3260
3587
  * This hook evaluates and stores the result of a passed function and only
@@ -3269,16 +3596,21 @@ var lodash_1 = __webpack_require__(3);
3269
3596
  * @param fn the function to be executed and
3270
3597
  * @param dependencies an array of dependencies
3271
3598
  */
3599
+
3600
+
3272
3601
  var useDeepMemo = function useDeepMemo(fn, dependencies) {
3273
3602
  var ref = (0, react_1.useRef)();
3603
+
3274
3604
  if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
3275
3605
  ref.current = {
3276
3606
  dependencies: dependencies,
3277
3607
  value: fn()
3278
3608
  };
3279
3609
  }
3610
+
3280
3611
  return ref.current.value;
3281
3612
  };
3613
+
3282
3614
  exports.useDeepMemo = useDeepMemo;
3283
3615
 
3284
3616
  /***/ }),
@@ -3293,19 +3625,27 @@ Object.defineProperty(exports, "__esModule", {
3293
3625
  value: true
3294
3626
  });
3295
3627
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
3628
+
3296
3629
  var React = __webpack_require__(1);
3630
+
3297
3631
  var T = __webpack_require__(0);
3632
+
3298
3633
  var i18n_1 = __webpack_require__(2);
3634
+
3299
3635
  var Message_1 = __webpack_require__(10);
3636
+
3300
3637
  var FixedSizeContainer_1 = __webpack_require__(13);
3301
3638
  /**
3302
3639
  * @method isMissing
3303
3640
  * @param {any} v
3304
3641
  * @returns {boolean} true if the input value === null or undefined
3305
3642
  */
3643
+
3644
+
3306
3645
  var isMissing = function isMissing(v) {
3307
3646
  return v === null || v === undefined;
3308
3647
  };
3648
+
3309
3649
  exports.isMissing = isMissing;
3310
3650
  /**
3311
3651
  * @method misskingKeys
@@ -3313,11 +3653,13 @@ exports.isMissing = isMissing;
3313
3653
  * @param {object} target
3314
3654
  * @returns {string[]} the keys of missing required props
3315
3655
  */
3656
+
3316
3657
  var missingKeys = function missingKeys(keys, target) {
3317
3658
  return keys.filter(function (k) {
3318
3659
  return (0, exports.isMissing)(target[k]);
3319
3660
  });
3320
3661
  };
3662
+
3321
3663
  exports.missingKeys = missingKeys;
3322
3664
  var propTypes = {
3323
3665
  width: T.oneOfType([T.string, T.number]),
@@ -3331,10 +3673,11 @@ var propTypes = {
3331
3673
  * @param {MissingPropsProps} props
3332
3674
  * @returns {React.ReactElement}
3333
3675
  */
3676
+
3334
3677
  var MissingPropsMessage = function MissingPropsMessage(props) {
3335
3678
  var width = props.width,
3336
- height = props.height,
3337
- missingProps = props.missingProps;
3679
+ height = props.height,
3680
+ missingProps = props.missingProps;
3338
3681
  return React.createElement(Message_1.default, {
3339
3682
  "data-test": "message",
3340
3683
  width: width,
@@ -3342,6 +3685,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
3342
3685
  message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
3343
3686
  });
3344
3687
  };
3688
+
3345
3689
  exports.MissingPropsMessage = MissingPropsMessage;
3346
3690
  exports.MissingPropsMessage.propTypes = propTypes;
3347
3691
  exports.MissingPropsMessage.defaultProps = {
@@ -3361,15 +3705,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
3361
3705
  Object.defineProperty(exports, "__esModule", {
3362
3706
  value: true
3363
3707
  });
3708
+
3364
3709
  var React = __webpack_require__(1);
3710
+
3365
3711
  var styled_components_1 = __webpack_require__(4);
3712
+
3366
3713
  var hocUtils_1 = __webpack_require__(15);
3714
+
3367
3715
  var Cover = styled_components_1.default.div.withConfig({
3368
3716
  displayName: "withEditModeCover__Cover",
3369
3717
  componentId: "sc-1gsbnxb-0"
3370
3718
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
3371
3719
  var Blocker = styled_components_1.default.div.attrs({
3372
- 'data-splunk-visualization-version': "26.0.0 - 2f7458907"
3720
+ 'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
3373
3721
  }).withConfig({
3374
3722
  displayName: "withEditModeCover__Blocker",
3375
3723
  componentId: "sc-1gsbnxb-1"
@@ -3380,6 +3728,7 @@ var Blocker = styled_components_1.default.div.attrs({
3380
3728
  * @param {ExtendedDashViz} Visualization
3381
3729
  * @returns {ExtendedDashViz} Wrapper
3382
3730
  */
3731
+
3383
3732
  var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
3384
3733
  var Wrapper = function Wrapper(props) {
3385
3734
  var mode = props.mode;
@@ -3388,12 +3737,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
3388
3737
  "data-test": "edit-mode-cover"
3389
3738
  }));
3390
3739
  };
3740
+
3391
3741
  (0, hocUtils_1.extendStaticWrapperProps)({
3392
3742
  Wrapper: Wrapper,
3393
3743
  Visualization: Visualization
3394
3744
  });
3395
3745
  return Wrapper;
3396
3746
  };
3747
+
3397
3748
  exports.default = withEditModeCover;
3398
3749
 
3399
3750
  /***/ }),
@@ -3407,27 +3758,37 @@ exports.default = withEditModeCover;
3407
3758
  Object.defineProperty(exports, "__esModule", {
3408
3759
  value: true
3409
3760
  });
3761
+
3410
3762
  var React = __webpack_require__(1);
3763
+
3411
3764
  var colorUtils_1 = __webpack_require__(12);
3765
+
3412
3766
  var variables_1 = __webpack_require__(11);
3767
+
3413
3768
  var IconPlaceholder_1 = __webpack_require__(32);
3769
+
3414
3770
  var VizBehavior_1 = __webpack_require__(6);
3771
+
3415
3772
  var hocUtils_1 = __webpack_require__(15);
3773
+
3416
3774
  var withPlaceholder = function withPlaceholder(Visualization) {
3417
3775
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
3418
3776
  var config = Visualization.config;
3419
3777
  var themes = config.themes;
3778
+
3420
3779
  var Wrapper = function Wrapper(props) {
3421
3780
  var _a, _b;
3781
+
3422
3782
  var dataSources = props.dataSources,
3423
- loading = props.loading,
3424
- options = props.options,
3425
- height = props.height,
3426
- width = props.width;
3783
+ loading = props.loading,
3784
+ options = props.options,
3785
+ height = props.height,
3786
+ width = props.width;
3427
3787
  var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
3428
3788
  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);
3429
3789
  var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
3430
3790
  var iconColor = variables_1.default.contentColorActive(props);
3791
+
3431
3792
  if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
3432
3793
  return React.createElement(IconPlaceholder_1.default, {
3433
3794
  "data-test": "icon-placeholder",
@@ -3438,14 +3799,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
3438
3799
  iconColor: iconColor
3439
3800
  });
3440
3801
  }
3802
+
3441
3803
  return React.createElement(Visualization, Object.assign({}, props));
3442
3804
  };
3805
+
3443
3806
  (0, hocUtils_1.extendStaticWrapperProps)({
3444
3807
  Wrapper: Wrapper,
3445
3808
  Visualization: Visualization
3446
3809
  });
3447
3810
  return Wrapper;
3448
3811
  };
3812
+
3449
3813
  exports.default = withPlaceholder;
3450
3814
 
3451
3815
  /***/ }),
@@ -3487,11 +3851,13 @@ module.exports = require("@splunk/visualization-icons");
3487
3851
  Object.defineProperty(exports, "__esModule", {
3488
3852
  value: true
3489
3853
  });
3854
+
3490
3855
  var i18n_1 = __webpack_require__(2);
3856
+
3491
3857
  var background = function background(_ref) {
3492
3858
  var label = _ref.label,
3493
- themes = _ref.themes,
3494
- labelPosition = _ref.labelPosition;
3859
+ themes = _ref.themes,
3860
+ labelPosition = _ref.labelPosition;
3495
3861
  return [{
3496
3862
  label: (0, i18n_1._)(label || 'Background'),
3497
3863
  option: 'backgroundColor',
@@ -3502,6 +3868,7 @@ var background = function background(_ref) {
3502
3868
  }
3503
3869
  }];
3504
3870
  };
3871
+
3505
3872
  exports.default = background;
3506
3873
 
3507
3874
  /***/ }),
@@ -3524,6 +3891,7 @@ Object.defineProperty(exports, "__esModule", {
3524
3891
  });
3525
3892
  exports.VizBehavior = void 0;
3526
3893
  var VizBehavior;
3894
+
3527
3895
  (function (VizBehavior) {
3528
3896
  /**
3529
3897
  * Dynamic Options Behavior.
@@ -3543,6 +3911,7 @@ var VizBehavior;
3543
3911
  * missing.
3544
3912
  * @type {string}
3545
3913
  */
3914
+
3546
3915
  VizBehavior["PLACEHOLDER"] = "placeholder";
3547
3916
  VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
3548
3917
  VizBehavior["TRELLIS"] = "trellis";
@@ -3578,7 +3947,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
3578
3947
 
3579
3948
  /***/ }),
3580
3949
 
3581
- /***/ 92:
3950
+ /***/ 93:
3582
3951
  /***/ (function(module, exports) {
3583
3952
 
3584
3953
  module.exports = require("d3-scale");