@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/Table.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
  */
@@ -150,11 +150,17 @@ module.exports = require("@splunk/react-ui/Message");
150
150
  Object.defineProperty(exports, "__esModule", {
151
151
  value: true
152
152
  });
153
+
153
154
  var React = __webpack_require__(1);
155
+
154
156
  var styled_components_1 = __webpack_require__(4);
157
+
155
158
  var SizeAwareWrapper_1 = __webpack_require__(19);
159
+
156
160
  var style_1 = __webpack_require__(14);
161
+
157
162
  var colorUtils_1 = __webpack_require__(12);
163
+
158
164
  var Item = styled_components_1.default.div.attrs(function (_ref) {
159
165
  var width = _ref.width;
160
166
  return {
@@ -167,11 +173,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
167
173
  componentId: "sc-1yhgpod-0"
168
174
  })(["position:relative;background-color:", "};"], function (props) {
169
175
  return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
170
- });
171
- // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
176
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
177
+
172
178
  var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
173
179
  var width = _ref2.width,
174
- height = _ref2.height;
180
+ height = _ref2.height;
175
181
  return {
176
182
  style: Object.assign(Object.assign({}, width && {
177
183
  width: (0, style_1.toPx)(width)
@@ -193,11 +199,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
193
199
  displayName: "FixedSizeContainer__FixSizeItemContent",
194
200
  componentId: "sc-1yhgpod-3"
195
201
  })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
202
+
196
203
  var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
197
204
  var FixedSizeContainer = function FixedSizeContainer(props) {
198
205
  var width = props.width,
199
- height = props.height,
200
- backgroundColor = props.backgroundColor;
206
+ height = props.height,
207
+ backgroundColor = props.backgroundColor;
208
+
201
209
  if (!height) {
202
210
  return React.createElement(Item, {
203
211
  "data-test": "item",
@@ -205,24 +213,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
205
213
  backgroundColor: backgroundColor
206
214
  }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
207
215
  }
216
+
208
217
  return React.createElement(FixSizeItem, {
209
218
  "data-test": "fix-size-item",
210
- "data-splunk-visualization-version": "26.0.0 - 2f7458907",
219
+ "data-splunk-visualization-version": "26.1.1 - b6df0a015",
211
220
  width: width,
212
221
  height: height,
213
222
  backgroundColor: backgroundColor
214
223
  }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
215
224
  var newWidth = _ref3.width,
216
- newHeight = _ref3.height;
225
+ newHeight = _ref3.height;
217
226
  return React.createElement(Viz, Object.assign({}, props, {
218
227
  width: newWidth,
219
228
  height: newHeight
220
229
  }));
221
230
  })));
222
231
  };
232
+
223
233
  FixedSizeContainer.displayName = 'withFixedSizeContainer';
224
234
  return FixedSizeContainer;
225
235
  };
236
+
226
237
  exports.default = withFixedSizeContainer;
227
238
 
228
239
  /***/ }),
@@ -269,9 +280,10 @@ exports.extendStaticWrapperProps = void 0;
269
280
  * @param {DashboardVizType} props.Wrapper
270
281
  * @param {DashboardVizType} props.Visualization
271
282
  */
283
+
272
284
  var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
273
285
  var Wrapper = _ref.Wrapper,
274
- Visualization = _ref.Visualization;
286
+ Visualization = _ref.Visualization;
275
287
  var extendProperties = ['propTypes', 'defaultProps', 'config'];
276
288
  extendProperties.forEach(function (prop) {
277
289
  if (Visualization[prop]) {
@@ -280,6 +292,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
280
292
  }
281
293
  });
282
294
  };
295
+
283
296
  exports.extendStaticWrapperProps = extendStaticWrapperProps;
284
297
 
285
298
  /***/ }),
@@ -291,64 +304,80 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
291
304
 
292
305
  /***/ }),
293
306
 
