@splunk/visualizations 26.0.0 → 26.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/Area.config.js +103 -19
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +646 -243
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +105 -21
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +653 -237
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +95 -21
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +635 -229
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +66 -15
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +589 -211
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +104 -19
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +666 -239
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +83 -18
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +444 -156
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +101 -19
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +792 -322
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +97 -28
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +786 -390
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +63 -19
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +439 -164
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +107 -23
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +841 -456
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +73 -23
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +653 -230
  44. package/LinkGraph.js.map +1 -1
  45. package/MIGRATION.md +1082 -0
  46. package/Map.config.js +244 -99
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +1223 -612
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +71 -21
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +477 -202
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +80 -22
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +819 -418
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +73 -19
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +870 -491
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +76 -23
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +643 -233
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +82 -30
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +863 -387
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +86 -20
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +449 -159
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +85 -23
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +895 -349
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +97 -23
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +639 -234
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +95 -25
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +1198 -656
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +287 -226
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +93 -23
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +991 -522
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +100 -27
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +1185 -624
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +127 -68
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +74 -21
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +827 -329
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +152 -69
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +25 -14
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/DocExampleWithVizSandbox.js +530 -0
  107. package/common/DocExampleWithVizSandbox.js.map +1 -0
  108. package/common/EventsDoc.js +139 -104
  109. package/common/EventsDoc.js.map +1 -1
  110. package/common/GaugeMajorTicks.js +79 -69
  111. package/common/GaugeMajorTicks.js.map +1 -1
  112. package/common/GaugeValueMarker.js +54 -45
  113. package/common/GaugeValueMarker.js.map +1 -1
  114. package/common/OptionsDoc.js +178 -87
  115. package/common/OptionsDoc.js.map +1 -1
  116. package/common/OverviewDoc.js +530 -68
  117. package/common/OverviewDoc.js.map +1 -1
  118. package/common/SplunkVisualization.js +47 -20
  119. package/common/SplunkVisualization.js.map +1 -1
  120. package/common/SplunkVisualizationApi.js +15 -9
  121. package/common/SplunkVisualizationApi.js.map +1 -1
  122. package/common/ThemesDoc.js +57 -44
  123. package/common/ThemesDoc.js.map +1 -1
  124. package/common/chartingUtils.js +52 -20
  125. package/common/chartingUtils.js.map +1 -1
  126. package/common/docUtils.js +139 -7
  127. package/common/docUtils.js.map +1 -1
  128. package/common/gaugeUtils.js +185 -102
  129. package/common/gaugeUtils.js.map +1 -1
  130. package/common/shapeUtils.js +28 -16
  131. package/common/shapeUtils.js.map +1 -1
  132. package/common/utils/configUtils.js +50 -15
  133. package/common/utils/configUtils.js.map +1 -1
  134. package/common/utils/dataUtils.js +8 -3
  135. package/common/utils/dataUtils.js.map +1 -1
  136. package/common/utils/hocUtils.js +4 -2
  137. package/common/utils/hocUtils.js.map +1 -1
  138. package/common/utils/layoutUtils.js +2 -1
  139. package/common/utils/layoutUtils.js.map +1 -1
  140. package/common/utils/mapUtils.js +288 -128
  141. package/common/utils/mapUtils.js.map +1 -1
  142. package/common/utils/singleValueUtils.js +242 -197
  143. package/common/utils/singleValueUtils.js.map +1 -1
  144. package/common/utils/testHelper.js +10 -1
  145. package/common/utils/testHelper.js.map +1 -1
  146. package/common/utils/trellisUtils.js +62 -1
  147. package/common/utils/trellisUtils.js.map +1 -1
  148. package/common/utils/urlUtils.js +3 -1
  149. package/common/utils/urlUtils.js.map +1 -1
  150. package/common/withDashboardViz.js +389 -192
  151. package/common/withDashboardViz.js.map +1 -1
  152. package/package.json +18 -26
package/Area.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2018 Splunk Inc.
2
+ * Copyright © 2024 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
5
  */
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 177);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 178);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -133,6 +133,7 @@ Object.defineProperty(exports, "__esModule", {
133
133
  });
134
134
  exports.VizBehavior = void 0;
135
135
  var VizBehavior;
136
+
136
137
  (function (VizBehavior) {
137
138
  /**
138
139
  * Dynamic Options Behavior.
@@ -152,6 +153,7 @@ var VizBehavior;
152
153
  * missing.
153
154
  * @type {string}
154
155
  */
156
+
155
157
  VizBehavior["PLACEHOLDER"] = "placeholder";
156
158
  VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
157
159
  VizBehavior["TRELLIS"] = "trellis";
@@ -203,11 +205,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
203
205
  Object.defineProperty(exports, "__esModule", {
204
206
  value: true
205
207
  });
208
+
206
209
  var React = __webpack_require__(1);
210
+
207
211
  var styled_components_1 = __webpack_require__(4);
212
+
208
213
  var SizeAwareWrapper_1 = __webpack_require__(19);
214
+
209
215
  var style_1 = __webpack_require__(14);
216
+
210
217
  var colorUtils_1 = __webpack_require__(12);
218
+
211
219
  var Item = styled_components_1.default.div.attrs(function (_ref) {
212
220
  var width = _ref.width;
213
221
  return {
@@ -220,11 +228,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
220
228
  componentId: "sc-1yhgpod-0"
221
229
  })(["position:relative;background-color:", "};"], function (props) {
222
230
  return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
223
- });
224
- // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
231
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
232
+
225
233
  var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
226
234
  var width = _ref2.width,
227
- height = _ref2.height;
235
+ height = _ref2.height;
228
236
  return {
229
237
  style: Object.assign(Object.assign({}, width && {
230
238
  width: (0, style_1.toPx)(width)
@@ -246,11 +254,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
246
254
  displayName: "FixedSizeContainer__FixSizeItemContent",
247
255
  componentId: "sc-1yhgpod-3"
248
256
  })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
257
+
249
258
  var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
250
259
  var FixedSizeContainer = function FixedSizeContainer(props) {
251
260
  var width = props.width,
252
- height = props.height,
253
- backgroundColor = props.backgroundColor;
261
+ height = props.height,
262
+ backgroundColor = props.backgroundColor;
263
+
254
264
  if (!height) {
255
265
  return React.createElement(Item, {
256
266
  "data-test": "item",
@@ -258,24 +268,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
258
268
  backgroundColor: backgroundColor
259
269
  }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
260
270
  }
271
+
261
272
  return React.createElement(FixSizeItem, {
262
273
  "data-test": "fix-size-item",
263
- "data-splunk-visualization-version": "26.0.0 - 2f7458907",
274
+ "data-splunk-visualization-version": "26.1.1 - b6df0a015",
264
275
  width: width,
265
276
  height: height,
266
277
  backgroundColor: backgroundColor
267
278
  }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
268
279
  var newWidth = _ref3.width,
269
- newHeight = _ref3.height;
280
+ newHeight = _ref3.height;
270
281
  return React.createElement(Viz, Object.assign({}, props, {
271
282
  width: newWidth,
272
283
  height: newHeight
273
284
  }));
274
285
  })));
275
286
  };
287
+
276
288
  FixedSizeContainer.displayName = 'withFixedSizeContainer';
277
289
  return FixedSizeContainer;
278
290
  };
291
+
279
292
  exports.default = withFixedSizeContainer;
280
293
 
281
294
  /***/ }),
@@ -301,9 +314,10 @@ exports.extendStaticWrapperProps = void 0;
301
314
  * @param {DashboardVizType} props.Wrapper
302
315
  * @param {DashboardVizType} props.Visualization
303
316
  */
317
+
304
318
  var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
305
319
  var Wrapper = _ref.Wrapper,
306
- Visualization = _ref.Visualization;
320
+ Visualization = _ref.Visualization;
307
321
  var extendProperties = ['propTypes', 'defaultProps', 'config'];
308
322
  extendProperties.forEach(function (prop) {
309
323
  if (Visualization[prop]) {
@@ -312,6 +326,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
312
326
  }
313
327
  });
314
328
  };
329
+
315
330
  exports.extendStaticWrapperProps = extendStaticWrapperProps;
316
331
 
317
332
  /***/ }),
@@ -346,24 +361,33 @@ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
346
361
 
347
362
 
348
363
  var _toConsumableArray = __webpack_require__(8);
364
+
349
365
  var _defineProperty = __webpack_require__(7);
366
+
350
367
  var __rest = this && this.__rest || function (s, e) {
351
368
  var t = {};
369
+
352
370
  for (var p in s) {
353
371
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
354
372
  }
373
+
355
374
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
356
375
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
357
376
  }
358
377
  return t;
359
378
  };
379
+
360
380
  Object.defineProperty(exports, "__esModule", {
361
381
  value: true
362
382
  });
363
383
  exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
384
+
364
385
  var lodash_1 = __webpack_require__(3);
386
+
365
387
  var schemaUtils_1 = __webpack_require__(16);
388
+
366
389
  var VizBehavior_1 = __webpack_require__(6);
390
+
367
391
  var dynamicOptionsDSLType = {
368
392
  type: 'string',
369
393
  pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
@@ -373,20 +397,22 @@ var dynamicOptionsDSLType = {
373
397
  * @param optionsSchema a visualization's options schema
374
398
  * @returns an updated options schema that additionally allows strings starting with > for each option
375
399
  */
400
+
376
401
  function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
377
402
  var enhancedOptionsSchema = {};
378
403
  Object.keys(optionsSchema).forEach(function (key) {
379
404
  var _a = optionsSchema[key],
380
- title = _a.title,
381
- description = _a.description,
382
- readOnly = _a.readOnly,
383
- writeOnly = _a.writeOnly,
384
- examples = _a.examples,
385
- defaultValue = _a.default,
386
- type = _a.type,
387
- properties = _a.properties,
388
- patternProperties = _a.patternProperties,
389
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
405
+ title = _a.title,
406
+ description = _a.description,
407
+ readOnly = _a.readOnly,
408
+ writeOnly = _a.writeOnly,
409
+ examples = _a.examples,
410
+ defaultValue = _a.default,
411
+ type = _a.type,
412
+ properties = _a.properties,
413
+ patternProperties = _a.patternProperties,
414
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
415
+
390
416
  var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
391
417
  title: title
392
418
  }), description !== undefined && {
@@ -400,12 +426,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
400
426
  }), defaultValue !== undefined && {
401
427
  default: defaultValue
402
428
  });
429
+
403
430
  if (type === 'object') {
404
431
  enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
405
432
  type: type
406
433
  }), properties && {
407
434
  properties: enhanceOptionsSchemaWithDynamicOptions(properties)
408
435
  });
436
+
409
437
  if (patternProperties) {
410
438
  var enhancedPatternProperties = {};
411
439
  Object.keys(patternProperties).forEach(function (opt) {
@@ -423,6 +451,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
423
451
  });
424
452
  return enhancedOptionsSchema;
425
453
  }
454
+
426
455
  exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
427
456
  /**
428
457
  * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
@@ -431,11 +460,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
431
460
  * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
432
461
  * and containing `open: false` for all editor panels in editorConfig
433
462
  */
463
+
434
464
  function enhanceConfig(vizConfig) {
435
465
  var enhancedConfig = Object.assign({}, vizConfig);
466
+
436
467
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
437
468
  enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
438
469
  }
470
+
439
471
  enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
440
472
  return Object.assign(Object.assign({}, config), {
441
473
  open: config.open || false
@@ -443,6 +475,7 @@ function enhanceConfig(vizConfig) {
443
475
  });
444
476
  return enhancedConfig;
445
477
  }
478
+
446
479
  exports.enhanceConfig = enhanceConfig;
447
480
  /**
448
481
  * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
@@ -450,6 +483,7 @@ exports.enhanceConfig = enhanceConfig;
450
483
  * @param vizConfig a Visualization Config
451
484
  * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
452
485
  */
486
+
453
487
  function uncollapseEditorConfig(vizConfig) {
454
488
  var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
455
489
  editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
@@ -459,13 +493,16 @@ function uncollapseEditorConfig(vizConfig) {
459
493
  });
460
494
  return editorPanelUncollapsedConfig;
461
495
  }
496
+
462
497
  exports.uncollapseEditorConfig = uncollapseEditorConfig;
498
+
463
499
  function isDynamicOption(option) {
464
500
  return option && typeof option === 'string' && option.trim().startsWith('>') || false;
465
501
  }
466
- exports.isDynamicOption = isDynamicOption;
467
- // private helpers to improve readability of getInitialPreset
502
+
503
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
468
504
  // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
505
+
469
506
  /**
470
507
  * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
471
508
  * if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
@@ -474,6 +511,7 @@ exports.isDynamicOption = isDynamicOption;
474
511
  *
475
512
  * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
476
513
  */
