@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/ChoroplethSvg.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 = 185);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 186);
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
1471
 
1277
- /***/ }),
1278
- /* 43 */
1279
- /***/ (function(module, exports, __webpack_require__) {
1280
-
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
  /***/ }),
@@ -1585,7 +1808,8 @@ VizStyleWrapper.displayName = 'VizStyleWrapper';
1585
1808
  /* 87 */,
1586
1809
  /* 88 */,
1587
1810
  /* 89 */,
1588
- /* 90 */
1811
+ /* 90 */,
1812
+ /* 91 */
1589
1813
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1590
1814
 
1591
1815
  "use strict";
@@ -1608,7 +1832,6 @@ var StaticBackgroundColorEditor = {
1608
1832
  /* harmony default export */ __webpack_exports__["default"] = (StaticBackgroundColorEditor);
1609
1833
 
1610
1834
  /***/ }),
1611
- /* 91 */,
1612
1835
  /* 92 */,
1613
1836
  /* 93 */,
1614
1837
  /* 94 */,
@@ -1671,18 +1894,28 @@ var StaticBackgroundColorEditor = {
1671
1894
 
1672
1895
 
1673
1896
  var _classCallCheck = __webpack_require__(9);
1897
+
1674
1898
  var _createClass = __webpack_require__(18);
1899
+
1675
1900
  var _inherits = __webpack_require__(71);
1901
+
1676
1902
  var _possibleConstructorReturn = __webpack_require__(72);
1903
+
1677
1904
  var _getPrototypeOf = __webpack_require__(63);
1905
+
1678
1906
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1907
+
1679
1908
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1909
+
1680
1910
  Object.defineProperty(exports, "__esModule", {
1681
1911
  value: true
1682
1912
  });
1913
+
1683
1914
  var React = __webpack_require__(1);
1915
+
1684
1916
  var lodash_1 = __webpack_require__(3);
1685
- var SvgMutator_1 = __webpack_require__(190);
1917
+
1918
+ var SvgMutator_1 = __webpack_require__(191);
1686
1919
  /**
1687
1920
  * This react component simply take an SVG document, and mutates it by applying data to the document according to
1688
1921
  * dataBindings. The data (data prop) is processed by performing the mutation once for each 'row' of the data even though the data is formatted as columns.
@@ -1691,13 +1924,20 @@ var SvgMutator_1 = __webpack_require__(190);
1691
1924
  * The first mutation has $i=0, the second has $1=1, the third has $i=2.
1692
1925
  * This allows for JEXL expressions to access the data in a row-like fashion via expressions such as 'foo[$i] + bar[$i]' which will return "ax" for the first row mutation, "by" for the second, and "cz" for the third mutation
1693
1926
  */
1927
+
1928
+
1694
1929
  var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
1695
1930
  _inherits(SvgChoroplethDynamic, _React$Component);
1931
+
1696
1932
  var _super = _createSuper(SvgChoroplethDynamic);
1933
+
1697
1934
  function SvgChoroplethDynamic(props, context) {
1698
1935
  var _this;
1936
+
1699
1937
  _classCallCheck(this, SvgChoroplethDynamic);
1938
+
1700
1939
  _this = _super.call(this, props, context);
1940
+
1701
1941
  _this.handleAreaClick = function (ev) {
1702
1942
  if (typeof _this.props.onAreaClick === 'function') {
1703
1943
  _this.props.onAreaClick(Object.assign(Object.assign({}, ev), {
@@ -1705,21 +1945,25 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
1705
1945
  }));
1706
1946
  }
1707
1947
  };
1948
+
1708
1949
  _this.areaClickRef = function (node) {
1709
1950
  if (!node) {
1710
1951
  return;
1711
1952
  }
1953
+
1712
1954
  node.addEventListener('areaClick', function (ev) {
1713
1955
  return _this.handleAreaClick(ev);
1714
1956
  });
1715
1957
  _this.node = node;
1716
1958
  };
1959
+
1717
1960
  _this.state = {
1718
1961
  svgNode: null
1719
1962
  };
1720
1963
  _this.node = null;
1721
1964
  return _this;
1722
1965
  }
1966
+
1723
1967
  _createClass(SvgChoroplethDynamic, [{
1724
1968
  key: "componentDidMount",
1725
1969
  value: function componentDidMount() {
@@ -1728,8 +1972,7 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
1728
1972
  }, {
1729
1973
  key: "shouldComponentUpdate",
1730
1974
  value: function shouldComponentUpdate(nextProps, nextState) {
1731
- return nextProps.svg !== this.props.svg || !(0, lodash_1.isEqual)(nextProps.data, this.props.data) ||
1732
- // must do deep equal on data because when no data is passed we do 'let data = { featureIDs: [], values: [], fill: [] };' in ChoroplethSVG which looks to react like different data every time
1975
+ return nextProps.svg !== this.props.svg || !(0, lodash_1.isEqual)(nextProps.data, this.props.data) || // must do deep equal on data because when no data is passed we do 'let data = { featureIDs: [], values: [], fill: [] };' in ChoroplethSVG which looks to react like different data every time
1733
1976
  nextState.svgNode !== this.state.svgNode || !(0, lodash_1.isEqual)(nextProps.width, this.props.width) || !(0, lodash_1.isEqual)(nextProps.height, this.props.height);
1734
1977
  }
1735
1978
  }, {
@@ -1750,8 +1993,10 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
1750
1993
  key: "mutate",
1751
1994
  value: function mutate() {
1752
1995
  var svg = this.props.svg;
1996
+
1753
1997
  if (svg) {
1754
1998
  var m = new SvgMutator_1.SvgMutator(this.props);
1999
+
1755
2000
  try {
1756
2001
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1757
2002
  this.setState({
@@ -1766,11 +2011,12 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
1766
2011
  key: "render",
1767
2012
  value: function render() {
1768
2013
  var _this$props = this.props,
1769
- _this$props$width = _this$props.width,
1770
- width = _this$props$width === void 0 ? '100%' : _this$props$width,
1771
- _this$props$height = _this$props.height,
1772
- height = _this$props$height === void 0 ? '100%' : _this$props$height;
2014
+ _this$props$width = _this$props.width,
2015
+ width = _this$props$width === void 0 ? '100%' : _this$props$width,
2016
+ _this$props$height = _this$props.height,
2017
+ height = _this$props$height === void 0 ? '100%' : _this$props$height;
1773
2018
  var svgNode = this.state.svgNode;
2019
+
1774
2020
  if (svgNode) {
1775
2021
  return React.createElement("div", {
1776
2022
  style: {
@@ -1780,11 +2026,14 @@ var SvgChoroplethDynamic = /*#__PURE__*/function (_React$Component) {
1780
2026
  ref: this.areaClickRef
1781
2027
  }, svgNode);
1782
2028
  }
2029
+
1783
2030
  return null;
1784
2031
  }
1785
2032
  }]);
2033
+
1786
2034
  return SvgChoroplethDynamic;
1787
2035
  }(React.Component);
2036
+
1788
2037
  exports.default = SvgChoroplethDynamic;
1789
2038
  SvgChoroplethDynamic.defaultProps = {
1790
2039
  svg: ''
@@ -1828,7 +2077,8 @@ SvgChoroplethDynamic.defaultProps = {
1828
2077
  /* 182 */,
1829
2078
  /* 183 */,
1830
2079
  /* 184 */,
1831
- /* 185 */
2080
+ /* 185 */,
2081
+ /* 186 */
1832
2082
  /***/ (function(module, exports, __webpack_require__) {
1833
2083
 
1834
2084
  "use strict";
@@ -1836,35 +2086,53 @@ SvgChoroplethDynamic.defaultProps = {
1836
2086
 
1837
2087
  var __rest = this && this.__rest || function (s, e) {
1838
2088
  var t = {};
2089
+
1839
2090
  for (var p in s) {
1840
2091
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1841
2092
  }
2093
+
1842
2094
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1843
2095
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1844
2096
  }
1845
2097
  return t;
1846
2098
  };
2099
+
1847
2100
  Object.defineProperty(exports, "__esModule", {
1848
2101
  value: true
1849
2102
  });
1850
2103
  exports.useIconPlaceholder = exports.createProtocolHandlers = exports.PureSvgChoroplethDynamic = exports.PureChoroplethSvg = exports.config = void 0;
2104
+
1851
2105
  var React = __webpack_require__(1);
2106
+
1852
2107
  var T = __webpack_require__(0);
2108
+
1853
2109
  var lodash_1 = __webpack_require__(3);
2110
+
1854
2111
  var FeatureFlagContext_1 = __webpack_require__(21);
1855
- var ImageContext_1 = __webpack_require__(186);
1856
- var FileDownloader_1 = __webpack_require__(187);
1857
- var Downloader_1 = __webpack_require__(188);
1858
- var withDashboardViz_1 = __webpack_require__(36);
1859
- var PureChoroplethSvg_1 = __webpack_require__(189);
2112
+
2113
+ var ImageContext_1 = __webpack_require__(187);
2114
+
2115
+ var FileDownloader_1 = __webpack_require__(188);
2116
+
2117
+ var Downloader_1 = __webpack_require__(189);
2118
+
2119
+ var withDashboardViz_1 = __webpack_require__(37);
2120
+
2121
+ var PureChoroplethSvg_1 = __webpack_require__(190);
2122
+
1860
2123
  var SvgChoroplethDynamic_1 = __webpack_require__(147);
1861
- var config_1 = __webpack_require__(194);
2124
+
2125
+ var config_1 = __webpack_require__(195);
2126
+
1862
2127
  var IconPlaceholder_1 = __webpack_require__(32);
1863
- var urlUtils_1 = __webpack_require__(195);
1864
- var ErrorMessage_1 = __webpack_require__(196);
2128
+
2129
+ var urlUtils_1 = __webpack_require__(196);
2130
+
2131
+ var ErrorMessage_1 = __webpack_require__(197);
2132
+
1865
2133
  exports.config = config_1.default;
1866
- exports.PureChoroplethSvg = PureChoroplethSvg_1.default;
1867
- // todo: need remove when deleting @splunk/react-visualizations package
2134
+ exports.PureChoroplethSvg = PureChoroplethSvg_1.default; // todo: need remove when deleting @splunk/react-visualizations package
2135
+
1868
2136
  exports.PureSvgChoroplethDynamic = SvgChoroplethDynamic_1.default;
1869
2137
  /**
1870
2138
  * This function generates the protocol handlers
@@ -1874,44 +2142,56 @@ exports.PureSvgChoroplethDynamic = SvgChoroplethDynamic_1.default;
1874
2142
  * @param {ImageContext} imageContext
1875
2143
  * @returns {object}
1876
2144
  */
2145
+
1877
2146
  var createProtocolHandlers = function createProtocolHandlers() {
1878
2147
  var featureFlagContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1879
2148
  var imageContext = arguments.length > 1 ? arguments[1] : undefined;
1880
2149
  var handlers = {
1881
2150
  data: new Downloader_1.URLDownloader()
1882
2151
  };
2152
+
1883
2153
  if (imageContext) {
1884
2154
  imageContext.listProviders().forEach(function (_ref) {
1885
2155
  var type = _ref.type;
1886
2156
  handlers[type] = new Downloader_1.ImageRegistryFetcher(imageContext);
1887
2157
  });
1888
2158
  }
2159
+
1889
2160
  var enableSvgHttpDownloader = featureFlagContext.enableSvgHttpDownloader;
2161
+
1890
2162
  if (enableSvgHttpDownloader) {
1891
2163
  handlers.http = new Downloader_1.URLDownloader();
1892
2164
  handlers.https = new Downloader_1.URLDownloader();
1893
2165
  }
2166
+
1894
2167
  return handlers;
1895
2168
  };
2169
+
1896
2170
  exports.createProtocolHandlers = createProtocolHandlers;
2171
+
1897
2172
  var ChoroplethSvg = function ChoroplethSvg(_a) {
1898
2173
  var props = __rest(_a, []);
2174
+
1899
2175
  var svg = props.svg;
1900
2176
  var url = React.useMemo(function () {
1901
2177
  if (!svg) {
1902
2178
  return svg;
1903
2179
  }
2180
+
1904
2181
  var trimmed = svg.trim();
2182
+
1905
2183
  if ((0, urlUtils_1.isValidUrl)(trimmed)) {
1906
2184
  return trimmed;
1907
2185
  }
2186
+
1908
2187
  if (/.*<svg.*/i.test(trimmed)) {
1909
2188
  return trimmed;
1910
2189
  }
2190
+
1911
2191
  return "".concat(window.location.origin, "/").concat(trimmed);
1912
- }, [svg]);
1913
- // note that the FileDownloader will just immediately pass through literal (non-url) content in the case that
2192
+ }, [svg]); // note that the FileDownloader will just immediately pass through literal (non-url) content in the case that
1914
2193
  // the svg argument is not a url.
2194
+
1915
2195
  return React.createElement(ImageContext_1.default.Consumer, null, function (imageContext) {
1916
2196
  return React.createElement(FeatureFlagContext_1.default.Consumer, null, function (featureFlagContext) {
1917
2197
  return React.createElement(FileDownloader_1.FileDownloader, {
@@ -1932,44 +2212,47 @@ var ChoroplethSvg = function ChoroplethSvg(_a) {
1932
2212
  });
1933
2213
  });
1934
2214
  };
2215
+
1935
2216
  ChoroplethSvg.propTypes = {
1936
2217
  svg: T.string
1937
2218
  };
2219
+
1938
2220
  function useIconPlaceholder(dataSources, loading, options) {
1939
2221
  var svg = (0, lodash_1.get)(options, 'svg');
1940
2222
  var missingData = (0, IconPlaceholder_1.shouldShowIconPlaceholder)(dataSources, loading);
1941
2223
  return missingData && !svg;
1942
2224
  }
2225
+
1943
2226
  exports.useIconPlaceholder = useIconPlaceholder;
1944
2227
  var platformViz = (0, withDashboardViz_1.default)({
1945
2228
  ReactViz: ChoroplethSvg,
1946
2229
  vizConfig: config_1.default,
1947
2230
  useIconPlaceholder: useIconPlaceholder
1948
- });
1949
- // (platformViz as any).defaultProps.width = '100%';
2231
+ }); // (platformViz as any).defaultProps.width = '100%';
1950
2232
  // (platformViz as any).defaultProps.height = '100%';
2233
+
1951
2234
  exports.default = platformViz;
1952
2235
 
1953
2236
  /***/ }),
1954
- /* 186 */
2237
+ /* 187 */
1955
2238
  /***/ (function(module, exports) {
1956
2239
 
1957
2240
  module.exports = require("@splunk/visualization-context/ImageContext");
1958
2241
 
1959
2242
  /***/ }),
1960
- /* 187 */
2243
+ /* 188 */
1961
2244
  /***/ (function(module, exports) {
1962
2245
 
1963
2246
  module.exports = require("@splunk/visualizations-shared/FileDownloader");
1964
2247
 
1965
2248
  /***/ }),
1966
- /* 188 */
2249
+ /* 189 */
1967
2250
  /***/ (function(module, exports) {
1968
2251
 
1969
2252
  module.exports = require("@splunk/visualizations-shared/Downloader");
1970
2253
 
1971
2254
  /***/ }),
1972
- /* 189 */
2255
+ /* 190 */
1973
2256
  /***/ (function(module, exports, __webpack_require__) {
1974
2257
 
1975
2258
  "use strict";
@@ -1977,25 +2260,36 @@ module.exports = require("@splunk/visualizations-shared/Downloader");
1977
2260
 
1978
2261
  var __rest = this && this.__rest || function (s, e) {
1979
2262
  var t = {};
2263
+
1980
2264
  for (var p in s) {
1981
2265
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1982
2266
  }
2267
+
1983
2268
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1984
2269
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1985
2270
  }
1986
2271
  return t;
1987
2272
  };
2273
+
1988
2274
  Object.defineProperty(exports, "__esModule", {
1989
2275
  value: true
1990
2276
  });
1991
2277
  exports.computeSvgDynamicProps = void 0;
2278
+
1992
2279
  var React = __webpack_require__(1);
2280
+
1993
2281
  var styled_components_1 = __webpack_require__(4);
2282
+
1994
2283
  var lodash_1 = __webpack_require__(3);
2284
+
1995
2285
  var style_1 = __webpack_require__(14);
2286
+
1996
2287
  var SizeAwareWrapper_1 = __webpack_require__(19);
2288
+
1997
2289
  var SvgChoroplethDynamic_1 = __webpack_require__(147);
2290
+
1998
2291
  var VizStyleWrapper_1 = __webpack_require__(73);
2292
+
1999
2293
  var Container = styled_components_1.default.div.withConfig({
2000
2294
  displayName: "PureChoroplethSvg__Container",
2001
2295
  componentId: "m24jrf-0"
@@ -2006,14 +2300,16 @@ var ChoroplethSvgWrapper = styled_components_1.default.div.withConfig({
2006
2300
  displayName: "PureChoroplethSvg__ChoroplethSvgWrapper",
2007
2301
  componentId: "m24jrf-1"
2008
2302
  })(["min-height:0px;flex:1;position:relative;"]);
2303
+
2009
2304
  var computeSvgDynamicProps = function computeSvgDynamicProps(_a) {
2010
2305
  var props = __rest(_a, []);
2306
+
2011
2307
  var data = {
2012
2308
  featureIDs: props.areaIds || [],
2013
2309
  values: props.areaValues || [],
2014
2310
  fill: props.areaColors || []
2015
- };
2016
- // current implementation is limited to only setting the fill attribute
2311
+ }; // current implementation is limited to only setting the fill attribute
2312
+
2017
2313
  var dataBinding = [{
2018
2314
  xPath: "'//*[@id=\"'+featureIDs[$i]+'\"]/@fill'",
2019
2315
  value: 'fill[$i]'
@@ -2023,15 +2319,19 @@ var computeSvgDynamicProps = function computeSvgDynamicProps(_a) {
2023
2319
  dataBinding: dataBinding
2024
2320
  });
2025
2321
  };
2322
+
2026
2323
  exports.computeSvgDynamicProps = computeSvgDynamicProps;
2324
+
2027
2325
  var PureChoroplethSvg = function PureChoroplethSvg(_a) {
2028
2326
  var props = __rest(_a, []);
2327
+
2029
2328
  var width = props.width,
2030
- height = props.height,
2031
- backgroundColor = props.backgroundColor;
2329
+ height = props.height,
2330
+ backgroundColor = props.backgroundColor;
2331
+
2032
2332
  var renderVisualization = function renderVisualization(_ref) {
2033
2333
  var containerWidth = _ref.width,
2034
- containerHeight = _ref.height;
2334
+ containerHeight = _ref.height;
2035
2335
  var svgProps = (0, exports.computeSvgDynamicProps)(Object.assign(Object.assign({}, props), {
2036
2336
  width: containerWidth,
2037
2337
  height: containerHeight
@@ -2041,6 +2341,7 @@ var PureChoroplethSvg = function PureChoroplethSvg(_a) {
2041
2341
  dataTestKey: "ChoroplethSvgWrapper"
2042
2342
  }, React.createElement(SvgChoroplethDynamic_1.default, Object.assign({}, svgProps)));
2043
2343
  };
2344
+
2044
2345
  return React.createElement(Container, {
2045
2346
  width: width,
2046
2347
  height: height
@@ -2048,6 +2349,7 @@ var PureChoroplethSvg = function PureChoroplethSvg(_a) {
2048
2349
  return renderVisualization(containerDimension);
2049
2350
  })));
2050
2351
  };
2352
+
2051
2353
  PureChoroplethSvg.defaultProps = {
2052
2354
  width: '100%',
2053
2355
  height: 250,
@@ -2056,27 +2358,35 @@ PureChoroplethSvg.defaultProps = {
2056
2358
  exports.default = (0, styled_components_1.withTheme)(PureChoroplethSvg);
2057
2359
 
2058
2360
  /***/ }),
2059
- /* 190 */
2361
+ /* 191 */
2060
2362
  /***/ (function(module, exports, __webpack_require__) {
2061
2363
 
2062
2364
  "use strict";
2063
2365
 
2064
2366
 
2065
2367
  var _classCallCheck = __webpack_require__(9);
2368
+
2066
2369
  var _createClass = __webpack_require__(18);
2370
+
2067
2371
  Object.defineProperty(exports, "__esModule", {
2068
2372
  value: true
2069
2373
  });
2070
2374
  exports.SvgMutator = exports.ERROR_NON_ATTRIBUTE_MUTATION = void 0;
2071
2375
  /* eslint-disable no-param-reassign */
2376
+
2072
2377
  var React = __webpack_require__(1);
2073
- var XPath = __webpack_require__(191);
2074
- var xmldom_1 = __webpack_require__(192);
2075
- var jexl = __webpack_require__(193);
2378
+
2379
+ var XPath = __webpack_require__(192);
2380
+
2381
+ var xmldom_1 = __webpack_require__(193);
2382
+
2383
+ var jexl = __webpack_require__(194);
2076
2384
  /**
2077
2385
  * An error message indicating that a mutation has attempted to target anything other than SVG attribute(s)
2078
2386
  * @type {string}
2079
2387
  */
2388
+
2389
+
2080
2390
  exports.ERROR_NON_ATTRIBUTE_MUTATION = 'mutations only allowed on attribute nodes';
2081
2391
  /**
2082
2392
  * This class takes columnar data and mutates an SVG document by applying rules defined in DataBindings. This class
@@ -2084,6 +2394,7 @@ exports.ERROR_NON_ATTRIBUTE_MUTATION = 'mutations only allowed on attribute node
2084
2394
  * animation delays. This class parses an SVG document into an internal dom (NOT THE BROWSER DOM), which is then
2085
2395
  * converted into a ReactNode.
2086
2396
  */
2397
+
2087
2398
  var SvgMutator = /*#__PURE__*/function () {
2088
2399
  /**
2089
2400
  * parses the svg and stores the parsed Document in a local field. Keeps a copy of the props.
@@ -2091,6 +2402,7 @@ var SvgMutator = /*#__PURE__*/function () {
2091
2402
  */
2092
2403
  function SvgMutator(props) {
2093
2404
  _classCallCheck(this, SvgMutator);
2405
+
2094
2406
  var svg = props.svg;
2095
2407
  this.svgDoc = new xmldom_1.DOMParser().parseFromString(svg);
2096
2408
  this.props = Object.assign({}, props);
@@ -2102,6 +2414,8 @@ var SvgMutator = /*#__PURE__*/function () {
2102
2414
  * @param {(node: Node) => void} refCallback
2103
2415
  * @returns {React.ReactNode}
2104
2416
  */
2417
+
2418
+
2105
2419
  _createClass(SvgMutator, [{
2106
2420
  key: "mutate",
2107
2421
  value: function mutate() {
@@ -2118,6 +2432,7 @@ var SvgMutator = /*#__PURE__*/function () {
2118
2432
  * @param {number} i
2119
2433
  * @param {Node} target
2120
2434
  */
2435
+
2121
2436
  }, {
2122
2437
  key: "applyMutations",
2123
2438
  value:
@@ -2128,22 +2443,26 @@ var SvgMutator = /*#__PURE__*/function () {
2128
2443
  */
2129
2444
  function applyMutations(prototypicalNode) {
2130
2445
  var _this$props = this.props,
2131
- dataBinding = _this$props.dataBinding,
2132
- data = _this$props.data;
2446
+ dataBinding = _this$props.dataBinding,
2447
+ data = _this$props.data;
2133
2448
  var target = prototypicalNode.cloneNode(true);
2449
+
2134
2450
  if (data) {
2135
2451
  var anyKey = Object.keys(data)[0];
2136
2452
  var len = data[anyKey].length;
2453
+
2137
2454
  var _loop = function _loop(i) {
2138
2455
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
2139
2456
  dataBinding.forEach(function (db) {
2140
2457
  return SvgMutator.applyMutation(db, data, i, target);
2141
2458
  });
2142
2459
  };
2460
+
2143
2461
  for (var i = 0; i < len; i += 1) {
2144
2462
  _loop(i);
2145
2463
  }
2146
2464
  }
2465
+
2147
2466
  return target;
2148
2467
  }
2149
2468
  /**
@@ -2154,26 +2473,29 @@ var SvgMutator = /*#__PURE__*/function () {
2154
2473
  * @param height
2155
2474
  * @returns {React.ReactElement}
2156
2475
  */
2476
+
2157
2477
  }], [{
2158
2478
  key: "applyMutation",
2159
2479
  value: function applyMutation(dataBinding, data, i, target) {
2160
2480
  var xPath = dataBinding.xPath;
2481
+
2161
2482
  if (!xPath) {
2162
2483
  throw new Error('xPath property not defined');
2163
- }
2164
- // use xpath expression to seek out places to make changes
2484
+ } // use xpath expression to seek out places to make changes
2485
+
2486
+
2165
2487
  var hits = SvgMutator.evaluateXPath(xPath, target, Object.assign(Object.assign({}, data), {
2166
2488
  $i: i
2167
2489
  }));
2168
2490
  var hit;
2491
+
2169
2492
  for (hit = hits.iterateNext(); hit; hit = hits.iterateNext()) {
2170
2493
  SvgMutator.mutateNode(hit, dataBinding, data, i);
2171
2494
  }
2172
2495
  }
2173
2496
  }, {
2174
2497
  key: "getSandboxedIframe",
2175
- value: function getSandboxedIframe(refCallback,
2176
- // fixme get rid of?
2498
+ value: function getSandboxedIframe(refCallback, // fixme get rid of?
2177
2499
  node, currentProps) {
2178
2500
  var svgNode = SvgMutator.getSvgElementFromDoc(node);
2179
2501
  svgNode.setAttribute('width', currentProps.width || '100%');
@@ -2187,6 +2509,7 @@ var SvgMutator = /*#__PURE__*/function () {
2187
2509
  * Alternatively, Chrome has a higher size limit for Blobs (500Mib? - https://source.chromium.org/chromium/chromium/src/+/main:storage/browser/blob/README.md)
2188
2510
  * and we can create Blob URLs via URL.createObjectURL(), using the URL API together with blobs via the File API
2189
2511
  */
2512
+
2190
2513
  var blob = new Blob([html], {
2191
2514
  type: 'text/html'
2192
2515
  });
@@ -2201,8 +2524,8 @@ var SvgMutator = /*#__PURE__*/function () {
2201
2524
  padding: '0',
2202
2525
  pointerEvents: 'auto',
2203
2526
  colorScheme: 'light' // iframe adds a white background when using 'dark' theme, hacking to set scheme to 'light'
2204
- },
2205
2527
 
2528
+ },
2206
2529
  frameBorder: 0,
2207
2530
  sandbox: 'allow-scripts',
2208
2531
  id: 'svgChoroplethIframe'
@@ -2222,23 +2545,28 @@ var SvgMutator = /*#__PURE__*/function () {
2222
2545
  if (!div) {
2223
2546
  // called on unmount
2224
2547
  SvgMutator.removeIframeEventListener(div, messageListener, intervalID, refCallback);
2548
+
2225
2549
  if (blobURL) {
2226
2550
  URL.revokeObjectURL(blobURL);
2227
2551
  }
2552
+
2228
2553
  return;
2229
2554
  }
2555
+
2230
2556
  messageListener = SvgMutator.createIframeMessageListener(NONCE, intervalID, div);
2231
2557
  window.addEventListener('message', messageListener);
2558
+
2232
2559
  function sendSetupMessage() {
2233
- var svgIframe = div.querySelector('#svgChoroplethIframe');
2234
- // send single message to iframe content so that content can "learn" the targetOrigin for it's reply messages
2560
+ var svgIframe = div.querySelector('#svgChoroplethIframe'); // send single message to iframe content so that content can "learn" the targetOrigin for it's reply messages
2561
+
2235
2562
  if (svgIframe) {
2236
2563
  svgIframe.contentWindow.postMessage({
2237
2564
  parentIdentity: PARENT_ID
2238
2565
  }, '*');
2239
2566
  }
2240
- }
2241
- // continuously send an initialization message to the iframe until it ack's back
2567
+ } // continuously send an initialization message to the iframe until it ack's back
2568
+
2569
+
2242
2570
  intervalID = setInterval(sendSetupMessage, 500);
2243
2571
  refCallback(div);
2244
2572
  }
@@ -2250,18 +2578,21 @@ var SvgMutator = /*#__PURE__*/function () {
2250
2578
  value: function getSvgElementFromDoc(node) {
2251
2579
  if (node.nodeName === '#document') {
2252
2580
  var kids = node.childNodes;
2581
+
2253
2582
  for (var i = 0; i < kids.length; i += 1) {
2254
- node = kids.item(i);
2255
- // re https://jira.splunk.com/browse/SPL-188348 DOCTYPE nodes that we want to skip would have
2583
+ node = kids.item(i); // re https://jira.splunk.com/browse/SPL-188348 DOCTYPE nodes that we want to skip would have
2256
2584
  // nodeName 'svg', but only the actualy <svg> element has nodeType 1 (ELEMENT_NODE)
2585
+
2257
2586
  if (node.nodeName === 'svg' && node.nodeType && node.nodeType === 1) {
2258
2587
  break;
2259
2588
  }
2260
2589
  }
2261
2590
  }
2591
+
2262
2592
  if (node.nodeName !== 'svg') {
2263
2593
  throw new Error("Could not find an <svg> element");
2264
2594
  }
2595
+
2265
2596
  return node;
2266
2597
  }
2267
2598
  /**
@@ -2272,6 +2603,7 @@ var SvgMutator = /*#__PURE__*/function () {
2272
2603
  * @param {object} context
2273
2604
  * @returns {XPathResult}
2274
2605
  */
2606
+
2275
2607
  }, {
2276
2608
  key: "evaluateXPath",
2277
2609
  value: function evaluateXPath(xpathExpr, doc) {
@@ -2288,12 +2620,15 @@ var SvgMutator = /*#__PURE__*/function () {
2288
2620
  key: "getTitle",
2289
2621
  value: function getTitle(data, i) {
2290
2622
  var title = '';
2623
+
2291
2624
  if (data.featureIDs && data.featureIDs[i]) {
2292
2625
  title += "name: ".concat(data.featureIDs[i]);
2293
2626
  }
2627
+
2294
2628
  if (data.values && data.values[i] !== undefined) {
2295
2629
  title += "\nvalue: ".concat(data.values[i]);
2296
2630
  }
2631
+
2297
2632
  return title;
2298
2633
  }
2299
2634
  /**
@@ -2308,6 +2643,7 @@ var SvgMutator = /*#__PURE__*/function () {
2308
2643
  * @param {number} i
2309
2644
  * @returns {any}
2310
2645
  */
2646
+
2311
2647
  }, {
2312
2648
  key: "mutateNode",
2313
2649
  value: function mutateNode(n, dataBinding, data, i) {
@@ -2315,38 +2651,47 @@ var SvgMutator = /*#__PURE__*/function () {
2315
2651
  if (n.nodeType && n.nodeType != Node.ATTRIBUTE_NODE) {
2316
2652
  throw new Error(exports.ERROR_NON_ATTRIBUTE_MUTATION);
2317
2653
  }
2654
+
2318
2655
  var context = Object.assign(Object.assign({
2319
2656
  $oldValue: n.nodeValue
2320
2657
  }, data), {
2321
2658
  $i: i
2322
2659
  });
2323
2660
  var computed;
2661
+
2324
2662
  try {
2325
2663
  computed = jexl.evalSync(dataBinding.value, context);
2326
2664
  } catch (error) {
2327
2665
  return;
2328
- }
2329
- // this is the actual mutation: we change the attributes value
2666
+ } // this is the actual mutation: we change the attributes value
2667
+
2668
+
2330
2669
  n.nodeValue = computed;
2331
2670
  n.value = computed; // So you may ask...why do we set BOTH the nodeValue and the Attr value. The nodeValue seems to be the one that "shows up" as reflecting the change. We use nodeValue down in addSubtree. Yet XMLSerializer will only see the changes from Attr.value. So what the heck, we use BOTH
2332
2671
  // we also add data-* attributes to the node and a title that behaves like a hover
2672
+
2333
2673
  var parent = n.ownerElement;
2334
2674
  var title = SvgMutator.getTitle(data, i);
2675
+
2335
2676
  if (data.featureIDs && data.featureIDs[i]) {
2336
2677
  parent.setAttribute('data-name', data.featureIDs[i]);
2337
2678
  }
2679
+
2338
2680
  if (data.values && data.values[i] !== undefined) {
2339
2681
  parent.setAttribute('data-value', data.values[i]);
2340
2682
  }
2683
+
2341
2684
  if (title !== '') {
2342
2685
  var titleElem = n.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'title');
2343
2686
  titleElem.textContent = title;
2344
2687
  parent.appendChild(titleElem);
2345
2688
  }
2689
+
2346
2690
  if (data.featureIDs) {
2347
2691
  parent.setAttribute('data-name', data.featureIDs[i]);
2348
- }
2349
- // eslint-disable-next-line consistent-return
2692
+ } // eslint-disable-next-line consistent-return
2693
+
2694
+
2350
2695
  return computed; // makes this method more testable to return the updated node value, though real callers don't need to use the returned value.
2351
2696
  }
2352
2697
  }, {
@@ -2370,12 +2715,13 @@ var SvgMutator = /*#__PURE__*/function () {
2370
2715
  var jsdom = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2371
2716
  return function (m) {
2372
2717
  var _m$data = m.data,
2373
- nonce = _m$data.nonce,
2374
- eventType = _m$data.eventType,
2375
- clientX = _m$data.clientX,
2376
- clientY = _m$data.clientY,
2377
- value = _m$data.value,
2378
- name = _m$data.name;
2718
+ nonce = _m$data.nonce,
2719
+ eventType = _m$data.eventType,
2720
+ clientX = _m$data.clientX,
2721
+ clientY = _m$data.clientY,
2722
+ value = _m$data.value,
2723
+ name = _m$data.name;
2724
+
2379
2725
  if (nonce !== expectedNonce || !jsdom && m.origin !== 'null') {
2380
2726
  // yes, m.origin IS actually supposed to be a string 'null'. That is origin for opaque URL
2381
2727
  return; // If message did not contain expected nonce, then ignore (comms will not be stablished).
@@ -2386,6 +2732,7 @@ var SvgMutator = /*#__PURE__*/function () {
2386
2732
  }
2387
2733
 
2388
2734
  var boundingRect = div.getBoundingClientRect();
2735
+
2389
2736
  if (eventType && clientX && clientY) {
2390
2737
  var mEvent;
2391
2738
  var realClientX = Math.round(clientX + boundingRect.left);
@@ -2394,8 +2741,8 @@ var SvgMutator = /*#__PURE__*/function () {
2394
2741
  bubbles: true,
2395
2742
  cancelable: true,
2396
2743
  composed: true
2397
- };
2398
- // only dispatch customEvent for click because value and name are needed to bubble up
2744
+ }; // only dispatch customEvent for click because value and name are needed to bubble up
2745
+
2399
2746
  if (eventType === 'click') {
2400
2747
  mEvent = new CustomEvent('areaClick', Object.assign({
2401
2748
  detail: {
@@ -2411,6 +2758,7 @@ var SvgMutator = /*#__PURE__*/function () {
2411
2758
  clientY: realClientY
2412
2759
  }, eventSetting));
2413
2760
  }
2761
+
2414
2762
  div.dispatchEvent(mEvent);
2415
2763
  }
2416
2764
  };
@@ -2421,6 +2769,7 @@ var SvgMutator = /*#__PURE__*/function () {
2421
2769
  if (messageListener) {
2422
2770
  window.removeEventListener('message', messageListener);
2423
2771
  }
2772
+
2424
2773
  if (intervalID) {
2425
2774
  clearInterval(intervalID); // stop sending setup message
2426
2775
  }
@@ -2428,31 +2777,33 @@ var SvgMutator = /*#__PURE__*/function () {
2428
2777
  refCallback(element);
2429
2778
  }
2430
2779
  }]);
2780
+
2431
2781
  return SvgMutator;
2432
2782
  }();
2783
+
2433
2784
  exports.SvgMutator = SvgMutator;
2434
2785
  SvgMutator.serializer = new xmldom_1.XMLSerializer();
2435
2786
 
2436
2787
  /***/ }),
2437
- /* 191 */
2788
+ /* 192 */
2438
2789
  /***/ (function(module, exports) {
2439
2790
 
2440
2791
  module.exports = require("xpath");
2441
2792
 
2442
2793
  /***/ }),
2443
- /* 192 */
2794
+ /* 193 */
2444
2795
  /***/ (function(module, exports) {
2445
2796
 
2446
2797
  module.exports = require("@xmldom/xmldom");
2447
2798
 
2448
2799
  /***/ }),
2449
- /* 193 */
2800
+ /* 194 */
2450
2801
  /***/ (function(module, exports) {
2451
2802
 
2452
2803
  module.exports = require("jexl");
2453
2804
 
2454
2805
  /***/ }),
2455
- /* 194 */
2806
+ /* 195 */
2456
2807
  /***/ (function(module, exports, __webpack_require__) {
2457
2808
 
2458
2809
  "use strict";
@@ -2461,17 +2812,29 @@ module.exports = require("jexl");
2461
2812
  Object.defineProperty(exports, "__esModule", {
2462
2813
  value: true
2463
2814
  });
2815
+
2464
2816
  var i18n_1 = __webpack_require__(2);
2817
+
2465
2818
  var pick_1 = __webpack_require__(23);
2819
+
2466
2820
  var variables_1 = __webpack_require__(11);
2821
+
2467
2822
  var schemaUtils_1 = __webpack_require__(16);
2823
+
2468
2824
  var PresetPalettes_1 = __webpack_require__(61);
2825
+
2469
2826
  var visualization_icons_1 = __webpack_require__(52);
2827
+
2470
2828
  var placeholders_1 = __webpack_require__(50);
2829
+
2471
2830
  var VizBehavior_1 = __webpack_require__(6);
2831
+
2472
2832
  var configUtils_1 = __webpack_require__(20);
2473
- var VizCategory_1 = __webpack_require__(35);
2474
- var StaticBackgroundColorEditor_1 = __webpack_require__(90);
2833
+
2834
+ var VizCategory_1 = __webpack_require__(36);
2835
+
2836
+ var StaticBackgroundColorEditor_1 = __webpack_require__(91);
2837
+
2475
2838
  var dataContract = {
2476
2839
  requiredDataSources: [],
2477
2840
  optionalDataSources: [{
@@ -2634,16 +2997,19 @@ var editorConfig = [{
2634
2997
  /**
2635
2998
  * visualization configuration
2636
2999
  */
3000
+
2637
3001
  var config = {
2638
3002
  /**
2639
3003
  * unique viz key
2640
3004
  */
2641
3005
  key: 'splunk.choropleth.svg',
3006
+
2642
3007
  /**
2643
3008
  * viz name
2644
3009
  */
2645
3010
  name: (0, i18n_1._)('Choropleth SVG'),
2646
3011
  category: VizCategory_1.VizCategory.SPATIAL,
3012
+
2647
3013
  /**
2648
3014
  * viz icon
2649
3015
  */
@@ -2667,7 +3033,7 @@ var config = {
2667
3033
  exports.default = (0, configUtils_1.enhanceConfig)(config);
2668
3034
 
2669
3035
  /***/ }),
2670
- /* 195 */
3036
+ /* 196 */
2671
3037
  /***/ (function(module, exports, __webpack_require__) {
2672
3038
 
2673
3039
  "use strict";
@@ -2677,6 +3043,7 @@ Object.defineProperty(exports, "__esModule", {
2677
3043
  value: true
2678
3044
  });
2679
3045
  exports.isValidUrl = void 0;
3046
+
2680
3047
  var isValidUrl = function isValidUrl(value) {
2681
3048
  try {
2682
3049
  var url = new URL(value);
@@ -2685,10 +3052,11 @@ var isValidUrl = function isValidUrl(value) {
2685
3052
  return false;
2686
3053
  }
2687
3054
  };
3055
+
2688
3056
  exports.isValidUrl = isValidUrl;
2689
3057
 
2690
3058
  /***/ }),
2691
- /* 196 */
3059
+ /* 197 */
2692
3060
  /***/ (function(module, exports, __webpack_require__) {
2693
3061
 
2694
3062
  "use strict";
@@ -2696,20 +3064,27 @@ exports.isValidUrl = isValidUrl;
2696
3064
 
2697
3065
  var __rest = this && this.__rest || function (s, e) {
2698
3066
  var t = {};
3067
+
2699
3068
  for (var p in s) {
2700
3069
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2701
3070
  }
3071
+
2702
3072
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2703
3073
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2704
3074
  }
2705
3075
  return t;
2706
3076
  };
3077
+
2707
3078
  Object.defineProperty(exports, "__esModule", {
2708
3079
  value: true
2709
3080
  });
3081
+
2710
3082
  var React = __webpack_require__(1);
3083
+
2711
3084
  var styled_components_1 = __webpack_require__(4);
3085
+
2712
3086
  var visualization_icons_1 = __webpack_require__(52);
3087
+
2713
3088
  var Container = styled_components_1.default.div.withConfig({
2714
3089
  displayName: "ErrorMessage__Container",
2715
3090
  componentId: "sc-190iqnz-0"
@@ -2718,13 +3093,16 @@ var Message = styled_components_1.default.div.withConfig({
2718
3093
  displayName: "ErrorMessage__Message",
2719
3094
  componentId: "sc-190iqnz-1"
2720
3095
  })(["width:100%;word-break:break-all;"]);
3096
+
2721
3097
  var ErrorMessage = function ErrorMessage(_a) {
2722
3098
  var props = __rest(_a, []);
3099
+
2723
3100
  var error = props.error;
2724
3101
  return React.createElement(Container, null, React.createElement(visualization_icons_1.Image, {
2725
3102
  "data-testid": "image-icon"
2726
3103
  }), React.createElement(Message, null, error));
2727
3104
  };
3105
+
2728
3106
  exports.default = (0, styled_components_1.withTheme)(ErrorMessage);
2729
3107
 
2730
3108
  /***/ })