294
- /***/ 168:
307
+ /***/ 169:
295
308
  /***/ (function(module, exports, __webpack_require__) {
296
309
 
297
310
  "use strict";
298
311
 
299
312
 
300
313
  var _slicedToArray = __webpack_require__(17);
314
+
301
315
  var __rest = this && this.__rest || function (s, e) {
302
316
  var t = {};
317
+
303
318
  for (var p in s) {
304
319
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
305
320
  }
321
+
306
322
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
307
323
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
308
324
  }
309
325
  return t;
310
326
  };
327
+
311
328
  Object.defineProperty(exports, "__esModule", {
312
329
  value: true
313
330
  });
314
331
  exports.config = exports.PureTable = exports.themes = exports.computeVizProps = void 0;
332
+
315
333
  var lodash_1 = __webpack_require__(3);
334
+
316
335
  var colorUtils_1 = __webpack_require__(12);
336
+
317
337
  var config_1 = __webpack_require__(480);
338
+
318
339
  exports.config = config_1.default;
319
- var withDashboardViz_1 = __webpack_require__(36);
340
+
341
+ var withDashboardViz_1 = __webpack_require__(37);
342
+
320
343
  var PureTable_1 = __webpack_require__(481);
344
+
321
345
  exports.PureTable = PureTable_1.default;
346
+
322
347
  var computeVizProps = function computeVizProps(_a) {
323
348
  var props = __rest(_a, []);
349
+
324
350
  var vizProps = Object.assign({}, props);
351
+
325
352
  if (vizProps.columnFormat) {
326
353
  var columns = vizProps.columnFormat;
327
354
  var themeRowBackgroundColorOdd = vizProps.themeFunc('rowBackgroundColorOdd');
328
355
  var themeRowBackgroundColorEven = vizProps.themeFunc('rowBackgroundColorEven');
329
- var themeTextColor = vizProps.themeFunc('textColor');
330
- // `columns` looks like { `column title`: { rowBackgroundColors, rowColors... }}
356
+ var themeTextColor = vizProps.themeFunc('textColor'); // `columns` looks like { `column title`: { rowBackgroundColors, rowColors... }}
357
+
331
358
  Object.entries(columns).forEach(function (_ref) {
332
359
  var _ref2 = _slicedToArray(_ref, 2),
333
- columnKey = _ref2[0],
334
- columnProperties = _ref2[1];
360
+ columnKey = _ref2[0],
361
+ columnProperties = _ref2[1];
362
+
335
363
  var rowBackgroundColors;
336
- var rowColors;
337
- // If columns have `rowBackgroundColors` or `rowColors` arrays defined, sanitize them. If there are undefined values after sanitization, these
364
+ var rowColors; // If columns have `rowBackgroundColors` or `rowColors` arrays defined, sanitize them. If there are undefined values after sanitization, these
338
365
  // elements are populated with the default values provided by the theme.
366
+
339
367
  if (columnProperties.rowBackgroundColors) {
340
368
  rowBackgroundColors = (0, colorUtils_1.sanitizeArrayOfColors)(columnProperties.rowBackgroundColors).map(function (color, i) {
341
- return (
342
- // using (i + 1) % 2 because 'odd' refers to row number, so index 0 -> row 1 -> odd colored
369
+ return (// using (i + 1) % 2 because 'odd' refers to row number, so index 0 -> row 1 -> odd colored
343
370
  color || ((i + 1) % 2 === 0 ? themeRowBackgroundColorEven : themeRowBackgroundColorOdd)
344
371
  );
345
372
  });
346
373
  }
374
+
347
375
  if (columnProperties.rowColors) {
348
376
  rowColors = (0, colorUtils_1.sanitizeArrayOfColors)(columnProperties.rowColors).map(function (color) {
349
377
  return color || themeTextColor;
350
378
  });
351
379
  }
380
+
352
381
  vizProps.columnFormat[columnKey] = Object.assign(Object.assign(Object.assign({}, vizProps.columnFormat[columnKey]), columnProperties.rowBackgroundColors && {
353
382
  rowBackgroundColors: rowBackgroundColors
354
383
  }), columnProperties.rowColors && {
@@ -356,9 +385,11 @@ var computeVizProps = function computeVizProps(_a) {
356
385
  });
357
386
  });
358
387
  }
388
+
359
389
  if (vizProps.onOptionsChange) {
360
390
  var handleColumnFormatChange = function handleColumnFormatChange(updatedColumnFormat) {
361
391
  var _a, _b;
392
+
362
393
  var cloneOfExistingColumnFormat = (_b = Object.assign({}, (_a = vizProps === null || vizProps === void 0 ? void 0 : vizProps.options) === null || _a === void 0 ? void 0 : _a.columnFormat)) !== null && _b !== void 0 ? _b : {};
363
394
  var keys = Object.keys(updatedColumnFormat);
364
395
  var values = Object.values(updatedColumnFormat);
@@ -366,6 +397,7 @@ var computeVizProps = function computeVizProps(_a) {
366
397
  if (!cloneOfExistingColumnFormat[key]) {
367
398
  cloneOfExistingColumnFormat[key] = {};
368
399
  }
400
+
369
401
  var newWidth = (0, lodash_1.get)(values[index], 'width');
370
402
  cloneOfExistingColumnFormat[key] = Object.assign(Object.assign({}, cloneOfExistingColumnFormat[key]), {
371
403
  width: newWidth
@@ -375,10 +407,13 @@ var computeVizProps = function computeVizProps(_a) {
375
407
  columnFormat: cloneOfExistingColumnFormat
376
408
  });
377
409
  };
410
+
378
411
  vizProps.onColumnFormatChange = handleColumnFormatChange;
379
412
  }
413
+
380
414
  return vizProps;
381
415
  };
416
+
382
417
  exports.computeVizProps = computeVizProps;
383
418
  var Table = (0, withDashboardViz_1.default)({
384
419
  ReactViz: PureTable_1.default,
@@ -427,24 +462,33 @@ module.exports = require("@splunk/ui-utils/i18n");
427
462
 
428
463
 
429
464
  var _toConsumableArray = __webpack_require__(8);
465
+
430
466
  var _defineProperty = __webpack_require__(7);
467
+
431
468
  var __rest = this && this.__rest || function (s, e) {
432
469
  var t = {};
470
+
433
471
  for (var p in s) {
434
472
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
435
473
  }
474
+
436
475
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
437
476
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
438
477
  }
439
478
  return t;
440
479
  };
480
+
441
481
  Object.defineProperty(exports, "__esModule", {
442
482
  value: true
443
483
  });
444
484
  exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
485
+
445
486
  var lodash_1 = __webpack_require__(3);
487
+
446
488
  var schemaUtils_1 = __webpack_require__(16);
489
+
447
490
  var VizBehavior_1 = __webpack_require__(6);
491
+
448
492
  var dynamicOptionsDSLType = {
449
493
  type: 'string',
450
494
  pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
@@ -454,20 +498,22 @@ var dynamicOptionsDSLType = {
454
498
  * @param optionsSchema a visualization's options schema
455
499
  * @returns an updated options schema that additionally allows strings starting with > for each option
456
500
  */
501
+
457
502
  function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
458
503
  var enhancedOptionsSchema = {};
459
504
  Object.keys(optionsSchema).forEach(function (key) {
460
505
  var _a = optionsSchema[key],
461
- title = _a.title,
462
- description = _a.description,
463
- readOnly = _a.readOnly,
464
- writeOnly = _a.writeOnly,
465
- examples = _a.examples,
466
- defaultValue = _a.default,
467
- type = _a.type,
468
- properties = _a.properties,
469
- patternProperties = _a.patternProperties,
470
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
506
+ title = _a.title,
507
+ description = _a.description,
508
+ readOnly = _a.readOnly,
509
+ writeOnly = _a.writeOnly,
510
+ examples = _a.examples,
511
+ defaultValue = _a.default,
512
+ type = _a.type,
513
+ properties = _a.properties,
514
+ patternProperties = _a.patternProperties,
515
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
516
+
471
517
  var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
472
518
  title: title
473
519
  }), description !== undefined && {
@@ -481,12 +527,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
481
527
  }), defaultValue !== undefined && {
482
528
  default: defaultValue
483
529
  });
530
+
484
531
  if (type === 'object') {
485
532
  enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
486
533
  type: type
487
534
  }), properties && {
488
535
  properties: enhanceOptionsSchemaWithDynamicOptions(properties)
489
536
  });
537
+
490
538
  if (patternProperties) {
491
539
  var enhancedPatternProperties = {};
492
540
  Object.keys(patternProperties).forEach(function (opt) {
@@ -504,6 +552,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
504
552
  });
505
553
  return enhancedOptionsSchema;
506
554
  }
555
+
507
556
  exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
508
557
  /**
509
558
  * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
@@ -512,11 +561,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
512
561
  * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
513
562
  * and containing `open: false` for all editor panels in editorConfig
514
563
  */
564
+
515
565
  function enhanceConfig(vizConfig) {
516
566
  var enhancedConfig = Object.assign({}, vizConfig);
567
+
517
568
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
518
569
  enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
519
570
  }
571
+
520
572
  enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
521
573
  return Object.assign(Object.assign({}, config), {
522
574
  open: config.open || false
@@ -524,6 +576,7 @@ function enhanceConfig(vizConfig) {
524
576
  });
525
577
  return enhancedConfig;
526
578
  }
579
+
527
580
  exports.enhanceConfig = enhanceConfig;
528
581
  /**
529
582
  * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
@@ -531,6 +584,7 @@ exports.enhanceConfig = enhanceConfig;
531
584
  * @param vizConfig a Visualization Config
532
585
  * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
533
586
  */
587
+
534
588
  function uncollapseEditorConfig(vizConfig) {
535
589
  var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
536
590
  editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
@@ -540,13 +594,16 @@ function uncollapseEditorConfig(vizConfig) {
540
594
  });
541
595
  return editorPanelUncollapsedConfig;
542
596
  }
597
+
543
598
  exports.uncollapseEditorConfig = uncollapseEditorConfig;
599
+
544
600
  function isDynamicOption(option) {
545
601
  return option && typeof option === 'string' && option.trim().startsWith('>') || false;
546
602
  }
547
- exports.isDynamicOption = isDynamicOption;
548
- // private helpers to improve readability of getInitialPreset
603
+
604
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
549
605
  // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
606
+
550
607
  /**
551
608
  * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
552
609
  * 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
@@ -555,6 +612,7 @@ exports.isDynamicOption = isDynamicOption;
555
612
  *
556
613
  * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
557
614
  */
615
+
558
616
  function hasCompatibleContexts(vizContext, presetContext) {
559
617
  var presetContextKeys = Object.keys(presetContext);
560
618
  return presetContextKeys.every(function (contextKey) {
@@ -564,6 +622,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
564
622
  /**
565
623
  * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
566
624
  */
625
+
626
+
567
627
  function hasCompatibleOptions(vizOptions, presetOptions) {
568
628
  var presetOptionKeys = Object.keys(presetOptions);
569
629
  return presetOptionKeys.every(function (optionKey) {
@@ -578,18 +638,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
578
638
  * @param {Object} vizOptions - the current vizOptions definition
579
639
  * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
580
640
  */
641
+
642
+
581
643
  function getInitialPreset(vizContext, vizOptions, presets) {
582
644
  return presets.find(function (preset) {
583
645
  var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
584
646
  var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
585
647
  var presetContextKeys = Object.keys(presetContext);
586
- var presetOptionKeys = Object.keys(presetOptions);
587
- // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
648
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
588
649
  // if not, then the preset is invalid in config.ts
650
+
589
651
  if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
590
652
  return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
591
653
  });
592
654
  }
655
+
593
656
  exports.getInitialPreset = getInitialPreset;
594
657
  /**
595
658
  * generates number precision values for a Select editor
@@ -597,6 +660,7 @@ exports.getInitialPreset = getInitialPreset;
597
660
  * @param {Number} numPrecisionValues - number of integer precision values to generate
598
661
  * @returns {{ label: string; value; string }[]} array of { label, value } tuples
599
662
  */
663
+
600
664
  function generatePrecisionValues(numPrecisionValues) {
601
665
  return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
602
666
  return {
@@ -605,6 +669,7 @@ function generatePrecisionValues(numPrecisionValues) {
605
669
  };
606
670
  });
607
671
  }
672
+
608
673
  exports.generatePrecisionValues = generatePrecisionValues;
609
674
  /**
610
675
  * insert layout in layout array, return a new layout array instead of updating the original
@@ -614,12 +679,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
614
679
  * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
615
680
  * @returns {EditorLayoutConfig[][]} new editor layout with insertion
616
681
  */
682
+
617
683
  var insertLayout = function insertLayout(layout, index) {
618
684
  for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
619
685
  layoutItems[_key - 2] = arguments[_key];
620
686
  }
687
+
621
688
  return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
622
689
  };
690
+
623
691
  exports.insertLayout = insertLayout;
624
692
 
625
693
  /***/ }),
@@ -690,11 +758,17 @@ Object.defineProperty(exports, "__esModule", {
690
758
  value: true
691
759
  });
692
760
  exports.shouldShowIconPlaceholder = void 0;
761
+
693
762
  var React = __webpack_require__(1);
763
+
694
764
  var T = __webpack_require__(0);
765
+
695
766
  var lodash_1 = __webpack_require__(3);
767
+
696
768
  var i18n_1 = __webpack_require__(2);
769
+
697
770
  var Message_1 = __webpack_require__(10);
771
+
698
772
  var FixedSizeContainer_1 = __webpack_require__(13);
699
773
  /**
700
774
  * @method shouldShowIconPlaceholder
@@ -702,6 +776,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
702
776
  * @param {boolean} loading
703
777
  * @returns {boolean}
704
778
  */
779
+
780
+
705
781
  var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
706
782
  var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
707
783
  var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
@@ -710,6 +786,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
710
786
  var noFields = fields === undefined;
711
787
  return loading || noData || noFields;
712
788
  };
789
+
713
790
  exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
714
791
  var propTypes = {
715
792
  icon: T.func,
@@ -724,11 +801,13 @@ var propTypes = {
724
801
  * @param {IconPlaceholderProps} props
725
802
  * @returns {React.ReactElement}
726
803
  */
804
+
727
805
  var IconPlaceholder = function IconPlaceholder(props) {
728
806
  var width = props.width,
729
- height = props.height,
730
- icon = props.icon,
731
- iconColor = props.iconColor;
807
+ height = props.height,
808
+ icon = props.icon,
809
+ iconColor = props.iconColor;
810
+
732
811
  if (icon) {
733
812
  return React.createElement(icon, {
734
813
  style: {
@@ -740,9 +819,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
740
819
  transform: 'translate(-50%, -50%)'
741
820
  },
742
821
  width: '50%',
743
- height: '50%'
822
+ height: '50%',
823
+ 'data-test': 'icon-placeholder'
744
824
  });
745
825
  }
826
+
746
827
  return React.createElement(Message_1.default, {
747
828
  width: width,
748
829
  height: height,
@@ -750,6 +831,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
750
831
  message: (0, i18n_1._)('No DataSource Connected')
751
832
  });
752
833
  };
834
+
753
835
  IconPlaceholder.propTypes = propTypes;
754
836
  IconPlaceholder.defaultProps = {
755
837
  width: '100%',
@@ -766,21 +848,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
766
848
 
767
849
 
768
850
  var _defineProperty = __webpack_require__(7);
851
+
769
852
  Object.defineProperty(exports, "__esModule", {
770
853
  value: true
771
854
  });
772
855
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
856
+
773
857
  var T = __webpack_require__(0);
858
+
774
859
  var lodash_1 = __webpack_require__(3);
775
- var DataSource_1 = __webpack_require__(43);
860
+
861
+ var DataSource_1 = __webpack_require__(34);
862
+
776
863
  exports.SortParamsPropTypes = T.shape({
777
864
  currentSortKey: T.string,
778
865
  currentSortDir: T.oneOf(DataSource_1.validSortDirs),
779
866
  onSort: T.func
780
867
  });
868
+
781
869
  var getSortingParams = function getSortingParams(_ref) {
782
870
  var requestParams = _ref.requestParams,
783
- onRequestParamsChange = _ref.onRequestParamsChange;
871
+ onRequestParamsChange = _ref.onRequestParamsChange;
784
872
  var currentSortKey;
785
873
  var currentSortDir;
786
874
  var nextSortDirMap = {
@@ -789,15 +877,18 @@ var getSortingParams = function getSortingParams(_ref) {
789
877
  none: 'asc'
790
878
  };
791
879
  var onSort;
880
+
792
881
  if (typeof onRequestParamsChange === 'function') {
793
882
  if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
794
883
  currentSortKey = Object.keys(requestParams.sort).shift();
795
884
  currentSortDir = requestParams.sort[currentSortKey];
796
- }
797
- // undid memoization since there is a dependency on requestParams, which is a deeply nested object
885
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
886
+
887
+
798
888
  onSort = function onSort(e, _ref2) {
799
889
  var sortKey = _ref2.sortKey,
800
- sortDir = _ref2.sortDir;
890
+ sortDir = _ref2.sortDir;
891
+
801
892
  if (typeof sortKey === 'string') {
802
893
  var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
803
894
  onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
@@ -809,12 +900,14 @@ var getSortingParams = function getSortingParams(_ref) {
809
900
  }
810
901
  };
811
902
  }
903
+
812
904
  return {
813
905
  currentSortKey: currentSortKey,
814
906
  currentSortDir: currentSortDir,
815
907
  onSort: onSort
816
908
  };
817
909
  };
910
+
818
911
  exports.getSortingParams = getSortingParams;
819
912
 
820
913
  /***/ }),
@@ -825,43 +918,69 @@ exports.getSortingParams = getSortingParams;
825
918
  "use strict";
826
919
 
827
920
 
921
+ Object.defineProperty(exports, "__esModule", {
922
+ value: true
923
+ });
924
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
925
+ exports.validSortDirs = ['asc', 'desc', 'none'];
926
+ exports.validSegmentationModes = ['none', 'inner'];
927
+ exports.validOutputModes = ['json_cols', 'json'];
928
+
929
+ /***/ }),
930
+
931
+ /***/ 35:
932
+ /***/ (function(module, exports, __webpack_require__) {
933
+
934
+ "use strict";
935
+
936
+
828
937
  Object.defineProperty(exports, "__esModule", {
829
938
  value: true
830
939
  });
831
940
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
941
+
832
942
  var T = __webpack_require__(0);
943
+
833
944
  var lodash_1 = __webpack_require__(3);
945
+
834
946
  exports.PaginatorParamsPropTypes = T.shape({
835
947
  isPaging: T.bool,
836
948
  current: T.number,
837
949
  totalPages: T.number,
838
950
  onChange: T.func
839
951
  });
952
+
840
953
  var getPaginationParams = function getPaginationParams(_ref) {
841
954
  var requestParams = _ref.requestParams,
842
- meta = _ref.meta,
843
- onRequestParamsChange = _ref.onRequestParamsChange;
955
+ meta = _ref.meta,
956
+ onRequestParamsChange = _ref.onRequestParamsChange;
844
957
  var totalCount = meta && meta.totalCount || 0;
845
958
  var offset = requestParams && requestParams.offset || 0;
846
959
  var count = requestParams && requestParams.count;
847
960
  var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
848
961
  var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
849
962
  var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
963
+
850
964
  var onChangeHandler = function onChangeHandler(e, _ref2) {
851
965
  var page = _ref2.page,
852
- countArg = _ref2.count;
966
+ countArg = _ref2.count;
853
967
  var newParams = (0, lodash_1.cloneDeep)(requestParams);
968
+
854
969
  if (typeof countArg === 'number') {
855
970
  newParams.count = countArg;
856
971
  newParams.offset = 0;
857
972
  }
973
+
858
974
  var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
975
+
859
976
  if (typeof page === 'number' && page > 0) {
860
977
  newParams.count = pageCount;
861
978
  newParams.offset = (page - 1) * pageCount;
862
979
  }
980
+
863
981
  onRequestParamsChange(newParams);
864
982
  };
983
+
865
984
  return {
866
985
  isPaging: isPaging,
867
986
  current: current,
@@ -869,11 +988,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
869
988
  onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
870
989
  };
871
990
  };
991
+
872
992
  exports.getPaginationParams = getPaginationParams;
873
993
 
874
994
  /***/ }),
875
995
 
876
- /***/ 35:
996
+ /***/ 36:
877
997
  /***/ (function(module, exports, __webpack_require__) {
878
998
 
879
999
  "use strict";
@@ -884,6 +1004,7 @@ Object.defineProperty(exports, "__esModule", {
884
1004
  });
885
1005
  exports.VizCategory = void 0;
886
1006
  var VizCategory;
1007
+
887
1008
  (function (VizCategory) {
888
1009
  VizCategory["SINGLE_VALUE"] = "Single Value";
889
1010
  VizCategory["TRENDS"] = "Trends";
@@ -901,67 +1022,96 @@ var VizCategory;
901
1022
 
902
1023
  /***/ }),
903
1024
 
904
- /***/ 36:
1025
+ /***/ 37:
905
1026
  /***/ (function(module, exports, __webpack_require__) {
906
1027
 
907
1028
  "use strict";
908
1029
 
909
1030
 
910
1031
  var _slicedToArray = __webpack_require__(17);
1032
+
911
1033
  Object.defineProperty(exports, "__esModule", {
912
1034
  value: true
913
1035
  });
1036
+
914
1037
  var React = __webpack_require__(1);
1038
+
915
1039
  var lodash_1 = __webpack_require__(3);
916
- var getSettingsFromThemedProps_1 = __webpack_require__(37);
1040
+
1041
+ var getSettingsFromThemedProps_1 = __webpack_require__(38);
1042
+
917
1043
  var Options_1 = __webpack_require__(30);
918
- var SanitizeProps_1 = __webpack_require__(38);
1044
+
1045
+ var SanitizeProps_1 = __webpack_require__(39);
1046
+
919
1047
  var TimezoneContext_1 = __webpack_require__(26);
920
- var moment_1 = __webpack_require__(39);
1048
+
1049
+ var moment_1 = __webpack_require__(40);
1050
+
921
1051
  var FeatureFlagContext_1 = __webpack_require__(21);
1052
+
922
1053
  var styled_components_1 = __webpack_require__(4);
1054
+
923
1055
  var hocUtils_1 = __webpack_require__(27);
1056
+
924
1057
  var JSONSchemaUtils_1 = __webpack_require__(28);
925
- var async_dynamic_options_evaluator_1 = __webpack_require__(40);
1058
+
1059
+ var async_dynamic_options_evaluator_1 = __webpack_require__(41);
1060
+
926
1061
  var id_1 = __webpack_require__(25);
927
- var SplunkVisualization_1 = __webpack_require__(41);
1062
+
1063
+ var SplunkVisualization_1 = __webpack_require__(42);
1064
+
928
1065
  var VizBehavior_1 = __webpack_require__(6);
1066
+
929
1067
  var getSorting_1 = __webpack_require__(33);
930
- var getPagination_1 = __webpack_require__(34);
1068
+
1069
+ var getPagination_1 = __webpack_require__(35);
1070
+
931
1071
  var useDeepMemo_1 = __webpack_require__(44);
1072
+
932
1073
  var MissingPropsMessage_1 = __webpack_require__(45);
1074
+
933
1075
  var withEditModeCover_1 = __webpack_require__(46);
1076
+
934
1077
  var withPlaceholder_1 = __webpack_require__(47);
935
1078
  /**
936
1079
  * hoc that wraps a pure react visualization in a Dashboard visualization
937
1080
  * @param {DashboardVizOpts} opts
938
1081
  * @returns {HOC}
939
1082
  */
1083
+
1084
+
940
1085
  var withDashboardViz = function withDashboardViz(opts) {
941
1086
  var ReactViz = opts.ReactViz,
942
- vizConfig = opts.vizConfig,
943
- _opts$computeVizProps = opts.computeVizProps,
944
- computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
945
- disableEditModeCover = opts.disableEditModeCover,
946
- useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
1087
+ vizConfig = opts.vizConfig,
1088
+ _opts$computeVizProps = opts.computeVizProps,
1089
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
1090
+ disableEditModeCover = opts.disableEditModeCover,
1091
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
1092
+
947
1093
  var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
948
1094
  var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
1095
+
949
1096
  var DashboardViz = function DashboardViz(props) {
950
1097
  var _a;
1098
+
951
1099
  var mode = props.mode,
952
- hasEventHandlers = props.hasEventHandlers,
953
- dataSources = props.dataSources,
954
- options = props.options,
955
- _props$context = props.context,
956
- context = _props$context === void 0 ? {} : _props$context,
957
- width = props.width,
958
- height = props.height,
959
- onComputedProps = props.onComputedProps,
960
- onEventTrigger = props.onEventTrigger,
961
- theme = props.theme,
962
- onRequestParamsChange = props.onRequestParamsChange;
1100
+ hasEventHandlers = props.hasEventHandlers,
1101
+ dataSources = props.dataSources,
1102
+ options = props.options,
1103
+ _props$context = props.context,
1104
+ context = _props$context === void 0 ? {} : _props$context,
1105
+ width = props.width,
1106
+ height = props.height,
1107
+ onComputedProps = props.onComputedProps,
1108
+ onEventTrigger = props.onEventTrigger,
1109
+ theme = props.theme,
1110
+ onRequestParamsChange = props.onRequestParamsChange;
1111
+
963
1112
  var _React$useContext = React.useContext(TimezoneContext_1.default),
964
- serializedTimezone = _React$useContext.serializedTimezone;
1113
+ serializedTimezone = _React$useContext.serializedTimezone;
1114
+
965
1115
  if (serializedTimezone) {
966
1116
  /*
967
1117
  @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
@@ -975,38 +1125,51 @@ var withDashboardViz = function withDashboardViz(opts) {
975
1125
  moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
976
1126
  }
977
1127
  }
1128
+
978
1129
  var themeFunc = function themeFunc(themeVar) {
979
1130
  var _a, _b;
1131
+
980
1132
  return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
981
1133
  };
1134
+
982
1135
  var bgColorFromTheme = themeFunc('defaultBackgroundColor');
1136
+
983
1137
  var _ref = (0, getSettingsFromThemedProps_1.default)({
984
- theme: theme
985
- }),
986
- currentThemeFamily = _ref.family,
987
- currentThemeColorScheme = _ref.colorScheme,
988
- currentThemeDensity = _ref.density;
1138
+ theme: theme
1139
+ }),
1140
+ currentThemeFamily = _ref.family,
1141
+ currentThemeColorScheme = _ref.colorScheme,
1142
+ currentThemeDensity = _ref.density;
1143
+
989
1144
  var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
1145
+
990
1146
  var _React$useState = React.useState({}),
991
- _React$useState2 = _slicedToArray(_React$useState, 2),
992
- evaluatedOptionsAsync = _React$useState2[0],
993
- setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1147
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1148
+ evaluatedOptionsAsync = _React$useState2[0],
1149
+ setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1150
+
1151
+
994
1152
  var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
1153
+
995
1154
  var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
996
- _React$useState4 = _slicedToArray(_React$useState3, 1),
997
- visualizationID = _React$useState4[0];
1155
+ _React$useState4 = _slicedToArray(_React$useState3, 1),
1156
+ visualizationID = _React$useState4[0];
1157
+
998
1158
  var _React$useState5 = React.useState({}),
999
- _React$useState6 = _slicedToArray(_React$useState5, 2),
1000
- dataSourcesInState = _React$useState6[0],
1001
- setDataSourcesInState = _React$useState6[1];
1159
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
1160
+ dataSourcesInState = _React$useState6[0],
1161
+ setDataSourcesInState = _React$useState6[1];
1162
+
1002
1163
  var _React$useState7 = React.useState(),
1003
- _React$useState8 = _slicedToArray(_React$useState7, 2),
1004
- dataFramesInState = _React$useState8[0],
1005
- setDataFramesInState = _React$useState8[1];
1164
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
1165
+ dataFramesInState = _React$useState8[0],
1166
+ setDataFramesInState = _React$useState8[1];
1167
+
1006
1168
  var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
1007
- _React$useState10 = _slicedToArray(_React$useState9, 2),
1008
- useAsyncEvaluatedOptions = _React$useState10[0],
1009
- setUseAsyncEvaluatedOptions = _React$useState10[1];
1169
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
1170
+ useAsyncEvaluatedOptions = _React$useState10[0],
1171
+ setUseAsyncEvaluatedOptions = _React$useState10[1];
1172
+
1010
1173
  var isMounted = React.useRef(true);
1011
1174
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
1012
1175
  try {
@@ -1031,11 +1194,13 @@ var withDashboardViz = function withDashboardViz(opts) {
1031
1194
  });
1032
1195
  } else {
1033
1196
  var dataFrames = dataFramesInState;
1197
+
1034
1198
  if (dataSources !== dataSourcesInState) {
1035
1199
  setDataSourcesInState(dataSources);
1036
1200
  dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
1037
1201
  setDataFramesInState(dataFrames);
1038
1202
  }
1203
+
1039
1204
  return Options_1.Options.evaluate({
1040
1205
  context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
1041
1206
  options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
@@ -1046,21 +1211,24 @@ var withDashboardViz = function withDashboardViz(opts) {
1046
1211
  console.error("unexpected error evaluating options: ".concat(e.message));
1047
1212
  return {};
1048
1213
  }
1214
+
1049
1215
  return {};
1050
1216
  }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1051
- var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
1052
- // trellis specific backgroundColor update for onComputedProps
1217
+ var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
1053
1218
  // 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
1054
1219
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
1220
+
1055
1221
  var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
1056
1222
  var clonedEvaluatedOptions = evaluatedOptionsToUse;
1223
+
1057
1224
  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) {
1058
1225
  clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
1059
1226
  backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
1060
1227
  });
1061
- }
1062
- // useEffect hook needs to be initialized before any early returns
1228
+ } // useEffect hook needs to be initialized before any early returns
1063
1229
  // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
1230
+
1231
+
1064
1232
  React.useEffect(function () {
1065
1233
  onComputedProps(clonedEvaluatedOptions);
1066
1234
  });
@@ -1070,53 +1238,68 @@ var withDashboardViz = function withDashboardViz(opts) {
1070
1238
  isMounted.current = false;
1071
1239
  async_dynamic_options_evaluator_1.default.reset(visualizationID);
1072
1240
  }
1073
- };
1074
- // eslint-disable-next-line react-hooks/exhaustive-deps
1075
- }, []);
1076
- // present warning message if any required props are missing
1241
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
1242
+ }, []); // present warning message if any required props are missing
1243
+
1077
1244
  var _vizConfig$requiredPr = vizConfig.requiredProps,
1078
- requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1079
- supports = vizConfig.supports;
1245
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1246
+ supports = vizConfig.supports;
1080
1247
  var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
1248
+
1081
1249
  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
1082
1250
  ) {
1083
- return React.createElement(MissingPropsMessage_1.default, {
1084
- "data-test": "missing-props-message",
1085
- width: width,
1086
- height: height,
1087
- missingProps: missing,
1088
- backgroundColor: bgColorFromTheme
1089
- });
1090
- }
1091
- // events
1251
+ return React.createElement(MissingPropsMessage_1.default, {
1252
+ "data-test": "missing-props-message",
1253
+ width: width,
1254
+ height: height,
1255
+ missingProps: missing,
1256
+ backgroundColor: bgColorFromTheme
1257
+ });
1258
+ } // events
1259
+
1260
+
1092
1261
  var eventCallbackProps = {};
1262
+
1093
1263
  if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
1094
1264
  var supportedEvents = vizConfig.events;
1095
1265
  Object.keys(supportedEvents).forEach(function (eventName) {
1096
- var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
1097
- eventCallbackProps[eventCallbackPropName] = null;
1098
- // todo: refactor single value and single value icon to send payload from viz
1266
+ var _supportedEvents$even = supportedEvents[eventName],
1267
+ parentKeys = _supportedEvents$even.parentKeys,
1268
+ payloadKeys = _supportedEvents$even.payloadKeys;
1269
+ var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
1099
1270
  // then remove these lines
1100
- var payloadKeys = supportedEvents[eventName].payloadKeys;
1271
+
1101
1272
  var payload = {};
1273
+
1102
1274
  if (Array.isArray(payloadKeys) && payloadKeys.length) {
1103
1275
  payloadKeys.forEach(function (p) {
1104
1276
  payload[p] = evaluatedOptionsToUse[p];
1105
1277
  });
1106
1278
  }
1279
+
1107
1280
  eventCallbackProps[eventCallbackPropName] = function (ev) {
1108
1281
  if (ev && ev.payload) {
1109
1282
  payload = ev.payload;
1110
1283
  }
1284
+
1111
1285
  return onEventTrigger({
1112
1286
  originalEvent: ev,
1113
1287
  payload: payload,
1114
1288
  type: eventName
1115
1289
  });
1116
1290
  };
1291
+
1292
+ if (parentKeys) {
1293
+ for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
1294
+ var newObject = {};
1295
+ newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
1296
+ eventCallbackProps[eventCallbackPropName] = newObject;
1297
+ }
1298
+ }
1117
1299
  });
1118
- }
1119
- // compute pure viz props which are not from options
1300
+ } // compute pure viz props which are not from options
1301
+
1302
+
1120
1303
  var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
1121
1304
  themeFunc: themeFunc
1122
1305
  }));
@@ -1134,15 +1317,19 @@ var withDashboardViz = function withDashboardViz(opts) {
1134
1317
  * In future, we could automatically detect which all datasources are being used
1135
1318
  * and bind those magically to pagination/sorting behavior.
1136
1319
  */
1320
+
1137
1321
  var dataSourceMetadata = {};
1138
1322
  var OptionKey = 'paginateDataSourceKey';
1139
1323
  var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
1324
+
1140
1325
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
1141
1326
  var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
1142
1327
  var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
1328
+
1143
1329
  var handleRequestParamsChange = function handleRequestParamsChange(payload) {
1144
1330
  return onRequestParamsChange(paginateDataSourceKey, payload);
1145
1331
  };
1332
+
1146
1333
  var sortParams = (0, getSorting_1.getSortingParams)({
1147
1334
  requestParams: requestParams,
1148
1335
  meta: meta,
@@ -1157,115 +1344,132 @@ var withDashboardViz = function withDashboardViz(opts) {
1157
1344
  sortParams: sortParams,
1158
1345
  paginatorParams: paginatorParams
1159
1346
  };
1160
- }
1161
- // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
1347
+ } // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
1348
+
1349
+
1162
1350
  if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
1163
1351
  return null;
1164
1352
  }
1353
+
1165
1354
  return React.createElement(SanitizedReactViz, Object.assign({
1166
1355
  mode: mode,
1167
1356
  width: width,
1168
1357
  height: height
1169
1358
  }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1170
1359
  };
1360
+
1171
1361
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
1172
1362
  DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
1173
1363
  // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
1174
1364
  theme: {}
1175
- });
1176
- // attach viz config
1177
- DashboardViz.config = vizConfig;
1178
- // @ts-ignore: TODO fix sc upgrade TS issues
1365
+ }); // attach viz config
1366
+
1367
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1368
+
1179
1369
  return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
1180
1370
  };
1371
+
1181
1372
  exports.default = withDashboardViz;
1182
1373
 
1183
1374
  /***/ }),
1184
1375
 
1185
- /***/ 37:
1376
+ /***/ 38:
1186
1377
  /***/ (function(module, exports) {
1187
1378
 
1188
1379
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1189
1380
 
1190
1381
  /***/ }),
1191
1382
 
1192
- /***/ 38:
1383
+ /***/ 39:
1193
1384
  /***/ (function(module, exports) {
1194
1385
 
1195
1386
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1196
1387
 
1197
1388
  /***/ }),
1198
1389
 
1199
- /***/ 39:
1390
+ /***/ 4:
1200
1391
  /***/ (function(module, exports) {
1201
1392
 
1202
- module.exports = require("@splunk/moment");
1393
+ module.exports = require("styled-components");
1203
1394
 
1204
1395
  /***/ }),
1205
1396
 
1206
- /***/ 4:
1397
+ /***/ 40:
1207
1398
  /***/ (function(module, exports) {
1208
1399
 
1209
- module.exports = require("styled-components");
1400
+ module.exports = require("@splunk/moment");
1210
1401
 
1211
1402
  /***/ }),
1212
1403
 
1213
- /***/ 40:
1404
+ /***/ 41:
1214
1405
  /***/ (function(module, exports) {
1215
1406
 
1216
1407
  module.exports = require("@splunk/async-dynamic-options-evaluator");
1217
1408
 
1218
1409
  /***/ }),
1219
1410
 
1220
- /***/ 41:
1411
+ /***/ 42:
1221
1412
  /***/ (function(module, exports, __webpack_require__) {
1222
1413
 
1223
1414
  "use strict";
1224
1415
 
1225
1416
 
1226
1417
  var _classCallCheck = __webpack_require__(9);
1418
+
1227
1419
  Object.defineProperty(exports, "__esModule", {
1228
1420
  value: true
1229
1421
  });
1230
1422
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1231
1423
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1424
+
1232
1425
  var T = __webpack_require__(0);
1426
+
1233
1427
  var lodash_1 = __webpack_require__(3);
1234
- var VizActionHandler_1 = __webpack_require__(42);
1235
- // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1428
+
1429
+ var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1430
+
1431
+
1236
1432
  exports.INITIAL_WIDTH = 250;
1237
1433
  exports.INITIAL_HEIGHT = 250;
1238
1434
  /**
1239
1435
  * A Splunk visualization
1240
1436
  */
1437
+
1241
1438
  var SplunkVisualization = function SplunkVisualization() {
1242
1439
  _classCallCheck(this, SplunkVisualization);
1243
1440
  };
1441
+
1244
1442
  SplunkVisualization.propTypes = {
1245
1443
  /**
1246
1444
  * display mode
1247
1445
  */
1248
1446
  mode: T.oneOf(['view', 'edit', 'export']).isRequired,
1447
+
1249
1448
  /**
1250
1449
  * width in pixel or string, defaults to 100%
1251
1450
  */
1252
1451
  width: T.oneOfType([T.string, T.number]).isRequired,
1452
+
1253
1453
  /**
1254
1454
  * height in pixel or string
1255
1455
  */
1256
1456
  height: T.oneOfType([T.string, T.number]).isRequired,
1457
+
1257
1458
  /**
1258
1459
  * visualization context used for dynamic option evaluation
1259
1460
  */
1260
1461
  context: T.object,
1462
+
1261
1463
  /**
1262
1464
  * visualization formatting options
1263
1465
  */
1264
1466
  options: T.object,
1467
+
1265
1468
  /**
1266
1469
  * A callback to update formatting options
1267
1470
  */
1268
1471
  onOptionsChange: T.func,
1472
+
1269
1473
  /**
1270
1474
  * datasource state which include data and request params, object key indicate the datasource type.
1271
1475
  */
@@ -1274,6 +1478,7 @@ SplunkVisualization.propTypes = {
1274
1478
  * current request params
1275
1479
  */
1276
1480
  requestParams: T.object,
1481
+
1277
1482
  /**
1278
1483
  * current dataset
1279
1484
  */
@@ -1281,6 +1486,7 @@ SplunkVisualization.propTypes = {
1281
1486
  fields: T.array,
1282
1487
  columns: T.array
1283
1488
  }),
1489
+
1284
1490
  /**
1285
1491
  * error
1286
1492
  */
@@ -1288,29 +1494,35 @@ SplunkVisualization.propTypes = {
1288
1494
  level: T.string,
1289
1495
  message: T.string
1290
1496
  }),
1497
+
1291
1498
  /**
1292
1499
  * meta data that came with the dataset
1293
1500
  */
1294
1501
  meta: T.object
1295
1502
  })),
1503
+
1296
1504
  /**
1297
1505
  * A callback to trigger event
1298
1506
  */
1299
1507
  onEventTrigger: T.func,
1508
+
1300
1509
  /**
1301
1510
  * Inform viz if there are handlers listening to events
1302
1511
  */
1303
1512
  hasEventHandlers: T.bool,
1513
+
1304
1514
  /**
1305
1515
  * A callback to communicate computed props to a consumer
1306
1516
  */
1307
1517
  onComputedProps: T.func,
1518
+
1308
1519
  /**
1309
1520
  * A callback to obtain visualization api
1310
1521
  */
1311
1522
  vizActionHandlerRef: T.func,
1312
1523
  loading: T.bool,
1313
1524
  theme: T.object,
1525
+
1314
1526
  /**
1315
1527
  * A callback to request new data with updated request params
1316
1528
  */
@@ -1319,6 +1531,7 @@ SplunkVisualization.propTypes = {
1319
1531
  /**
1320
1532
  *
1321
1533
  */
1534
+
1322
1535
  SplunkVisualization.defaultProps = {
1323
1536
  // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1324
1537
  width: '100%',
@@ -1347,26 +1560,29 @@ exports.default = SplunkVisualization;
1347
1560
 
1348
1561
  /***/ }),
1349
1562
 
1350
- /***/ 42:
1563
+ /***/ 43:
1351
1564
  /***/ (function(module, exports, __webpack_require__) {
1352
1565
 
1353
1566
  "use strict";
1354
1567
 
1355
1568
 
1356
1569
  var _classCallCheck = __webpack_require__(9);
1570
+
1357
1571
  var _createClass = __webpack_require__(18);
1572
+
1358
1573
  Object.defineProperty(exports, "__esModule", {
1359
1574
  value: true
1360
1575
  });
1361
1576
  exports.DefaultVizActionHandler = void 0;
1577
+
1362
1578
  var DefaultVizActionHandler = /*#__PURE__*/function () {
1363
1579
  function DefaultVizActionHandler() {
1364
1580
  _classCallCheck(this, DefaultVizActionHandler);
1365
1581
  }
1582
+
1366
1583
  _createClass(DefaultVizActionHandler, [{
1367
1584
  key: "focus",
1368
- value: function focus() {
1369
- // noop
1585
+ value: function focus() {// noop
1370
1586
  }
1371
1587
  }, {
1372
1588
  key: "snapshot",
@@ -1374,23 +1590,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
1374
1590
  return null; // noop
1375
1591
  }
1376
1592
  }]);
1593
+
1377
1594
  return DefaultVizActionHandler;
1378
1595
  }();
1379
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1380
-
1381
- /***/ }),
1382
-
1383
- /***/ 43:
1384
- /***/ (function(module, exports, __webpack_require__) {
1385
1596
 
1386
- "use strict";
1387
-
1388
-
1389
- Object.defineProperty(exports, "__esModule", {
1390
- value: true
1391
- });
1392
- exports.validSortDirs = void 0;
1393
- exports.validSortDirs = ['asc', 'desc', 'none'];
1597
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
1394
1598
 
1395
1599
  /***/ }),
1396
1600
 
@@ -1404,7 +1608,9 @@ Object.defineProperty(exports, "__esModule", {
1404
1608
  value: true
1405
1609
  });
1406
1610
  exports.useDeepMemo = void 0;
1611
+
1407
1612
  var react_1 = __webpack_require__(1);
1613
+
1408
1614
  var lodash_1 = __webpack_require__(3);
1409
1615
  /**
1410
1616
  * This hook evaluates and stores the result of a passed function and only
@@ -1419,16 +1625,21 @@ var lodash_1 = __webpack_require__(3);
1419
1625
  * @param fn the function to be executed and
1420
1626
  * @param dependencies an array of dependencies
1421
1627
  */
1628
+
1629
+
1422
1630
  var useDeepMemo = function useDeepMemo(fn, dependencies) {
1423
1631
  var ref = (0, react_1.useRef)();
1632
+
1424
1633
  if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
1425
1634
  ref.current = {
1426
1635
  dependencies: dependencies,
1427
1636
  value: fn()
1428
1637
  };
1429
1638
  }
1639
+
1430
1640
  return ref.current.value;
1431
1641
  };
1642
+
1432
1643
  exports.useDeepMemo = useDeepMemo;
1433
1644
 
1434
1645
  /***/ }),