514
+
477
515
  function hasCompatibleContexts(vizContext, presetContext) {
478
516
  var presetContextKeys = Object.keys(presetContext);
479
517
  return presetContextKeys.every(function (contextKey) {
@@ -483,6 +521,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
483
521
  /**
484
522
  * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
485
523
  */
524
+
525
+
486
526
  function hasCompatibleOptions(vizOptions, presetOptions) {
487
527
  var presetOptionKeys = Object.keys(presetOptions);
488
528
  return presetOptionKeys.every(function (optionKey) {
@@ -497,18 +537,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
497
537
  * @param {Object} vizOptions - the current vizOptions definition
498
538
  * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
499
539
  */
540
+
541
+
500
542
  function getInitialPreset(vizContext, vizOptions, presets) {
501
543
  return presets.find(function (preset) {
502
544
  var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
503
545
  var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
504
546
  var presetContextKeys = Object.keys(presetContext);
505
- var presetOptionKeys = Object.keys(presetOptions);
506
- // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
547
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
507
548
  // if not, then the preset is invalid in config.ts
549
+
508
550
  if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
509
551
  return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
510
552
  });
511
553
  }
554
+
512
555
  exports.getInitialPreset = getInitialPreset;
513
556
  /**
514
557
  * generates number precision values for a Select editor
@@ -516,6 +559,7 @@ exports.getInitialPreset = getInitialPreset;
516
559
  * @param {Number} numPrecisionValues - number of integer precision values to generate
517
560
  * @returns {{ label: string; value; string }[]} array of { label, value } tuples
518
561
  */
562
+
519
563
  function generatePrecisionValues(numPrecisionValues) {
520
564
  return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
521
565
  return {
@@ -524,6 +568,7 @@ function generatePrecisionValues(numPrecisionValues) {
524
568
  };
525
569
  });
526
570
  }
571
+
527
572
  exports.generatePrecisionValues = generatePrecisionValues;
528
573
  /**
529
574
  * insert layout in layout array, return a new layout array instead of updating the original
@@ -533,12 +578,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
533
578
  * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
534
579
  * @returns {EditorLayoutConfig[][]} new editor layout with insertion
535
580
  */
581
+
536
582
  var insertLayout = function insertLayout(layout, index) {
537
583
  for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
538
584
  layoutItems[_key - 2] = arguments[_key];
539
585
  }
586
+
540
587
  return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
541
588
  };
589
+
542
590
  exports.insertLayout = insertLayout;
543
591
 
544
592
  /***/ }),
@@ -603,11 +651,17 @@ Object.defineProperty(exports, "__esModule", {
603
651
  value: true
604
652
  });
605
653
  exports.shouldShowIconPlaceholder = void 0;
654
+
606
655
  var React = __webpack_require__(1);
656
+
607
657
  var T = __webpack_require__(0);
658
+
608
659
  var lodash_1 = __webpack_require__(3);
660
+
609
661
  var i18n_1 = __webpack_require__(2);
662
+
610
663
  var Message_1 = __webpack_require__(10);
664
+
611
665
  var FixedSizeContainer_1 = __webpack_require__(13);
612
666
  /**
613
667
  * @method shouldShowIconPlaceholder
@@ -615,6 +669,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
615
669
  * @param {boolean} loading
616
670
  * @returns {boolean}
617
671
  */
672
+
673
+
618
674
  var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
619
675
  var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
620
676
  var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
@@ -623,6 +679,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
623
679
  var noFields = fields === undefined;
624
680
  return loading || noData || noFields;
625
681
  };
682
+
626
683
  exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
627
684
  var propTypes = {
628
685
  icon: T.func,
@@ -637,11 +694,13 @@ var propTypes = {
637
694
  * @param {IconPlaceholderProps} props
638
695
  * @returns {React.ReactElement}
639
696
  */
697
+
640
698
  var IconPlaceholder = function IconPlaceholder(props) {
641
699
  var width = props.width,
642
- height = props.height,
643
- icon = props.icon,
644
- iconColor = props.iconColor;
700
+ height = props.height,
701
+ icon = props.icon,
702
+ iconColor = props.iconColor;
703
+
645
704
  if (icon) {
646
705
  return React.createElement(icon, {
647
706
  style: {
@@ -653,9 +712,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
653
712
  transform: 'translate(-50%, -50%)'
654
713
  },
655
714
  width: '50%',
656
- height: '50%'
715
+ height: '50%',
716
+ 'data-test': 'icon-placeholder'
657
717
  });
658
718
  }
719
+
659
720
  return React.createElement(Message_1.default, {
660
721
  width: width,
661
722
  height: height,
@@ -663,6 +724,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
663
724
  message: (0, i18n_1._)('No DataSource Connected')
664
725
  });
665
726
  };
727
+
666
728
  IconPlaceholder.propTypes = propTypes;
667
729
  IconPlaceholder.defaultProps = {
668
730
  width: '100%',
@@ -678,21 +740,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
678
740
 
679
741
 
680
742
  var _defineProperty = __webpack_require__(7);
743
+
681
744
  Object.defineProperty(exports, "__esModule", {
682
745
  value: true
683
746
  });
684
747
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
748
+
685
749
  var T = __webpack_require__(0);
750
+
686
751
  var lodash_1 = __webpack_require__(3);
687
- var DataSource_1 = __webpack_require__(43);
752
+
753
+ var DataSource_1 = __webpack_require__(34);
754
+
688
755
  exports.SortParamsPropTypes = T.shape({
689
756
  currentSortKey: T.string,
690
757
  currentSortDir: T.oneOf(DataSource_1.validSortDirs),
691
758
  onSort: T.func
692
759
  });
760
+
693
761
  var getSortingParams = function getSortingParams(_ref) {
694
762
  var requestParams = _ref.requestParams,
695
- onRequestParamsChange = _ref.onRequestParamsChange;
763
+ onRequestParamsChange = _ref.onRequestParamsChange;
696
764
  var currentSortKey;
697
765
  var currentSortDir;
698
766
  var nextSortDirMap = {
@@ -701,15 +769,18 @@ var getSortingParams = function getSortingParams(_ref) {
701
769
  none: 'asc'
702
770
  };
703
771
  var onSort;
772
+
704
773
  if (typeof onRequestParamsChange === 'function') {
705
774
  if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
706
775
  currentSortKey = Object.keys(requestParams.sort).shift();
707
776
  currentSortDir = requestParams.sort[currentSortKey];
708
- }
709
- // undid memoization since there is a dependency on requestParams, which is a deeply nested object
777
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
778
+
779
+
710
780
  onSort = function onSort(e, _ref2) {
711
781
  var sortKey = _ref2.sortKey,
712
- sortDir = _ref2.sortDir;
782
+ sortDir = _ref2.sortDir;
783
+
713
784
  if (typeof sortKey === 'string') {
714
785
  var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
715
786
  onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
@@ -721,12 +792,14 @@ var getSortingParams = function getSortingParams(_ref) {
721
792
  }
722
793
  };
723
794
  }
795
+
724
796
  return {
725
797
  currentSortKey: currentSortKey,
726
798
  currentSortDir: currentSortDir,
727
799
  onSort: onSort
728
800
  };
729
801
  };
802
+
730
803
  exports.getSortingParams = getSortingParams;
731
804
 
732
805
  /***/ }),
@@ -736,43 +809,68 @@ exports.getSortingParams = getSortingParams;
736
809
  "use strict";
737
810
 
738
811
 
812
+ Object.defineProperty(exports, "__esModule", {
813
+ value: true
814
+ });
815
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
816
+ exports.validSortDirs = ['asc', 'desc', 'none'];
817
+ exports.validSegmentationModes = ['none', 'inner'];
818
+ exports.validOutputModes = ['json_cols', 'json'];
819
+
820
+ /***/ }),
821
+ /* 35 */
822
+ /***/ (function(module, exports, __webpack_require__) {
823
+
824
+ "use strict";
825
+
826
+
739
827
  Object.defineProperty(exports, "__esModule", {
740
828
  value: true
741
829
  });
742
830
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
831
+
743
832
  var T = __webpack_require__(0);
833
+
744
834
  var lodash_1 = __webpack_require__(3);
835
+
745
836
  exports.PaginatorParamsPropTypes = T.shape({
746
837
  isPaging: T.bool,
747
838
  current: T.number,
748
839
  totalPages: T.number,
749
840
  onChange: T.func
750
841
  });
842
+
751
843
  var getPaginationParams = function getPaginationParams(_ref) {
752
844
  var requestParams = _ref.requestParams,
753
- meta = _ref.meta,
754
- onRequestParamsChange = _ref.onRequestParamsChange;
845
+ meta = _ref.meta,
846
+ onRequestParamsChange = _ref.onRequestParamsChange;
755
847
  var totalCount = meta && meta.totalCount || 0;
756
848
  var offset = requestParams && requestParams.offset || 0;
757
849
  var count = requestParams && requestParams.count;
758
850
  var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
759
851
  var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
760
852
  var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
853
+
761
854
  var onChangeHandler = function onChangeHandler(e, _ref2) {
762
855
  var page = _ref2.page,
763
- countArg = _ref2.count;
856
+ countArg = _ref2.count;
764
857
  var newParams = (0, lodash_1.cloneDeep)(requestParams);
858
+
765
859
  if (typeof countArg === 'number') {
766
860
  newParams.count = countArg;
767
861
  newParams.offset = 0;
768
862
  }
863
+
769
864
  var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
865
+
770
866
  if (typeof page === 'number' && page > 0) {
771
867
  newParams.count = pageCount;
772
868
  newParams.offset = (page - 1) * pageCount;
773
869
  }
870
+
774
871
  onRequestParamsChange(newParams);
775
872
  };
873
+
776
874
  return {
777
875
  isPaging: isPaging,
778
876
  current: current,
@@ -780,10 +878,11 @@ var getPaginationParams = function getPaginationParams(_ref) {
780
878
  onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
781
879
  };
782
880
  };
881
+
783
882
  exports.getPaginationParams = getPaginationParams;
784
883
 
785
884
  /***/ }),
786
- /* 35 */
885
+ /* 36 */
787
886
  /***/ (function(module, exports, __webpack_require__) {
788
887
 
789
888
  "use strict";
@@ -794,6 +893,7 @@ Object.defineProperty(exports, "__esModule", {
794
893
  });
795
894
  exports.VizCategory = void 0;
796
895
  var VizCategory;
896
+
797
897
  (function (VizCategory) {
798
898
  VizCategory["SINGLE_VALUE"] = "Single Value";
799
899
  VizCategory["TRENDS"] = "Trends";
@@ -810,67 +910,96 @@ var VizCategory;
810
910
  })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
811
911
 
812
912
  /***/ }),
813
- /* 36 */
913
+ /* 37 */
814
914
  /***/ (function(module, exports, __webpack_require__) {
815
915
 
816
916
  "use strict";
817
917
 
818
918
 
819
919
  var _slicedToArray = __webpack_require__(17);
920
+
820
921
  Object.defineProperty(exports, "__esModule", {
821
922
  value: true
822
923
  });
924
+
823
925
  var React = __webpack_require__(1);
926
+
824
927
  var lodash_1 = __webpack_require__(3);
825
- var getSettingsFromThemedProps_1 = __webpack_require__(37);
928
+
929
+ var getSettingsFromThemedProps_1 = __webpack_require__(38);
930
+
826
931
  var Options_1 = __webpack_require__(30);
827
- var SanitizeProps_1 = __webpack_require__(38);
932
+
933
+ var SanitizeProps_1 = __webpack_require__(39);
934
+
828
935
  var TimezoneContext_1 = __webpack_require__(26);
829
- var moment_1 = __webpack_require__(39);
936
+
937
+ var moment_1 = __webpack_require__(40);
938
+
830
939
  var FeatureFlagContext_1 = __webpack_require__(21);
940
+
831
941
  var styled_components_1 = __webpack_require__(4);
942
+
832
943
  var hocUtils_1 = __webpack_require__(27);
944
+
833
945
  var JSONSchemaUtils_1 = __webpack_require__(28);
834
- var async_dynamic_options_evaluator_1 = __webpack_require__(40);
946
+
947
+ var async_dynamic_options_evaluator_1 = __webpack_require__(41);
948
+
835
949
  var id_1 = __webpack_require__(25);
836
- var SplunkVisualization_1 = __webpack_require__(41);
950
+
951
+ var SplunkVisualization_1 = __webpack_require__(42);
952
+
837
953
  var VizBehavior_1 = __webpack_require__(6);
954
+
838
955
  var getSorting_1 = __webpack_require__(33);
839
- var getPagination_1 = __webpack_require__(34);
956
+
957
+ var getPagination_1 = __webpack_require__(35);
958
+
840
959
  var useDeepMemo_1 = __webpack_require__(44);
960
+
841
961
  var MissingPropsMessage_1 = __webpack_require__(45);
962
+
842
963
  var withEditModeCover_1 = __webpack_require__(46);
964
+
843
965
  var withPlaceholder_1 = __webpack_require__(47);
844
966
  /**
845
967
  * hoc that wraps a pure react visualization in a Dashboard visualization
846
968
  * @param {DashboardVizOpts} opts
847
969
  * @returns {HOC}
848
970
  */
971
+
972
+
849
973
  var withDashboardViz = function withDashboardViz(opts) {
850
974
  var ReactViz = opts.ReactViz,
851
- vizConfig = opts.vizConfig,
852
- _opts$computeVizProps = opts.computeVizProps,
853
- computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
854
- disableEditModeCover = opts.disableEditModeCover,
855
- useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
975
+ vizConfig = opts.vizConfig,
976
+ _opts$computeVizProps = opts.computeVizProps,
977
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
978
+ disableEditModeCover = opts.disableEditModeCover,
979
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
980
+
856
981
  var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
857
982
  var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
983
+
858
984
  var DashboardViz = function DashboardViz(props) {
859
985
  var _a;
986
+
860
987
  var mode = props.mode,
861
- hasEventHandlers = props.hasEventHandlers,
862
- dataSources = props.dataSources,
863
- options = props.options,
864
- _props$context = props.context,
865
- context = _props$context === void 0 ? {} : _props$context,
866
- width = props.width,
867
- height = props.height,
868
- onComputedProps = props.onComputedProps,
869
- onEventTrigger = props.onEventTrigger,
870
- theme = props.theme,
871
- onRequestParamsChange = props.onRequestParamsChange;
988
+ hasEventHandlers = props.hasEventHandlers,
989
+ dataSources = props.dataSources,
990
+ options = props.options,
991
+ _props$context = props.context,
992
+ context = _props$context === void 0 ? {} : _props$context,
993
+ width = props.width,
994
+ height = props.height,
995
+ onComputedProps = props.onComputedProps,
996
+ onEventTrigger = props.onEventTrigger,
997
+ theme = props.theme,
998
+ onRequestParamsChange = props.onRequestParamsChange;
999
+
872
1000
  var _React$useContext = React.useContext(TimezoneContext_1.default),
873
- serializedTimezone = _React$useContext.serializedTimezone;
1001
+ serializedTimezone = _React$useContext.serializedTimezone;
1002
+
874
1003
  if (serializedTimezone) {
875
1004
  /*
876
1005
  @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
@@ -884,38 +1013,51 @@ var withDashboardViz = function withDashboardViz(opts) {
884
1013
  moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
885
1014
  }
886
1015
  }
1016
+
887
1017
  var themeFunc = function themeFunc(themeVar) {
888
1018
  var _a, _b;
1019
+
889
1020
  return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
890
1021
  };
1022
+
891
1023
  var bgColorFromTheme = themeFunc('defaultBackgroundColor');
1024
+
892
1025
  var _ref = (0, getSettingsFromThemedProps_1.default)({
893
- theme: theme
894
- }),
895
- currentThemeFamily = _ref.family,
896
- currentThemeColorScheme = _ref.colorScheme,
897
- currentThemeDensity = _ref.density;
1026
+ theme: theme
1027
+ }),
1028
+ currentThemeFamily = _ref.family,
1029
+ currentThemeColorScheme = _ref.colorScheme,
1030
+ currentThemeDensity = _ref.density;
1031
+
898
1032
  var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
1033
+
899
1034
  var _React$useState = React.useState({}),
900
- _React$useState2 = _slicedToArray(_React$useState, 2),
901
- evaluatedOptionsAsync = _React$useState2[0],
902
- setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1035
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1036
+ evaluatedOptionsAsync = _React$useState2[0],
1037
+ setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1038
+
1039
+
903
1040
  var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
1041
+
904
1042
  var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
905
- _React$useState4 = _slicedToArray(_React$useState3, 1),
906
- visualizationID = _React$useState4[0];
1043
+ _React$useState4 = _slicedToArray(_React$useState3, 1),
1044
+ visualizationID = _React$useState4[0];
1045
+
907
1046
  var _React$useState5 = React.useState({}),
908
- _React$useState6 = _slicedToArray(_React$useState5, 2),
909
- dataSourcesInState = _React$useState6[0],
910
- setDataSourcesInState = _React$useState6[1];
1047
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
1048
+ dataSourcesInState = _React$useState6[0],
1049
+ setDataSourcesInState = _React$useState6[1];
1050
+
911
1051
  var _React$useState7 = React.useState(),
912
- _React$useState8 = _slicedToArray(_React$useState7, 2),
913
- dataFramesInState = _React$useState8[0],
914
- setDataFramesInState = _React$useState8[1];
1052
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
1053
+ dataFramesInState = _React$useState8[0],
1054
+ setDataFramesInState = _React$useState8[1];
1055
+
915
1056
  var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
916
- _React$useState10 = _slicedToArray(_React$useState9, 2),
917
- useAsyncEvaluatedOptions = _React$useState10[0],
918
- setUseAsyncEvaluatedOptions = _React$useState10[1];
1057
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
1058
+ useAsyncEvaluatedOptions = _React$useState10[0],
1059
+ setUseAsyncEvaluatedOptions = _React$useState10[1];
1060
+
919
1061
  var isMounted = React.useRef(true);
920
1062
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
921
1063
  try {
@@ -940,11 +1082,13 @@ var withDashboardViz = function withDashboardViz(opts) {
940
1082
  });
941
1083
  } else {
942
1084
  var dataFrames = dataFramesInState;
1085
+
943
1086
  if (dataSources !== dataSourcesInState) {
944
1087
  setDataSourcesInState(dataSources);
945
1088
  dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
946
1089
  setDataFramesInState(dataFrames);
947
1090
  }
1091
+
948
1092
  return Options_1.Options.evaluate({
949
1093
  context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
950
1094
  options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
@@ -955,21 +1099,24 @@ var withDashboardViz = function withDashboardViz(opts) {
955
1099
  console.error("unexpected error evaluating options: ".concat(e.message));
956
1100
  return {};
957
1101
  }
1102
+
958
1103
  return {};
959
1104
  }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
960
- var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
961
- // trellis specific backgroundColor update for onComputedProps
1105
+ var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
962
1106
  // 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
963
1107
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
1108
+
964
1109
  var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
965
1110
  var clonedEvaluatedOptions = evaluatedOptionsToUse;
1111
+
966
1112
  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) {
967
1113
  clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
968
1114
  backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
969
1115
  });
970
- }
971
- // useEffect hook needs to be initialized before any early returns
1116
+ } // useEffect hook needs to be initialized before any early returns
972
1117
  // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
1118
+
1119
+
973
1120
  React.useEffect(function () {
974
1121
  onComputedProps(clonedEvaluatedOptions);
975
1122
  });
@@ -979,53 +1126,68 @@ var withDashboardViz = function withDashboardViz(opts) {
979
1126
  isMounted.current = false;
980
1127
  async_dynamic_options_evaluator_1.default.reset(visualizationID);
981
1128
  }
982
- };
983
- // eslint-disable-next-line react-hooks/exhaustive-deps
984
- }, []);
985
- // present warning message if any required props are missing
1129
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
1130
+ }, []); // present warning message if any required props are missing
1131
+
986
1132
  var _vizConfig$requiredPr = vizConfig.requiredProps,
987
- requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
988
- supports = vizConfig.supports;
1133
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1134
+ supports = vizConfig.supports;
989
1135
  var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
1136
+
990
1137
  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
991
1138
  ) {
992
- return React.createElement(MissingPropsMessage_1.default, {
993
- "data-test": "missing-props-message",
994
- width: width,
995
- height: height,
996
- missingProps: missing,
997
- backgroundColor: bgColorFromTheme
998
- });
999
- }
1000
- // events
1139
+ return React.createElement(MissingPropsMessage_1.default, {
1140
+ "data-test": "missing-props-message",
1141
+ width: width,
1142
+ height: height,
1143
+ missingProps: missing,
1144
+ backgroundColor: bgColorFromTheme
1145
+ });
1146
+ } // events
1147
+
1148
+
1001
1149
  var eventCallbackProps = {};
1150
+
1002
1151
  if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
1003
1152
  var supportedEvents = vizConfig.events;
1004
1153
  Object.keys(supportedEvents).forEach(function (eventName) {
1005
- var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
1006
- eventCallbackProps[eventCallbackPropName] = null;
1007
- // todo: refactor single value and single value icon to send payload from viz
1154
+ var _supportedEvents$even = supportedEvents[eventName],
1155
+ parentKeys = _supportedEvents$even.parentKeys,
1156
+ payloadKeys = _supportedEvents$even.payloadKeys;
1157
+ var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
1008
1158
  // then remove these lines
1009
- var payloadKeys = supportedEvents[eventName].payloadKeys;
1159
+
1010
1160
  var payload = {};
1161
+
1011
1162
  if (Array.isArray(payloadKeys) && payloadKeys.length) {
1012
1163
  payloadKeys.forEach(function (p) {
1013
1164
  payload[p] = evaluatedOptionsToUse[p];
1014
1165
  });
1015
1166
  }
1167
+
1016
1168
  eventCallbackProps[eventCallbackPropName] = function (ev) {
1017
1169
  if (ev && ev.payload) {
1018
1170
  payload = ev.payload;
1019
1171
  }
1172
+
1020
1173
  return onEventTrigger({
1021
1174
  originalEvent: ev,
1022
1175
  payload: payload,
1023
1176
  type: eventName
1024
1177
  });
1025
1178
  };
1179
+
1180
+ if (parentKeys) {
1181
+ for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
1182
+ var newObject = {};
1183
+ newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
1184
+ eventCallbackProps[eventCallbackPropName] = newObject;
1185
+ }
1186
+ }
1026
1187
  });
1027
- }
1028
- // compute pure viz props which are not from options
1188
+ } // compute pure viz props which are not from options
1189
+
1190
+
1029
1191
  var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
1030
1192
  themeFunc: themeFunc
1031
1193
  }));
@@ -1043,15 +1205,19 @@ var withDashboardViz = function withDashboardViz(opts) {
1043
1205
  * In future, we could automatically detect which all datasources are being used
1044
1206
  * and bind those magically to pagination/sorting behavior.
1045
1207
  */
1208
+
1046
1209
  var dataSourceMetadata = {};
1047
1210
  var OptionKey = 'paginateDataSourceKey';
1048
1211
  var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
1212
+
1049
1213
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
1050
1214
  var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
1051
1215
  var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
1216
+
1052
1217
  var handleRequestParamsChange = function handleRequestParamsChange(payload) {
1053
1218
  return onRequestParamsChange(paginateDataSourceKey, payload);
1054
1219
  };
1220
+
1055
1221
  var sortParams = (0, getSorting_1.getSortingParams)({
1056
1222
  requestParams: requestParams,
1057
1223
  meta: meta,
@@ -1066,103 +1232,120 @@ var withDashboardViz = function withDashboardViz(opts) {
1066
1232
  sortParams: sortParams,
1067
1233
  paginatorParams: paginatorParams
1068
1234
  };
1069
- }
1070
- // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
1235
+ } // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
1236
+
1237
+
1071
1238
  if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
1072
1239
  return null;
1073
1240
  }
1241
+
1074
1242
  return React.createElement(SanitizedReactViz, Object.assign({
1075
1243
  mode: mode,
1076
1244
  width: width,
1077
1245
  height: height
1078
1246
  }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1079
1247
  };
1248
+
1080
1249
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
1081
1250
  DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
1082
1251
  // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
1083
1252
  theme: {}
1084
- });
1085
- // attach viz config
1086
- DashboardViz.config = vizConfig;
1087
- // @ts-ignore: TODO fix sc upgrade TS issues
1253
+ }); // attach viz config
1254
+
1255
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1256
+
1088
1257
  return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
1089
1258
  };
1259
+
1090
1260
  exports.default = withDashboardViz;
1091
1261
 
1092
1262
  /***/ }),