@@ -1443,19 +1654,27 @@ Object.defineProperty(exports, "__esModule", {
1443
1654
  value: true
1444
1655
  });
1445
1656
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1657
+
1446
1658
  var React = __webpack_require__(1);
1659
+
1447
1660
  var T = __webpack_require__(0);
1661
+
1448
1662
  var i18n_1 = __webpack_require__(2);
1663
+
1449
1664
  var Message_1 = __webpack_require__(10);
1665
+
1450
1666
  var FixedSizeContainer_1 = __webpack_require__(13);
1451
1667
  /**
1452
1668
  * @method isMissing
1453
1669
  * @param {any} v
1454
1670
  * @returns {boolean} true if the input value === null or undefined
1455
1671
  */
1672
+
1673
+
1456
1674
  var isMissing = function isMissing(v) {
1457
1675
  return v === null || v === undefined;
1458
1676
  };
1677
+
1459
1678
  exports.isMissing = isMissing;
1460
1679
  /**
1461
1680
  * @method misskingKeys
@@ -1463,11 +1682,13 @@ exports.isMissing = isMissing;
1463
1682
  * @param {object} target
1464
1683
  * @returns {string[]} the keys of missing required props
1465
1684
  */
1685
+
1466
1686
  var missingKeys = function missingKeys(keys, target) {
1467
1687
  return keys.filter(function (k) {
1468
1688
  return (0, exports.isMissing)(target[k]);
1469
1689
  });
1470
1690
  };
1691
+
1471
1692
  exports.missingKeys = missingKeys;