1093
- /* 37 */
1263
+ /* 38 */
1094
1264
  /***/ (function(module, exports) {
1095
1265
 
1096
1266
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1097
1267
 
1098
1268
  /***/ }),
1099
- /* 38 */
1269
+ /* 39 */
1100
1270
  /***/ (function(module, exports) {
1101
1271
 
1102
1272
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1103
1273
 
1104
1274
  /***/ }),
1105
- /* 39 */
1275
+ /* 40 */
1106
1276
  /***/ (function(module, exports) {
1107
1277
 
1108
1278
  module.exports = require("@splunk/moment");
1109
1279
 
1110
1280
  /***/ }),
1111
- /* 40 */
1281
+ /* 41 */
1112
1282
  /***/ (function(module, exports) {
1113
1283
 
1114
1284
  module.exports = require("@splunk/async-dynamic-options-evaluator");
1115
1285
 
1116
1286
  /***/ }),
1117
- /* 41 */
1287
+ /* 42 */
1118
1288
  /***/ (function(module, exports, __webpack_require__) {
1119
1289
 
1120
1290
  "use strict";
1121
1291
 
1122
1292
 
1123
1293
  var _classCallCheck = __webpack_require__(9);
1294
+
1124
1295
  Object.defineProperty(exports, "__esModule", {
1125
1296
  value: true
1126
1297
  });
1127
1298
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1128
1299
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1300
+
1129
1301
  var T = __webpack_require__(0);
1302
+
1130
1303
  var lodash_1 = __webpack_require__(3);
1131
- var VizActionHandler_1 = __webpack_require__(42);
1132
- // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1304
+
1305
+ var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1306
+
1307
+
1133
1308
  exports.INITIAL_WIDTH = 250;
1134
1309
  exports.INITIAL_HEIGHT = 250;
1135
1310
  /**
1136
1311
  * A Splunk visualization
1137
1312
  */
1313
+
1138
1314
  var SplunkVisualization = function SplunkVisualization() {
1139
1315
  _classCallCheck(this, SplunkVisualization);
1140
1316
  };
1317
+
1141
1318
  SplunkVisualization.propTypes = {
1142
1319
  /**
1143
1320
  * display mode
1144
1321
  */
1145
1322
  mode: T.oneOf(['view', 'edit', 'export']).isRequired,
1323
+
1146
1324
  /**
1147
1325
  * width in pixel or string, defaults to 100%
1148
1326
  */
1149
1327
  width: T.oneOfType([T.string, T.number]).isRequired,
1328
+
1150
1329
  /**
1151
1330
  * height in pixel or string
1152
1331
  */
1153
1332
  height: T.oneOfType([T.string, T.number]).isRequired,
1333
+
1154
1334
  /**
1155
1335
  * visualization context used for dynamic option evaluation
1156
1336
  */
1157
1337
  context: T.object,
1338
+
1158
1339
  /**
1159
1340
  * visualization formatting options
1160
1341
  */
1161
1342
  options: T.object,
1343
+
1162
1344
  /**
1163
1345
  * A callback to update formatting options
1164
1346
  */
1165
1347
  onOptionsChange: T.func,
1348
+
1166
1349
  /**
1167
1350
  * datasource state which include data and request params, object key indicate the datasource type.
1168
1351
  */
@@ -1171,6 +1354,7 @@ SplunkVisualization.propTypes = {
1171
1354
  * current request params
1172
1355
  */
1173
1356
  requestParams: T.object,
1357
+
1174
1358
  /**
1175
1359
  * current dataset
1176
1360
  */
@@ -1178,6 +1362,7 @@ SplunkVisualization.propTypes = {
1178
1362
  fields: T.array,
1179
1363
  columns: T.array
1180
1364
  }),
1365
+
1181
1366
  /**
1182
1367
  * error
1183
1368
  */
@@ -1185,29 +1370,35 @@ SplunkVisualization.propTypes = {
1185
1370
  level: T.string,
1186
1371
  message: T.string
1187
1372
  }),
1373
+
1188
1374
  /**
1189
1375
  * meta data that came with the dataset
1190
1376
  */
1191
1377
  meta: T.object
1192
1378
  })),