1472
1693
  var propTypes = {
1473
1694
  width: T.oneOfType([T.string, T.number]),
@@ -1481,10 +1702,11 @@ var propTypes = {
1481
1702
  * @param {MissingPropsProps} props
1482
1703
  * @returns {React.ReactElement}
1483
1704
  */
1705
+
1484
1706
  var MissingPropsMessage = function MissingPropsMessage(props) {
1485
1707
  var width = props.width,
1486
- height = props.height,
1487
- missingProps = props.missingProps;
1708
+ height = props.height,
1709
+ missingProps = props.missingProps;
1488
1710
  return React.createElement(Message_1.default, {
1489
1711
  "data-test": "message",
1490
1712
  width: width,
@@ -1492,6 +1714,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
1492
1714
  message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
1493
1715
  });
1494
1716
  };
1717
+
1495
1718
  exports.MissingPropsMessage = MissingPropsMessage;
1496
1719
  exports.MissingPropsMessage.propTypes = propTypes;
1497
1720
  exports.MissingPropsMessage.defaultProps = {
@@ -1511,15 +1734,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
1511
1734
  Object.defineProperty(exports, "__esModule", {
1512
1735
  value: true
1513
1736
  });
1737
+
1514
1738
  var React = __webpack_require__(1);
1739
+
1515
1740
  var styled_components_1 = __webpack_require__(4);
1741
+
1516
1742
  var hocUtils_1 = __webpack_require__(15);
1743
+
1517
1744
  var Cover = styled_components_1.default.div.withConfig({
1518
1745
  displayName: "withEditModeCover__Cover",
1519
1746
  componentId: "sc-1gsbnxb-0"
1520
1747
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1521
1748
  var Blocker = styled_components_1.default.div.attrs({
1522
- 'data-splunk-visualization-version': "26.0.0 - 2f7458907"
1749
+ 'data-splunk-visualization-version': "26.1.1 - b6df0a015"
1523
1750
  }).withConfig({
1524
1751
  displayName: "withEditModeCover__Blocker",
1525
1752
  componentId: "sc-1gsbnxb-1"
@@ -1530,6 +1757,7 @@ var Blocker = styled_components_1.default.div.attrs({
1530
1757
  * @param {ExtendedDashViz} Visualization
1531
1758
  * @returns {ExtendedDashViz} Wrapper
1532
1759
  */
1760
+
1533
1761
  var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
1534
1762
  var Wrapper = function Wrapper(props) {
1535
1763
  var mode = props.mode;
@@ -1538,12 +1766,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1538
1766
  "data-test": "edit-mode-cover"
1539
1767
  }));
1540
1768
  };
1769
+
1541
1770
  (0, hocUtils_1.extendStaticWrapperProps)({
1542
1771
  Wrapper: Wrapper,
1543
1772
  Visualization: Visualization
1544
1773
  });
1545
1774
  return Wrapper;
1546
1775
  };
1776
+
1547
1777
  exports.default = withEditModeCover;
1548
1778
 
1549
1779
  /***/ }),
@@ -1557,27 +1787,37 @@ exports.default = withEditModeCover;
1557
1787
  Object.defineProperty(exports, "__esModule", {
1558
1788
  value: true
1559
1789
  });
1790
+
1560
1791
  var React = __webpack_require__(1);
1792
+
1561
1793
  var colorUtils_1 = __webpack_require__(12);
1794
+
1562
1795
  var variables_1 = __webpack_require__(11);
1796
+
1563
1797
  var IconPlaceholder_1 = __webpack_require__(32);
1798
+
1564
1799
  var VizBehavior_1 = __webpack_require__(6);
1800
+
1565
1801
  var hocUtils_1 = __webpack_require__(15);
1802
+
1566
1803
  var withPlaceholder = function withPlaceholder(Visualization) {
1567
1804
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
1568
1805
  var config = Visualization.config;
1569
1806
  var themes = config.themes;
1807
+
1570
1808
  var Wrapper = function Wrapper(props) {
1571
1809
  var _a, _b;
1810
+
1572
1811
  var dataSources = props.dataSources,
1573
- loading = props.loading,
1574
- options = props.options,
1575
- height = props.height,
1576
- width = props.width;
1812
+ loading = props.loading,
1813
+ options = props.options,
1814
+ height = props.height,
1815
+ width = props.width;
1577
1816
  var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
1578
1817
  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);
1579
1818
  var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
1580
1819
  var iconColor = variables_1.default.contentColorActive(props);
1820
+
1581
1821
  if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
1582
1822
  return React.createElement(IconPlaceholder_1.default, {
1583
1823
  "data-test": "icon-placeholder",
@@ -1588,14 +1828,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1588
1828
  iconColor: iconColor
1589
1829
  });
1590
1830
  }
1831
+
1591
1832
  return React.createElement(Visualization, Object.assign({}, props));
1592
1833
  };
1834
+
1593
1835
  (0, hocUtils_1.extendStaticWrapperProps)({
1594
1836
  Wrapper: Wrapper,
1595
1837
  Visualization: Visualization
1596
1838
  });
1597
1839
  return Wrapper;
1598
1840
  };
1841
+
1599
1842
  exports.default = withPlaceholder;
1600
1843
 
1601
1844
  /***/ }),
@@ -1609,6 +1852,7 @@ exports.default = withPlaceholder;
1609
1852
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1610
1853
  if (k2 === undefined) k2 = k;
1611
1854
  var desc = Object.getOwnPropertyDescriptor(m, k);
1855
+
1612
1856
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1613
1857
  desc = {
1614
1858
  enumerable: true,
@@ -1617,25 +1861,30 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
1617
1861
  }
1618
1862
  };
1619
1863
  }
1864
+
1620
1865
  Object.defineProperty(o, k2, desc);
1621
1866
  } : function (o, m, k, k2) {
1622
1867
  if (k2 === undefined) k2 = k;
1623
1868
  o[k2] = m[k];
1624
1869
  });
1870
+
1625
1871
  var __exportStar = this && this.__exportStar || function (m, exports) {
1626
1872
  for (var p in m) {
1627
1873
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1628
1874
  }
1629
1875
  };
1876
+
1630
1877
  Object.defineProperty(exports, "__esModule", {
1631
1878
  value: true
1632
1879
  });
1633
- exports.default = void 0;
1634
- // NOTE: wildcard syntax only works for named exports
1880
+ exports.default = void 0; // NOTE: wildcard syntax only works for named exports
1635
1881
  // for some reason, omitting the default export worked before TS v4
1636
1882
  // see: https://stackoverflow.com/a/34445175