1379
+
1193
1380
  /**
1194
1381
  * A callback to trigger event
1195
1382
  */
1196
1383
  onEventTrigger: T.func,
1384
+
1197
1385
  /**
1198
1386
  * Inform viz if there are handlers listening to events
1199
1387
  */
1200
1388
  hasEventHandlers: T.bool,
1389
+
1201
1390
  /**
1202
1391
  * A callback to communicate computed props to a consumer
1203
1392
  */
1204
1393
  onComputedProps: T.func,
1394
+
1205
1395
  /**
1206
1396
  * A callback to obtain visualization api
1207
1397
  */
1208
1398
  vizActionHandlerRef: T.func,
1209
1399
  loading: T.bool,
1210
1400
  theme: T.object,
1401
+
1211
1402
  /**
1212
1403
  * A callback to request new data with updated request params
1213
1404
  */
@@ -1216,6 +1407,7 @@ SplunkVisualization.propTypes = {
1216
1407
  /**
1217
1408
  *
1218
1409
  */
1410
+
1219
1411
  SplunkVisualization.defaultProps = {
1220
1412
  // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1221
1413
  width: '100%',
@@ -1243,26 +1435,29 @@ SplunkVisualization.defaultProps = {
1243
1435
  exports.default = SplunkVisualization;
1244
1436
 
1245
1437
  /***/ }),
1246
- /* 42 */
1438
+ /* 43 */
1247
1439
  /***/ (function(module, exports, __webpack_require__) {
1248
1440
 
1249
1441
  "use strict";
1250
1442
 
1251
1443
 
1252
1444
  var _classCallCheck = __webpack_require__(9);
1445
+
1253
1446
  var _createClass = __webpack_require__(18);
1447
+
1254
1448
  Object.defineProperty(exports, "__esModule", {
1255
1449
  value: true
1256
1450
  });
1257
1451
  exports.DefaultVizActionHandler = void 0;
1452
+
1258
1453
  var DefaultVizActionHandler = /*#__PURE__*/function () {
1259
1454
  function DefaultVizActionHandler() {
1260
1455
  _classCallCheck(this, DefaultVizActionHandler);
1261
1456
  }
1457
+
1262
1458
  _createClass(DefaultVizActionHandler, [{
1263
1459
  key: "focus",
1264
- value: function focus() {
1265
- // noop
1460
+ value: function focus() {// noop
1266
1461
  }
1267
1462
  }, {
1268
1463
  key: "snapshot",
@@ -1270,22 +1465,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
1270
1465
  return null; // noop
1271
1466
  }
1272
1467
  }]);
1468
+
1273
1469
  return DefaultVizActionHandler;
1274
1470
  }();
1275
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1276
-
1277
- /***/ }),
1278
- /* 43 */
1279
- /***/ (function(module, exports, __webpack_require__) {
1280
1471
 
1281
- "use strict";
1282
-
1283
-
1284
- Object.defineProperty(exports, "__esModule", {
1285
- value: true
1286
- });
1287
- exports.validSortDirs = void 0;
1288
- exports.validSortDirs = ['asc', 'desc', 'none'];
1472
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
1289
1473
 
1290
1474
  /***/ }),
1291
1475
  /* 44 */
@@ -1298,7 +1482,9 @@ Object.defineProperty(exports, "__esModule", {
1298
1482
  value: true
1299
1483
  });
1300
1484
  exports.useDeepMemo = void 0;
1485
+
1301
1486
  var react_1 = __webpack_require__(1);
1487
+
1302
1488
  var lodash_1 = __webpack_require__(3);
1303
1489
  /**
1304
1490
  * This hook evaluates and stores the result of a passed function and only
@@ -1313,16 +1499,21 @@ var lodash_1 = __webpack_require__(3);
1313
1499
  * @param fn the function to be executed and
1314
1500
  * @param dependencies an array of dependencies
1315
1501
  */
1502
+
1503
+
1316
1504
  var useDeepMemo = function useDeepMemo(fn, dependencies) {
1317
1505
  var ref = (0, react_1.useRef)();
1506
+
1318
1507
  if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
1319
1508
  ref.current = {
1320
1509
  dependencies: dependencies,
1321
1510
  value: fn()
1322
1511
  };
1323
1512
  }
1513
+
1324
1514
  return ref.current.value;
1325
1515
  };
1516
+
1326
1517
  exports.useDeepMemo = useDeepMemo;
1327
1518
 
1328
1519
  /***/ }),
@@ -1336,19 +1527,27 @@ Object.defineProperty(exports, "__esModule", {
1336
1527
  value: true
1337
1528
  });
1338
1529
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1530
+
1339
1531
  var React = __webpack_require__(1);
1532
+
1340
1533
  var T = __webpack_require__(0);
1534
+
1341
1535
  var i18n_1 = __webpack_require__(2);
1536
+
1342
1537
  var Message_1 = __webpack_require__(10);
1538
+
1343
1539
  var FixedSizeContainer_1 = __webpack_require__(13);
1344
1540
  /**
1345
1541
  * @method isMissing
1346
1542
  * @param {any} v
1347
1543
  * @returns {boolean} true if the input value === null or undefined
1348
1544
  */
1545
+
1546
+
1349
1547
  var isMissing = function isMissing(v) {
1350
1548
  return v === null || v === undefined;
1351
1549
  };
1550
+
1352
1551
  exports.isMissing = isMissing;
1353
1552
  /**
1354
1553
  * @method misskingKeys
@@ -1356,11 +1555,13 @@ exports.isMissing = isMissing;
1356
1555
  * @param {object} target
1357
1556
  * @returns {string[]} the keys of missing required props
1358
1557
  */
1558
+
1359
1559
  var missingKeys = function missingKeys(keys, target) {
1360
1560
  return keys.filter(function (k) {
1361
1561
  return (0, exports.isMissing)(target[k]);
1362
1562
  });
1363
1563
  };
1564
+
1364
1565
  exports.missingKeys = missingKeys;
1365
1566
  var propTypes = {
1366
1567
  width: T.oneOfType([T.string, T.number]),
@@ -1374,10 +1575,11 @@ var propTypes = {
1374
1575
  * @param {MissingPropsProps} props
1375
1576
  * @returns {React.ReactElement}
1376
1577
  */
1578
+
1377
1579
  var MissingPropsMessage = function MissingPropsMessage(props) {
1378
1580
  var width = props.width,
1379
- height = props.height,
1380
- missingProps = props.missingProps;
1581
+ height = props.height,
1582
+ missingProps = props.missingProps;
1381
1583
  return React.createElement(Message_1.default, {
1382
1584
  "data-test": "message",
1383
1585
  width: width,
@@ -1385,6 +1587,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
1385
1587
  message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
1386
1588
  });
1387
1589
  };
1590
+
1388
1591
  exports.MissingPropsMessage = MissingPropsMessage;
1389
1592
  exports.MissingPropsMessage.propTypes = propTypes;
1390
1593
  exports.MissingPropsMessage.defaultProps = {
@@ -1403,15 +1606,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
1403
1606
  Object.defineProperty(exports, "__esModule", {
1404
1607
  value: true
1405
1608
  });
1609
+
1406
1610
  var React = __webpack_require__(1);
1611
+
1407
1612
  var styled_components_1 = __webpack_require__(4);
1613
+
1408
1614
  var hocUtils_1 = __webpack_require__(15);
1615
+
1409
1616
  var Cover = styled_components_1.default.div.withConfig({
1410
1617
  displayName: "withEditModeCover__Cover",
1411
1618
  componentId: "sc-1gsbnxb-0"
1412
1619
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1413
1620
  var Blocker = styled_components_1.default.div.attrs({
1414
- 'data-splunk-visualization-version': "26.0.0 - 2f7458907"
1621
+ 'data-splunk-visualization-version': "26.1.1 - b6df0a015"
1415
1622
  }).withConfig({
1416
1623
  displayName: "withEditModeCover__Blocker",
1417
1624
  componentId: "sc-1gsbnxb-1"
@@ -1422,6 +1629,7 @@ var Blocker = styled_components_1.default.div.attrs({
1422
1629
  * @param {ExtendedDashViz} Visualization
1423
1630
  * @returns {ExtendedDashViz} Wrapper
1424
1631
  */
1632
+
1425
1633
  var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
1426
1634
  var Wrapper = function Wrapper(props) {
1427
1635
  var mode = props.mode;
@@ -1430,12 +1638,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1430
1638
  "data-test": "edit-mode-cover"
1431
1639
  }));
1432
1640
  };
1641
+
1433
1642
  (0, hocUtils_1.extendStaticWrapperProps)({
1434
1643
  Wrapper: Wrapper,
1435
1644
  Visualization: Visualization
1436
1645
  });
1437
1646
  return Wrapper;
1438
1647
  };
1648
+
1439
1649
  exports.default = withEditModeCover;
1440
1650
 
1441
1651
  /***/ }),
@@ -1448,27 +1658,37 @@ exports.default = withEditModeCover;
1448
1658
  Object.defineProperty(exports, "__esModule", {
1449
1659
  value: true
1450
1660
  });
1661
+
1451
1662
  var React = __webpack_require__(1);
1663
+
1452
1664
  var colorUtils_1 = __webpack_require__(12);
1665
+
1453
1666
  var variables_1 = __webpack_require__(11);
1667
+
1454
1668
  var IconPlaceholder_1 = __webpack_require__(32);
1669
+
1455
1670
  var VizBehavior_1 = __webpack_require__(6);
1671
+
1456
1672
  var hocUtils_1 = __webpack_require__(15);
1673
+
1457
1674
  var withPlaceholder = function withPlaceholder(Visualization) {
1458
1675
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
1459
1676
  var config = Visualization.config;
1460
1677
  var themes = config.themes;
1678
+
1461
1679
  var Wrapper = function Wrapper(props) {
1462
1680
  var _a, _b;
1681
+
1463
1682
  var dataSources = props.dataSources,
1464
- loading = props.loading,
1465
- options = props.options,
1466
- height = props.height,
1467
- width = props.width;
1683
+ loading = props.loading,
1684
+ options = props.options,
1685
+ height = props.height,
1686
+ width = props.width;
1468
1687
  var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
1469
1688
  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);
1470
1689
  var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
1471
1690
  var iconColor = variables_1.default.contentColorActive(props);
1691
+
1472
1692
  if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
1473
1693
  return React.createElement(IconPlaceholder_1.default, {
1474
1694
  "data-test": "icon-placeholder",
@@ -1479,14 +1699,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1479
1699
  iconColor: iconColor
1480
1700
  });
1481
1701
  }
1702
+
1482
1703
  return React.createElement(Visualization, Object.assign({}, props));
1483
1704
  };
1705
+
1484
1706
  (0, hocUtils_1.extendStaticWrapperProps)({
1485
1707
  Wrapper: Wrapper,
1486
1708
  Visualization: Visualization
1487
1709
  });
1488
1710
  return Wrapper;
1489
1711
  };
1712
+
1490
1713
  exports.default = withPlaceholder;
1491
1714
 
1492
1715
  /***/ }),
@@ -1519,11 +1742,13 @@ module.exports = require("@splunk/visualization-icons");
1519
1742
  Object.defineProperty(exports, "__esModule", {
1520
1743
  value: true
1521
1744
  });
1745
+
1522
1746
  var i18n_1 = __webpack_require__(2);
1747
+
1523
1748
  var background = function background(_ref) {
1524
1749
  var label = _ref.label,
1525
- themes = _ref.themes,
1526
- labelPosition = _ref.labelPosition;
1750
+ themes = _ref.themes,
1751
+ labelPosition = _ref.labelPosition;
1527
1752
  return [{
1528
1753
  label: (0, i18n_1._)(label || 'Background'),
1529
1754
  option: 'backgroundColor',
@@ -1534,6 +1759,7 @@ var background = function background(_ref) {
1534
1759
  }
1535
1760
  }];
1536
1761
  };
1762
+
1537
1763
  exports.default = background;
1538
1764
 
1539
1765
  /***/ }),
@@ -1545,26 +1771,37 @@ module.exports = require("@splunk/charting-bundle");
1545
1771
 
1546
1772
  /***/ }),
1547
1773
  /* 56 */
1774
+ /***/ (function(module, exports) {
1775
+
1776
+ module.exports = require("@splunk/themes/useSplunkTheme");
1777
+
1778
+ /***/ }),
1779
+ /* 57 */
1548
1780
  /***/ (function(module, exports, __webpack_require__) {
1549
1781
 
1550
1782
  "use strict";
1551
1783
 
1552
1784
 
1553
1785
  var _toConsumableArray = __webpack_require__(8);
1786
+
1554
1787
  var __rest = this && this.__rest || function (s, e) {
1555
1788
  var t = {};
1789
+
1556
1790
  for (var p in s) {
1557
1791
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1558
1792
  }
1793
+
1559
1794
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1560
1795
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1561
1796
  }
1562
1797
  return t;
1563
1798
  };
1799
+
1564
1800
  Object.defineProperty(exports, "__esModule", {
1565
1801
  value: true
1566
1802
  });
1567
1803
  exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
1804
+
1568
1805
  var lodash_1 = __webpack_require__(3);
1569
1806
  /**
1570
1807
  * Get formatted annotations
@@ -1575,10 +1812,12 @@ var lodash_1 = __webpack_require__(3);
1575
1812
  * @param {Array} options.annotationLabel
1576
1813
  * @returns {Array}
1577
1814
  */
1815
+
1816
+
1578
1817
  var getAnnotations = function getAnnotations(_ref) {
1579
1818
  var annotationX = _ref.annotationX,
1580
- annotationColor = _ref.annotationColor,
1581
- annotationLabel = _ref.annotationLabel;
1819
+ annotationColor = _ref.annotationColor,
1820
+ annotationLabel = _ref.annotationLabel;
1582
1821
  return annotationX && annotationX.length ? annotationX.map(function (timestamp, i) {
1583
1822
  return {
1584
1823
  color: annotationColor && annotationColor[i],
@@ -1587,6 +1826,7 @@ var getAnnotations = function getAnnotations(_ref) {
1587
1826
  };
1588
1827
  }) : [];
1589
1828
  };
1829
+
1590
1830
  exports.getAnnotations = getAnnotations;
1591
1831
  /**
1592
1832
  * Truncate the result set to given limit
@@ -1595,20 +1835,25 @@ exports.getAnnotations = getAnnotations;
1595
1835
  * @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']
1596
1836
  * @returns {Object}
1597
1837
  */
1838
+
1598
1839
  var truncateData = function truncateData(dataSet, truncationLimit) {
1599
1840
  if (!dataSet) {
1600
1841
  return null;
1601
1842
  }
1843
+
1602
1844
  var limit = parseInt(truncationLimit, 10);
1845
+
1603
1846
  if (!limit || limit <= 0) {
1604
1847
  return dataSet;
1605
1848
  }
1849
+
1606
1850
  var truncatedData = Object.assign({}, dataSet);
1607
1851
  truncatedData.columns = truncatedData.columns.map(function (columnData) {
1608
1852
  return columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData;
1609
1853
  });
1610
1854
  return truncatedData;
1611
1855
  };
1856
+
1612
1857
  exports.truncateData = truncateData;
1613
1858
  /**
1614
1859
  * Helper method to update the option values into the values that SC accepts
@@ -1616,12 +1861,14 @@ exports.truncateData = truncateData;
1616
1861
  * @param {Object} options
1617
1862
  * @returns {Object}
1618
1863
  */
1864
+
1619
1865
  var mapToValues = function mapToValues(optionValuesSCMapping) {
1620
1866
  return function (options) {
1621
1867
  var convertedOptions = Object.assign({}, options);
1622
1868
  Object.keys(optionValuesSCMapping).forEach(function (key) {
1623
1869
  if ((0, lodash_1.has)(options, key)) {
1624
1870
  var updatedValue = optionValuesSCMapping[key][options[key]];
1871
+
1625
1872
  if (!(0, lodash_1.isUndefined)(updatedValue)) {
1626
1873
  convertedOptions[key] = updatedValue;
1627
1874
  }
@@ -1630,6 +1877,7 @@ var mapToValues = function mapToValues(optionValuesSCMapping) {
1630
1877
  return convertedOptions;
1631
1878
  };
1632
1879
  };
1880
+
1633
1881
  exports.mapToValues = mapToValues;
1634
1882
  /**
1635
1883
  * Helper method to process options related to y2Fields
@@ -1637,18 +1885,23 @@ exports.mapToValues = mapToValues;
1637
1885
  * @param {Object} originalOptions
1638
1886
  * @returns {Object}
1639
1887
  */
1888
+
1640
1889
  var convertY2AxisOptions = function convertY2AxisOptions(_a) {
1641
1890
  var y2Fields = _a.y2Fields,
1642
- originalOptions = __rest(_a, ["y2Fields"]);
1891
+ originalOptions = __rest(_a, ["y2Fields"]);
1892
+
1643
1893
  var convertedOptions = Object.assign({}, originalOptions);
1894
+
1644
1895
  if (y2Fields) {
1645
1896
  convertedOptions['axisY2.enabled'] = true;
1646
1897
  convertedOptions['axisY2.fields'] = (0, lodash_1.isArray)(y2Fields) ? y2Fields.filter(function (name) {
1647
1898
  return name;
1648
1899
  }).join(',') : y2Fields;
1649
1900
  }
1901
+
1650
1902
  return convertedOptions;
1651
1903
  };
1904
+
1652
1905
  exports.convertY2AxisOptions = convertY2AxisOptions;
1653
1906
  /**
1654
1907
  * Helper method to format value for overlayFields
@@ -1656,9 +1909,11 @@ exports.convertY2AxisOptions = convertY2AxisOptions;
1656
1909
  * @param {Object} originalOptions
1657
1910
  * @returns {Object}
1658
1911
  */
1912
+
1659
1913
  var convertOverlayFields = function convertOverlayFields(originalOptions) {
1660
1914
  var convertedOptions = Object.assign({}, originalOptions);
1661
1915
  var overlayFields = originalOptions.overlayFields;
1916
+
1662
1917
  if (overlayFields) {
1663
1918
  convertedOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
1664
1919
  return field;
@@ -1666,17 +1921,21 @@ var convertOverlayFields = function convertOverlayFields(originalOptions) {
1666
1921
  return field.trim();
1667
1922
  }).join(',') : overlayFields;
1668
1923
  }
1924
+
1669
1925
  return convertedOptions;
1670
1926
  };
1927
+
1671
1928
  exports.convertOverlayFields = convertOverlayFields;
1672
1929
  /**
1673
1930
  * checks whether data is multi series data
1674
1931
  * @param {array} data array
1675
1932
  * @return {Boolean}
1676
1933
  */
1934
+
1677
1935
  var isMultiSeriesData = function isMultiSeriesData(data) {
1678
1936
  return Array.isArray(data) && Array.isArray(data[0]);
1679
1937
  };
1938
+
1680
1939
  exports.isMultiSeriesData = isMultiSeriesData;
1681
1940
  /**
1682
1941
  * checks whether data is multi series data and returns value as array
@@ -1684,19 +1943,22 @@ exports.isMultiSeriesData = isMultiSeriesData;
1684
1943
  * @param {*} value to return as array
1685
1944
  * @return {array}
1686
1945
  */
1946
+
1687
1947
  var toArrayForSeries = function toArrayForSeries(data, value) {
1688
1948
  return (0, exports.isMultiSeriesData)(data) ? value : [value];
1689
1949
  };
1950
+
1690
1951
  exports.toArrayForSeries = toArrayForSeries;
1952
+
1691
1953
  var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
1692
1954
  var _ref2$x = _ref2.x,
1693
- x = _ref2$x === void 0 ? [] : _ref2$x,
1694
- _ref2$y = _ref2.y,
1695
- y = _ref2$y === void 0 ? [] : _ref2$y,
1696
- xField = _ref2.xField,
1697
- yFields = _ref2.yFields,
1698
- y2 = _ref2.y2,
1699
- y2Fields = _ref2.y2Fields;
1955
+ x = _ref2$x === void 0 ? [] : _ref2$x,
1956
+ _ref2$y = _ref2.y,
1957
+ y = _ref2$y === void 0 ? [] : _ref2$y,
1958
+ xField = _ref2.xField,
1959
+ yFields = _ref2.yFields,
1960
+ y2 = _ref2.y2,
1961
+ y2Fields = _ref2.y2Fields;
1700
1962
  var columns = [x.map(String)].concat(_toConsumableArray((0, exports.toArrayForSeries)(y, y).map(function (series) {
1701
1963
  return series.map(String);
1702
1964
  })));
@@ -1707,10 +1969,10 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
1707
1969
  return {
1708
1970
  name: field
1709
1971
  };
1710
- })));
1711
- // splunk-charting requires y2 to be part of columns
1972
+ }))); // splunk-charting requires y2 to be part of columns
1712
1973
  // when y & y2 options are configured with different (mutually exclusive) series
1713
1974
  // y2 columns need to be added to columns
1975
+
1714
1976
  if (y2Fields) {
1715
1977
  var y2FieldsArray = (0, exports.toArrayForSeries)(y2, y2Fields);
1716
1978
  var y2AsArray = (0, exports.toArrayForSeries)(y2, y2).map(function (series) {
@@ -1725,18 +1987,14 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
1725
1987
  }
1726
1988
  });
1727
1989
  }
1990
+
1728
1991
  return {
1729
1992
  columns: columns,
1730
1993
  fields: fields
1731
1994
  };
1732
1995
  };
1733
- exports.constructFieldsAndColumns = constructFieldsAndColumns;
1734
-
1735
- /***/ }),
1736
- /* 57 */
1737
- /***/ (function(module, exports) {
1738
1996
 
1739
- module.exports = require("@splunk/themes/useSplunkTheme");
1997
+ exports.constructFieldsAndColumns = constructFieldsAndColumns;
1740
1998
 
1741
1999
  /***/ }),
1742
2000
  /* 58 */,