1637
- __exportStar(__webpack_require__(168), exports);
1638
- var Table_1 = __webpack_require__(168);
1883
+
1884
+ __exportStar(__webpack_require__(169), exports);
1885
+
1886
+ var Table_1 = __webpack_require__(169);
1887
+
1639
1888
  Object.defineProperty(exports, "default", {
1640
1889
  enumerable: true,
1641
1890
  get: function get() {
@@ -1659,21 +1908,35 @@ module.exports = require("@babel/runtime/helpers/extends");
1659
1908
 
1660
1909
 
1661
1910
  var _toConsumableArray = __webpack_require__(8);
1911
+
1662
1912
  Object.defineProperty(exports, "__esModule", {
1663
1913
  value: true
1664
1914
  });
1915
+
1665
1916
  var i18n_1 = __webpack_require__(2);
1917
+
1666
1918
  var lodash_1 = __webpack_require__(3);
1919
+
1667
1920
  var schemaUtils_1 = __webpack_require__(16);
1921
+
1668
1922
  var colorConstants_1 = __webpack_require__(49);
1923
+
1669
1924
  var visualization_icons_1 = __webpack_require__(52);
1925
+
1670
1926
  var placeholders_1 = __webpack_require__(50);
1927
+
1671
1928
  var variables_1 = __webpack_require__(11);
1929
+
1672
1930
  var pick_1 = __webpack_require__(23);
1931
+
1673
1932
  var configUtils_1 = __webpack_require__(20);
1933
+
1674
1934
  var VizBehavior_1 = __webpack_require__(6);
1935
+
1675
1936
  var consts_1 = __webpack_require__(137);
1676
- var VizCategory_1 = __webpack_require__(35);
1937
+
1938
+ var VizCategory_1 = __webpack_require__(36);
1939
+
1677
1940
  var dataContract = {
1678
1941
  requiredDataSources: [{
1679
1942
  name: 'primary',
@@ -2150,8 +2413,8 @@ var themes = {
2150
2413
  enterprise: {
2151
2414
  dark: variables_1.default.contentColorInverted(props),
2152
2415
  light: variables_1.default.white(props) // equal to textColor in enterpriseDark
2153
- },
2154
2416
 
2417
+ },
2155
2418
  prisma: variables_1.default.contentColorInverted(props)
2156
2419
  })(props);
2157
2420
  }
@@ -2318,7 +2581,7 @@ var editorConfig = [{
2318
2581
  },
2319
2582
  value: function value(_ref) {
2320
2583
  var context = _ref.context,
2321
- options = _ref.options;
2584
+ options = _ref.options;
2322
2585
  return {
2323
2586
  context: context,
2324
2587
  columnFormat: options.columnFormat,
@@ -2332,16 +2595,19 @@ var editorConfig = [{
2332
2595
  /**
2333
2596
  * visualization configuration
2334
2597
  */
2598
+
2335
2599
  var config = {
2336
2600
  /**
2337
2601
  * unique viz key
2338
2602
  */
2339
2603
  key: 'splunk.table',
2604
+
2340
2605
  /**
2341
2606
  * viz name
2342
2607
  */
2343
2608
  name: (0, i18n_1._)('Table'),
2344
2609
  category: VizCategory_1.VizCategory.TABLE,
2610
+
2345
2611
  /**
2346
2612
  * viz icon
2347
2613
  */
@@ -2371,43 +2637,69 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
2371
2637
 
2372
2638
 
2373
2639
  var _slicedToArray = __webpack_require__(17);
2640
+
2374
2641
  var _taggedTemplateLiteral = __webpack_require__(59);
2642
+
2375
2643
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
2644
+
2376
2645
  var __rest = this && this.__rest || function (s, e) {
2377
2646
  var t = {};
2647
+
2378
2648
  for (var p in s) {
2379
2649
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2380
2650
  }
2651
+
2381
2652
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2382
2653
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2383
2654
  }
2384
2655
  return t;
2385
2656
  };
2657
+
2386
2658
  Object.defineProperty(exports, "__esModule", {
2387
2659
  value: true
2388
2660
  });
2389
2661
  exports.INITIAL_UNSET_COLUMN_WIDTH = exports.MINIMUM_COLUMN_SIZE = void 0;
2662
+
2390
2663
  var React = __webpack_require__(1);
2664
+
2391
2665
  var T = __webpack_require__(0);
2666
+
2392
2667
  var lodash_1 = __webpack_require__(3);
2668
+
2393
2669
  var styled_components_1 = __webpack_require__(4);
2670
+
2394
2671
  var i18n_1 = __webpack_require__(2);
2672
+
2395
2673
  var Table_1 = __webpack_require__(112);
2396
- var Paginator_1 = __webpack_require__(93);
2674
+
2675
+ var Paginator_1 = __webpack_require__(94);
2676
+
2397
2677
  var Message_1 = __webpack_require__(124);
2678
+
2398
2679
  var colorUtils_1 = __webpack_require__(12);
2680
+
2399
2681
  var style_1 = __webpack_require__(14);
2682
+
2400
2683
  var pick_1 = __webpack_require__(23);
2684
+
2401
2685
  var variables_1 = __webpack_require__(11);
2686
+
2402
2687
  var hooks_1 = __webpack_require__(482);
2688
+
2403
2689
  var consts_1 = __webpack_require__(137);
2690
+
2404
2691
  var cells_1 = __webpack_require__(483);
2405
- var getPagination_1 = __webpack_require__(34);
2692
+
2693
+ var getPagination_1 = __webpack_require__(35);
2694
+
2406
2695
  var getSorting_1 = __webpack_require__(33);
2407
- var FixedSizeContainer_1 = __webpack_require__(13);
2408
- // debounce was imported this way due to typing
2696
+
2697
+ var FixedSizeContainer_1 = __webpack_require__(13); // debounce was imported this way due to typing
2409
2698
  // eslint-disable-next-line import/order
2699
+
2700
+
2410
2701
  var debounce = __webpack_require__(488);
2702
+
2411
2703
  exports.MINIMUM_COLUMN_SIZE = 30;
2412
2704
  exports.INITIAL_UNSET_COLUMN_WIDTH = 90;
2413
2705
  var NonVisibleTableHead = (0, styled_components_1.default)(Table_1.default.Head)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n pointer-events: none;\n & [data-test='head-cell'] > div {\n height: 0;\n padding: 0;\n margin: 0;\n }\n"])));
@@ -2442,9 +2734,9 @@ var SUITableContainer = styled_components_1.default.div.withConfig({
2442
2734
  return props.lineHeight;
2443
2735
  }, function (_ref3) {
2444
2736
  var width = _ref3.width,
2445
- height = _ref3.height,
2446
- isPaging = _ref3.isPaging,
2447
- theme = _ref3.theme;
2737
+ height = _ref3.height,
2738
+ isPaging = _ref3.isPaging,
2739
+ theme = _ref3.theme;
2448
2740
  var padding = (0, pick_1.default)({
2449
2741
  enterprise: variables_1.default.spacingHalf({
2450
2742
  theme: theme
@@ -2478,69 +2770,79 @@ var PaginatorContainer = styled_components_1.default.div.withConfig({
2478
2770
  displayName: "PureTable__PaginatorContainer",
2479
2771
  componentId: "tovzjg-2"
2480
2772
  })(["position:relative;text-align:right;height:", "px;"], PAGINATOR_CONTAINER_HEIGHT);
2481
- PaginatorContainer.displayName = 'PaginatorContainer';
2482
- // allow for early return in case of empty tableBody while still following hook rules
2773
+ PaginatorContainer.displayName = 'PaginatorContainer'; // allow for early return in case of empty tableBody while still following hook rules
2774
+
2483
2775
  var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
2484
2776
  // TODO(fkurniawan): add omit type to differentiate WrapperProps from PureTableProps
2485
2777
  var Wrapper = function Wrapper(props) {
2486
2778
  var headers = props.headers,
2487
- table = props.table,
2488
- headerVisibility = props.headerVisibility,
2489
- showRowNumbers = props.showRowNumbers,
2490
- showInternalFields = props.showInternalFields,
2491
- tableFormat = props.tableFormat,
2492
- columnFormat = props.columnFormat,
2493
- paginatorParams = props.paginatorParams,
2494
- count = props.count;
2779
+ table = props.table,
2780
+ headerVisibility = props.headerVisibility,
2781
+ showRowNumbers = props.showRowNumbers,
2782
+ showInternalFields = props.showInternalFields,
2783
+ tableFormat = props.tableFormat,
2784
+ columnFormat = props.columnFormat,
2785
+ paginatorParams = props.paginatorParams,
2786
+ count = props.count;
2787
+
2495
2788
  var _ref8 = (0, hooks_1.useTable)({
2496
- headers: headers,
2497
- table: table,
2498
- headerVisibility: headerVisibility,
2499
- showRowNumbers: showRowNumbers,
2500
- showInternalFields: showInternalFields,
2501
- tableFormat: Object.assign(Object.assign(Object.assign(Object.assign({}, tableFormat), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.align) && {
2502
- align: (0, lodash_1.cloneDeep)(tableFormat.align)
2503
- }), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.cellTypes) && {
2504
- cellTypes: (0, lodash_1.cloneDeep)(tableFormat.cellTypes)
2505
- }), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.data) && {
2506
- data: (0, lodash_1.cloneDeep)(tableFormat.data)
2507
- }),
2508
- columnFormat: columnFormat,
2509
- paginationOffset: paginatorParams === null || paginatorParams === void 0 ? void 0 : paginatorParams.current,
2510
- count: count
2789
+ headers: headers,
2790
+ table: table,
2791
+ headerVisibility: headerVisibility,
2792
+ showRowNumbers: showRowNumbers,
2793
+ showInternalFields: showInternalFields,
2794
+ tableFormat: Object.assign(Object.assign(Object.assign(Object.assign({}, tableFormat), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.align) && {
2795
+ align: (0, lodash_1.cloneDeep)(tableFormat.align)
2796
+ }), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.cellTypes) && {
2797
+ cellTypes: (0, lodash_1.cloneDeep)(tableFormat.cellTypes)
2798
+ }), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.data) && {
2799
+ data: (0, lodash_1.cloneDeep)(tableFormat.data)
2511
2800
  }),
2512
- tableHeader = _ref8.tableHeader,
2513
- tableBody = _ref8.tableBody;
2801
+ columnFormat: columnFormat,
2802
+ paginationOffset: paginatorParams === null || paginatorParams === void 0 ? void 0 : paginatorParams.current,
2803
+ count: count
2804
+ }),
2805
+ tableHeader = _ref8.tableHeader,
2806
+ tableBody = _ref8.tableBody;
2807
+
2514
2808
  if (tableBody.rows.length === 0) {
2515
2809
  return React.createElement(Message_1.default, {
2516
2810
  type: "warning"
2517
2811
  }, (0, i18n_1._)('No data!'));
2518
2812
  }
2813
+
2519
2814
  return React.createElement(Viz, Object.assign({}, props, {
2520
2815
  tableHeader: tableHeader,
2521
2816
  tableBody: tableBody
2522
2817
  }));
2523
2818
  };
2819
+
2524
2820
  Wrapper.displayName = 'PureTableWrapper';
2525
2821
  return Wrapper;
2526
2822
  };
2823
+
2527
2824
  var useTableHead = function useTableHead(visibility) {
2528
2825
  if (visibility === 'none') {
2529
2826
  return NonVisibleTableHead;
2530
2827
  }
2828
+
2531
2829
  if (visibility === 'fixed') {
2532
2830
  return FixedTableHead;
2533
2831
  }
2832
+
2534
2833
  return Table_1.default.Head;
2535
2834
  };
2835
+
2536
2836
  var HeadCell = function HeadCell(_a) {
2537
2837
  var value = _a.value,
2538
- props = __rest(_a, ["value"]);
2838
+ props = __rest(_a, ["value"]);
2839
+
2539
2840
  var cellRef = React.useRef(null);
2540
2841
  return React.createElement(TableHeadCell, Object.assign({
2541
2842
  elementRef: cellRef
2542
2843
  }, props), value);
2543
2844
  };
2845
+
2544
2846
  var fontMap = {
2545
2847
  proportional: 'Splunk Platform Sans',
2546
2848
  monospace: 'Splunk Platform Mono'
@@ -2560,40 +2862,44 @@ var rowHeightMap = {
2560
2862
  var tableInnerStyle = {
2561
2863
  height: '100%'
2562
2864
  };
2865
+
2563
2866
  var PureTable = function PureTable(props) {
2564
2867
  var count = props.count,
2565
- width = props.width,
2566
- height = props.height,
2567
- backgroundColor = props.backgroundColor,
2568
- tableHeader = props.tableHeader,
2569
- tableBody = props.tableBody,
2570
- showRowNumbers = props.showRowNumbers,
2571
- _props$sortParams = props.sortParams,
2572
- currentSortKey = _props$sortParams.currentSortKey,
2573
- currentSortDir = _props$sortParams.currentSortDir,
2574
- onSort = _props$sortParams.onSort,
2575
- _a = props.paginatorParams,
2576
- isPaging = _a.isPaging,
2577
- paginatorOnChange = _a.onChange,
2578
- paginatorProps = __rest(_a, ["isPaging", "onChange"]),
2579
- onCellClick = props.onCellClick,
2580
- onColumnFormatChange = props.onColumnFormatChange,
2581
- columnFormat = props.columnFormat,
2582
- mode = props.mode,
2583
- headerVisibility = props.headerVisibility,
2584
- font = props.font,
2585
- fontSize = props.fontSize;
2868
+ width = props.width,
2869
+ height = props.height,
2870
+ backgroundColor = props.backgroundColor,
2871
+ tableHeader = props.tableHeader,
2872
+ tableBody = props.tableBody,
2873
+ showRowNumbers = props.showRowNumbers,
2874
+ _props$sortParams = props.sortParams,
2875
+ currentSortKey = _props$sortParams.currentSortKey,
2876
+ currentSortDir = _props$sortParams.currentSortDir,
2877
+ onSort = _props$sortParams.onSort,
2878
+ _a = props.paginatorParams,
2879
+ isPaging = _a.isPaging,
2880
+ paginatorOnChange = _a.onChange,
2881
+ paginatorProps = __rest(_a, ["isPaging", "onChange"]),
2882
+ onCellClick = props.onCellClick,
2883
+ onColumnFormatChange = props.onColumnFormatChange,
2884
+ columnFormat = props.columnFormat,
2885
+ mode = props.mode,
2886
+ headerVisibility = props.headerVisibility,
2887
+ font = props.font,
2888
+ fontSize = props.fontSize;
2889
+
2586
2890
  var _React$useState = React.useState(columnFormat),
2587
- _React$useState2 = _slicedToArray(_React$useState, 2),
2588
- columns = _React$useState2[0],
2589
- setColumns = _React$useState2[1];
2891
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2892
+ columns = _React$useState2[0],
2893
+ setColumns = _React$useState2[1];
2894
+
2590
2895
  var containerRef = React.useRef(null);
2591
- var containerRefInner = React.useRef(null);
2592
- // this state avoids unncessary column sorting when column resize ends
2896
+ var containerRefInner = React.useRef(null); // this state avoids unncessary column sorting when column resize ends
2897
+
2593
2898
  var _React$useState3 = React.useState(false),
2594
- _React$useState4 = _slicedToArray(_React$useState3, 2),
2595
- isResizing = _React$useState4[0],
2596
- setResizing = _React$useState4[1];
2899
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
2900
+ isResizing = _React$useState4[0],
2901
+ setResizing = _React$useState4[1];
2902
+
2597
2903
  var firstRenderCount = React.useRef(count);
2598
2904
  React.useEffect(function () {
2599
2905
  if (firstRenderCount.current !== count) {
@@ -2616,6 +2922,7 @@ var PureTable = function PureTable(props) {
2616
2922
  var TableHead = useTableHead(headerVisibility);
2617
2923
  var tableCellClickHandler = React.useCallback(function (e) {
2618
2924
  setResizing(false); // The resizing state will be set back to false on any cell click
2925
+
2619
2926
  return onCellClick ? drilldownHandler(e) : lodash_1.noop;
2620
2927
  }, [onCellClick, showRowNumbers, tableHeader, tableBody]);
2621
2928
  var debouncedDrilldown = debounce(function (e, payload) {
@@ -2628,11 +2935,13 @@ var PureTable = function PureTable(props) {
2628
2935
  }
2629
2936
  }
2630
2937
  }, 200);
2938
+
2631
2939
  var drilldownHandler = function drilldownHandler(e) {
2632
2940
  var element = e.target;
2633
2941
  var row = element.getAttribute('data-row-index');
2634
2942
  var col = element.getAttribute('data-col-index');
2635
2943
  var arrayIndex = element.getAttribute('data-array-index') || -1;
2944
+
2636
2945
  if (row && col) {
2637
2946
  var cellRefIndex = +col;
2638
2947
  var cellIndex = cellRefIndex;
@@ -2640,16 +2949,18 @@ var PureTable = function PureTable(props) {
2640
2949
  var fieldValue = tableHeader.cells[cellRefIndex].value;
2641
2950
  var cellValue = tableBody.rows[rowIndex].cells[cellRefIndex].value;
2642
2951
  var cellRawValue = tableBody.rows[rowIndex].cells[cellRefIndex].value;
2643
- var value = arrayIndex === -1 ? cellValue : cellRawValue[+arrayIndex];
2644
- // Wish we did not have these if statements for
2952
+ var value = arrayIndex === -1 ? cellValue : cellRawValue[+arrayIndex]; // Wish we did not have these if statements for
2645
2953
  // showRowNumbers
2954
+
2646
2955
  if (showRowNumbers === true) {
2647
2956
  if (cellIndex === 0) {
2648
2957
  // no click event for row numbers
2649
2958
  return;
2650
2959
  }
2960
+
2651
2961
  cellIndex -= 1;
2652
2962
  }
2963
+
2653
2964
  var payload = {
2654
2965
  cellIndex: cellIndex,
2655
2966
  rowIndex: rowIndex,
@@ -2666,23 +2977,28 @@ var PureTable = function PureTable(props) {
2666
2977
  debouncedDrilldown(e.nativeEvent, payload);
2667
2978
  }
2668
2979
  };
2980
+
2669
2981
  var debouncedOnColumnFormatChange = React.useMemo(function () {
2670
2982
  return debounce(function (newFormat) {
2671
2983
  onColumnFormatChange(newFormat);
2672
2984
  }, 300);
2673
2985
  }, [onColumnFormatChange]);
2986
+
2674
2987
  var handleEventClick = function handleEventClick(e) {
2675
2988
  // Hack to target the resize handlers, since the only button within a HeadCell is the resize handlers
2676
2989
  if (e.target.tagName.toLowerCase() === 'button') {
2677
2990
  e.stopPropagation();
2678
2991
  }
2679
2992
  };
2993
+
2680
2994
  var handleKeyDown = function handleKeyDown(e) {
2681
2995
  if (e.keyCode !== 13) {
2682
2996
  return;
2683
2997
  }
2998
+
2684
2999
  drilldownHandler(e);
2685
3000
  };
3001
+
2686
3002
  var handleResizeColumn = function handleResizeColumn(_event, payload) {
2687
3003
  setResizing(true);
2688
3004
  var updatedCF = columns;
@@ -2690,12 +3006,13 @@ var PureTable = function PureTable(props) {
2690
3006
  updatedCF[field] = Object.assign(Object.assign({}, updatedCF[field]), {
2691
3007
  width: Math.max(payload.width, exports.MINIMUM_COLUMN_SIZE)
2692
3008
  });
2693
- setColumns(Object.assign({}, updatedCF));
2694
- // Updates column json in edit mode
3009
+ setColumns(Object.assign({}, updatedCF)); // Updates column json in edit mode
3010
+
2695
3011
  if (mode === 'edit') {
2696
3012
  debouncedOnColumnFormatChange(updatedCF);
2697
3013
  }
2698
3014
  };
3015
+
2699
3016
  var fontMapped = fontMap[font] || fontMap.proportional;
2700
3017
  var fontSizeMapped = fontSizeMap[fontSize] || fontSizeMap.default;
2701
3018
  var rowHeightMapped = rowHeightMap[fontSize] || rowHeightMap.default;
@@ -2710,7 +3027,9 @@ var PureTable = function PureTable(props) {
2710
3027
  });
2711
3028
  var numberOfFixedHeaders = visibleHeaderCells.filter(function (_ref9) {
2712
3029
  var value = _ref9.value;
3030
+
2713
3031
  var _a, _b;
3032
+
2714
3033
  return ((_a = columns[value]) === null || _a === void 0 ? void 0 : _a.width) && ((_b = columns[value]) === null || _b === void 0 ? void 0 : _b.width) !== 'auto';
2715
3034
  }).length;
2716
3035
  var isFullyFixed = visibleHeaderCells.length === numberOfFixedHeaders;
@@ -2718,7 +3037,8 @@ var PureTable = function PureTable(props) {
2718
3037
  return React.createElement(VizTableContainer, {
2719
3038
  isCellClickable: Boolean(onCellClick),
2720
3039
  backgroundColor: backgroundColor,
2721
- ref: containerRef
3040
+ ref: containerRef,
3041
+ "data-test": "table-container"
2722
3042
  }, React.createElement(SUITableContainer, {
2723
3043
  ref: containerRefInner,
2724
3044
  width: width,
@@ -2739,11 +3059,13 @@ var PureTable = function PureTable(props) {
2739
3059
  onRequestResizeColumn: handleResizeColumn
2740
3060
  }, React.createElement(TableHead, null, visibleHeaderCells.map(function (_a) {
2741
3061
  var _b, _c;
3062
+
2742
3063
  var key = _a.key,
2743
- value = _a.value,
2744
- sortKey = _a.sortKey,
2745
- style = _a.style,
2746
- rest = __rest(_a, ["key", "value", "sortKey", "style"]);
3064
+ value = _a.value,
3065
+ sortKey = _a.sortKey,
3066
+ style = _a.style,
3067
+ rest = __rest(_a, ["key", "value", "sortKey", "style"]);
3068
+
2747
3069
  return React.createElement(HeadCell, Object.assign({
2748
3070
  key: key,
2749
3071
  columnId: value,
@@ -2767,6 +3089,7 @@ var PureTable = function PureTable(props) {
2767
3089
  return c.showCell;
2768
3090
  }).map(function (cell) {
2769
3091
  var _a, _b;
3092
+
2770
3093
  return React.createElement(cells_1.SwitchTableCell, {
2771
3094
  key: cell.key,
2772
3095
  type: cell.cellType
@@ -2786,6 +3109,7 @@ var PureTable = function PureTable(props) {
2786
3109
  onChange: paginatorOnChange
2787
3110
  }, paginatorProps))) : null);
2788
3111
  };
3112
+
2789
3113
  var cellDataType = T.oneOfType([T.string, T.number, T.arrayOf(T.oneOfType([T.string, T.number]))]);
2790
3114
  PureTable.propTypes = {
2791
3115
  backgroundColor: T.string,
@@ -2862,17 +3186,24 @@ exports.default = withEmptyTableMessage((0, FixedSizeContainer_1.default)(PureTa
2862
3186
 
2863
3187
 
2864
3188
  var _toConsumableArray = __webpack_require__(8);
3189
+
2865
3190
  var _typeof = __webpack_require__(82);
3191
+
2866
3192
  Object.defineProperty(exports, "__esModule", {
2867
3193
  value: true
2868
3194
  });
2869
3195
  exports.useTable = exports.getTextOverflowType = exports.getOverflowStyles = void 0;
3196
+
2870
3197
  var lodash_1 = __webpack_require__(3);
3198
+
2871
3199
  var colorUtils_1 = __webpack_require__(12);
3200
+
2872
3201
  var consts_1 = __webpack_require__(137);
3202
+
2873
3203
  var isArray = function isArray(v) {
2874
3204
  return Array.isArray(v);
2875
3205
  };
3206
+
2876
3207
  var textOverflowStyles = {
2877
3208
  anywhere: {
2878
3209
  wordBreak: 'break-all'
@@ -2889,20 +3220,26 @@ var textOverflowStyles = {
2889
3220
  }
2890
3221
  };
2891
3222
  var empty = {};
3223
+
2892
3224
  var getOverflowStyles = function getOverflowStyles(_ref) {
2893
3225
  var textOverflow = _ref.textOverflow;
2894
3226
  return textOverflowStyles[textOverflow] || empty;
2895
3227
  };
3228
+
2896
3229
  exports.getOverflowStyles = getOverflowStyles;
3230
+
2897
3231
  var generateKey = function generateKey() {
2898
3232
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2899
3233
  var i = arguments.length > 1 ? arguments[1] : undefined;
2900
3234
  return "".concat(i, "-").concat(value);
2901
3235
  };
3236
+
2902
3237
  var getTextOverflowType = function getTextOverflowType(columnFormat, currentColumn) {
2903
3238
  return (0, lodash_1.get)(columnFormat, ["".concat(currentColumn), 'textOverflow']);
2904
3239
  };
3240
+
2905
3241
  exports.getTextOverflowType = getTextOverflowType;
3242
+
2906
3243
  var generateHeader = function generateHeader(value, i, columnFormat, showInternalFields) {
2907
3244
  var ret = {
2908
3245
  key: generateKey(value, i),
@@ -2910,9 +3247,11 @@ var generateHeader = function generateHeader(value, i, columnFormat, showInterna
2910
3247
  sortKey: value,
2911
3248
  showCell: true
2912
3249
  };
3250
+
2913
3251
  if (!showInternalFields && value.charAt(0) === '_' && value !== '_time') {
2914
3252
  ret.showCell = false;
2915
3253
  }
3254
+
2916
3255
  var textOverflowType = (0, exports.getTextOverflowType)(columnFormat, value);
2917
3256
  var textOverflowStyle = (0, exports.getOverflowStyles)({
2918
3257
  textOverflow: textOverflowType
@@ -2922,101 +3261,131 @@ var generateHeader = function generateHeader(value, i, columnFormat, showInterna
2922
3261
  ret.style = textOverflowStyle;
2923
3262
  return ret;
2924
3263
  };
3264
+
2925
3265
  var getColumnFormatAlign = function getColumnFormatAlign(columnFormat, currentColumn, currentRow) {
2926
3266
  var alignOption = (0, lodash_1.get)(columnFormat, [currentColumn.value, 'align']);
2927
3267
  var align;
3268
+
2928
3269
  if (isArray(alignOption) && (0, lodash_1.includes)(consts_1.validAlignments, alignOption[currentRow])) {
2929
3270
  align = alignOption[currentRow];
2930
3271
  } else if (typeof alignOption !== 'undefined') {
2931
3272
  console.warn("columnFormat.".concat(currentColumn.value, ".align should be an array containing (").concat(consts_1.validAlignments.join(' | '), "). ").concat(JSON.stringify(alignOption), " provided"));
2932
3273
  }
3274
+
2933
3275
  return align;
2934
3276
  };
3277
+
2935
3278
  var getColumnFormatCellType = function getColumnFormatCellType(columnFormat, currentColumn, currentRow) {
2936
3279
  var cellTypes = (0, lodash_1.get)(columnFormat, [currentColumn.value, 'cellTypes']);
2937
3280
  var cellType;
3281
+
2938
3282
  if (isArray(cellTypes) && (0, lodash_1.includes)(consts_1.validCellRenderers, cellTypes[currentRow])) {
2939
3283
  cellType = cellTypes[currentRow];
2940
3284
  } else if (typeof cellTypes !== 'undefined') {
2941
3285
  console.warn("columnFormat.".concat(currentColumn.value, ".cellType should be an array containing (").concat(consts_1.validCellRenderers.join(' | '), "). ").concat(JSON.stringify(cellTypes), " provided"));
2942
3286
  }
3287
+
2943
3288
  return cellType;
2944
3289
  };
3290
+
2945
3291
  var getColumnFormatSparklineType = function getColumnFormatSparklineType(columnFormat, currentColumn, currentRow) {
2946
3292
  var types = (0, lodash_1.get)(columnFormat, [currentColumn.value, 'sparklineTypes']);
2947
3293
  var sparklineType;
3294
+
2948
3295
  if (isArray(types) && (0, lodash_1.includes)(consts_1.validSparklineTypes, types[currentRow])) {
2949
3296
  sparklineType = types[currentRow];
2950
3297
  } else if (typeof types !== 'undefined') {
2951
3298
  console.warn("columnFormat.".concat(currentColumn.value, ".sparklineTypes should be one of (").concat(consts_1.validSparklineTypes.join(' | '), "). ").concat(JSON.stringify(types), " provided"));
2952
3299
  }
3300
+
2953
3301
  return sparklineType;
2954
3302
  };
3303
+
2955
3304
  var getColumnFormatData = function getColumnFormatData(columnFormat, currentColumn, currentRow) {
2956
3305
  var data = (0, lodash_1.get)(columnFormat, [currentColumn.value, 'data']);
2957
3306
  var datum;
3307
+
2958
3308
  if (isArray(data)) {
2959
3309
  datum = data[currentRow];
2960
3310
  } else if (typeof data !== 'undefined') {
2961
3311
  console.warn("columnFormat.".concat(currentColumn.value, ".data should be an array containing formatted data. ").concat(_typeof(data), " provided"));
2962
3312
  }
3313
+
2963
3314
  return datum;
2964
3315
  };
3316
+
2965
3317
  var getColumnFormatColor = function getColumnFormatColor(columnFormat, currentColumn, currentRow, field) {
2966
3318
  var colors = (0, lodash_1.get)(columnFormat, [currentColumn.value, field]);
2967
3319
  var color;
3320
+
2968
3321
  if (isArray(colors) && (0, colorUtils_1.isColor)(colors[currentRow])) {
2969
3322
  color = colors[currentRow];
2970
3323
  } else if (typeof colors !== 'undefined') {
2971
3324
  console.warn("columnFormat.".concat(currentColumn.value, ".").concat(field, " should be an array containing valid colors. ").concat(JSON.stringify(colors), " provided"));
2972
3325
  }
3326
+
2973
3327
  return color;
2974
3328
  };
3329
+
2975
3330
  var getColumnFormatRowColor = function getColumnFormatRowColor(columnFormat, currentColumn, currentRow) {
2976
3331
  return getColumnFormatColor(columnFormat, currentColumn, currentRow, 'rowColors');
2977
3332
  };
3333
+
2978
3334
  var getColumnFormatRowBgColor = function getColumnFormatRowBgColor(columnFormat, currentColumn, currentRow) {
2979
3335
  return getColumnFormatColor(columnFormat, currentColumn, currentRow, 'rowBackgroundColors');
2980
3336
  };
3337
+
2981
3338
  var getColumnFormatSparklineColor = function getColumnFormatSparklineColor(columnFormat, currentColumn, currentRow) {
2982
3339
  return getColumnFormatColor(columnFormat, currentColumn, currentRow, 'sparklineColors');
2983
3340
  };
3341
+
2984
3342
  var getColumnFormatSparklineAreaColor = function getColumnFormatSparklineAreaColor(columnFormat, currentColumn, currentRow) {
2985
3343
  return getColumnFormatColor(columnFormat, currentColumn, currentRow, 'sparklineAreaColors');
2986
3344
  };
3345
+
2987
3346
  var getTableFormatAlign = function getTableFormatAlign(tableFormat, currentColumn, currentRow) {
2988
3347
  var alignOption = (0, lodash_1.get)(tableFormat, 'align');
2989
3348
  var align;
3349
+
2990
3350
  if (isArray(alignOption) && isArray(alignOption[currentColumn]) && (0, lodash_1.includes)(consts_1.validAlignments, alignOption[currentColumn][currentRow])) {
2991
3351
  align = alignOption[currentColumn][currentRow];
2992
3352
  } else if (typeof alignOption !== 'undefined') {
2993
3353
  console.warn("tableFormat.align should be a 2 dimensional array containing (".concat(consts_1.validAlignments.join(' | '), "). ").concat(JSON.stringify(alignOption), " provided"));
2994
3354
  }
3355
+
2995
3356
  return align;
2996
3357
  };
3358
+
2997
3359
  var getTableFormatCellType = function getTableFormatCellType(tableFormat, currentColumn, currentRow) {
2998
3360
  var cellTypes = (0, lodash_1.get)(tableFormat, 'cellTypes');
2999
3361
  var cellType;
3362
+
3000
3363
  if (isArray(cellTypes) && isArray(cellTypes[currentColumn]) && (0, lodash_1.includes)(consts_1.validCellRenderers, cellTypes[currentColumn][currentRow])) {
3001
3364
  cellType = cellTypes[currentColumn][currentRow];
3002
3365
  } else if (typeof cellTypes !== 'undefined') {
3003
3366
  console.warn("tableFormat.cellType should be a 2 dimensional array containing (".concat(consts_1.validCellRenderers.join(' | '), "). ").concat(JSON.stringify(cellTypes), " provided"));
3004
3367
  }
3368
+
3005
3369
  return cellType;
3006
3370
  };
3371
+
3007
3372
  var getTableFormatSparklineType = function getTableFormatSparklineType(tableFormat, currentColumn, currentRow) {
3008
3373
  var types = (0, lodash_1.get)(tableFormat, 'sparklineTypes');
3009
3374
  var sparklineType;
3375
+
3010
3376
  if (isArray(types) && isArray(types[currentColumn]) && (0, lodash_1.includes)(consts_1.validSparklineTypes, types[currentColumn][currentRow])) {
3011
3377
  sparklineType = types[currentColumn][currentRow];
3012
3378
  } else if (typeof types !== 'undefined') {
3013
3379
  console.warn("tableFormat.sparklineTypes should be a 2 dimensional array containing one of (".concat(consts_1.validSparklineTypes.join(' | '), "). ").concat(JSON.stringify(types), " provided"));
3014
3380
  }
3381
+
3015
3382
  return sparklineType;
3016
3383
  };
3384
+
3017
3385
  var getTableFormatColor = function getTableFormatColor(tableFormat, currentColumn, currentRow, field) {
3018
3386
  var colors = (0, lodash_1.get)(tableFormat, field);
3019
3387
  var color;
3388
+
3020
3389
  if (isArray(colors) && isArray(colors[currentColumn]) && (0, colorUtils_1.isColor)(colors[currentColumn][currentRow])) {
3021
3390
  color = colors[currentColumn][currentRow];
3022
3391
  } else if (isArray(colors) && (0, colorUtils_1.isColor)(colors[currentRow])) {
@@ -3024,66 +3393,81 @@ var getTableFormatColor = function getTableFormatColor(tableFormat, currentColum
3024
3393
  } else if (typeof colors !== 'undefined' && isArray(colors) && isArray(colors[currentColumn]) && colors[currentColumn][currentRow] !== undefined) {
3025
3394
  console.warn("tableFormat.".concat(field, " needs to be an array of colors, provided ").concat(JSON.stringify(colors), ". Current value at [").concat(currentColumn, "][").concat(currentRow, "] is ").concat(JSON.stringify(colors[currentRow])));
3026
3395
  }
3396
+
3027
3397
  return color;
3028
3398
  };
3399
+
3029
3400
  var getTableFormatRowColor = function getTableFormatRowColor(tableFormat, currentCol, currentRow) {
3030
3401
  return getTableFormatColor(tableFormat, currentCol, currentRow, 'rowColors');
3031
3402
  };
3403
+
3032
3404
  var getTableFormatRowBgColor = function getTableFormatRowBgColor(tableFormat, currentCol, currentRow) {
3033
3405
  return getTableFormatColor(tableFormat, currentCol, currentRow, 'rowBackgroundColors');
3034
3406
  };
3407
+
3035
3408
  var getTableFormatSparklineColor = function getTableFormatSparklineColor(tableFormat, currentCol, currentRow) {
3036
3409
  return getTableFormatColor(tableFormat, currentCol, currentRow, 'sparklineColors');
3037
3410
  };
3411
+
3038
3412
  var getTableFormatSparklineAreaColor = function getTableFormatSparklineAreaColor(tableFormat, currentCol, currentRow) {
3039
3413
  return getTableFormatColor(tableFormat, currentCol, currentRow, 'sparklineAreaColors');
3040
3414
  };
3415
+
3041
3416
  var getTableFormatData = function getTableFormatData(tableFormat, currentCol, currentRow) {
3042
3417
  var data = (0, lodash_1.get)(tableFormat, 'data');
3043
3418
  var datum;
3419
+
3044
3420
  if (isArray(data) && isArray(data[currentCol])) {
3045
3421
  datum = data[currentCol][currentRow];
3046
3422
  } else if (typeof data !== 'undefined') {
3047
3423
  console.warn("tableFormat.data should be a 2 dimensional array containing formatted data to be displayed. ".concat(_typeof(data), " provided"));
3048
3424
  }
3425
+
3049
3426
  return datum;
3050
3427
  };
3428
+
3051
3429
  var validValueSelector = function validValueSelector(v1, v2, v3, defaultValue) {
3052
3430
  var validTypes = ['string', 'number'];
3431
+
3053
3432
  if (validTypes.includes(_typeof(v1)) || isArray(v1)) {
3054
3433
  return v1;
3055
3434
  }
3435
+
3056
3436
  if (validTypes.includes(_typeof(v2)) || isArray(v2)) {
3057
3437
  return v2;
3058
3438
  }
3439
+
3059
3440
  if (validTypes.includes(_typeof(v3)) || isArray(v3)) {
3060
3441
  return v3;
3061
3442
  }
3443
+
3062
3444
  return defaultValue;
3063
3445
  };
3446
+
3064
3447
  var useTable = function useTable() {
3065
3448
  var tableArgs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3066
3449
  var _tableArgs$table = tableArgs.table,
3067
- table = _tableArgs$table === void 0 ? [] : _tableArgs$table,
3068
- _tableArgs$headers = tableArgs.headers,
3069
- headers = _tableArgs$headers === void 0 ? [] : _tableArgs$headers;
3450
+ table = _tableArgs$table === void 0 ? [] : _tableArgs$table,
3451
+ _tableArgs$headers = tableArgs.headers,
3452
+ headers = _tableArgs$headers === void 0 ? [] : _tableArgs$headers;
3070
3453
  var _tableArgs$headerVisi = tableArgs.headerVisibility,
3071
- headerVisibility = _tableArgs$headerVisi === void 0 ? 'inline' : _tableArgs$headerVisi,
3072
- _tableArgs$showRowNum = tableArgs.showRowNumbers,
3073
- showRowNumbers = _tableArgs$showRowNum === void 0 ? false : _tableArgs$showRowNum,
3074
- _tableArgs$showIntern = tableArgs.showInternalFields,
3075
- showInternalFields = _tableArgs$showIntern === void 0 ? true : _tableArgs$showIntern,
3076
- _tableArgs$tableForma = tableArgs.tableFormat,
3077
- tableFormat = _tableArgs$tableForma === void 0 ? {} : _tableArgs$tableForma,
3078
- _tableArgs$columnForm = tableArgs.columnFormat,
3079
- columnFormat = _tableArgs$columnForm === void 0 ? {} : _tableArgs$columnForm,
3080
- _tableArgs$pagination = tableArgs.paginationOffset,
3081
- paginationOffset = _tableArgs$pagination === void 0 ? 0 : _tableArgs$pagination,
3082
- _tableArgs$count = tableArgs.count,
3083
- count = _tableArgs$count === void 0 ? 0 : _tableArgs$count;
3454
+ headerVisibility = _tableArgs$headerVisi === void 0 ? 'inline' : _tableArgs$headerVisi,
3455
+ _tableArgs$showRowNum = tableArgs.showRowNumbers,
3456
+ showRowNumbers = _tableArgs$showRowNum === void 0 ? false : _tableArgs$showRowNum,
3457
+ _tableArgs$showIntern = tableArgs.showInternalFields,
3458
+ showInternalFields = _tableArgs$showIntern === void 0 ? true : _tableArgs$showIntern,
3459
+ _tableArgs$tableForma = tableArgs.tableFormat,
3460
+ tableFormat = _tableArgs$tableForma === void 0 ? {} : _tableArgs$tableForma,
3461
+ _tableArgs$columnForm = tableArgs.columnFormat,
3462
+ columnFormat = _tableArgs$columnForm === void 0 ? {} : _tableArgs$columnForm,
3463
+ _tableArgs$pagination = tableArgs.paginationOffset,
3464
+ paginationOffset = _tableArgs$pagination === void 0 ? 0 : _tableArgs$pagination,
3465
+ _tableArgs$count = tableArgs.count,
3466
+ count = _tableArgs$count === void 0 ? 0 : _tableArgs$count;
3084
3467
  var longestColumnLength = Math.max.apply(Math, _toConsumableArray(table.map(function (column) {
3085
3468
  return column.length;
3086
3469
  })));
3470
+
3087
3471
  if (showRowNumbers) {
3088
3472
  var correctedPaginationOffset = Math.max(0, (paginationOffset - 1) * count);
3089
3473
  headers = ['#'].concat(_toConsumableArray(headers));
@@ -3092,12 +3476,15 @@ var useTable = function useTable() {
3092
3476
  }, function (v, i) {
3093
3477
  return correctedPaginationOffset + i + 1;
3094
3478
  })].concat(_toConsumableArray(table));
3479
+
3095
3480
  if (isArray(tableFormat.align)) {
3096
3481
  tableFormat.align = [new Array(longestColumnLength).fill('left')].concat(_toConsumableArray(tableFormat.align));
3097
3482
  }
3483
+
3098
3484
  if (isArray(tableFormat.cellTypes)) {
3099
3485
  tableFormat.cellTypes = [new Array(longestColumnLength).fill('TextCell')].concat(_toConsumableArray(tableFormat.cellTypes));
3100
3486
  }
3487
+
3101
3488
  if (isArray(tableFormat.data)) {
3102
3489
  tableFormat.data = [Array.from({
3103
3490
  length: longestColumnLength
@@ -3105,32 +3492,39 @@ var useTable = function useTable() {
3105
3492
  return "".concat(i + 1);
3106
3493
  })].concat(_toConsumableArray(tableFormat.data));
3107
3494
  }
3495
+
3108
3496
  if (isArray(tableFormat.rowBackgroundColors)) {
3109
3497
  if (tableFormat.rowBackgroundColors.length > 0 && isArray(tableFormat.rowBackgroundColors[0])) {
3110
3498
  tableFormat.rowBackgroundColors = [new Array(longestColumnLength)].concat(_toConsumableArray(tableFormat.rowBackgroundColors));
3111
3499
  }
3112
3500
  }
3501
+
3113
3502
  if (isArray(tableFormat.rowColors)) {
3114
3503
  if (tableFormat.rowColors.length > 0 && isArray(tableFormat.rowColors[0])) {
3115
3504
  tableFormat.rowColors = [new Array(longestColumnLength)].concat(_toConsumableArray(tableFormat.rowColors));
3116
3505
  }
3117
3506
  }
3507
+
3118
3508
  if (isArray(tableFormat.sparklineColors)) {
3119
3509
  tableFormat.sparklineColors = [new Array(longestColumnLength)].concat(_toConsumableArray(tableFormat.sparklineColors));
3120
3510
  }
3511
+
3121
3512
  if (isArray(tableFormat.sparklineAreaColors)) {
3122
3513
  tableFormat.sparklineAreaColors = [new Array(longestColumnLength)].concat(_toConsumableArray(tableFormat.sparklineAreaColors));
3123
3514
  }
3515
+
3124
3516
  if (isArray(tableFormat.sparklineTypes)) {
3125
3517
  tableFormat.sparklineTypes = [new Array(longestColumnLength).fill('area')].concat(_toConsumableArray(tableFormat.sparklineTypes));
3126
3518
  }
3127
3519
  }
3520
+
3128
3521
  var tableHeader = {
3129
3522
  visibility: consts_1.validHeaderVisibilities.indexOf(headerVisibility) >= 0 ? headerVisibility : 'inline',
3130
3523
  cells: table.map(function (f, i) {
3131
3524
  if (i < headers.length) {
3132
3525
  return generateHeader(headers[i], i, columnFormat, showInternalFields);
3133
3526
  }
3527
+
3134
3528
  return generateHeader('', i, columnFormat, showInternalFields);
3135
3529
  }),
3136
3530
  style: {
@@ -3141,6 +3535,7 @@ var useTable = function useTable() {
3141
3535
  var tableBody = {
3142
3536
  rows: []
3143
3537
  };
3538
+
3144
3539
  var _loop = function _loop(currentRow) {
3145
3540
  var row = {
3146
3541
  key: "row-".concat(currentRow),
@@ -3166,9 +3561,11 @@ var useTable = function useTable() {
3166
3561
  });
3167
3562
  additionalStyles = Object.assign(Object.assign({}, additionalStyles), textOverflowStyle);
3168
3563
  var showCell = true;
3564
+
3169
3565
  if (!showInternalFields && currentHeader.value.charAt(0) === '_' && currentHeader.value !== '_time') {
3170
3566
  showCell = false;
3171
3567
  }
3568
+
3172
3569
  row.cells.push({
3173
3570
  key: key,
3174
3571
  value: value,
@@ -3190,14 +3587,17 @@ var useTable = function useTable() {
3190
3587
  });
3191
3588
  tableBody.rows.push(row);
3192
3589
  };
3590
+
3193
3591
  for (var currentRow = 0; currentRow < longestColumnLength; currentRow += 1) {
3194
3592
  _loop(currentRow);
3195
3593
  }
3594
+
3196
3595
  return {
3197
3596
  tableHeader: tableHeader,
3198
3597
  tableBody: tableBody
3199
3598
  };
3200
3599
  };
3600
+
3201
3601
  exports.useTable = useTable;
3202
3602
 
3203
3603
  /***/ }),
@@ -3211,6 +3611,7 @@ exports.useTable = useTable;
3211
3611
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
3212
3612
  if (k2 === undefined) k2 = k;
3213
3613
  var desc = Object.getOwnPropertyDescriptor(m, k);
3614
+
3214
3615
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3215
3616
  desc = {
3216
3617
  enumerable: true,
@@ -3219,22 +3620,29 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
3219
3620
  }
3220
3621
  };
3221
3622
  }
3623
+
3222
3624
  Object.defineProperty(o, k2, desc);
3223
3625
  } : function (o, m, k, k2) {
3224
3626
  if (k2 === undefined) k2 = k;
3225
3627
  o[k2] = m[k];
3226
3628
  });
3629
+
3227
3630
  var __exportStar = this && this.__exportStar || function (m, exports) {
3228
3631
  for (var p in m) {
3229
3632
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3230
3633
  }
3231
3634
  };
3635
+
3232
3636
  Object.defineProperty(exports, "__esModule", {
3233
3637
  value: true
3234
3638
  });
3639
+
3235
3640
  __exportStar(__webpack_require__(484), exports);
3641
+
3236
3642
  __exportStar(__webpack_require__(485), exports);
3643
+
3237
3644
  __exportStar(__webpack_require__(486), exports);
3645
+
3238
3646
  __exportStar(__webpack_require__(487), exports);
3239
3647
 
3240
3648
  /***/ }),
@@ -3249,13 +3657,15 @@ Object.defineProperty(exports, "__esModule", {
3249
3657
  value: true
3250
3658
  });
3251
3659
  exports.SwitchTableCell = void 0;
3660
+
3252
3661
  var SwitchTableCell = function SwitchTableCell(_ref) {
3253
3662
  var type = _ref.type,
3254
- children = _ref.children;
3663
+ children = _ref.children;
3255
3664
  return children.filter(function (child) {
3256
3665
  return child.type.displayName === type;
3257
3666
  });
3258
3667
  };
3668
+
3259
3669
  exports.SwitchTableCell = SwitchTableCell;
3260
3670
 
3261
3671
  /***/ }),
@@ -3270,14 +3680,18 @@ Object.defineProperty(exports, "__esModule", {
3270
3680
  value: true
3271
3681
  });
3272
3682
  exports.TextCell = void 0;
3683
+
3273
3684
  var React = __webpack_require__(1);
3685
+
3274
3686
  var Table_1 = __webpack_require__(112);
3687
+
3275
3688
  var noop = function noop() {
3276
3689
  return undefined;
3277
3690
  };
3691
+
3278
3692
  var TextCell = function TextCell(_ref) {
3279
3693
  var cell = _ref.cell,
3280
- useMouseOverEffect = _ref.useMouseOverEffect;
3694
+ useMouseOverEffect = _ref.useMouseOverEffect;
3281
3695
  var cellStyle = React.useMemo(function () {
3282
3696
  return Object.assign({}, cell.style);
3283
3697
  }, [cell.style]);
@@ -3290,6 +3704,7 @@ var TextCell = function TextCell(_ref) {
3290
3704
  onClick: useMouseOverEffect ? noop : undefined
3291
3705
  }, cell.value.toString());
3292
3706
  };
3707
+
3293
3708
  exports.TextCell = TextCell;
3294
3709
  exports.TextCell.displayName = 'TextCell';
3295
3710
 
@@ -3305,14 +3720,18 @@ Object.defineProperty(exports, "__esModule", {
3305
3720
  value: true
3306
3721
  });
3307
3722
  exports.ArrayCell = void 0;
3723
+
3308
3724
  var React = __webpack_require__(1);
3725
+
3309
3726
  var Table_1 = __webpack_require__(112);
3727
+
3310
3728
  var noop = function noop() {
3311
3729
  return undefined;
3312
3730
  };
3731
+
3313
3732
  var ArrayCell = function ArrayCell(_ref) {
3314
3733
  var cell = _ref.cell,
3315
- useMouseOverEffect = _ref.useMouseOverEffect;
3734
+ useMouseOverEffect = _ref.useMouseOverEffect;
3316
3735
  var value = React.useMemo(function () {
3317
3736
  return Array.isArray(cell.value) ? cell.value : [cell.value];
3318
3737
  }, [cell.value]);
@@ -3333,6 +3752,7 @@ var ArrayCell = function ArrayCell(_ref) {
3333
3752
  }, v.toString());
3334
3753
  }));
3335
3754
  };
3755
+
3336
3756
  exports.ArrayCell = ArrayCell;
3337
3757
  exports.ArrayCell.displayName = 'ArrayCell';
3338
3758
 
@@ -3345,15 +3765,21 @@ exports.ArrayCell.displayName = 'ArrayCell';
3345
3765
 
3346
3766
 
3347
3767
  var _slicedToArray = __webpack_require__(17);
3768
+
3348
3769
  Object.defineProperty(exports, "__esModule", {
3349
3770
  value: true
3350
3771
  });
3351
3772
  exports.SparklineCell = exports.validSparklineTypes = void 0;
3773
+
3352
3774
  var React = __webpack_require__(1);
3775
+
3353
3776
  var Table_1 = __webpack_require__(112);
3777
+
3354
3778
  var SparkLine_1 = __webpack_require__(95);
3779
+
3355
3780
  var paddingLeftRight = 5;
3356
3781
  var paddingTopBottom = 3;
3782
+
3357
3783
  var parseSparklineData = function parseSparklineData(data) {
3358
3784
  return (Array.isArray(data) ? data : [data]).map(function (d) {
3359
3785
  return parseInt(d.toString(), 10);
@@ -3361,34 +3787,44 @@ var parseSparklineData = function parseSparklineData(data) {
3361
3787
  return isNaN(d) ? null : d;
3362
3788
  });
3363
3789
  }; // eslint-disable-line no-restricted-globals
3790
+
3791
+
3364
3792
  exports.validSparklineTypes = ['line', 'area'];
3793
+
3365
3794
  var noop = function noop() {
3366
3795
  return undefined;
3367
3796
  };
3797
+
3368
3798
  var svgStyle = {
3369
3799
  height: 0
3370
3800
  };
3371
3801
  var dummySVG = React.createElement("svg", {
3372
3802
  style: svgStyle
3373
3803
  });
3804
+
3374
3805
  var SparklineCell = function SparklineCell(_ref) {
3375
3806
  var cell = _ref.cell,
3376
- useMouseOverEffect = _ref.useMouseOverEffect,
3377
- width = _ref.width;
3807
+ useMouseOverEffect = _ref.useMouseOverEffect,
3808
+ width = _ref.width;
3809
+
3378
3810
  var _React$useState = React.useState(),
3379
- _React$useState2 = _slicedToArray(_React$useState, 2),
3380
- cellEl = _React$useState2[0],
3381
- setEl = _React$useState2[1];
3811
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3812
+ cellEl = _React$useState2[0],
3813
+ setEl = _React$useState2[1];
3814
+
3382
3815
  var _React$useState3 = React.useState(),
3383
- _React$useState4 = _slicedToArray(_React$useState3, 2),
3384
- height = _React$useState4[0],
3385
- setHeight = _React$useState4[1];
3816
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
3817
+ height = _React$useState4[0],
3818
+ setHeight = _React$useState4[1];
3819
+
3386
3820
  var data = React.useMemo(function () {
3387
3821
  return parseSparklineData(cell.value);
3388
3822
  }, [cell.value]);
3823
+
3389
3824
  if (cell.value[0] === '##__SPARKLINE__##') {
3390
3825
  data = data.slice(1);
3391
3826
  }
3827
+
3392
3828
  React.useLayoutEffect(function () {
3393
3829
  setHeight(cellEl === null || cellEl === void 0 ? void 0 : cellEl.offsetHeight);
3394
3830
  }, [cellEl]);
@@ -3427,6 +3863,7 @@ var SparklineCell = function SparklineCell(_ref) {
3427
3863
  fillColor: cell.sparklineAreaColor
3428
3864
  }) : dummySVG);
3429
3865
  };
3866
+
3430
3867
  exports.SparklineCell = SparklineCell;
3431
3868
  exports.SparklineCell.displayName = 'SparklineCell';
3432
3869
 
@@ -3478,6 +3915,7 @@ Object.defineProperty(exports, "__esModule", {
3478
3915
  });
3479
3916
  exports.VizBehavior = void 0;
3480
3917
  var VizBehavior;
3918
+
3481
3919
  (function (VizBehavior) {
3482
3920
  /**
3483
3921
  * Dynamic Options Behavior.
@@ -3497,6 +3935,7 @@ var VizBehavior;
3497
3935
  * missing.
3498
3936
  * @type {string}
3499
3937
  */
3938
+
3500
3939
  VizBehavior["PLACEHOLDER"] = "placeholder";
3501
3940
  VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
3502
3941
  VizBehavior["TRELLIS"] = "trellis";
@@ -3553,7 +3992,7 @@ module.exports = require("@babel/runtime/helpers/typeof");
3553
3992
 
3554
3993
  /***/ }),
3555
3994
 
3556
- /***/ 87:
3995
+ /***/ 88:
3557
3996
  /***/ (function(module, exports) {
3558
3997
 
3559
3998
  module.exports = require("@babel/runtime/helpers/assertThisInitialized");
@@ -3567,7 +4006,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
3567
4006
 
3568
4007
  /***/ }),
3569
4008
 
3570
- /***/ 93:
4009
+ /***/ 94:
3571
4010
  /***/ (function(module, exports) {
3572
4011
 
3573
4012
  module.exports = require("@splunk/react-ui/Paginator");
@@ -3585,7 +4024,7 @@ __webpack_require__.r(__webpack_exports__);
3585
4024
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
3586
4025
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
3587
4026
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
3588
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87);
4027
+ /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(88);
3589
4028
  /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__);
3590
4029
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71);
3591
4030
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);
@@ -3617,24 +4056,31 @@ __webpack_require__.r(__webpack_exports__);
3617
4056
 
3618
4057
 
3619
4058
 
4059
+
3620
4060
  function _createSuper(Derived) {
3621
4061
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
4062
+
3622
4063
  return function _createSuperInternal() {
3623
4064
  var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived),
3624
- result;
4065
+ result;
4066
+
3625
4067
  if (hasNativeReflectConstruct) {
3626
4068
  var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;
4069
+
3627
4070
  result = Reflect.construct(Super, arguments, NewTarget);
3628
4071
  } else {
3629
4072
  result = Super.apply(this, arguments);
3630
4073
  }
4074
+
3631
4075
  return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, result);
3632
4076
  };
3633
4077
  }
4078
+
3634
4079
  function _isNativeReflectConstruct() {
3635
4080
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3636
4081
  if (Reflect.construct.sham) return false;
3637
4082
  if (typeof Proxy === "function") return true;
4083
+
3638
4084
  try {
3639
4085
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
3640
4086
  return true;
@@ -3649,6 +4095,7 @@ function _isNativeReflectConstruct() {
3649
4095
 
3650
4096
 
3651
4097
 
4098
+
3652
4099
  var StyledSvg = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.svg.withConfig({
3653
4100
  displayName: "SparkLine__StyledSvg",
3654
4101
  componentId: "sc-5oplra-0"
@@ -3657,21 +4104,29 @@ var StyledTooltip = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.di
3657
4104
  displayName: "SparkLine__StyledTooltip",
3658
4105
  componentId: "sc-5oplra-1"
3659
4106
  })(["padding:3px 8px;font-size:12px;"]);
4107
+
3660
4108
  var SparkLine = /*#__PURE__*/function (_Component) {
3661
4109
  _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(SparkLine, _Component);
4110
+
3662
4111
  var _super = _createSuper(SparkLine);
4112
+
3663
4113
  function SparkLine(props) {
3664
4114
  var _this;
4115
+
3665
4116
  _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SparkLine);
4117
+
3666
4118
  for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3667
4119
  rest[_key - 1] = arguments[_key];
3668
4120
  }
4121
+
3669
4122
  _this = _super.call.apply(_super, [this, props].concat(rest));
4123
+
3670
4124
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this), "handleCursorMount", function (el) {
3671
4125
  _this.setState({
3672
4126
  anchor: el
3673
4127
  });
3674
4128
  });
4129
+
3675
4130
  _this.state = {
3676
4131
  anchor: null,
3677
4132
  currentPointX: null,
@@ -3682,69 +4137,75 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3682
4137
  _this.titleId = Object(_splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__["createDOMID"])();
3683
4138
  return _this;
3684
4139
  }
4140
+
3685
4141
  _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(SparkLine, [{
3686
4142
  key: "getMax",
3687
4143
  value: function getMax() {
3688
4144
  var _this2 = this;
4145
+
3689
4146
  var _this$props = this.props,
3690
- data = _this$props.data,
3691
- acceptNull = _this$props.acceptNull,
3692
- yMax = _this$props.yMax;
4147
+ data = _this$props.data,
4148
+ acceptNull = _this$props.acceptNull,
4149
+ yMax = _this$props.yMax;
4150
+
3693
4151
  var dataMax = function dataMax() {
3694
4152
  return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(_this2.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(data);
3695
4153
  };
4154
+
3696
4155
  return yMax !== undefined ? yMax : dataMax();
3697
4156
  }
3698
4157
  }, {
3699
4158
  key: "getMin",
3700
4159
  value: function getMin() {
3701
4160
  var _this3 = this;
4161
+
3702
4162
  var _this$props2 = this.props,
3703
- data = _this$props2.data,
3704
- acceptNull = _this$props2.acceptNull,
3705
- yMin = _this$props2.yMin;
4163
+ data = _this$props2.data,
4164
+ acceptNull = _this$props2.acceptNull,
4165
+ yMin = _this$props2.yMin;
4166
+
3706
4167
  var dataMin = function dataMin() {
3707
4168
  return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(_this3.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(data);
3708
4169
  };
4170
+
3709
4171
  return yMin !== undefined ? yMin : dataMin();
3710
4172
  }
3711
-
3712
4173
  /**
3713
4174
  * Gets unit value of x axis.
3714
4175
  * @param {Number} xMargin - margin of x axis.
3715
4176
  * @return {Number} unit value of x axis.
3716
4177
  * @private
3717
4178
  */
4179
+
3718
4180
  }, {
3719
4181
  key: "getXUnit",
3720
4182
  value: function getXUnit(xMargin) {
3721
4183
  var _this$props3 = this.props,
3722
- data = _this$props3.data,
3723
- width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
4184
+ data = _this$props3.data,
4185
+ width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
4186
+
3724
4187
  var xUnit = (width - xMargin * 2) / (data.length > 1 ? data.length - 1 : 1);
3725
4188
  return Math.max(0, xUnit);
3726
4189
  }
3727
-
3728
4190
  /**
3729
4191
  * Gets unit value of y axis.
3730
4192
  * @param {String} yMargin - margin of y axis.
3731
4193
  * @return {Number} unit value of y axis.
3732
4194
  * @private
3733
4195
  */
4196
+
3734
4197
  }, {
3735
4198
  key: "getYUnit",
3736
4199
  value: function getYUnit(yMargin) {
3737
4200
  var height = this.props.height;
3738
4201
  var maxValue = this.getMax();
3739
- var minValue = this.getMin();
3740
-
3741
- // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
4202
+ var minValue = this.getMin(); // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
3742
4203
  // if the maxValue equals minValue, means all values in data are the same, then, we need to set the YUnit at the mid value of Height.
3743
4204
  // So, draws sparkline right in the mid of the container.
4205
+
3744
4206
  var yUnit = (height - yMargin * 2) / (maxValue - minValue || 2);
3745
4207
  return Math.max(0, yUnit);
3746
4208
  }
3747
-
3748
4209
  /**
3749
4210
  * Get a list of arrays of points for drawing lines, based on acceptNull property
3750
4211
  * @method getSegmentSets
@@ -3752,6 +4213,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3752
4213
  * @param {Array} points
3753
4214
  * @returns {Array} List of datapoint sets used for drawing lines
3754
4215
  */
4216
+
3755
4217
  }, {
3756
4218
  key: "getSegmentSets",
3757
4219
  value: function getSegmentSets(data, points) {
@@ -3764,19 +4226,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3764
4226
  // need at least 2 points to draw a segment
3765
4227
  if (currentLine.length > 1) {
3766
4228
  lines.push(currentLine);
3767
- }
3768
- // reset for the next segment
4229
+ } // reset for the next segment
4230
+
4231
+
3769
4232
  currentLine = [];
3770
4233
  } else {
3771
4234
  // data is good, add point data
3772
4235
  currentLine.push(points[idx]);
3773
4236
  }
3774
- });
4237
+ }); // Add the last line
3775
4238
 
3776
- // Add the last line
3777
4239
  if (currentLine.length > 1) {
3778
4240
  lines.push(currentLine);
3779
4241
  }
4242
+
3780
4243
  return lines;
3781
4244
  }
3782
4245
  }, {
@@ -3792,7 +4255,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3792
4255
  return value === null ? 0 : value;
3793
4256
  });
3794
4257
  }
3795
-
3796
4258
  /**
3797
4259
  * Converts data to points in svg
3798
4260
  * @param {Number} xMargin - margin of x axis.
@@ -3800,6 +4262,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3800
4262
  * @return {Array} points coordination.
3801
4263
  * @private
3802
4264
  */
4265
+
3803
4266
  }, {
3804
4267
  key: "dataToPoints",
3805
4268
  value: function dataToPoints(xMargin, yMargin) {
@@ -3817,7 +4280,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3817
4280
  return [p.x, p.y];
3818
4281
  });
3819
4282
  }
3820
-
3821
4283
  /**
3822
4284
  * Renders rect area for helping figure out which is the nearest point so that
3823
4285
  * render related cursor and tooltip.
@@ -3826,16 +4288,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3826
4288
  * @return {Array} array of svg rect objects
3827
4289
  * @private
3828
4290
  */
4291
+
3829
4292
  }, {
3830
4293
  key: "renderRect",
3831
4294
  value: function renderRect(points, xMargin) {
3832
4295
  var _this4 = this;
4296
+
3833
4297
  var _this$props4 = this.props,
3834
- data = _this$props4.data,
3835
- height = _this$props4.height;
4298
+ data = _this$props4.data,
4299
+ height = _this$props4.height;
3836
4300
  var xUnit = this.getXUnit(xMargin);
3837
4301
  return points.map(function (p, i) {
3838
- return /*#__PURE__*/(
4302
+ return (
4303
+ /*#__PURE__*/
4304
+
3839
4305
  /* eslint-disable react/no-array-index-key */
3840
4306
  react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("rect", {
3841
4307
  // eslint-disable-line jsx-a11y/mouse-events-have-key-events
@@ -3858,33 +4324,32 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3858
4324
  }
3859
4325
  })
3860
4326
  /* eslint-enable react/no-array-index-key */
4327
+
3861
4328
  );
3862
4329
  });
3863
- }
4330
+ } // Renders area chart
3864
4331
 
3865
- // Renders area chart
3866
4332
  }, {
3867
4333
  key: "renderArea",
3868
4334
  value: function renderArea(points) {
3869
4335
  var _this$props5 = this.props,
3870
- data = _this$props5.data,
3871
- fillColor = _this$props5.fillColor,
3872
- fillOpacity = _this$props5.fillOpacity,
3873
- height = _this$props5.height,
3874
- isArea = _this$props5.isArea;
4336
+ data = _this$props5.data,
4337
+ fillColor = _this$props5.fillColor,
4338
+ fillOpacity = _this$props5.fillOpacity,
4339
+ height = _this$props5.height,
4340
+ isArea = _this$props5.isArea;
4341
+
3875
4342
  if (!isArea || points.length === 0) {
3876
4343
  return null;
3877
4344
  }
4345
+
3878
4346
  var segments = this.getSegmentSets(data, points);
3879
4347
  segments = segments.map(function (s) {
3880
- return s.concat([[s[s.length - 1][0], height],
3881
- // down to bottom of graph
3882
- [s[0][0], height],
3883
- // over to below first data point
4348
+ return s.concat([[s[s.length - 1][0], height], // down to bottom of graph
4349
+ [s[0][0], height], // over to below first data point
3884
4350
  s[0] // up to first data point to close the box
3885
4351
  ]);
3886
4352
  });
3887
-
3888
4353
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
3889
4354
  "data-test": "area"
3890
4355
  }, segments.map(function (s) {
@@ -3904,11 +4369,11 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3904
4369
  key: "renderCursor",
3905
4370
  value: function renderCursor() {
3906
4371
  var _this$props6 = this.props,
3907
- cursorStroke = _this$props6.cursorStroke,
3908
- cursorStrokeWidth = _this$props6.cursorStrokeWidth,
3909
- cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
3910
- cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
3911
- height = _this$props6.height;
4372
+ cursorStroke = _this$props6.cursorStroke,
4373
+ cursorStrokeWidth = _this$props6.cursorStrokeWidth,
4374
+ cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
4375
+ cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
4376
+ height = _this$props6.height;
3912
4377
  return this.state.rectArea !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("line", {
3913
4378
  "data-test": "cursor",
3914
4379
  ref: this.handleCursorMount,
@@ -3937,7 +4402,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3937
4402
  animation: false
3938
4403
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(StyledTooltip, null, this.state.anchor !== null ? this.state.tooltip : undefined));
3939
4404
  }
3940
-
3941
4405
  /**
3942
4406
  * Renders one or more svg circles to highlight values on the sparkline
3943
4407
  * @method renderEndDots
@@ -3947,14 +4411,15 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3947
4411
  * @returns {Object} React representation of SVG group
3948
4412
  * @private
3949
4413
  */
4414
+
3950
4415
  }, {
3951
4416
  key: "renderEndDots",
3952
4417
  value: function renderEndDots(points, dotsToShow, xMargin) {
3953
4418
  var _this$props7 = this.props,
3954
- endDotFillColor = _this$props7.endDotFillColor,
3955
- endDotRadius = _this$props7.endDotRadius,
3956
- endDotStroke = _this$props7.endDotStroke,
3957
- endDotStrokeWidth = _this$props7.endDotStrokeWidth;
4419
+ endDotFillColor = _this$props7.endDotFillColor,
4420
+ endDotRadius = _this$props7.endDotRadius,
4421
+ endDotStroke = _this$props7.endDotStroke,
4422
+ endDotStrokeWidth = _this$props7.endDotStrokeWidth;
3958
4423
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, points.slice(-dotsToShow).map(function (point) {
3959
4424
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("circle", {
3960
4425
  key: "end-dot".concat(point[0]).concat(point[1]),
@@ -3970,21 +4435,21 @@ var SparkLine = /*#__PURE__*/function (_Component) {
3970
4435
  });
3971
4436
  }));
3972
4437
  }
3973
-
3974
4438
  /**
3975
4439
  * Renders the line(s) above the area graph
3976
4440
  * @method renderPolyline
3977
4441
  * @param {Array} points
3978
4442
  * @returns {Object} SVG Group of polylines
3979
4443
  */
4444
+
3980
4445
  }, {
3981
4446
  key: "renderPolyline",
3982
4447
  value: function renderPolyline(points) {
3983
4448
  var _this$props8 = this.props,
3984
- data = _this$props8.data,
3985
- lineColor = _this$props8.lineColor,
3986
- lineLength = _this$props8.lineLength,
3987
- lineStrokeWidth = _this$props8.lineStrokeWidth;
4449
+ data = _this$props8.data,
4450
+ lineColor = _this$props8.lineColor,
4451
+ lineLength = _this$props8.lineLength,
4452
+ lineStrokeWidth = _this$props8.lineStrokeWidth;
3988
4453
  var linePoints = Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(lineLength) && lineLength > 0 ? lineLength : points.length;
3989
4454
  var lines = this.getSegmentSets(data.slice(-linePoints), points.slice(-linePoints));
3990
4455
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
@@ -4008,24 +4473,26 @@ var SparkLine = /*#__PURE__*/function (_Component) {
4008
4473
  key: "render",
4009
4474
  value: function render() {
4010
4475
  var _this5 = this;
4476
+
4011
4477
  var _this$props9 = this.props,
4012
- data = _this$props9.data,
4013
- elementRef = _this$props9.elementRef,
4014
- showTooltip = _this$props9.showTooltip,
4015
- showEndDot = _this$props9.showEndDot,
4016
- endDotRadius = _this$props9.endDotRadius,
4017
- endDotStrokeWidth = _this$props9.endDotStrokeWidth,
4018
- endDotCount = _this$props9.endDotCount,
4019
- height = _this$props9.height,
4020
- isArea = _this$props9.isArea,
4021
- lineStrokeWidth = _this$props9.lineStrokeWidth,
4022
- width = _this$props9.width,
4023
- title = _this$props9.title;
4478
+ data = _this$props9.data,
4479
+ elementRef = _this$props9.elementRef,
4480
+ showTooltip = _this$props9.showTooltip,
4481
+ showEndDot = _this$props9.showEndDot,
4482
+ endDotRadius = _this$props9.endDotRadius,
4483
+ endDotStrokeWidth = _this$props9.endDotStrokeWidth,
4484
+ endDotCount = _this$props9.endDotCount,
4485
+ height = _this$props9.height,
4486
+ isArea = _this$props9.isArea,
4487
+ lineStrokeWidth = _this$props9.lineStrokeWidth,
4488
+ width = _this$props9.width,
4489
+ title = _this$props9.title;
4490
+
4024
4491
  if (data.length === 0) {
4025
4492
  return null;
4026
- }
4493
+ } // Calculate horizontal and vertical margin so that fit line or end dot.
4494
+
4027
4495
 
4028
- // Calculate horizontal and vertical margin so that fit line or end dot.
4029
4496
  var xMargin = endDotRadius + endDotStrokeWidth / 2;
4030
4497
  var yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
4031
4498
  var points = this.dataToPoints(xMargin, yMargin);
@@ -4055,84 +4522,114 @@ var SparkLine = /*#__PURE__*/function (_Component) {
4055
4522
  }, title || Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__["_"])('Source count over time sparkline trend')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, this.renderCursor(), this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, showTooltip ? this.renderRect(points, xMargin) : null, showTooltip ? this.renderTooltip() : null)));
4056
4523
  }
4057
4524
  }]);
4525
+
4058
4526
  return SparkLine;
4059
4527
  }(react__WEBPACK_IMPORTED_MODULE_9__["Component"]);
4528
+
4060
4529
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "propTypes", {
4061
4530
  /**
4062
4531
  * If true, data can contain `null` as a value and is treated as `0`. If false, this throws error when data contains `null`.
4063
4532
  */
4064
4533
  acceptNull: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
4534
+
4065
4535
  /** Array of numbers. These data numbers are converted to points and show on sparkline. */
4066
4536
  data: function data(props) {
4067
4537
  if (!Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isArray"])(props.data)) {
4068
4538
  return new Error('Data provided to Sparkline must be an array.');
4069
4539
  }
4540
+
4070
4541
  if (props.acceptNull && !props.data.every(function (value) {
4071
4542
  return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isNull"])(value) || Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
4072
4543
  })) {
4073
4544
  return new Error('Data provided to Sparkline must be finite numbers or null.');
4074
4545
  }
4546
+
4075
4547
  if (!props.acceptNull && !props.data.every(function (value) {
4076
4548
  return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
4077
4549
  })) {
4078
4550
  return new Error('Data provided to Sparkline must be finite numbers.');
4079
4551
  }
4552
+
4080
4553
  return null;
4081
4554
  },
4555
+
4082
4556
  /** A React ref which is set to the DOM element when the component mounts and `null` when it unmounts. */
4083
4557
  elementRef: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.object]),
4558
+
4084
4559
  /** Sets the number of end dots to display. When showEndDot is set to `true`, endDotCount is at least 1. If set to a positive value, this overrides showEndDot. */
4085
4560
  endDotCount: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
4561
+
4086
4562
  /** Fills color to the end dot. */
4087
4563
  endDotFillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
4564
+
4088
4565
  /**
4089
4566
  * Sets end dot radius. End dot radius must be less than or equal to the margin. By default, its value equals the margin.
4090
4567
  */
4091
4568
  endDotRadius: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
4569
+
4092
4570
  /** Sets end dot circle stroke color. */
4093
4571
  endDotStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
4572
+
4094
4573
  /** Sets end dot circle stroke width in pixels. */
4095
4574
  endDotStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
4575
+
4096
4576
  /** Fills color to area. */
4097
4577
  fillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
4578
+
4098
4579
  /** Fills opacity to area. Value must be in 0 ~ 1. */
4099
4580
  fillOpacity: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
4581
+
4100
4582
  /** Sets cursor stroke color. */
4101
4583
  cursorStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
4584
+
4102
4585
  /** Sets cursor stroke width in pixels. */
4103
4586
  cursorStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
4587
+
4104
4588
  /** Sets cursor line cap style. */
4105
4589
  cursorStrokeLinecap: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOf(['butt', 'round', 'square']),
4590
+
4106
4591
  /** Sets cursor dash array style. */
4107
4592
  cursorStrokeDasharray: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
4593
+
4108
4594
  /**
4109
4595
  * Container height. If this value is specified, sparkline calculates the size using this height. If height isn't specified,
4110
4596
  * sparkline figures out the container height by itself.
4111
4597
  */
4112
4598
  height: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
4599
+
4113
4600
  /** When set to `true`, sparkline shows as area. */
4114
4601
  isArea: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
4602
+
4115
4603
  /** The sparkline line color. */
4116
4604
  lineColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
4605
+
4117
4606
  /** Allows user to draw only the last data points for the line. */
4118
4607
  lineLength: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
4608
+
4119
4609
  /** The sparkline line stroke width in pixels. */
4120
4610
  lineStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
4611
+
4121
4612
  /** Enable to show end dot. */
4122
4613
  showEndDot: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
4614
+
4123
4615
  /** Enable to show tooltip. */
4124
4616
  showTooltip: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
4617
+
4125
4618
  /** Sets the data value range and maximum value shown on sparkline. */
4126
4619
  yMax: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
4620
+
4127
4621
  /** Sets the data value range and minimum value shown on sparkline. */
4128
4622
  yMin: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
4623
+
4129
4624
  /**
4130
4625
  * The width of the container.
4131
4626
  */
4132
4627
  width: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
4628
+
4133
4629
  /** Sets the a11y title text on sparkline. */
4134
4630
  title: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string
4135
4631
  });
4632
+
4136
4633
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "defaultProps", {
4137
4634
  acceptNull: false,
4138
4635
  data: [],
@@ -4153,6 +4650,7 @@ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(Spa
4153
4650
  lineColor: '#65a637',
4154
4651
  lineStrokeWidth: 1
4155
4652
  });
4653
+
4156
4654
  /* harmony default export */ __webpack_exports__["default"] = (SparkLine);
4157
4655
 
4158
4656
  /***/ })