@@ -1757,23 +2015,42 @@ Object.defineProperty(exports, "__esModule", {
1757
2015
  });
1758
2016
  exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
1759
2017
  /* eslint-disable react/no-unused-prop-types */
2018
+
1760
2019
  var lodash_1 = __webpack_require__(3);
2020
+
1761
2021
  var i18n_1 = __webpack_require__(2);
2022
+
1762
2023
  var visualization_color_palettes_1 = __webpack_require__(51);
2024
+
1763
2025
  var react_1 = __webpack_require__(1);
2026
+
1764
2027
  var React = __webpack_require__(1);
2028
+
1765
2029
  var T = __webpack_require__(0);
2030
+
1766
2031
  var react_event_listener_1 = __webpack_require__(66);
2032
+
1767
2033
  __webpack_require__(67); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
2034
+
2035
+
1768
2036
  var charting_bundle_1 = __webpack_require__(55);
2037
+
1769
2038
  var TimezoneContext_1 = __webpack_require__(26);
2039
+
1770
2040
  var style_1 = __webpack_require__(14);
2041
+
1771
2042
  var styled_components_1 = __webpack_require__(4);
2043
+
1772
2044
  var Message_1 = __webpack_require__(10);
1773
- var useSplunkTheme_1 = __webpack_require__(57);
2045
+
2046
+ var useSplunkTheme_1 = __webpack_require__(56);
2047
+
1774
2048
  var themeUtils_1 = __webpack_require__(68);
2049
+
1775
2050
  var ChartingApi_1 = __webpack_require__(69);
2051
+
1776
2052
  exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
2053
+
1777
2054
  var changedOptions = function changedOptions(curOptions, nextOptions) {
1778
2055
  return Object.keys(curOptions).filter(function (key) {
1779
2056
  return !(key in nextOptions);
@@ -1781,7 +2058,9 @@ var changedOptions = function changedOptions(curOptions, nextOptions) {
1781
2058
  return !(key in curOptions) || curOptions[key] !== nextOptions[key];
1782
2059
  }));
1783
2060
  };
2061
+
1784
2062
  exports.changedOptions = changedOptions;
2063
+
1785
2064
  function usePrevious(value) {
1786
2065
  var ref = (0, react_1.useRef)();
1787
2066
  (0, react_1.useEffect)(function () {
@@ -1789,21 +2068,24 @@ function usePrevious(value) {
1789
2068
  });
1790
2069
  return ref.current;
1791
2070
  }
2071
+
1792
2072
  var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
1793
2073
  // if either of the options are undefined
1794
2074
  // it cannot update in place.
1795
2075
  if (!curOptions || !nextOptions) {
1796
2076
  return false;
1797
2077
  }
2078
+
1798
2079
  return !exports.NO_INPLACE_PROPS.some(function (p) {
1799
2080
  return curOptions[p] !== nextOptions[p];
1800
2081
  }) && !(0, exports.changedOptions)(curOptions, nextOptions).some(function (p) {
1801
2082
  return p.toLowerCase().endsWith('color');
1802
2083
  });
1803
2084
  };
1804
- exports.canUpdateInPlace = canUpdateInPlace;
1805
- // create 'row' payloads from 'rowContext' in the flattened format:
2085
+
2086
+ exports.canUpdateInPlace = canUpdateInPlace; // create 'row' payloads from 'rowContext' in the flattened format:
1806
2087
  // row.<fieldname>.value
2088
+
1807
2089
  var updateRowPayload = function updateRowPayload(chartEventRowContext, payload) {
1808
2090
  Object.keys(chartEventRowContext || {}).forEach(function (key) {
1809
2091
  // eslint-disable-next-line no-param-reassign
@@ -1811,18 +2093,21 @@ var updateRowPayload = function updateRowPayload(chartEventRowContext, payload)
1811
2093
  });
1812
2094
  return payload;
1813
2095
  };
2096
+
1814
2097
  exports.updateRowPayload = updateRowPayload;
1815
2098
  var VizChartEventType;
2099
+
1816
2100
  (function (VizChartEventType) {
1817
2101
  VizChartEventType["POINT_CLICK"] = "point.click";
1818
2102
  VizChartEventType["POINT_MOUSE_OUT"] = "point.mouseout";
1819
2103
  VizChartEventType["POINT_MOUSE_OVER"] = "point.mouseover";
1820
2104
  VizChartEventType["LEGEND_CLICK"] = "legend.click";
1821
- })(VizChartEventType || (VizChartEventType = {}));
1822
- // @TODO(pwied): remove after HC upgrade to 8+
2105
+ })(VizChartEventType || (VizChartEventType = {})); // @TODO(pwied): remove after HC upgrade to 8+
1823
2106
  // .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug
1824
2107
  // caused by the accessibility plugin
1825
2108
  // https://github.com/highcharts/highcharts/issues/12883
2109
+
2110
+
1826
2111
  var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
1827
2112
  return {
1828
2113
  'data-test': 'charting-container',
@@ -1850,6 +2135,7 @@ var propTypes = {
1850
2135
  visualizationApiRef: T.func,
1851
2136
  themeKey: T.string
1852
2137
  };
2138
+
1853
2139
  var Charting = function Charting(props) {
1854
2140
  var container = (0, react_1.useRef)(null);
1855
2141
  var needsInit = (0, react_1.useRef)(true);
@@ -1857,6 +2143,7 @@ var Charting = function Charting(props) {
1857
2143
  var needsRedraw = (0, react_1.useRef)(true);
1858
2144
  var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
1859
2145
  var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
2146
+
1860
2147
  var computeChartingSize = function computeChartingSize() {
1861
2148
  if (container.current) {
1862
2149
  var rect = container.current.getBoundingClientRect();
@@ -1865,48 +2152,56 @@ var Charting = function Charting(props) {
1865
2152
  width: rect.width
1866
2153
  };
1867
2154
  }
2155
+
1868
2156
  return {};
1869
2157
  };
2158
+
1870
2159
  var splunkTheme = (0, useSplunkTheme_1.default)();
1871
2160
  var themeKey = props.themeKey ? props.themeKey : (0, themeUtils_1.getChartingThemeKey)({
1872
2161
  splunkThemeV1: splunkTheme
1873
2162
  });
1874
2163
  var width = props.width,
1875
- height = props.height,
1876
- style = props.style,
1877
- chartData = props.chartData,
1878
- options = props.options,
1879
- colorPalette = props.colorPalette,
1880
- onClick = props.onClick,
1881
- onSelect = props.onSelect,
1882
- onPointMouseOut = props.onPointMouseOut,
1883
- onPointMouseOver = props.onPointMouseOver,
1884
- onEventTrigger = props.onEventTrigger;
2164
+ height = props.height,
2165
+ style = props.style,
2166
+ chartData = props.chartData,
2167
+ options = props.options,
2168
+ colorPalette = props.colorPalette,
2169
+ onClick = props.onClick,
2170
+ onSelect = props.onSelect,
2171
+ onPointMouseOut = props.onPointMouseOut,
2172
+ onPointMouseOver = props.onPointMouseOver,
2173
+ onEventTrigger = props.onEventTrigger;
1885
2174
  var prevOptions = usePrevious(options);
1886
2175
  var prevTimezone = usePrevious(timezone);
2176
+
1887
2177
  var handleClick = function handleClick(chartEvent, type) {
1888
2178
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
1889
2179
  payload.name = payload.name2;
1890
2180
  delete payload.name2;
2181
+
1891
2182
  if (type === VizChartEventType.POINT_CLICK) {
1892
2183
  payload.value = payload.value2;
1893
2184
  delete payload.value2;
1894
2185
  payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
1895
2186
  }
2187
+
1896
2188
  onClick({
1897
2189
  type: type,
1898
2190
  originalEvent: chartEvent,
1899
2191
  payload: payload
1900
2192
  });
1901
2193
  };
2194
+
1902
2195
  var destroyChart = function destroyChart() {
1903
2196
  if (chart.current) {
1904
2197
  chart.current.destroy();
1905
2198
  chart.current = null;
1906
2199
  }
2200
+
1907
2201
  needsRedraw.current = true;
1908
2202
  needsInit.current = true;
1909
2203
  };
2204
+
1910
2205
  var handleSelect = function handleSelect(chartEvent) {
1911
2206
  // todo: need change this after breaking all visualizations
1912
2207
  if (onSelect && typeof onSelect === 'function') {
@@ -1916,14 +2211,16 @@ var Charting = function Charting(props) {
1916
2211
  payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
1917
2212
  });
1918
2213
  return;
1919
- }
1920
- // the chartEvent here is a jQuery event
2214
+ } // the chartEvent here is a jQuery event
2215
+
2216
+
1921
2217
  onEventTrigger({
1922
2218
  type: 'range.select',
1923
2219
  originalEvent: chartEvent,
1924
2220
  payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
1925
2221
  });
1926
2222
  };
2223
+
1927
2224
  var handlePointMouseOut = function handlePointMouseOut(chartEvent, type) {
1928
2225
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
1929
2226
  payload.name = payload.name2;
@@ -1937,6 +2234,7 @@ var Charting = function Charting(props) {
1937
2234
  payload: payload
1938
2235
  });
1939
2236
  };
2237
+
1940
2238
  var handlePointMouseOver = function handlePointMouseOver(chartEvent, type) {
1941
2239
  var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
1942
2240
  payload.name = payload.name2;
@@ -1950,6 +2248,7 @@ var Charting = function Charting(props) {
1950
2248
  payload: payload
1951
2249
  });
1952
2250
  };
2251
+
1953
2252
  var drawChart = function drawChart() {
1954
2253
  var updatedOptions = Object.assign(Object.assign({}, options), {
1955
2254
  shouldColorizeTooltipData: false
@@ -1960,15 +2259,18 @@ var Charting = function Charting(props) {
1960
2259
  var serializedTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone;
1961
2260
  var ianaTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone;
1962
2261
  var utcOffset = timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset;
2262
+
1963
2263
  if (!computedWidth || !computedHeight) {
1964
2264
  return;
1965
2265
  }
2266
+
1966
2267
  if (!chartData || !Object.keys(chartData).length) {
1967
2268
  return;
1968
- }
1969
- // splunk-charting layers configuration option updates.
2269
+ } // splunk-charting layers configuration option updates.
1970
2270
  // when an option is removed it needs to be set to an empty string
1971
2271
  // to override the previous configuration
2272
+
2273
+
1972
2274
  if (prevOptions) {
1973
2275
  Object.keys(prevOptions).forEach(function (key) {
1974
2276
  if (updatedOptions[key] === undefined) {
@@ -1976,13 +2278,16 @@ var Charting = function Charting(props) {
1976
2278
  }
1977
2279
  });
1978
2280
  }
2281
+
1979
2282
  try {
1980
2283
  if (needsInit.current) {
1981
2284
  destroyChart();
1982
2285
  charting_bundle_1.default.setTheme(themeKey);
2286
+
1983
2287
  if (colorPalette.length > 0) {
1984
2288
  charting_bundle_1.default.setColorPalette(colorPalette);
1985
2289
  }
2290
+
1986
2291
  chart.current = charting_bundle_1.default.createChart(container.current, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedOptions), {
1987
2292
  drilldown: 'all'
1988
2293
  }), typeof serializedTimezone === 'string' && {
@@ -1991,8 +2296,8 @@ var Charting = function Charting(props) {
1991
2296
  'time.ianaTimezone': ianaTimezone
1992
2297
  }), typeof utcOffset === 'number' && {
1993
2298
  'time.timezoneOffset': utcOffset
1994
- }));
1995
- // bind event handlers
2299
+ })); // bind event handlers
2300
+
1996
2301
  chart.current.on('pointClick', function (e) {
1997
2302
  handleClick(e, VizChartEventType.POINT_CLICK);
1998
2303
  });
@@ -2007,29 +2312,37 @@ var Charting = function Charting(props) {
2007
2312
  });
2008
2313
  chart.current.on('chartRangeSelect', handleSelect);
2009
2314
  }
2315
+
2010
2316
  if (needsRedraw.current) {
2011
2317
  charting_bundle_1.default.setTheme(themeKey);
2318
+
2012
2319
  if (colorPalette.length > 0) {
2013
2320
  charting_bundle_1.default.setColorPalette(colorPalette);
2014
2321
  }
2322
+
2015
2323
  chart.current.prepareAndDraw(chartData, updatedOptions, function () {});
2016
2324
  }
2325
+
2017
2326
  if (chart.current) {
2018
2327
  if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
2019
2328
  chart.current.resize(computedWidth, computedHeight);
2020
2329
  }
2021
2330
  }
2331
+
2022
2332
  needsInit.current = false;
2023
2333
  needsRedraw.current = false;
2024
2334
  } catch (e) {
2025
2335
  window.console.error('Caught error rendering chart:', e);
2026
2336
  }
2027
2337
  };
2338
+
2028
2339
  var debouncedDrawChart = (0, lodash_1.debounce)(drawChart, 5);
2340
+
2029
2341
  var onContainerMount = function onContainerMount(chartingContainer) {
2030
2342
  container.current = chartingContainer;
2031
2343
  debouncedDrawChart();
2032
2344
  };
2345
+
2033
2346
  var prevTheme = usePrevious(themeKey);
2034
2347
  var prevOnClick = usePrevious(onClick);
2035
2348
  (0, react_1.useEffect)(function () {
@@ -2043,14 +2356,14 @@ var Charting = function Charting(props) {
2043
2356
  (0, react_1.useEffect)(function () {
2044
2357
  // TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme
2045
2358
  // seems like redraw doesn't suffice to update the background colors
2046
- if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) ||
2047
- // timezone is a simple object so this comparison should be fast
2359
+ if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
2048
2360
  JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
2049
2361
  needsInit.current = true;
2050
2362
  }
2051
- needsRedraw.current = true;
2052
- // need to immediately call drawChart upon an option or chartData change
2363
+
2364
+ needsRedraw.current = true; // need to immediately call drawChart upon an option or chartData change
2053
2365
  // otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
2366
+
2054
2367
  drawChart();
2055
2368
  }, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone, timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset, timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone, themeKey, onClick]);
2056
2369
  return React.createElement(ChartingContainer, {
@@ -2063,6 +2376,7 @@ var Charting = function Charting(props) {
2063
2376
  onResize: debouncedDrawChart
2064
2377
  }));
2065
2378
  };
2379
+
2066
2380
  var defaultProps = {
2067
2381
  width: '100%',
2068
2382
  height: 250,
@@ -2080,31 +2394,36 @@ var defaultProps = {
2080
2394
  themeKey: null
2081
2395
  };
2082
2396
  Charting.propTypes = propTypes;
2083
- Charting.defaultProps = defaultProps;
2084
- // allow for early return in case of empty chartData while still following hook rules
2397
+ Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
2398
+
2085
2399
  var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
2086
2400
  var Wrapper = function Wrapper(props) {
2087
2401
  var chartData = props.chartData;
2402
+
2088
2403
  if (!chartData) {
2089
2404
  return React.createElement(Message_1.default, {
2090
2405
  message: (0, i18n_1._)('No DataSource'),
2091
2406
  level: "warning"
2092
2407
  });
2093
2408
  }
2409
+
2094
2410
  if (chartData && !Object.keys(chartData).length) {
2095
2411
  return React.createElement(Message_1.default, {
2096
2412
  message: (0, i18n_1._)('No Result'),
2097
2413
  level: "info"
2098
2414
  });
2099
2415
  }
2416
+
2100
2417
  return React.createElement(Chart, Object.assign({}, props));
2101
2418
  };
2419
+
2102
2420
  Wrapper.displayName = 'ChartingWrapper';
2103
2421
  Wrapper.propTypes = propTypes;
2104
2422
  Wrapper.defaultProps = defaultProps;
2105
2423
  return Wrapper;
2106
- };
2107
- // export default Charting;
2424
+ }; // export default Charting;
2425
+
2426
+
2108
2427
  exports.default = withEmptyChartMessage(Charting);
2109
2428
 
2110
2429
  /***/ }),
@@ -2133,15 +2452,19 @@ module.exports = require("@splunk/visualizations-shared/themeUtils");
2133
2452
 
2134
2453
 
2135
2454
  var _classCallCheck = __webpack_require__(9);
2455
+
2136
2456
  var _createClass = __webpack_require__(18);
2457
+
2137
2458
  Object.defineProperty(exports, "__esModule", {
2138
2459
  value: true
2139
2460
  });
2140
2461
  exports.ChartingApiFunctional = void 0;
2462
+
2141
2463
  var ChartingApiFunctional = /*#__PURE__*/function () {
2142
2464
  // eslint-disable-next-line no-useless-constructor
2143
2465
  function ChartingApiFunctional(chartRef) {
2144
2466
  _classCallCheck(this, ChartingApiFunctional);
2467
+
2145
2468
  this.chartRef = chartRef;
2146
2469
  }
2147
2470
  /**
@@ -2149,15 +2472,18 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
2149
2472
  *
2150
2473
  * @memberof ChartingApiFunctional
2151
2474
  */
2475
+
2476
+
2152
2477
  _createClass(ChartingApiFunctional, [{
2153
2478
  key: "highlight",
2154
2479
  value: function highlight() {
2155
2480
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
2156
- xValue: '',
2157
- seriesName: ''
2158
- },
2159
- xValue = _ref.xValue,
2160
- seriesName = _ref.seriesName;
2481
+ xValue: '',
2482
+ seriesName: ''
2483
+ },
2484
+ xValue = _ref.xValue,
2485
+ seriesName = _ref.seriesName;
2486
+
2161
2487
  this.getChart().highlight(xValue, seriesName);
2162
2488
  }
2163
2489
  /**
@@ -2165,21 +2491,25 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
2165
2491
  *
2166
2492
  * @memberof ChartingApiFunctional
2167
2493
  */
2494
+
2168
2495
  }, {
2169
2496
  key: "unHighlight",
2170
2497
  value: function unHighlight() {
2171
2498
  this.getChart().unHighlight();
2172
- }
2173
- // returns chart object
2499
+ } // returns chart object
2500
+
2174
2501
  }, {
2175
2502
  key: "getChart",
2176
2503
  value: function getChart() {
2177
2504
  var _a;
2505
+
2178
2506
  return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
2179
2507
  }
2180
2508
  }]);
2509
+
2181
2510
  return ChartingApiFunctional;
2182
2511
  }();
2512
+
2183
2513
  exports.ChartingApiFunctional = ChartingApiFunctional;
2184
2514
 
2185
2515
  /***/ }),
@@ -2199,12 +2529,16 @@ module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
2199
2529
 
2200
2530
 
2201
2531
  var _toConsumableArray = __webpack_require__(8);
2532
+
2202
2533
  Object.defineProperty(exports, "__esModule", {
2203
2534
  value: true
2204
2535
  });
2205
2536
  exports.AxesChartDataConfigAreaColumnLine = exports.AxesChartDataConfigBubble = exports.AxesChartDataConfigScatter = exports.AxesChartDataConfigBar = void 0;
2537
+
2206
2538
  var i18n_1 = __webpack_require__(2);
2539
+
2207
2540
  var configUtils_1 = __webpack_require__(20);
2541
+
2208
2542
  var AxesChartDataConfig = {
2209
2543
  label: (0, i18n_1._)('Data configurations'),
2210
2544
  layout: [[{
@@ -2337,10 +2671,15 @@ exports.default = AxesChartDataConfig;
2337
2671
  Object.defineProperty(exports, "__esModule", {
2338
2672
  value: true
2339
2673
  });
2674
+
2340
2675
  var i18n_1 = __webpack_require__(2);
2676
+
2341
2677
  var pick_1 = __webpack_require__(23);
2678
+
2342
2679
  var variables_1 = __webpack_require__(11);
2680
+
2343
2681
  var BackgroundColor_1 = __webpack_require__(53);
2682
+
2344
2683
  var themes = {
2345
2684
  defaultBackgroundColor: function defaultBackgroundColor(props) {
2346
2685
  return (0, pick_1.default)({
@@ -2378,7 +2717,9 @@ exports.default = AxesChartColorAndStyle;
2378
2717
  Object.defineProperty(exports, "__esModule", {
2379
2718
  value: true
2380
2719
  });
2720
+
2381
2721
  var i18n_1 = __webpack_require__(2);
2722
+
2382
2723
  var AxesChartLegend = {
2383
2724
  label: (0, i18n_1._)('Legend'),
2384
2725
  layout: [[{
@@ -2438,12 +2779,16 @@ exports.default = AxesChartLegend;
2438
2779
 
2439
2780
 
2440
2781
  var _toConsumableArray = __webpack_require__(8);
2782
+
2441
2783
  Object.defineProperty(exports, "__esModule", {
2442
2784
  value: true
2443
2785
  });
2444
2786
  exports.AxesChartXGridAndLabelsBubbleScatter = exports.AxesChartXGridAndLabelsCommon = void 0;
2787
+
2445
2788
  var i18n_1 = __webpack_require__(2);
2789
+
2446
2790
  var configUtils_1 = __webpack_require__(20);
2791
+
2447
2792
  exports.AxesChartXGridAndLabelsCommon = {
2448
2793
  label: (0, i18n_1._)('X-axis grid and labels'),
2449
2794
  layout: [[{
@@ -2632,8 +2977,7 @@ exports.AxesChartXGridAndLabelsBubbleScatter = {
2632
2977
  label: (0, i18n_1._)('Axis line visibility'),
2633
2978
  option: 'xAxisLineVisibility',
2634
2979
  editor: 'editor.checkbox'
2635
- }],
2636
- // this option is disabled for bubble and scatter
2980
+ }], // this option is disabled for bubble and scatter
2637
2981
  // [
2638
2982
  // {
2639
2983
  // label: _('Major gridlines'),
@@ -2725,7 +3069,9 @@ exports.default = AxesChartXGridAndLabels;
2725
3069
  Object.defineProperty(exports, "__esModule", {
2726
3070
  value: true
2727
3071
  });
3072
+
2728
3073
  var i18n_1 = __webpack_require__(2);
3074
+
2729
3075
  var AxesChartYGridAndLabels = {
2730
3076
  label: (0, i18n_1._)('Y-axis grid and labels'),
2731
3077
  layout: [[{
@@ -2885,20 +3231,26 @@ exports.default = AxesChartYGridAndLabels;
2885
3231
  /* 85 */,
2886
3232
  /* 86 */,
2887
3233
  /* 87 */,
2888
- /* 88 */
3234
+ /* 88 */,
3235
+ /* 89 */
2889
3236
  /***/ (function(module, exports, __webpack_require__) {
2890
3237
 
2891
3238
  "use strict";
2892
3239
 
2893
3240
 
2894
3241
  var _toConsumableArray = __webpack_require__(8);
3242
+
2895
3243
  Object.defineProperty(exports, "__esModule", {
2896
3244
  value: true
2897
3245
  });
2898
3246
  exports.AxesChartDataDisplayColumn = exports.AxesChartDataDisplayBar = exports.AxesChartDataDisplayLine = void 0;
3247
+
2899
3248
  var i18n_1 = __webpack_require__(2);
3249
+
2900
3250
  var lodash_1 = __webpack_require__(3);
3251
+
2901
3252
  var configUtils_1 = __webpack_require__(20);
3253
+
2902
3254
  exports.AxesChartDataDisplayLine = {
2903
3255
  label: (0, i18n_1._)('Data display'),
2904
3256
  layout: [[{
@@ -3018,7 +3370,7 @@ exports.AxesChartDataDisplayColumn = {
3018
3370
  exports.default = AxesChartDataDisplay;
3019
3371
 
3020
3372
  /***/ }),
3021
- /* 89 */
3373
+ /* 90 */
3022
3374
  /***/ (function(module, exports, __webpack_require__) {
3023
3375
 
3024
3376
  "use strict";
@@ -3027,7 +3379,9 @@ exports.default = AxesChartDataDisplay;
3027
3379
  Object.defineProperty(exports, "__esModule", {
3028
3380
  value: true
3029
3381
  });
3382
+
3030
3383
  var i18n_1 = __webpack_require__(2);
3384
+
3031
3385
  var axesChartY2GridAndLabels = {
3032
3386
  label: (0, i18n_1._)('Y2-axis grid and labels'),
3033
3387
  layout: [[{
@@ -3190,7 +3544,6 @@ var axesChartY2GridAndLabels = {
3190
3544
  exports.default = axesChartY2GridAndLabels;
3191
3545
 
3192
3546
  /***/ }),
3193
- /* 90 */,
3194
3547
  /* 91 */,
3195
3548
  /* 92 */,
3196
3549
  /* 93 */,
@@ -3251,45 +3604,57 @@ exports.default = axesChartY2GridAndLabels;
3251
3604
 
3252
3605
  var __rest = this && this.__rest || function (s, e) {
3253
3606
  var t = {};
3607
+
3254
3608
  for (var p in s) {
3255
3609
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
3256
3610
  }
3611
+
3257
3612
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3258
3613
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
3259
3614
  }
3260
3615
  return t;
3261
3616
  };
3617
+
3262
3618
  Object.defineProperty(exports, "__esModule", {
3263
3619
  value: true
3264
3620
  });
3265
- exports.config = exports.themes = exports.computeVizProps = void 0;
3266
- // Charting imports i18n which needs to be run to instantiate window globals in the tests
3267
- var Charting_1 = __webpack_require__(65);
3268
- // eslint-disable-next-line import/order
3621
+ exports.config = exports.themes = exports.computeVizProps = void 0; // Charting imports i18n which needs to be run to instantiate window globals in the tests
3622
+
3623
+ var Charting_1 = __webpack_require__(65); // eslint-disable-next-line import/order
3624
+
3625
+
3269
3626
  var charting_bundle_1 = __webpack_require__(55);
3627
+
3270
3628
  var config_1 = __webpack_require__(144);
3629
+
3271
3630
  exports.config = config_1.default;
3272
- var withDashboardViz_1 = __webpack_require__(36);
3273
- var areaUtils_1 = __webpack_require__(178);
3274
- var chartingUtils_1 = __webpack_require__(56);
3631
+
3632
+ var withDashboardViz_1 = __webpack_require__(37);
3633
+
3634
+ var areaUtils_1 = __webpack_require__(179);
3635
+
3636
+ var chartingUtils_1 = __webpack_require__(57);
3637
+
3275
3638
  var computeVizProps = function computeVizProps(_a) {
3276
3639
  var dataSources = _a.dataSources,
3277
- onEventTrigger = _a.onEventTrigger,
3278
- x = _a.x,
3279
- y = _a.y,
3280
- xField = _a.xField,
3281
- yFields = _a.yFields,
3282
- annotationX = _a.annotationX,
3283
- annotationColor = _a.annotationColor,
3284
- annotationLabel = _a.annotationLabel,
3285
- visualizationApiRef = _a.visualizationApiRef,
3286
- otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "x", "y", "xField", "yFields", "annotationX", "annotationColor", "annotationLabel", "visualizationApiRef"]); // options to be passed as props
3640
+ onEventTrigger = _a.onEventTrigger,
3641
+ x = _a.x,
3642
+ y = _a.y,
3643
+ xField = _a.xField,
3644
+ yFields = _a.yFields,
3645
+ annotationX = _a.annotationX,
3646
+ annotationColor = _a.annotationColor,
3647
+ annotationLabel = _a.annotationLabel,
3648
+ visualizationApiRef = _a.visualizationApiRef,
3649
+ otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "x", "y", "xField", "yFields", "annotationX", "annotationColor", "annotationLabel", "visualizationApiRef"]); // options to be passed as props
3650
+
3651
+
3287
3652
  var computedProps = {
3288
3653
  visualizationApiRef: visualizationApiRef
3289
3654
  };
3290
3655
  var y2 = otherOptions.y2,
3291
- y2Fields = otherOptions.y2Fields,
3292
- hasEventHandlers = otherOptions.hasEventHandlers;
3656
+ y2Fields = otherOptions.y2Fields,
3657
+ hasEventHandlers = otherOptions.hasEventHandlers;
3293
3658
  computedProps.options = (0, areaUtils_1.transformOptions)(otherOptions);
3294
3659
  var chartingAnnotations = (0, chartingUtils_1.getAnnotations)({
3295
3660
  annotationX: annotationX,
@@ -3297,29 +3662,34 @@ var computeVizProps = function computeVizProps(_a) {
3297
3662
  annotationLabel: annotationLabel
3298
3663
  });
3299
3664
  var primaryData = Object.assign({}, dataSources.primary.data);
3665
+
3300
3666
  var _ref = (0, chartingUtils_1.constructFieldsAndColumns)({
3301
- x: x,
3302
- y: y,
3303
- xField: xField,
3304
- yFields: yFields,
3305
- y2: y2,
3306
- y2Fields: y2Fields
3307
- }),
3308
- columns = _ref.columns,
3309
- fields = _ref.fields;
3667
+ x: x,
3668
+ y: y,
3669
+ xField: xField,
3670
+ yFields: yFields,
3671
+ y2: y2,
3672
+ y2Fields: y2Fields
3673
+ }),
3674
+ columns = _ref.columns,
3675
+ fields = _ref.fields;
3676
+
3310
3677
  primaryData.columns = columns;
3311
3678
  primaryData.fields = fields;
3312
3679
  computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign(Object.assign({}, primaryData), {
3313
3680
  annotations: chartingAnnotations
3314
3681
  }));
3682
+
3315
3683
  if (hasEventHandlers) {
3316
3684
  computedProps.onClick = onEventTrigger;
3317
3685
  computedProps.onSelect = onEventTrigger;
3318
3686
  computedProps.onPointMouseOver = onEventTrigger;
3319
3687
  computedProps.onPointMouseOut = onEventTrigger;
3320
3688
  }
3689
+
3321
3690
  return computedProps;
3322
3691
  };
3692
+
3323
3693
  exports.computeVizProps = computeVizProps;
3324
3694
  var Area = (0, withDashboardViz_1.default)({
3325
3695
  ReactViz: Charting_1.default,
@@ -3338,26 +3708,45 @@ exports.default = Area;
3338
3708
 
3339
3709
 
3340
3710
  var _toConsumableArray = __webpack_require__(8);
3711
+
3341
3712
  Object.defineProperty(exports, "__esModule", {
3342
3713
  value: true
3343
3714
  });
3715
+
3344
3716
  var visualization_icons_1 = __webpack_require__(52);
3717
+
3345
3718
  var placeholders_1 = __webpack_require__(50);
3719
+
3346
3720
  var schemaUtils_1 = __webpack_require__(16);
3721
+
3347
3722
  var visualization_color_palettes_1 = __webpack_require__(51);
3723
+
3348
3724
  var i18n_1 = __webpack_require__(2);
3725
+
3349
3726
  var pick_1 = __webpack_require__(23);
3727
+
3350
3728
  var variables_1 = __webpack_require__(11);
3729
+
3351
3730
  var VizBehavior_1 = __webpack_require__(6);
3352
- var VizCategory_1 = __webpack_require__(35);
3731
+
3732
+ var VizCategory_1 = __webpack_require__(36);
3733
+
3353
3734
  var configUtils_1 = __webpack_require__(20);
3735
+
3354
3736
  var AxesChartDataConfig_1 = __webpack_require__(74);
3355
- var AxesChartDataDisplay_1 = __webpack_require__(88);
3737
+
3738
+ var AxesChartDataDisplay_1 = __webpack_require__(89);
3739
+
3356
3740
  var AxesChartColorAndStyle_1 = __webpack_require__(75);
3741
+
3357
3742
  var AxesChartLegend_1 = __webpack_require__(76);
3743
+
3358
3744
  var AxesChartXGridAndLabels_1 = __webpack_require__(77);
3745
+
3359
3746
  var AxesChartYGridAndLabels_1 = __webpack_require__(78);
3360
- var AxesChartY2GridAndLabels_1 = __webpack_require__(89);
3747
+
3748
+ var AxesChartY2GridAndLabels_1 = __webpack_require__(90);
3749
+
3361
3750
  var dataContract = {
3362
3751
  requiredDataSources: [{
3363
3752
  name: 'primary',
@@ -3914,16 +4303,19 @@ var editorConfig = [AxesChartDataConfig_1.AxesChartDataConfigAreaColumnLine, Axe
3914
4303
  /**
3915
4304
  * visualization configuration
3916
4305
  */
4306
+
3917
4307
  var config = {
3918
4308
  /**
3919
4309
  * unique viz key
3920
4310
  */
3921
4311
  key: 'splunk.area',
4312
+
3922
4313
  /**
3923
4314
  * viz name
3924
4315
  */
3925
4316
  name: (0, i18n_1._)('Area'),
3926
4317
  category: VizCategory_1.VizCategory.TRENDS,
4318
+
3927
4319
  /**
3928
4320
  * viz icon
3929
4321
  */
@@ -3989,7 +4381,8 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
3989
4381
  /* 174 */,
3990
4382
  /* 175 */,
3991
4383
  /* 176 */,
3992
- /* 177 */
4384
+ /* 177 */,
4385
+ /* 178 */
3993
4386
  /***/ (function(module, exports, __webpack_require__) {
3994
4387
 
3995
4388
  "use strict";
@@ -3998,6 +4391,7 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
3998
4391
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
3999
4392
  if (k2 === undefined) k2 = k;
4000
4393
  var desc = Object.getOwnPropertyDescriptor(m, k);
4394
+
4001
4395
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4002
4396
  desc = {
4003
4397
  enumerable: true,
@@ -4006,22 +4400,28 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
4006
4400
  }
4007
4401
  };
4008
4402
  }
4403
+
4009
4404
  Object.defineProperty(o, k2, desc);
4010
4405
  } : function (o, m, k, k2) {
4011
4406
  if (k2 === undefined) k2 = k;
4012
4407
  o[k2] = m[k];
4013
4408
  });
4409
+
4014
4410
  var __exportStar = this && this.__exportStar || function (m, exports) {
4015
4411
  for (var p in m) {
4016
4412
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4017
4413
  }
4018
4414
  };
4415
+
4019
4416
  Object.defineProperty(exports, "__esModule", {
4020
4417
  value: true
4021
4418
  });
4022
4419
  exports.default = void 0;
4420
+
4023
4421
  __exportStar(__webpack_require__(143), exports);
4422
+
4024
4423
  var Area_1 = __webpack_require__(143);
4424
+
4025
4425
  Object.defineProperty(exports, "default", {
4026
4426
  enumerable: true,
4027
4427
  get: function get() {
@@ -4030,7 +4430,7 @@ Object.defineProperty(exports, "default", {
4030
4430
  });
4031
4431
 
4032
4432
  /***/ }),
4033
- /* 178 */
4433
+ /* 179 */
4034
4434
  /***/ (function(module, exports, __webpack_require__) {
4035
4435
 
4036
4436
  "use strict";
@@ -4040,8 +4440,11 @@ Object.defineProperty(exports, "__esModule", {
4040
4440
  value: true
4041
4441
  });
4042
4442
  exports.convertToAreaSCProperties = exports.transformOptions = void 0;
4443
+
4043
4444
  var propUtils_1 = __webpack_require__(29);
4445
+
4044
4446
  var simpleXMLOptions_1 = __webpack_require__(70);
4447
+
4045
4448
  var config_1 = __webpack_require__(144);
4046
4449
  /**
4047
4450
  * Helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
@@ -4051,18 +4454,17 @@ var config_1 = __webpack_require__(144);
4051
4454
  * @param {Object} originalOptions
4052
4455
  * @returns {Object}
4053
4456
  */
4457
+
4458
+
4054
4459
  var transformOptions = function transformOptions(originalOptions) {
4055
- var returnOptions = {};
4056
- Object.keys(config_1.default.optionsSchema).forEach(function (key) {
4057
- if (Object.prototype.hasOwnProperty.call(originalOptions, key)) {
4058
- returnOptions[key] = originalOptions[key];
4059
- }
4060
- });
4460
+ var returnOptions = (0, propUtils_1.adjustOptionsToSchema)(originalOptions, config_1.default.optionsSchema);
4061
4461
  return Object.assign(Object.assign({}, (0, simpleXMLOptions_1.getSimpleXMLOptionsForProps)((0, exports.convertToAreaSCProperties)(returnOptions))), {
4062
4462
  chart: 'area'
4063
4463
  });
4064
4464
  };
4465
+
4065
4466
  exports.transformOptions = transformOptions;
4467
+
4066
4468
  var convertToAreaSCProperties = function convertToAreaSCProperties(originalOptions) {
4067
4469
  // map for key names which are either new or not present in SimpleXML options mapping
4068
4470
  var areaOptionsSCMapping = {
@@ -4095,8 +4497,8 @@ var convertToAreaSCProperties = function convertToAreaSCProperties(originalOptio
4095
4497
  yAxisLineVisibility: 'yAxisVisibility',
4096
4498
  y2AxisLineVisibility: 'y2AxisVisibility',
4097
4499
  areaOpacity: 'areaFillOpacity'
4098
- };
4099
- // key value mapping of what options (and their corresponding values) which we expose in config.ts to property values SC understands
4500
+ }; // key value mapping of what options (and their corresponding values) which we expose in config.ts to property values SC understands
4501
+
4100
4502
  var areaOptionValuesSCMapping = {
4101
4503
  xAxisTitleVisibility: {
4102
4504
  show: 'visible',
@@ -4132,6 +4534,7 @@ var convertToAreaSCProperties = function convertToAreaSCProperties(originalOptio
4132
4534
  var stingValues = ['seriesColors', 'fieldColors', 'legendLabels', 'fieldDashStyles'];
4133
4535
  return (0, propUtils_1.convertToSCProperties)(originalOptions, areaOptionsSCMapping, areaOptionValuesSCMapping, stingValues);
4134
4536
  };
4537
+
4135
4538
  exports.convertToAreaSCProperties = convertToAreaSCProperties;
4136
4539
 
4137
4540
  /***/ })