@splunk/visualizations 25.2.0 → 25.3.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 (168) hide show
  1. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Area_Editor.png +0 -0
  2. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Line_Editor.png +0 -0
  3. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Value_Highlighting.png +0 -0
  4. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Background_Color_af575a.png +0 -0
  5. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Basic_Markdown.png +0 -0
  6. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Begin_with_Text_Instead_of_Header.png +0 -0
  7. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Font_Color_purple.png +0 -0
  8. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Font_Size_custom.png +0 -0
  9. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Font_Size_extraLarge.png +0 -0
  10. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Markdown_with_number_as_DSL.png +0 -0
  11. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_By_Type_Custom.png +0 -0
  12. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Default.png +0 -0
  13. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Kitchen_Sink.png +0 -0
  14. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Right.png +0 -0
  15. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Single_Column.png +0 -0
  16. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Color_light_blue.png +0 -0
  17. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_No_Stripe.png +0 -0
  18. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Stripe.png +0 -0
  19. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table.png +0 -0
  20. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table_With_No_Click.png +0 -0
  21. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Cell_Types.png +0 -0
  22. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Gradient.png +0 -0
  23. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Override.png +0 -0
  24. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_All_Columns.png +0 -0
  25. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_Auto_Expand_First_Column.png +0 -0
  26. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_Auto_Expand_Last_Column.png +0 -0
  27. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_Middle_Columns.png +0 -0
  28. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Count_2.png +0 -0
  29. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Header_Colors.png +0 -0
  30. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Row_Colors.png +0 -0
  31. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Stripe.png +0 -0
  32. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_No_Stripe.png +0 -0
  33. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_Stripe.png +0 -0
  34. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Default.png +0 -0
  35. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Extra_Small.png +0 -0
  36. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Large.png +0 -0
  37. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Monospace.png +0 -0
  38. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Proportional.png +0 -0
  39. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Small.png +0 -0
  40. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number.png +0 -0
  41. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number_Adv.png +0 -0
  42. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_fixed.png +0 -0
  43. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage.png +0 -0
  44. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage_100_no_paginator.png +0 -0
  45. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Invalid_Background_Color.png +0 -0
  46. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Mixed_Type_Column_With_Null.png +0 -0
  47. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Multi_Value_Field.png +0 -0
  48. package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes.png +0 -0
  49. package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes_Row_Numbers.png +0 -0
  50. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_false.png +0 -0
  51. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_true_default.png +0 -0
  52. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Row_Numbers_true.png +0 -0
  53. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline.png +0 -0
  54. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Custom.png +0 -0
  55. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Width.png +0 -0
  56. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparklines_Adv.png +0 -0
  57. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Formatting.png +0 -0
  58. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Gradient.png +0 -0
  59. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Formatting.png +0 -0
  60. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Zone_Time_Formatting.png +0 -0
  61. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Height.png +0 -0
  62. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Percentage.png +0 -0
  63. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Px.png +0 -0
  64. package/Area.config.js +58 -8
  65. package/Area.config.js.map +1 -1
  66. package/Area.js +83 -34
  67. package/Area.js.map +1 -1
  68. package/Bar.config.js +3 -3
  69. package/Bar.config.js.map +1 -1
  70. package/Bar.js +28 -29
  71. package/Bar.js.map +1 -1
  72. package/Bubble.config.js +3 -3
  73. package/Bubble.config.js.map +1 -1
  74. package/Bubble.js +28 -29
  75. package/Bubble.js.map +1 -1
  76. package/ChoroplethSvg.config.js +3 -3
  77. package/ChoroplethSvg.config.js.map +1 -1
  78. package/ChoroplethSvg.js +44 -45
  79. package/ChoroplethSvg.js.map +1 -1
  80. package/Column.config.js +3 -3
  81. package/Column.config.js.map +1 -1
  82. package/Column.js +28 -29
  83. package/Column.js.map +1 -1
  84. package/Ellipse.config.js +3 -3
  85. package/Ellipse.config.js.map +1 -1
  86. package/Ellipse.js +25 -26
  87. package/Ellipse.js.map +1 -1
  88. package/Events.config.js +15 -19
  89. package/Events.config.js.map +1 -1
  90. package/Events.js +65 -68
  91. package/Events.js.map +1 -1
  92. package/FillerGauge.config.js +3 -3
  93. package/FillerGauge.config.js.map +1 -1
  94. package/FillerGauge.js +41 -42
  95. package/FillerGauge.js.map +1 -1
  96. package/Image.config.js +3 -3
  97. package/Image.config.js.map +1 -1
  98. package/Image.js +27 -27
  99. package/Image.js.map +1 -1
  100. package/Line.config.js +56 -6
  101. package/Line.config.js.map +1 -1
  102. package/Line.js +81 -32
  103. package/Line.js.map +1 -1
  104. package/LinkGraph.config.js +3 -3
  105. package/LinkGraph.config.js.map +1 -1
  106. package/LinkGraph.js +2105 -1201
  107. package/LinkGraph.js.map +1 -1
  108. package/Map.config.js +3 -3
  109. package/Map.config.js.map +1 -1
  110. package/Map.js +77 -77
  111. package/Map.js.map +1 -1
  112. package/Markdown.config.js +26 -4
  113. package/Markdown.config.js.map +1 -1
  114. package/Markdown.js +143 -96
  115. package/Markdown.js.map +1 -1
  116. package/MarkerGauge.config.js +3 -3
  117. package/MarkerGauge.config.js.map +1 -1
  118. package/MarkerGauge.js +81 -81
  119. package/MarkerGauge.js.map +1 -1
  120. package/ParallelCoordinates.config.js +3 -3
  121. package/ParallelCoordinates.config.js.map +1 -1
  122. package/ParallelCoordinates.js +120 -120
  123. package/ParallelCoordinates.js.map +1 -1
  124. package/Pie.config.js +3 -3
  125. package/Pie.config.js.map +1 -1
  126. package/Pie.js +83 -83
  127. package/Pie.js.map +1 -1
  128. package/Punchcard.config.js +3 -3
  129. package/Punchcard.config.js.map +1 -1
  130. package/Punchcard.js +180 -180
  131. package/Punchcard.js.map +1 -1
  132. package/Rectangle.config.js +3 -3
  133. package/Rectangle.config.js.map +1 -1
  134. package/Rectangle.js +89 -89
  135. package/Rectangle.js.map +1 -1
  136. package/Sankey.config.js +3 -3
  137. package/Sankey.config.js.map +1 -1
  138. package/Sankey.js +61 -61
  139. package/Sankey.js.map +1 -1
  140. package/Scatter.config.js +3 -3
  141. package/Scatter.config.js.map +1 -1
  142. package/Scatter.js +35 -35
  143. package/Scatter.js.map +1 -1
  144. package/SingleValue.config.js +3 -3
  145. package/SingleValue.config.js.map +1 -1
  146. package/SingleValue.js +48 -48
  147. package/SingleValue.js.map +1 -1
  148. package/SingleValueBasic.js +4 -4
  149. package/SingleValueBasic.js.map +1 -1
  150. package/SingleValueIcon.config.js +3 -3
  151. package/SingleValueIcon.config.js.map +1 -1
  152. package/SingleValueIcon.js +68 -68
  153. package/SingleValueIcon.js.map +1 -1
  154. package/SingleValueRadial.config.js +3 -3
  155. package/SingleValueRadial.config.js.map +1 -1
  156. package/SingleValueRadial.js +62 -62
  157. package/SingleValueRadial.js.map +1 -1
  158. package/Table.config.js +9 -3
  159. package/Table.config.js.map +1 -1
  160. package/Table.js +890 -950
  161. package/Table.js.map +1 -1
  162. package/common/OptionsDoc.js +3 -4
  163. package/common/OptionsDoc.js.map +1 -1
  164. package/common/utils/configUtils.js +3 -3
  165. package/common/utils/configUtils.js.map +1 -1
  166. package/common/withDashboardViz.js +2 -2
  167. package/package.json +11 -11
  168. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width.png +0 -0
package/Table.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 451);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 456);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -95,14 +95,14 @@ module.exports =
95
95
  /***/ 0:
96
96
  /***/ (function(module, exports) {
97
97
 
98
- module.exports = require("prop-types");
98
+ module.exports = require("react");
99
99
 
100
100
  /***/ }),
101
101
 
102
102
  /***/ 1:
103
103
  /***/ (function(module, exports) {
104
104
 
105
- module.exports = require("react");
105
+ module.exports = require("prop-types");
106
106
 
107
107
  /***/ }),
108
108
 
@@ -156,7 +156,7 @@ Object.defineProperty(exports, "__esModule", {
156
156
  value: true
157
157
  });
158
158
 
159
- var React = __webpack_require__(1);
159
+ var React = __webpack_require__(0);
160
160
 
161
161
  var styled_components_1 = __webpack_require__(4);
162
162
 
@@ -221,7 +221,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
221
221
 
222
222
  return React.createElement(FixSizeItem, {
223
223
  "data-test": "fix-size-item",
224
- "data-splunk-visualization-version": "25.2.0 - 4373c5a66",
224
+ "data-splunk-visualization-version": "25.3.1 - b9a86c571",
225
225
  width: width,
226
226
  height: height,
227
227
  backgroundColor: backgroundColor
@@ -313,13 +313,13 @@ var lodash_1 = __webpack_require__(3);
313
313
 
314
314
  var colorUtils_1 = __webpack_require__(12);
315
315
 
316
- var config_1 = __webpack_require__(452);
316
+ var config_1 = __webpack_require__(457);
317
317
 
318
318
  exports.config = config_1.default;
319
319
 
320
320
  var withDashboardViz_1 = __webpack_require__(32);
321
321
 
322
- var PureTable_1 = __webpack_require__(151);
322
+ var PureTable_1 = __webpack_require__(458);
323
323
 
324
324
  exports.PureTable = PureTable_1.default;
325
325
 
@@ -397,20 +397,23 @@ exports.default = Table;
397
397
 
398
398
  /***/ }),
399
399
 
400
- /***/ 151:
400
+ /***/ 16:
401
+ /***/ (function(module, exports) {
402
+
403
+ module.exports = require("@splunk/visualizations-shared/schemaUtils");
404
+
405
+ /***/ }),
406
+
407
+ /***/ 17:
401
408
  /***/ (function(module, exports, __webpack_require__) {
402
409
 
403
410
  "use strict";
404
411
 
405
412
 
406
- var _slicedToArray = __webpack_require__(51);
413
+ var _toConsumableArray = __webpack_require__(8);
407
414
 
408
415
  var _defineProperty = __webpack_require__(7);
409
416
 
410
- var _taggedTemplateLiteral = __webpack_require__(85);
411
-
412
- var _templateObject, _templateObject2;
413
-
414
417
  var __rest = this && this.__rest || function (s, e) {
415
418
  var t = {};
416
419
 
@@ -427,905 +430,293 @@ var __rest = this && this.__rest || function (s, e) {
427
430
  Object.defineProperty(exports, "__esModule", {
428
431
  value: true
429
432
  });
430
- exports.MINIMUM_COLUMN_SIZE = void 0;
431
-
432
- var React = __webpack_require__(1);
433
-
434
- var T = __webpack_require__(0);
433
+ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
435
434
 
436
435
  var lodash_1 = __webpack_require__(3);
437
436
 
438
- var styled_components_1 = __webpack_require__(4);
439
-
440
- var i18n_1 = __webpack_require__(2);
437
+ var schemaUtils_1 = __webpack_require__(16);
441
438
 
442
- var Table_1 = __webpack_require__(95);
439
+ var VizBehavior_1 = __webpack_require__(6);
443
440
 
444
- var Paginator_1 = __webpack_require__(453);
441
+ var dynamicOptionsDSLType = {
442
+ type: 'string',
443
+ pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
444
+ };
445
+ /**
446
+ * Helper function to extend an options schema with dynamic options DSL
447
+ * @param optionsSchema a visualization's options schema
448
+ * @returns an updated options schema that additionally allows strings starting with > for each option
449
+ */
445
450
 
446
- var Message_1 = __webpack_require__(454);
451
+ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
452
+ var enhancedOptionsSchema = {};
453
+ Object.keys(optionsSchema).forEach(function (key) {
454
+ var _a = optionsSchema[key],
455
+ title = _a.title,
456
+ description = _a.description,
457
+ readOnly = _a.readOnly,
458
+ writeOnly = _a.writeOnly,
459
+ examples = _a.examples,
460
+ defaultValue = _a.default,
461
+ type = _a.type,
462
+ properties = _a.properties,
463
+ patternProperties = _a.patternProperties,
464
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
447
465
 
448
- var colorUtils_1 = __webpack_require__(12);
466
+ var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
467
+ title: title
468
+ }), description !== undefined && {
469
+ description: description
470
+ }), readOnly !== undefined && {
471
+ readOnly: readOnly
472
+ }), writeOnly !== undefined && {
473
+ writeOnly: writeOnly
474
+ }), examples !== undefined && {
475
+ examples: examples
476
+ }), defaultValue !== undefined && {
477
+ default: defaultValue
478
+ });
449
479
 
450
- var style_1 = __webpack_require__(15);
480
+ if (type === 'object') {
481
+ enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
482
+ type: type
483
+ }), properties && {
484
+ properties: enhanceOptionsSchemaWithDynamicOptions(properties)
485
+ });
451
486
 
452
- var pick_1 = __webpack_require__(21);
487
+ if (patternProperties) {
488
+ var enhancedPatternProperties = {};
489
+ Object.keys(patternProperties).forEach(function (opt) {
490
+ enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
491
+ });
492
+ enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
493
+ }
494
+ } else {
495
+ enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
496
+ anyOf: [Object.assign(Object.assign({}, type !== undefined && {
497
+ type: type
498
+ }), remainingSchemaEntry), dynamicOptionsDSLType]
499
+ });
500
+ }
501
+ });
502
+ return enhancedOptionsSchema;
503
+ }
453
504
 
454
- var variables_1 = __webpack_require__(9);
505
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
506
+ /**
507
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
508
+ * this function also collapse all editor panels
509
+ * @param vizConfig a Visualization Config
510
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
511
+ * and containing `open: false` for all editor panels in editorConfig
512
+ */
455
513
 
456
- var hooks_1 = __webpack_require__(455);
514
+ function enhanceConfig(vizConfig) {
515
+ var enhancedConfig = Object.assign({}, vizConfig);
457
516
 
458
- var consts_1 = __webpack_require__(120);
517
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
518
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
519
+ }
459
520
 
460
- var cells_1 = __webpack_require__(456);
521
+ enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
522
+ return Object.assign(Object.assign({}, config), {
523
+ open: config.open || false
524
+ });
525
+ });
526
+ return enhancedConfig;
527
+ }
461
528
 
462
- var getPagination_1 = __webpack_require__(29);
529
+ exports.enhanceConfig = enhanceConfig;
530
+ /**
531
+ * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
532
+ * Created for editor unit tests
533
+ * @param vizConfig a Visualization Config
534
+ * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
535
+ */
463
536
 
464
- var getSorting_1 = __webpack_require__(28);
537
+ function uncollapseEditorConfig(vizConfig) {
538
+ var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
539
+ editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
540
+ return Object.assign(Object.assign({}, config), {
541
+ open: true
542
+ });
543
+ });
544
+ return editorPanelUncollapsedConfig;
545
+ }
465
546
 
466
- var FixedSizeContainer_1 = __webpack_require__(13);
547
+ exports.uncollapseEditorConfig = uncollapseEditorConfig;
467
548
 
468
- var utils_1 = __webpack_require__(461); // debounce was imported this way due to typing
469
- // eslint-disable-next-line import/order
549
+ function isDynamicOption(option) {
550
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
551
+ }
470
552
 
553
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
554
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
471
555
 
472
- var debounce = __webpack_require__(462);
556
+ /**
557
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
558
+ * 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
559
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
560
+ * the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
561
+ *
562
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
563
+ */
473
564
 
474
- exports.MINIMUM_COLUMN_SIZE = 30;
475
- var NonVisibleTableHead = styled_components_1.default(Table_1.default.Head).withConfig({
476
- displayName: "PureTable__NonVisibleTableHead",
477
- componentId: "tovzjg-0"
478
- })(["display:none;"]);
479
- var FixedTableHead = styled_components_1.default(Table_1.default.Head).withConfig({
480
- displayName: "PureTable__FixedTableHead",
481
- componentId: "tovzjg-1"
482
- })(["position:sticky;top:0;"]);
483
- var VizTableContainer = styled_components_1.default.div.withConfig({
484
- displayName: "PureTable__VizTableContainer",
485
- componentId: "tovzjg-2"
486
- })(["box-sizing:border-box;padding:", ";background-color:", ";display:flex;flex-flow:column nowrap;overflow:hidden;"], pick_1.default({
487
- enterprise: variables_1.default.spacingHalf,
488
- prisma: variables_1.default.spacingSmall
489
- }), function (props) {
490
- return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
491
- });
492
- VizTableContainer.displayName = 'VizTableContainer';
493
- var PAGINATOR_CONTAINER_HEIGHT = 38;
494
- var PAGINATOR_SPACING = 5;
495
- var SUITableContainer = styled_components_1.default.div.withConfig({
496
- displayName: "PureTable__SUITableContainer",
497
- componentId: "tovzjg-3"
498
- })(["& *{font-family:", ";font-size:", ";line-height:", ";}box-sizing:border-box;flex-grow:1;overflow:hidden;", ";", ";", " ", " & [data-fixed-column='true']{table-layout:", ";width:", ";}"], function (props) {
499
- return props.font;
500
- }, function (props) {
501
- return props.fontSize;
502
- }, function (props) {
503
- return props.lineHeight;
504
- }, function (_ref) {
505
- var width = _ref.width,
506
- height = _ref.height,
507
- isPaging = _ref.isPaging,
508
- theme = _ref.theme;
509
- var padding = pick_1.default({
510
- enterprise: variables_1.default.spacingHalf({
511
- theme: theme
512
- }),
513
- prisma: variables_1.default.spacingSmall({
514
- theme: theme
515
- })
516
- })({
517
- theme: theme
565
+ function hasCompatibleContexts(vizContext, presetContext) {
566
+ var presetContextKeys = Object.keys(presetContext);
567
+ return presetContextKeys.every(function (contextKey) {
568
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
518
569
  });
519
- var paddingOffset = parseInt(padding, 10) * 2;
520
- return style_1.toDimension({
521
- width: width - paddingOffset,
522
- height: isPaging ? height - PAGINATOR_CONTAINER_HEIGHT - PAGINATOR_SPACING - paddingOffset : height - paddingOffset
570
+ }
571
+ /**
572
+ * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
573
+ */
574
+
575
+
576
+ function hasCompatibleOptions(vizOptions, presetOptions) {
577
+ var presetOptionKeys = Object.keys(presetOptions);
578
+ return presetOptionKeys.every(function (optionKey) {
579
+ return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
523
580
  });
524
- }, function (_ref2) {
525
- var isPaging = _ref2.isPaging;
526
- return isPaging && "\n margin-bottom: ".concat(PAGINATOR_SPACING, "px;\n ");
527
- }, function (_ref3) {
528
- var headerStyle = _ref3.headerStyle;
529
- return headerStyle && headerStyle.backgroundColor && styled_components_1.css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & [data-test='head-cell'] {\n background-color: ", ";\n }\n "])), headerStyle.backgroundColor);
530
- }, function (_ref4) {
531
- var headerStyle = _ref4.headerStyle;
532
- return headerStyle && headerStyle.color && styled_components_1.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & [data-test='head-cell'] > div > span {\n color: ", ";\n }\n "])), headerStyle.color);
533
- }, function (_ref5) {
534
- var widthSet = _ref5.widthSet;
535
- return widthSet ? 'fixed' : 'auto';
536
- }, function (_ref6) {
537
- var widthSet = _ref6.widthSet;
538
- return widthSet ? '0' : '100%';
539
- });
540
- SUITableContainer.displayName = 'SUITableContainer';
541
- var PaginatorContainer = styled_components_1.default.div.withConfig({
542
- displayName: "PureTable__PaginatorContainer",
543
- componentId: "tovzjg-4"
544
- })(["position:relative;text-align:right;height:", "px;"], PAGINATOR_CONTAINER_HEIGHT);
545
- PaginatorContainer.displayName = 'PaginatorContainer'; // allow for early return in case of empty tableBody while still following hook rules
581
+ }
582
+ /**
583
+ * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
584
+ * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
585
+ *
586
+ * @param {Object} vizContext - the current vizContext definition
587
+ * @param {Object} vizOptions - the current vizOptions definition
588
+ * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
589
+ */
546
590
 
547
- var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
548
- // TODO(fkurniawan): add omit type to differentiate WrapperProps from PureTableProps
549
- var Wrapper = function Wrapper(props) {
550
- var headers = props.headers,
551
- table = props.table,
552
- headerVisibility = props.headerVisibility,
553
- showRowNumbers = props.showRowNumbers,
554
- showInternalFields = props.showInternalFields,
555
- tableFormat = props.tableFormat,
556
- columnFormat = props.columnFormat;
557
591
 
558
- var _hooks_1$useTable = hooks_1.useTable({
559
- headers: headers,
560
- table: table,
561
- headerVisibility: headerVisibility,
562
- showRowNumbers: showRowNumbers,
563
- showInternalFields: showInternalFields,
564
- tableFormat: Object.assign(Object.assign(Object.assign(Object.assign({}, tableFormat), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.align) && {
565
- align: lodash_1.cloneDeep(tableFormat.align)
566
- }), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.cellTypes) && {
567
- cellTypes: lodash_1.cloneDeep(tableFormat.cellTypes)
568
- }), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.data) && {
569
- data: lodash_1.cloneDeep(tableFormat.data)
570
- }),
571
- columnFormat: columnFormat
572
- }),
573
- tableHeader = _hooks_1$useTable.tableHeader,
574
- tableBody = _hooks_1$useTable.tableBody;
592
+ function getInitialPreset(vizContext, vizOptions, presets) {
593
+ return presets.find(function (preset) {
594
+ var presetContext = lodash_1.get(preset, ['value', 'context'], {});
595
+ var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
596
+ var presetContextKeys = Object.keys(presetContext);
597
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
598
+ // if not, then the preset is invalid in config.ts
575
599
 
576
- if (tableBody.rows.length === 0) {
577
- return React.createElement(Message_1.default, {
578
- type: "warning"
579
- }, i18n_1._('No data!'));
580
- }
600
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
601
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
602
+ });
603
+ }
581
604
 
582
- return React.createElement(Viz, Object.assign({}, props, {
583
- tableHeader: tableHeader,
584
- tableBody: tableBody
585
- }));
586
- };
605
+ exports.getInitialPreset = getInitialPreset;
606
+ /**
607
+ * generates number precision values for a Select editor
608
+ *
609
+ * @param {Number} numPrecisionValues - number of integer precision values to generate
610
+ * @returns {{ label: string; value; string }[]} array of { label, value } tuples
611
+ */
587
612
 
588
- Wrapper.displayName = 'PureTableWrapper';
589
- return Wrapper;
590
- };
613
+ function generatePrecisionValues(numPrecisionValues) {
614
+ return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
615
+ return {
616
+ label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
617
+ value: i
618
+ };
619
+ });
620
+ }
591
621
 
592
- var useTableHead = function useTableHead(visibility) {
593
- if (visibility === 'none') {
594
- return NonVisibleTableHead;
595
- }
622
+ exports.generatePrecisionValues = generatePrecisionValues;
623
+ /**
624
+ * insert layout in layout array, return a new layout array instead of updating the original
625
+ *
626
+ * @param {EditorLayoutConfig[][]} layout - editor layout
627
+ * @param {Number} index - the index to insert layout item(s)
628
+ * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
629
+ * @returns {EditorLayoutConfig[][]} new editor layout with insertion
630
+ */
596
631
 
597
- if (visibility === 'fixed') {
598
- return FixedTableHead;
632
+ var insertLayout = function insertLayout(layout, index) {
633
+ for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
634
+ layoutItems[_key - 2] = arguments[_key];
599
635
  }
600
636
 
601
- return Table_1.default.Head;
637
+ return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
602
638
  };
603
639
 
604
- var HeadCell = function HeadCell(_a) {
605
- var setTempColumnWidth = _a.setTempColumnWidth,
606
- setRemainingWidth = _a.setRemainingWidth,
607
- value = _a.value,
608
- widthSet = _a.widthSet,
609
- headerVisibility = _a.headerVisibility,
610
- props = __rest(_a, ["setTempColumnWidth", "setRemainingWidth", "value", "widthSet", "headerVisibility"]);
640
+ exports.insertLayout = insertLayout;
611
641
 
612
- var cellRef = React.useRef(null);
613
- React.useEffect(function () {
614
- if (!widthSet && cellRef.current && cellRef.current.clientWidth >= 0 && headerVisibility !== 'none') {
615
- setTempColumnWidth(function (columnWidth) {
616
- return Object.assign(Object.assign({}, columnWidth), _defineProperty({}, value, {
617
- width: cellRef.current.clientWidth
618
- }));
619
- });
620
- setRemainingWidth(function (prevWidth) {
621
- return prevWidth + Math.max(props.width ? cellRef.current.clientWidth - props.width : 0, 0);
622
- });
623
- }
624
- });
625
- return React.createElement(Table_1.default.HeadCell, Object.assign({
626
- elementRef: cellRef
627
- }, props), value);
628
- };
642
+ /***/ }),
629
643
 
630
- var fontMap = {
631
- proportional: 'Splunk Platform Sans',
632
- monospace: 'Splunk Platform Mono'
633
- };
634
- var fontSizeMap = {
635
- extraSmall: '10px',
636
- small: '12px',
637
- default: '14px',
638
- large: '16px'
639
- };
640
- var rowHeightMap = {
641
- extraSmall: '12px',
642
- small: '12px',
643
- default: '20px',
644
- large: '24px'
645
- };
644
+ /***/ 19:
645
+ /***/ (function(module, exports) {
646
646
 
647
- var PureTable = function PureTable(props) {
648
- var _a;
647
+ module.exports = require("@babel/runtime/helpers/createClass");
649
648
 
650
- var count = props.count,
651
- width = props.width,
652
- height = props.height,
653
- backgroundColor = props.backgroundColor,
654
- tableHeader = props.tableHeader,
655
- tableBody = props.tableBody,
656
- showRowNumbers = props.showRowNumbers,
657
- _props$sortParams = props.sortParams,
658
- currentSortKey = _props$sortParams.currentSortKey,
659
- currentSortDir = _props$sortParams.currentSortDir,
660
- onSort = _props$sortParams.onSort,
661
- _b = props.paginatorParams,
662
- isPaging = _b.isPaging,
663
- paginatorOnChange = _b.onChange,
664
- paginatorProps = __rest(_b, ["isPaging", "onChange"]),
665
- onCellClick = props.onCellClick,
666
- onColumnFormatChange = props.onColumnFormatChange,
667
- columnFormat = props.columnFormat,
668
- mode = props.mode,
669
- headerVisibility = props.headerVisibility,
670
- font = props.font,
671
- fontSize = props.fontSize;
649
+ /***/ }),
672
650
 
673
- var _React$useState = React.useState(columnFormat),
674
- _React$useState2 = _slicedToArray(_React$useState, 2),
675
- columns = _React$useState2[0],
676
- setColumns = _React$useState2[1];
651
+ /***/ 2:
652
+ /***/ (function(module, exports) {
677
653
 
678
- var _React$useState3 = React.useState(columnFormat),
679
- _React$useState4 = _slicedToArray(_React$useState3, 2),
680
- tempColumns = _React$useState4[0],
681
- setTempColumns = _React$useState4[1];
654
+ module.exports = require("@splunk/ui-utils/i18n");
682
655
 
683
- var _React$useState5 = React.useState(0),
684
- _React$useState6 = _slicedToArray(_React$useState5, 2),
685
- remainingWidth = _React$useState6[0],
686
- setRemainingWidth = _React$useState6[1];
656
+ /***/ }),
687
657
 
688
- var numColumnsWithoutWidth = Object.keys(tempColumns).reduce(function (acc, key) {
689
- var _a;
658
+ /***/ 20:
659
+ /***/ (function(module, exports) {
690
660
 
691
- if ((_a = columns[key]) === null || _a === void 0 ? void 0 : _a.width) {
692
- return acc;
693
- }
661
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
694
662
 
695
- return acc + 1;
696
- }, 0);
697
- var containerRef = React.useRef(null);
698
- var containerRefInner = React.useRef(null);
699
- var containerRefInnerWidth = (_a = containerRefInner === null || containerRefInner === void 0 ? void 0 : containerRefInner.current) === null || _a === void 0 ? void 0 : _a.clientWidth;
700
- var widthRef = React.useRef(0);
701
- var widthSet = tableHeader.cells.length === tableHeader.cells.filter(function (_ref7) {
702
- var value = _ref7.value,
703
- showCell = _ref7.showCell;
663
+ /***/ }),
704
664
 
705
- var _a, _b;
665
+ /***/ 21:
666
+ /***/ (function(module, exports) {
706
667
 
707
- return ((_a = columns[value]) === null || _a === void 0 ? void 0 : _a.width) !== undefined || ((_b = tempColumns[value]) === null || _b === void 0 ? void 0 : _b.width) !== undefined || !showCell;
708
- }).length;
709
- React.useEffect(function () {
710
- if (containerRef.current && containerRef.current.clientWidth !== widthRef.current) {
711
- widthRef.current = containerRef.current.clientWidth;
712
- recalculateTempColumnWidths();
713
- }
714
- });
715
- var firstRenderCount = React.useRef(count);
716
- React.useEffect(function () {
717
- if (firstRenderCount.current !== count) {
718
- firstRenderCount.current = count;
719
- paginatorOnChange(null, {
720
- count: count
721
- });
722
- }
723
- }, [count, paginatorProps]);
724
- var stringifiedColumnFormat = JSON.stringify(columnFormat);
725
- var columnFormatRef = React.useRef(stringifiedColumnFormat);
726
- var modeRef = React.useRef(mode);
727
- React.useEffect(function () {
728
- if (modeRef.current !== mode || columnFormatRef.current !== stringifiedColumnFormat) {
729
- columnFormatRef.current = stringifiedColumnFormat;
730
- modeRef.current = mode;
731
- setColumns(columnFormat);
732
- }
733
- }, [mode, stringifiedColumnFormat]);
734
- var TableHead = useTableHead(headerVisibility);
735
- var debouncedDrilldown = debounce(function (e, payload) {
736
- if (window.getSelection().toString() === '') {
737
- if (lodash_1.isFunction(onCellClick)) {
738
- onCellClick({
739
- e: e,
740
- payload: payload
741
- });
742
- }
743
- }
744
- }, 200);
745
- var drilldownHandler = React.useCallback(function (e) {
746
- var element = e.target;
747
- var row = element.getAttribute('data-row-index');
748
- var col = element.getAttribute('data-col-index');
749
- var arrayIndex = element.getAttribute('data-array-index') || -1;
668
+ module.exports = require("@splunk/themes/pick");
750
669
 
751
- if (row && col) {
752
- var cellRefIndex = +col;
753
- var cellIndex = cellRefIndex;
754
- var rowIndex = +row;
755
- var fieldValue = tableHeader.cells[cellRefIndex].value;
756
- var cellValue = tableBody.rows[rowIndex].cells[cellRefIndex].value;
757
- var cellRawValue = tableBody.rows[rowIndex].cells[cellRefIndex].value;
758
- var value = arrayIndex === -1 ? cellValue : cellRawValue[+arrayIndex]; // Wish we did not have these if statements for
759
- // showRowNumbers
670
+ /***/ }),
760
671
 
761
- if (showRowNumbers === true) {
762
- if (cellIndex === 0) {
763
- // no click event for row numbers
764
- return;
765
- }
672
+ /***/ 23:
673
+ /***/ (function(module, exports) {
766
674
 
767
- cellIndex -= 1;
768
- }
675
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
769
676
 
770
- var payload = {
771
- cellIndex: cellIndex,
772
- rowIndex: rowIndex,
773
- fieldValue: fieldValue,
774
- cellValue: cellValue,
775
- cellRawValue: cellRawValue,
776
- value: value,
777
- name: fieldValue
778
- };
779
- tableBody.rows[rowIndex].cells.forEach(function (c, index) {
780
- var rowToken = "row.".concat(tableHeader.cells[index].value, ".value");
781
- payload[rowToken] = c.value;
782
- });
783
- debouncedDrilldown(e.nativeEvent, payload);
784
- }
785
- }, [onCellClick, showRowNumbers, tableHeader, tableBody]);
786
- var debouncedOnColumnFormatChange = React.useMemo(function () {
787
- return debounce(function (newFormat) {
788
- onColumnFormatChange(newFormat);
789
- }, 300);
790
- }, [onColumnFormatChange]);
677
+ /***/ }),
791
678
 
792
- var handleResizeColumn = function handleResizeColumn(_event, payload) {
793
- var updatedCF = columns;
794
- var field = payload.columnId;
795
- var lastShowingTableHeaderWidth = utils_1.getLastColumnWidth(containerRefInnerWidth, lastShowingTableHeadersID, columns, tempColumns, firstShowingTableHeadersID);
796
- updatedCF[lastShowingTableHeadersID] = Object.assign(Object.assign({}, updatedCF[lastShowingTableHeadersID]), {
797
- width: Math.max(lastShowingTableHeaderWidth, exports.MINIMUM_COLUMN_SIZE)
798
- });
799
- updatedCF[field] = Object.assign(Object.assign({}, updatedCF[field]), {
800
- width: Math.max(payload.width, exports.MINIMUM_COLUMN_SIZE)
801
- });
802
- setColumns(Object.assign({}, updatedCF)); // Updates column json in edit mode
803
-
804
- if (mode === 'edit') {
805
- debouncedOnColumnFormatChange(updatedCF);
806
- }
807
- };
808
-
809
- var handleEventClick = function handleEventClick(e) {
810
- // Hack to target the resize handlers, since the only button within a HeadCell is the resize handlers
811
- if (e.target.tagName.toLowerCase() === 'button') {
812
- e.stopPropagation();
813
- }
814
- };
815
-
816
- var recalculateTempColumnWidths = function recalculateTempColumnWidths() {
817
- setTempColumns({});
818
- setRemainingWidth(0);
819
- };
820
-
821
- var withColumnResizing = function withColumnResizing(func) {
822
- return function (e, additionalParams) {
823
- recalculateTempColumnWidths();
824
- func(e, additionalParams);
825
- };
826
- };
827
-
828
- var fontMapped = fontMap[font] || fontMap.proportional;
829
- var fontSizeMapped = fontSizeMap[fontSize] || fontSizeMap.default;
830
- var rowHeightMapped = rowHeightMap[fontSize] || rowHeightMap.default;
831
- var firstShowingTableHeadersID = tableHeader.cells.filter(function (c) {
832
- return c.showCell;
833
- }).map(function (c) {
834
- return c.value;
835
- })[0];
836
- var lastShowingTableHeadersID = tableHeader.cells.filter(function (c) {
837
- return c.showCell;
838
- }).map(function (c) {
839
- return c.value;
840
- }).reverse()[0];
841
- return React.createElement(VizTableContainer, {
842
- backgroundColor: backgroundColor,
843
- ref: containerRef
844
- }, React.createElement(SUITableContainer, {
845
- ref: containerRefInner,
846
- width: width,
847
- height: height,
848
- isPaging: isPaging,
849
- headerStyle: tableHeader.style,
850
- widthSet: widthSet,
851
- font: fontMapped,
852
- fontSize: fontSizeMapped,
853
- lineHeight: rowHeightMapped
854
- }, React.createElement(Table_1.default, {
855
- headType: headerVisibility !== 'none' ? 'inline' : undefined,
856
- innerStyle: {
857
- height: '100%'
858
- },
859
- outerStyle: {
860
- height: '100%',
861
- cursor: onCellClick ? 'pointer' : 'unset'
862
- },
863
- onClick: onCellClick ? drilldownHandler : lodash_1.noop,
864
- onRequestResizeColumn: handleResizeColumn
865
- }, React.createElement(TableHead, null, tableHeader.cells.filter(function (c) {
866
- return c.showCell;
867
- }).map(function (_a) {
868
- var key = _a.key,
869
- value = _a.value,
870
- sortKey = _a.sortKey,
871
- rest = __rest(_a, ["key", "value", "sortKey"]);
872
-
873
- return React.createElement(HeadCell, Object.assign({
874
- key: key,
875
- columnId: value,
876
- sortDir: sortKey === currentSortKey ? currentSortDir : 'none',
877
- width: value === lastShowingTableHeadersID ? utils_1.getLastColumnWidth(containerRefInnerWidth, lastShowingTableHeadersID, columns, tempColumns, firstShowingTableHeadersID) : utils_1.getColumnWidth({
878
- columns: columns,
879
- tempColumns: tempColumns,
880
- columnName: value,
881
- remainingWidth: remainingWidth,
882
- numColumnsWithoutWidth: numColumnsWithoutWidth
883
- }),
884
- onMouseDown: handleEventClick,
885
- value: value,
886
- setTempColumnWidth: setTempColumns,
887
- widthSet: widthSet,
888
- onSort: withColumnResizing(onSort),
889
- headerVisibility: headerVisibility,
890
- setRemainingWidth: setRemainingWidth
891
- }, Object.assign({
892
- sortKey: sortKey
893
- }, rest)));
894
- })), React.createElement(Table_1.default.Body, null, tableBody.rows.map(function (row) {
895
- return React.createElement(Table_1.default.Row, {
896
- key: row.key
897
- }, row.cells.filter(function (c) {
898
- return c.showCell;
899
- }).map(function (cell) {
900
- return React.createElement(cells_1.SwitchTableCell, {
901
- key: cell.key,
902
- type: cell.cellType
903
- }, React.createElement(cells_1.TextCell, {
904
- cell: cell,
905
- useMouseOverEffect: !!onCellClick,
906
- width: cell.header === lastShowingTableHeadersID ? utils_1.getLastColumnWidth(containerRefInnerWidth, lastShowingTableHeadersID, columns, tempColumns, firstShowingTableHeadersID) : utils_1.getColumnWidth({
907
- columns: columns,
908
- tempColumns: tempColumns,
909
- columnName: cell.header,
910
- remainingWidth: remainingWidth,
911
- numColumnsWithoutWidth: numColumnsWithoutWidth
912
- })
913
- }), React.createElement(cells_1.SparklineCell, {
914
- cell: cell,
915
- useMouseOverEffect: !!onCellClick,
916
- width: cell.header === lastShowingTableHeadersID ? utils_1.getLastColumnWidth(containerRefInnerWidth, lastShowingTableHeadersID, columns, tempColumns, firstShowingTableHeadersID) : utils_1.getColumnWidth({
917
- columns: columns,
918
- tempColumns: tempColumns,
919
- columnName: cell.header,
920
- remainingWidth: remainingWidth,
921
- numColumnsWithoutWidth: numColumnsWithoutWidth
922
- })
923
- }), React.createElement(cells_1.ArrayCell, {
924
- cell: cell,
925
- useMouseOverEffect: !!onCellClick,
926
- width: cell.header === lastShowingTableHeadersID ? utils_1.getLastColumnWidth(containerRefInnerWidth, lastShowingTableHeadersID, columns, tempColumns, firstShowingTableHeadersID) : utils_1.getColumnWidth({
927
- columns: columns,
928
- tempColumns: tempColumns,
929
- columnName: cell.header,
930
- remainingWidth: remainingWidth,
931
- numColumnsWithoutWidth: numColumnsWithoutWidth
932
- })
933
- }));
934
- }));
935
- })))), isPaging ? React.createElement(PaginatorContainer, null, React.createElement(Paginator_1.default, Object.assign({
936
- onChange: withColumnResizing(paginatorOnChange)
937
- }, paginatorProps))) : null);
938
- };
679
+ /***/ 25:
680
+ /***/ (function(module, exports) {
939
681
 
940
- var cellDataType = T.oneOfType([T.string, T.number, T.arrayOf(T.oneOfType([T.string, T.number]))]);
941
- PureTable.propTypes = {
942
- backgroundColor: T.string,
943
- count: T.number,
944
- columnFormat: T.objectOf(T.shape({
945
- align: T.arrayOf(T.oneOf(consts_1.validAlignments)),
946
- cellTypes: T.arrayOf(T.oneOf(consts_1.validCellRenderers)),
947
- data: T.arrayOf(cellDataType),
948
- rowBackgroundColors: T.arrayOf(T.string),
949
- rowColors: T.arrayOf(T.string),
950
- sparklineAreaColors: T.arrayOf(T.string),
951
- sparklineColors: T.arrayOf(T.string),
952
- sparklineTypes: T.arrayOf(T.oneOf(consts_1.validSparklineTypes))
953
- })),
954
- headers: T.arrayOf(T.string),
955
- headerVisibility: T.oneOf(consts_1.validHeaderVisibilities),
956
- height: T.oneOfType([T.number]),
957
- mode: T.string,
958
- onCellClick: T.func,
959
- paginatorParams: getPagination_1.PaginatorParamsPropTypes,
960
- showRowNumbers: T.bool,
961
- sortParams: getSorting_1.SortParamsPropTypes,
962
- table: T.arrayOf(T.arrayOf(cellDataType)),
963
- tableFormat: T.shape({
964
- align: T.arrayOf(T.arrayOf(T.oneOf(consts_1.validAlignments))),
965
- cellTypes: T.arrayOf(T.arrayOf(T.oneOf(consts_1.validCellRenderers))),
966
- data: T.arrayOf(T.arrayOf(cellDataType)),
967
- headerBackgroundColor: T.string,
968
- headerColor: T.string,
969
- rowBackgroundColors: T.oneOfType([T.arrayOf(T.string), T.arrayOf(T.arrayOf(T.string))]),
970
- rowColors: T.oneOfType([T.arrayOf(T.string), T.arrayOf(T.arrayOf(T.string))]),
971
- sparklineAreaColors: T.arrayOf(T.arrayOf(T.string)),
972
- sparklineColors: T.arrayOf(T.arrayOf(T.string)),
973
- sparklineTypes: T.arrayOf(T.arrayOf(T.oneOf(consts_1.validSparklineTypes)))
974
- }),
975
- theme: T.any,
976
- width: T.oneOfType([T.number]),
977
- onColumnFormatChange: T.func,
978
- font: T.string,
979
- fontSize: T.string
980
- };
981
- PureTable.defaultProps = {
982
- columnFormat: {},
983
- headers: [],
984
- headerVisibility: 'inline',
985
- height: 300,
986
- mode: 'view',
987
- onCellClick: null,
988
- paginatorParams: {
989
- isPaging: false,
990
- onChange: lodash_1.noop
991
- },
992
- showRowNumbers: false,
993
- sortParams: {
994
- onSort: lodash_1.noop
995
- },
996
- table: [],
997
- tableFormat: {},
998
- theme: {},
999
- width: 300,
1000
- onColumnFormatChange: lodash_1.noop,
1001
- font: fontMap.proportional,
1002
- fontSize: fontSizeMap.default
1003
- };
1004
- PureTable.displayName = 'VizTable';
1005
- exports.default = withEmptyTableMessage(FixedSizeContainer_1.default(PureTable));
682
+ module.exports = require("@splunk/visualizations-shared/hocUtils");
1006
683
 
1007
684
  /***/ }),
1008
685
 
1009
- /***/ 16:
686
+ /***/ 26:
1010
687
  /***/ (function(module, exports) {
1011
688
 
1012
- module.exports = require("@splunk/visualizations-shared/schemaUtils");
689
+ module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
1013
690
 
1014
691
  /***/ }),
1015
692
 
1016
- /***/ 17:
693
+ /***/ 27:
1017
694
  /***/ (function(module, exports, __webpack_require__) {
1018
695
 
1019
696
  "use strict";
1020
697
 
1021
698
 
1022
- var _toConsumableArray = __webpack_require__(8);
1023
-
1024
- var _defineProperty = __webpack_require__(7);
1025
-
1026
- var __rest = this && this.__rest || function (s, e) {
1027
- var t = {};
1028
-
1029
- for (var p in s) {
1030
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1031
- }
1032
-
1033
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1034
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1035
- }
1036
- return t;
1037
- };
1038
-
1039
699
  Object.defineProperty(exports, "__esModule", {
1040
700
  value: true
1041
701
  });
1042
- exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
702
+ exports.shouldShowIconPlaceholder = void 0;
703
+
704
+ var React = __webpack_require__(0);
705
+
706
+ var T = __webpack_require__(1);
1043
707
 
1044
708
  var lodash_1 = __webpack_require__(3);
1045
709
 
1046
- var schemaUtils_1 = __webpack_require__(16);
710
+ var i18n_1 = __webpack_require__(2);
1047
711
 
1048
- var VizBehavior_1 = __webpack_require__(6);
712
+ var Message_1 = __webpack_require__(10);
1049
713
 
1050
- var dynamicOptionsDSLType = {
1051
- type: 'string',
1052
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
1053
- };
714
+ var FixedSizeContainer_1 = __webpack_require__(13);
1054
715
  /**
1055
- * Helper function to extend an options schema with dynamic options DSL
1056
- * @param optionsSchema a visualization's options schema
1057
- * @returns an updated options schema that additionally allows strings starting with > for each option
1058
- */
1059
-
1060
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
1061
- var enhancedOptionsSchema = {};
1062
- Object.keys(optionsSchema).forEach(function (key) {
1063
- var _a = optionsSchema[key],
1064
- title = _a.title,
1065
- description = _a.description,
1066
- readOnly = _a.readOnly,
1067
- writeOnly = _a.writeOnly,
1068
- examples = _a.examples,
1069
- defaultValue = _a.default,
1070
- type = _a.type,
1071
- properties = _a.properties,
1072
- patternProperties = _a.patternProperties,
1073
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
1074
-
1075
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
1076
- title: title
1077
- }), description !== undefined && {
1078
- description: description
1079
- }), readOnly !== undefined && {
1080
- readOnly: readOnly
1081
- }), writeOnly !== undefined && {
1082
- writeOnly: writeOnly
1083
- }), examples !== undefined && {
1084
- examples: examples
1085
- }), defaultValue !== undefined && {
1086
- default: defaultValue
1087
- });
1088
-
1089
- if (type === 'object') {
1090
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
1091
- type: type
1092
- }), properties && {
1093
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
1094
- });
1095
-
1096
- if (patternProperties) {
1097
- var enhancedPatternProperties = {};
1098
- Object.keys(patternProperties).forEach(function (opt) {
1099
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
1100
- });
1101
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
1102
- }
1103
- } else {
1104
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
1105
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
1106
- type: type
1107
- }), remainingSchemaEntry), dynamicOptionsDSLType]
1108
- });
1109
- }
1110
- });
1111
- return enhancedOptionsSchema;
1112
- }
1113
-
1114
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
1115
- /**
1116
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
1117
- * this function also collapse all editor panels
1118
- * @param vizConfig a Visualization Config
1119
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
1120
- * and containing `open: false` for all editor panels in editorConfig
1121
- */
1122
-
1123
- function enhanceConfig(vizConfig) {
1124
- var enhancedConfig = vizConfig;
1125
-
1126
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
1127
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
1128
- }
1129
-
1130
- enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
1131
- return Object.assign(Object.assign({}, config), {
1132
- open: false
1133
- });
1134
- });
1135
- return enhancedConfig;
1136
- }
1137
-
1138
- exports.enhanceConfig = enhanceConfig;
1139
- /**
1140
- * Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
1141
- * Created for editor unit tests
1142
- * @param vizConfig a Visualization Config
1143
- * @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
1144
- */
1145
-
1146
- function uncollapseEditorConfig(vizConfig) {
1147
- var editorPanelUncollapsedConfig = vizConfig;
1148
- editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
1149
- return Object.assign(Object.assign({}, config), {
1150
- open: true
1151
- });
1152
- });
1153
- return editorPanelUncollapsedConfig;
1154
- }
1155
-
1156
- exports.uncollapseEditorConfig = uncollapseEditorConfig;
1157
-
1158
- function isDynamicOption(option) {
1159
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
1160
- }
1161
-
1162
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
1163
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
1164
-
1165
- /**
1166
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
1167
- * 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
1168
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
1169
- * the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
1170
- *
1171
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
1172
- */
1173
-
1174
- function hasCompatibleContexts(vizContext, presetContext) {
1175
- var presetContextKeys = Object.keys(presetContext);
1176
- return presetContextKeys.every(function (contextKey) {
1177
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
1178
- });
1179
- }
1180
- /**
1181
- * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
1182
- */
1183
-
1184
-
1185
- function hasCompatibleOptions(vizOptions, presetOptions) {
1186
- var presetOptionKeys = Object.keys(presetOptions);
1187
- return presetOptionKeys.every(function (optionKey) {
1188
- return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
1189
- });
1190
- }
1191
- /**
1192
- * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
1193
- * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
1194
- *
1195
- * @param {Object} vizContext - the current vizContext definition
1196
- * @param {Object} vizOptions - the current vizOptions definition
1197
- * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
1198
- */
1199
-
1200
-
1201
- function getInitialPreset(vizContext, vizOptions, presets) {
1202
- return presets.find(function (preset) {
1203
- var presetContext = lodash_1.get(preset, ['value', 'context'], {});
1204
- var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
1205
- var presetContextKeys = Object.keys(presetContext);
1206
- var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
1207
- // if not, then the preset is invalid in config.ts
1208
-
1209
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
1210
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
1211
- });
1212
- }
1213
-
1214
- exports.getInitialPreset = getInitialPreset;
1215
- /**
1216
- * generates number precision values for a Select editor
1217
- *
1218
- * @param {Number} numPrecisionValues - number of integer precision values to generate
1219
- * @returns {{ label: string; value; string }[]} array of { label, value } tuples
1220
- */
1221
-
1222
- function generatePrecisionValues(numPrecisionValues) {
1223
- return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
1224
- return {
1225
- label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
1226
- value: i
1227
- };
1228
- });
1229
- }
1230
-
1231
- exports.generatePrecisionValues = generatePrecisionValues;
1232
- /**
1233
- * insert layout in layout array, return a new layout array instead of updating the original
1234
- *
1235
- * @param {EditorLayoutConfig[][]} layout - editor layout
1236
- * @param {Number} index - the index to insert layout item(s)
1237
- * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
1238
- * @returns {EditorLayoutConfig[][]} new editor layout with insertion
1239
- */
1240
-
1241
- var insertLayout = function insertLayout(layout, index) {
1242
- for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1243
- layoutItems[_key - 2] = arguments[_key];
1244
- }
1245
-
1246
- return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
1247
- };
1248
-
1249
- exports.insertLayout = insertLayout;
1250
-
1251
- /***/ }),
1252
-
1253
- /***/ 19:
1254
- /***/ (function(module, exports) {
1255
-
1256
- module.exports = require("@babel/runtime/helpers/createClass");
1257
-
1258
- /***/ }),
1259
-
1260
- /***/ 2:
1261
- /***/ (function(module, exports) {
1262
-
1263
- module.exports = require("@splunk/ui-utils/i18n");
1264
-
1265
- /***/ }),
1266
-
1267
- /***/ 20:
1268
- /***/ (function(module, exports) {
1269
-
1270
- module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
1271
-
1272
- /***/ }),
1273
-
1274
- /***/ 21:
1275
- /***/ (function(module, exports) {
1276
-
1277
- module.exports = require("@splunk/themes/pick");
1278
-
1279
- /***/ }),
1280
-
1281
- /***/ 23:
1282
- /***/ (function(module, exports) {
1283
-
1284
- module.exports = require("@splunk/visualization-context/TimezoneContext");
1285
-
1286
- /***/ }),
1287
-
1288
- /***/ 25:
1289
- /***/ (function(module, exports) {
1290
-
1291
- module.exports = require("@splunk/visualizations-shared/hocUtils");
1292
-
1293
- /***/ }),
1294
-
1295
- /***/ 26:
1296
- /***/ (function(module, exports) {
1297
-
1298
- module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
1299
-
1300
- /***/ }),
1301
-
1302
- /***/ 27:
1303
- /***/ (function(module, exports, __webpack_require__) {
1304
-
1305
- "use strict";
1306
-
1307
-
1308
- Object.defineProperty(exports, "__esModule", {
1309
- value: true
1310
- });
1311
- exports.shouldShowIconPlaceholder = void 0;
1312
-
1313
- var React = __webpack_require__(1);
1314
-
1315
- var T = __webpack_require__(0);
1316
-
1317
- var lodash_1 = __webpack_require__(3);
1318
-
1319
- var i18n_1 = __webpack_require__(2);
1320
-
1321
- var Message_1 = __webpack_require__(10);
1322
-
1323
- var FixedSizeContainer_1 = __webpack_require__(13);
1324
- /**
1325
- * @method shouldShowIconPlaceholder
1326
- * @param {object} dataSources
1327
- * @param {boolean} loading
1328
- * @returns {boolean}
716
+ * @method shouldShowIconPlaceholder
717
+ * @param {object} dataSources
718
+ * @param {boolean} loading
719
+ * @returns {boolean}
1329
720
  */
1330
721
 
1331
722
 
@@ -1404,7 +795,7 @@ Object.defineProperty(exports, "__esModule", {
1404
795
  });
1405
796
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1406
797
 
1407
- var T = __webpack_require__(0);
798
+ var T = __webpack_require__(1);
1408
799
 
1409
800
  var lodash_1 = __webpack_require__(3);
1410
801
 
@@ -1473,7 +864,7 @@ Object.defineProperty(exports, "__esModule", {
1473
864
  });
1474
865
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1475
866
 
1476
- var T = __webpack_require__(0);
867
+ var T = __webpack_require__(1);
1477
868
 
1478
869
  var lodash_1 = __webpack_require__(3);
1479
870
 
@@ -1573,7 +964,7 @@ Object.defineProperty(exports, "__esModule", {
1573
964
  value: true
1574
965
  });
1575
966
 
1576
- var React = __webpack_require__(1);
967
+ var React = __webpack_require__(0);
1577
968
 
1578
969
  var lodash_1 = __webpack_require__(3);
1579
970
 
@@ -1851,7 +1242,7 @@ Object.defineProperty(exports, "__esModule", {
1851
1242
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1852
1243
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1853
1244
 
1854
- var T = __webpack_require__(0);
1245
+ var T = __webpack_require__(1);
1855
1246
 
1856
1247
  var lodash_1 = __webpack_require__(3);
1857
1248
 
@@ -2059,7 +1450,7 @@ Object.defineProperty(exports, "__esModule", {
2059
1450
  });
2060
1451
  exports.useDeepMemo = void 0;
2061
1452
 
2062
- var react_1 = __webpack_require__(1);
1453
+ var react_1 = __webpack_require__(0);
2063
1454
 
2064
1455
  var lodash_1 = __webpack_require__(3);
2065
1456
  /**
@@ -2105,9 +1496,9 @@ Object.defineProperty(exports, "__esModule", {
2105
1496
  });
2106
1497
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
2107
1498
 
2108
- var React = __webpack_require__(1);
1499
+ var React = __webpack_require__(0);
2109
1500
 
2110
- var T = __webpack_require__(0);
1501
+ var T = __webpack_require__(1);
2111
1502
 
2112
1503
  var i18n_1 = __webpack_require__(2);
2113
1504
 
@@ -2185,7 +1576,7 @@ Object.defineProperty(exports, "__esModule", {
2185
1576
  value: true
2186
1577
  });
2187
1578
 
2188
- var React = __webpack_require__(1);
1579
+ var React = __webpack_require__(0);
2189
1580
 
2190
1581
  var styled_components_1 = __webpack_require__(4);
2191
1582
 
@@ -2196,7 +1587,7 @@ var Cover = styled_components_1.default.div.withConfig({
2196
1587
  componentId: "sc-1gsbnxb-0"
2197
1588
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
2198
1589
  var Blocker = styled_components_1.default.div.attrs({
2199
- 'data-splunk-visualization-version': "25.2.0 - 4373c5a66"
1590
+ 'data-splunk-visualization-version': "25.3.1 - b9a86c571"
2200
1591
  }).withConfig({
2201
1592
  displayName: "withEditModeCover__Blocker",
2202
1593
  componentId: "sc-1gsbnxb-1"
@@ -2238,7 +1629,7 @@ Object.defineProperty(exports, "__esModule", {
2238
1629
  value: true
2239
1630
  });
2240
1631
 
2241
- var React = __webpack_require__(1);
1632
+ var React = __webpack_require__(0);
2242
1633
 
2243
1634
  var colorUtils_1 = __webpack_require__(12);
2244
1635
 
@@ -2307,7 +1698,7 @@ module.exports = require("@splunk/visualizations-shared/colorConstants");
2307
1698
 
2308
1699
  /***/ }),
2309
1700
 
2310
- /***/ 451:
1701
+ /***/ 456:
2311
1702
  /***/ (function(module, exports, __webpack_require__) {
2312
1703
 
2313
1704
  "use strict";
@@ -2352,7 +1743,7 @@ Object.defineProperty(exports, "default", {
2352
1743
 
2353
1744
  /***/ }),
2354
1745
 
2355
- /***/ 452:
1746
+ /***/ 457:
2356
1747
  /***/ (function(module, exports, __webpack_require__) {
2357
1748
 
2358
1749
  "use strict";
@@ -2431,6 +1822,9 @@ var defaultContext = {
2431
1822
  }, {
2432
1823
  match: 'unknown',
2433
1824
  value: 'left'
1825
+ }, {
1826
+ match: 'null',
1827
+ value: 'left'
2434
1828
  }],
2435
1829
  tableCellTypeByType: [{
2436
1830
  match: 'string',
@@ -2453,6 +1847,9 @@ var defaultContext = {
2453
1847
  }, {
2454
1848
  match: 'unknown',
2455
1849
  value: 'TextCell'
1850
+ }, {
1851
+ match: 'null',
1852
+ value: 'TextCell'
2456
1853
  }],
2457
1854
  // NOTE: These contexts are used by the table background color editor.
2458
1855
  // Please be careful removing/renaming/altering them.
@@ -3044,55 +2441,648 @@ var editorConfig = [{
3044
2441
  * visualization configuration
3045
2442
  */
3046
2443
 
3047
- var config = {
3048
- /**
3049
- * unique viz key
3050
- */
3051
- key: 'splunk.table',
2444
+ var config = {
2445
+ /**
2446
+ * unique viz key
2447
+ */
2448
+ key: 'splunk.table',
2449
+
2450
+ /**
2451
+ * viz name
2452
+ */
2453
+ name: 'Table',
2454
+ category: VizCategory_1.VizCategory.TABLE,
2455
+
2456
+ /**
2457
+ * viz icon
2458
+ */
2459
+ icon: visualization_icons_1.Table,
2460
+ placeholderIcon: placeholders_1.Table,
2461
+ dataContract: dataContract,
2462
+ size: size,
2463
+ defaultContext: defaultContext,
2464
+ optionsSchema: optionsSchema,
2465
+ editorConfig: editorConfig,
2466
+ events: {
2467
+ 'cell.click': {
2468
+ description: 'triggered when user clicks a table cell'
2469
+ }
2470
+ },
2471
+ supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS, VizBehavior_1.VizBehavior.PAGE_AND_SORT, VizBehavior_1.VizBehavior.PLACEHOLDER],
2472
+ themes: themes
2473
+ };
2474
+ exports.default = configUtils_1.enhanceConfig(config);
2475
+
2476
+ /***/ }),
2477
+
2478
+ /***/ 458:
2479
+ /***/ (function(module, exports, __webpack_require__) {
2480
+
2481
+ "use strict";
2482
+
2483
+
2484
+ var _slicedToArray = __webpack_require__(51);
2485
+
2486
+ var _defineProperty = __webpack_require__(7);
2487
+
2488
+ var _taggedTemplateLiteral = __webpack_require__(86);
2489
+
2490
+ var _templateObject, _templateObject2;
2491
+
2492
+ var __rest = this && this.__rest || function (s, e) {
2493
+ var t = {};
2494
+
2495
+ for (var p in s) {
2496
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2497
+ }
2498
+
2499
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2500
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2501
+ }
2502
+ return t;
2503
+ };
2504
+
2505
+ Object.defineProperty(exports, "__esModule", {
2506
+ value: true
2507
+ });
2508
+ exports.MINIMUM_COLUMN_SIZE = void 0;
2509
+
2510
+ var React = __webpack_require__(0);
2511
+
2512
+ var T = __webpack_require__(1);
2513
+
2514
+ var lodash_1 = __webpack_require__(3);
2515
+
2516
+ var styled_components_1 = __webpack_require__(4);
2517
+
2518
+ var i18n_1 = __webpack_require__(2);
2519
+
2520
+ var Table_1 = __webpack_require__(95);
2521
+
2522
+ var Paginator_1 = __webpack_require__(459);
2523
+
2524
+ var Message_1 = __webpack_require__(460);
2525
+
2526
+ var colorUtils_1 = __webpack_require__(12);
2527
+
2528
+ var style_1 = __webpack_require__(15);
2529
+
2530
+ var pick_1 = __webpack_require__(21);
2531
+
2532
+ var variables_1 = __webpack_require__(9);
2533
+
2534
+ var hooks_1 = __webpack_require__(461);
2535
+
2536
+ var consts_1 = __webpack_require__(120);
2537
+
2538
+ var cells_1 = __webpack_require__(462);
2539
+
2540
+ var getPagination_1 = __webpack_require__(29);
2541
+
2542
+ var getSorting_1 = __webpack_require__(28);
2543
+
2544
+ var FixedSizeContainer_1 = __webpack_require__(13);
2545
+
2546
+ var utils_1 = __webpack_require__(467); // debounce was imported this way due to typing
2547
+ // eslint-disable-next-line import/order
2548
+
2549
+
2550
+ var debounce = __webpack_require__(468);
2551
+
2552
+ exports.MINIMUM_COLUMN_SIZE = 30;
2553
+ var NonVisibleTableHead = styled_components_1.default(Table_1.default.Head).withConfig({
2554
+ displayName: "PureTable__NonVisibleTableHead",
2555
+ componentId: "tovzjg-0"
2556
+ })(["display:none;"]);
2557
+ var FixedTableHead = styled_components_1.default(Table_1.default.Head).withConfig({
2558
+ displayName: "PureTable__FixedTableHead",
2559
+ componentId: "tovzjg-1"
2560
+ })(["position:sticky;top:0;"]);
2561
+ var VizTableContainer = styled_components_1.default.div.withConfig({
2562
+ displayName: "PureTable__VizTableContainer",
2563
+ componentId: "tovzjg-2"
2564
+ })(["box-sizing:border-box;padding:", ";background-color:", ";display:flex;flex-flow:column nowrap;overflow:hidden;"], pick_1.default({
2565
+ enterprise: variables_1.default.spacingHalf,
2566
+ prisma: variables_1.default.spacingSmall
2567
+ }), function (props) {
2568
+ return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
2569
+ });
2570
+ VizTableContainer.displayName = 'VizTableContainer';
2571
+ var PAGINATOR_CONTAINER_HEIGHT = 38;
2572
+ var PAGINATOR_SPACING = 5;
2573
+ var SUITableContainer = styled_components_1.default.div.withConfig({
2574
+ displayName: "PureTable__SUITableContainer",
2575
+ componentId: "tovzjg-3"
2576
+ })(["& *{font-family:", ";font-size:", ";line-height:", ";}box-sizing:border-box;flex-grow:1;overflow:hidden;", ";", ";", " ", " & [data-fixed-column='true']{table-layout:", ";width:", ";}"], function (props) {
2577
+ return props.font;
2578
+ }, function (props) {
2579
+ return props.fontSize;
2580
+ }, function (props) {
2581
+ return props.lineHeight;
2582
+ }, function (_ref) {
2583
+ var width = _ref.width,
2584
+ height = _ref.height,
2585
+ isPaging = _ref.isPaging,
2586
+ theme = _ref.theme;
2587
+ var padding = pick_1.default({
2588
+ enterprise: variables_1.default.spacingHalf({
2589
+ theme: theme
2590
+ }),
2591
+ prisma: variables_1.default.spacingSmall({
2592
+ theme: theme
2593
+ })
2594
+ })({
2595
+ theme: theme
2596
+ });
2597
+ var paddingOffset = parseInt(padding, 10) * 2;
2598
+ return style_1.toDimension({
2599
+ width: width - paddingOffset,
2600
+ height: isPaging ? height - PAGINATOR_CONTAINER_HEIGHT - PAGINATOR_SPACING - paddingOffset : height - paddingOffset
2601
+ });
2602
+ }, function (_ref2) {
2603
+ var isPaging = _ref2.isPaging;
2604
+ return isPaging && "\n margin-bottom: ".concat(PAGINATOR_SPACING, "px;\n ");
2605
+ }, function (_ref3) {
2606
+ var headerStyle = _ref3.headerStyle;
2607
+ return headerStyle && headerStyle.backgroundColor && styled_components_1.css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & [data-test='head-cell'] {\n background-color: ", ";\n }\n "])), headerStyle.backgroundColor);
2608
+ }, function (_ref4) {
2609
+ var headerStyle = _ref4.headerStyle;
2610
+ return headerStyle && headerStyle.color && styled_components_1.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & [data-test='head-cell'] > div > span {\n color: ", ";\n }\n "])), headerStyle.color);
2611
+ }, function (_ref5) {
2612
+ var widthSet = _ref5.widthSet;
2613
+ return widthSet ? 'fixed' : 'auto';
2614
+ }, function (_ref6) {
2615
+ var widthSet = _ref6.widthSet;
2616
+ return widthSet ? '0' : '100%';
2617
+ });
2618
+ SUITableContainer.displayName = 'SUITableContainer';
2619
+ var PaginatorContainer = styled_components_1.default.div.withConfig({
2620
+ displayName: "PureTable__PaginatorContainer",
2621
+ componentId: "tovzjg-4"
2622
+ })(["position:relative;text-align:right;height:", "px;"], PAGINATOR_CONTAINER_HEIGHT);
2623
+ PaginatorContainer.displayName = 'PaginatorContainer'; // allow for early return in case of empty tableBody while still following hook rules
2624
+
2625
+ var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
2626
+ // TODO(fkurniawan): add omit type to differentiate WrapperProps from PureTableProps
2627
+ var Wrapper = function Wrapper(props) {
2628
+ var headers = props.headers,
2629
+ table = props.table,
2630
+ headerVisibility = props.headerVisibility,
2631
+ showRowNumbers = props.showRowNumbers,
2632
+ showInternalFields = props.showInternalFields,
2633
+ tableFormat = props.tableFormat,
2634
+ columnFormat = props.columnFormat;
2635
+
2636
+ var _hooks_1$useTable = hooks_1.useTable({
2637
+ headers: headers,
2638
+ table: table,
2639
+ headerVisibility: headerVisibility,
2640
+ showRowNumbers: showRowNumbers,
2641
+ showInternalFields: showInternalFields,
2642
+ tableFormat: Object.assign(Object.assign(Object.assign(Object.assign({}, tableFormat), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.align) && {
2643
+ align: lodash_1.cloneDeep(tableFormat.align)
2644
+ }), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.cellTypes) && {
2645
+ cellTypes: lodash_1.cloneDeep(tableFormat.cellTypes)
2646
+ }), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.data) && {
2647
+ data: lodash_1.cloneDeep(tableFormat.data)
2648
+ }),
2649
+ columnFormat: columnFormat
2650
+ }),
2651
+ tableHeader = _hooks_1$useTable.tableHeader,
2652
+ tableBody = _hooks_1$useTable.tableBody;
2653
+
2654
+ if (tableBody.rows.length === 0) {
2655
+ return React.createElement(Message_1.default, {
2656
+ type: "warning"
2657
+ }, i18n_1._('No data!'));
2658
+ }
2659
+
2660
+ return React.createElement(Viz, Object.assign({}, props, {
2661
+ tableHeader: tableHeader,
2662
+ tableBody: tableBody
2663
+ }));
2664
+ };
2665
+
2666
+ Wrapper.displayName = 'PureTableWrapper';
2667
+ return Wrapper;
2668
+ };
2669
+
2670
+ var useTableHead = function useTableHead(visibility) {
2671
+ if (visibility === 'none') {
2672
+ return NonVisibleTableHead;
2673
+ }
2674
+
2675
+ if (visibility === 'fixed') {
2676
+ return FixedTableHead;
2677
+ }
2678
+
2679
+ return Table_1.default.Head;
2680
+ };
2681
+
2682
+ var HeadCell = function HeadCell(_a) {
2683
+ var setTempColumnWidth = _a.setTempColumnWidth,
2684
+ setRemainingWidth = _a.setRemainingWidth,
2685
+ value = _a.value,
2686
+ widthSet = _a.widthSet,
2687
+ headerVisibility = _a.headerVisibility,
2688
+ props = __rest(_a, ["setTempColumnWidth", "setRemainingWidth", "value", "widthSet", "headerVisibility"]);
2689
+
2690
+ var cellRef = React.useRef(null);
2691
+ React.useEffect(function () {
2692
+ if (!widthSet && cellRef.current && cellRef.current.clientWidth >= 0 && headerVisibility !== 'none') {
2693
+ setTempColumnWidth(function (columnWidth) {
2694
+ return Object.assign(Object.assign({}, columnWidth), _defineProperty({}, value, {
2695
+ width: cellRef.current.clientWidth
2696
+ }));
2697
+ });
2698
+ setRemainingWidth(function (prevWidth) {
2699
+ return prevWidth + Math.max(props.width ? cellRef.current.clientWidth - props.width : 0, 0);
2700
+ });
2701
+ }
2702
+ });
2703
+ return React.createElement(Table_1.default.HeadCell, Object.assign({
2704
+ elementRef: cellRef
2705
+ }, props), value);
2706
+ };
2707
+
2708
+ var fontMap = {
2709
+ proportional: 'Splunk Platform Sans',
2710
+ monospace: 'Splunk Platform Mono'
2711
+ };
2712
+ var fontSizeMap = {
2713
+ extraSmall: '10px',
2714
+ small: '12px',
2715
+ default: '14px',
2716
+ large: '16px'
2717
+ };
2718
+ var rowHeightMap = {
2719
+ extraSmall: '12px',
2720
+ small: '12px',
2721
+ default: '20px',
2722
+ large: '24px'
2723
+ };
2724
+
2725
+ var PureTable = function PureTable(props) {
2726
+ var count = props.count,
2727
+ width = props.width,
2728
+ height = props.height,
2729
+ backgroundColor = props.backgroundColor,
2730
+ tableHeader = props.tableHeader,
2731
+ tableBody = props.tableBody,
2732
+ showRowNumbers = props.showRowNumbers,
2733
+ _props$sortParams = props.sortParams,
2734
+ currentSortKey = _props$sortParams.currentSortKey,
2735
+ currentSortDir = _props$sortParams.currentSortDir,
2736
+ onSort = _props$sortParams.onSort,
2737
+ _a = props.paginatorParams,
2738
+ isPaging = _a.isPaging,
2739
+ paginatorOnChange = _a.onChange,
2740
+ paginatorProps = __rest(_a, ["isPaging", "onChange"]),
2741
+ onCellClick = props.onCellClick,
2742
+ onColumnFormatChange = props.onColumnFormatChange,
2743
+ columnFormat = props.columnFormat,
2744
+ mode = props.mode,
2745
+ headerVisibility = props.headerVisibility,
2746
+ font = props.font,
2747
+ fontSize = props.fontSize;
2748
+
2749
+ var _React$useState = React.useState(columnFormat),
2750
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2751
+ columns = _React$useState2[0],
2752
+ setColumns = _React$useState2[1];
2753
+
2754
+ var _React$useState3 = React.useState(columnFormat),
2755
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
2756
+ tempColumns = _React$useState4[0],
2757
+ setTempColumns = _React$useState4[1];
2758
+
2759
+ var _React$useState5 = React.useState(0),
2760
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
2761
+ remainingWidth = _React$useState6[0],
2762
+ setRemainingWidth = _React$useState6[1];
2763
+
2764
+ var numColumnsWithoutWidth = Object.keys(tempColumns).reduce(function (acc, key) {
2765
+ var _a;
2766
+
2767
+ if ((_a = columns[key]) === null || _a === void 0 ? void 0 : _a.width) {
2768
+ return acc;
2769
+ }
2770
+
2771
+ return acc + 1;
2772
+ }, 0);
2773
+ var containerRef = React.useRef(null);
2774
+ var containerRefInner = React.useRef(null);
2775
+ var widthRef = React.useRef(0);
2776
+ var widthSet = tableHeader.cells.length === tableHeader.cells.filter(function (_ref7) {
2777
+ var value = _ref7.value,
2778
+ showCell = _ref7.showCell;
2779
+
2780
+ var _a, _b;
2781
+
2782
+ return ((_a = columns[value]) === null || _a === void 0 ? void 0 : _a.width) !== undefined || ((_b = tempColumns[value]) === null || _b === void 0 ? void 0 : _b.width) !== undefined || !showCell;
2783
+ }).length;
2784
+ React.useEffect(function () {
2785
+ if (containerRef.current && containerRef.current.clientWidth !== widthRef.current) {
2786
+ widthRef.current = containerRef.current.clientWidth;
2787
+ recalculateTempColumnWidths();
2788
+ }
2789
+ });
2790
+ var firstRenderCount = React.useRef(count);
2791
+ React.useEffect(function () {
2792
+ if (firstRenderCount.current !== count) {
2793
+ firstRenderCount.current = count;
2794
+ paginatorOnChange(null, {
2795
+ count: count
2796
+ });
2797
+ }
2798
+ }, [count, paginatorProps]);
2799
+ var stringifiedColumnFormat = JSON.stringify(columnFormat);
2800
+ var columnFormatRef = React.useRef(stringifiedColumnFormat);
2801
+ var modeRef = React.useRef(mode);
2802
+ React.useEffect(function () {
2803
+ if (modeRef.current !== mode || columnFormatRef.current !== stringifiedColumnFormat) {
2804
+ columnFormatRef.current = stringifiedColumnFormat;
2805
+ modeRef.current = mode;
2806
+ setColumns(columnFormat);
2807
+ }
2808
+ }, [mode, stringifiedColumnFormat]);
2809
+ var TableHead = useTableHead(headerVisibility);
2810
+ var debouncedDrilldown = debounce(function (e, payload) {
2811
+ if (window.getSelection().toString() === '') {
2812
+ if (lodash_1.isFunction(onCellClick)) {
2813
+ onCellClick({
2814
+ e: e,
2815
+ payload: payload
2816
+ });
2817
+ }
2818
+ }
2819
+ }, 200);
2820
+ var drilldownHandler = React.useCallback(function (e) {
2821
+ var element = e.target;
2822
+ var row = element.getAttribute('data-row-index');
2823
+ var col = element.getAttribute('data-col-index');
2824
+ var arrayIndex = element.getAttribute('data-array-index') || -1;
2825
+
2826
+ if (row && col) {
2827
+ var cellRefIndex = +col;
2828
+ var cellIndex = cellRefIndex;
2829
+ var rowIndex = +row;
2830
+ var fieldValue = tableHeader.cells[cellRefIndex].value;
2831
+ var cellValue = tableBody.rows[rowIndex].cells[cellRefIndex].value;
2832
+ var cellRawValue = tableBody.rows[rowIndex].cells[cellRefIndex].value;
2833
+ var value = arrayIndex === -1 ? cellValue : cellRawValue[+arrayIndex]; // Wish we did not have these if statements for
2834
+ // showRowNumbers
2835
+
2836
+ if (showRowNumbers === true) {
2837
+ if (cellIndex === 0) {
2838
+ // no click event for row numbers
2839
+ return;
2840
+ }
2841
+
2842
+ cellIndex -= 1;
2843
+ }
2844
+
2845
+ var payload = {
2846
+ cellIndex: cellIndex,
2847
+ rowIndex: rowIndex,
2848
+ fieldValue: fieldValue,
2849
+ cellValue: cellValue,
2850
+ cellRawValue: cellRawValue,
2851
+ value: value,
2852
+ name: fieldValue
2853
+ };
2854
+ tableBody.rows[rowIndex].cells.forEach(function (c, index) {
2855
+ var rowToken = "row.".concat(tableHeader.cells[index].value, ".value");
2856
+ payload[rowToken] = c.value;
2857
+ });
2858
+ debouncedDrilldown(e.nativeEvent, payload);
2859
+ }
2860
+ }, [onCellClick, showRowNumbers, tableHeader, tableBody]);
2861
+ var debouncedOnColumnFormatChange = React.useMemo(function () {
2862
+ return debounce(function (newFormat) {
2863
+ onColumnFormatChange(newFormat);
2864
+ }, 300);
2865
+ }, [onColumnFormatChange]);
2866
+
2867
+ var handleResizeColumn = function handleResizeColumn(_event, payload) {
2868
+ var updatedCF = columns;
2869
+ var field = payload.columnId;
2870
+ updatedCF[field] = Object.assign(Object.assign({}, updatedCF[field]), {
2871
+ width: Math.max(payload.width, exports.MINIMUM_COLUMN_SIZE)
2872
+ });
2873
+ setColumns(Object.assign({}, updatedCF));
2874
+ recalculateTempColumnWidths(); // Updates column json in edit mode
3052
2875
 
3053
- /**
3054
- * viz name
3055
- */
3056
- name: 'Table',
3057
- category: VizCategory_1.VizCategory.TABLE,
2876
+ if (mode === 'edit') {
2877
+ debouncedOnColumnFormatChange(updatedCF);
2878
+ }
2879
+ };
3058
2880
 
3059
- /**
3060
- * viz icon
3061
- */
3062
- icon: visualization_icons_1.Table,
3063
- placeholderIcon: placeholders_1.Table,
3064
- dataContract: dataContract,
3065
- size: size,
3066
- defaultContext: defaultContext,
3067
- optionsSchema: optionsSchema,
3068
- editorConfig: editorConfig,
3069
- events: {
3070
- 'cell.click': {
3071
- description: 'triggered when user clicks a table cell'
2881
+ var handleEventClick = function handleEventClick(e) {
2882
+ // Hack to target the resize handlers, since the only button within a HeadCell is the resize handlers
2883
+ if (e.target.tagName.toLowerCase() === 'button') {
2884
+ e.stopPropagation();
3072
2885
  }
2886
+ };
2887
+
2888
+ var recalculateTempColumnWidths = function recalculateTempColumnWidths() {
2889
+ setTempColumns({});
2890
+ setRemainingWidth(0);
2891
+ };
2892
+
2893
+ var withColumnResizing = function withColumnResizing(func) {
2894
+ return function (e, additionalParams) {
2895
+ recalculateTempColumnWidths();
2896
+ func(e, additionalParams);
2897
+ };
2898
+ };
2899
+
2900
+ var fontMapped = fontMap[font] || fontMap.proportional;
2901
+ var fontSizeMapped = fontSizeMap[fontSize] || fontSizeMap.default;
2902
+ var rowHeightMapped = rowHeightMap[fontSize] || rowHeightMap.default;
2903
+ return React.createElement(VizTableContainer, {
2904
+ backgroundColor: backgroundColor,
2905
+ ref: containerRef
2906
+ }, React.createElement(SUITableContainer, {
2907
+ ref: containerRefInner,
2908
+ width: width,
2909
+ height: height,
2910
+ isPaging: isPaging,
2911
+ headerStyle: tableHeader.style,
2912
+ widthSet: widthSet,
2913
+ font: fontMapped,
2914
+ fontSize: fontSizeMapped,
2915
+ lineHeight: rowHeightMapped
2916
+ }, React.createElement(Table_1.default, {
2917
+ headType: headerVisibility !== 'none' ? 'inline' : undefined,
2918
+ innerStyle: {
2919
+ height: '100%'
2920
+ },
2921
+ outerStyle: {
2922
+ height: '100%',
2923
+ cursor: onCellClick ? 'pointer' : 'unset'
2924
+ },
2925
+ onClick: onCellClick ? drilldownHandler : lodash_1.noop,
2926
+ onRequestResizeColumn: handleResizeColumn
2927
+ }, React.createElement(TableHead, null, tableHeader.cells.filter(function (c) {
2928
+ return c.showCell;
2929
+ }).map(function (_a) {
2930
+ var key = _a.key,
2931
+ value = _a.value,
2932
+ sortKey = _a.sortKey,
2933
+ rest = __rest(_a, ["key", "value", "sortKey"]);
2934
+
2935
+ return React.createElement(HeadCell, Object.assign({
2936
+ key: key,
2937
+ columnId: value,
2938
+ sortDir: sortKey === currentSortKey ? currentSortDir : 'none',
2939
+ width: utils_1.getColumnWidth({
2940
+ columns: columns,
2941
+ tempColumns: tempColumns,
2942
+ columnName: value,
2943
+ remainingWidth: remainingWidth,
2944
+ numColumnsWithoutWidth: numColumnsWithoutWidth
2945
+ }),
2946
+ onMouseDown: handleEventClick,
2947
+ value: value,
2948
+ setTempColumnWidth: setTempColumns,
2949
+ widthSet: widthSet,
2950
+ onSort: withColumnResizing(onSort),
2951
+ headerVisibility: headerVisibility,
2952
+ setRemainingWidth: setRemainingWidth
2953
+ }, Object.assign({
2954
+ sortKey: sortKey
2955
+ }, rest)));
2956
+ })), React.createElement(Table_1.default.Body, null, tableBody.rows.map(function (row) {
2957
+ return React.createElement(Table_1.default.Row, {
2958
+ key: row.key
2959
+ }, row.cells.filter(function (c) {
2960
+ return c.showCell;
2961
+ }).map(function (cell) {
2962
+ return React.createElement(cells_1.SwitchTableCell, {
2963
+ key: cell.key,
2964
+ type: cell.cellType
2965
+ }, React.createElement(cells_1.TextCell, {
2966
+ cell: cell,
2967
+ useMouseOverEffect: !!onCellClick,
2968
+ width: utils_1.getColumnWidth({
2969
+ columns: columns,
2970
+ tempColumns: tempColumns,
2971
+ columnName: cell.header,
2972
+ remainingWidth: remainingWidth,
2973
+ numColumnsWithoutWidth: numColumnsWithoutWidth
2974
+ })
2975
+ }), React.createElement(cells_1.SparklineCell, {
2976
+ cell: cell,
2977
+ useMouseOverEffect: !!onCellClick,
2978
+ width: utils_1.getColumnWidth({
2979
+ columns: columns,
2980
+ tempColumns: tempColumns,
2981
+ columnName: cell.header,
2982
+ remainingWidth: remainingWidth,
2983
+ numColumnsWithoutWidth: numColumnsWithoutWidth
2984
+ })
2985
+ }), React.createElement(cells_1.ArrayCell, {
2986
+ cell: cell,
2987
+ useMouseOverEffect: !!onCellClick,
2988
+ width: utils_1.getColumnWidth({
2989
+ columns: columns,
2990
+ tempColumns: tempColumns,
2991
+ columnName: cell.header,
2992
+ remainingWidth: remainingWidth,
2993
+ numColumnsWithoutWidth: numColumnsWithoutWidth
2994
+ })
2995
+ }));
2996
+ }));
2997
+ })))), isPaging ? React.createElement(PaginatorContainer, null, React.createElement(Paginator_1.default, Object.assign({
2998
+ onChange: withColumnResizing(paginatorOnChange)
2999
+ }, paginatorProps))) : null);
3000
+ };
3001
+
3002
+ var cellDataType = T.oneOfType([T.string, T.number, T.arrayOf(T.oneOfType([T.string, T.number]))]);
3003
+ PureTable.propTypes = {
3004
+ backgroundColor: T.string,
3005
+ count: T.number,
3006
+ columnFormat: T.objectOf(T.shape({
3007
+ align: T.arrayOf(T.oneOf(consts_1.validAlignments)),
3008
+ cellTypes: T.arrayOf(T.oneOf(consts_1.validCellRenderers)),
3009
+ data: T.arrayOf(cellDataType),
3010
+ rowBackgroundColors: T.arrayOf(T.string),
3011
+ rowColors: T.arrayOf(T.string),
3012
+ sparklineAreaColors: T.arrayOf(T.string),
3013
+ sparklineColors: T.arrayOf(T.string),
3014
+ sparklineTypes: T.arrayOf(T.oneOf(consts_1.validSparklineTypes))
3015
+ })),
3016
+ headers: T.arrayOf(T.string),
3017
+ headerVisibility: T.oneOf(consts_1.validHeaderVisibilities),
3018
+ height: T.oneOfType([T.number]),
3019
+ mode: T.string,
3020
+ onCellClick: T.func,
3021
+ paginatorParams: getPagination_1.PaginatorParamsPropTypes,
3022
+ showRowNumbers: T.bool,
3023
+ sortParams: getSorting_1.SortParamsPropTypes,
3024
+ table: T.arrayOf(T.arrayOf(cellDataType)),
3025
+ tableFormat: T.shape({
3026
+ align: T.arrayOf(T.arrayOf(T.oneOf(consts_1.validAlignments))),
3027
+ cellTypes: T.arrayOf(T.arrayOf(T.oneOf(consts_1.validCellRenderers))),
3028
+ data: T.arrayOf(T.arrayOf(cellDataType)),
3029
+ headerBackgroundColor: T.string,
3030
+ headerColor: T.string,
3031
+ rowBackgroundColors: T.oneOfType([T.arrayOf(T.string), T.arrayOf(T.arrayOf(T.string))]),
3032
+ rowColors: T.oneOfType([T.arrayOf(T.string), T.arrayOf(T.arrayOf(T.string))]),
3033
+ sparklineAreaColors: T.arrayOf(T.arrayOf(T.string)),
3034
+ sparklineColors: T.arrayOf(T.arrayOf(T.string)),
3035
+ sparklineTypes: T.arrayOf(T.arrayOf(T.oneOf(consts_1.validSparklineTypes)))
3036
+ }),
3037
+ theme: T.any,
3038
+ width: T.oneOfType([T.number]),
3039
+ onColumnFormatChange: T.func,
3040
+ font: T.string,
3041
+ fontSize: T.string
3042
+ };
3043
+ PureTable.defaultProps = {
3044
+ columnFormat: {},
3045
+ headers: [],
3046
+ headerVisibility: 'inline',
3047
+ height: 300,
3048
+ mode: 'view',
3049
+ onCellClick: null,
3050
+ paginatorParams: {
3051
+ isPaging: false,
3052
+ onChange: lodash_1.noop
3073
3053
  },
3074
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS, VizBehavior_1.VizBehavior.PAGE_AND_SORT, VizBehavior_1.VizBehavior.PLACEHOLDER],
3075
- themes: themes
3054
+ showRowNumbers: false,
3055
+ sortParams: {
3056
+ onSort: lodash_1.noop
3057
+ },
3058
+ table: [],
3059
+ tableFormat: {},
3060
+ theme: {},
3061
+ width: 300,
3062
+ onColumnFormatChange: lodash_1.noop,
3063
+ font: fontMap.proportional,
3064
+ fontSize: fontSizeMap.default
3076
3065
  };
3077
- exports.default = configUtils_1.enhanceConfig(config);
3066
+ PureTable.displayName = 'VizTable';
3067
+ exports.default = withEmptyTableMessage(FixedSizeContainer_1.default(PureTable));
3078
3068
 
3079
3069
  /***/ }),
3080
3070
 
3081
- /***/ 453:
3071
+ /***/ 459:
3082
3072
  /***/ (function(module, exports) {
3083
3073
 
3084
3074
  module.exports = require("@splunk/react-ui/Paginator");
3085
3075
 
3086
3076
  /***/ }),
3087
3077
 
3088
- /***/ 454:
3078
+ /***/ 460:
3089
3079
  /***/ (function(module, exports) {
3090
3080
 
3091
3081
  module.exports = require("@splunk/react-ui/Message");
3092
3082
 
3093
3083
  /***/ }),
3094
3084
 
3095
- /***/ 455:
3085
+ /***/ 461:
3096
3086
  /***/ (function(module, exports, __webpack_require__) {
3097
3087
 
3098
3088
  "use strict";
@@ -3100,7 +3090,7 @@ module.exports = require("@splunk/react-ui/Message");
3100
3090
 
3101
3091
  var _toConsumableArray = __webpack_require__(8);
3102
3092
 
3103
- var _typeof = __webpack_require__(82);
3093
+ var _typeof = __webpack_require__(83);
3104
3094
 
3105
3095
  Object.defineProperty(exports, "__esModule", {
3106
3096
  value: true
@@ -3518,7 +3508,7 @@ exports.useTable = useTable;
3518
3508
 
3519
3509
  /***/ }),
3520
3510
 
3521
- /***/ 456:
3511
+ /***/ 462:
3522
3512
  /***/ (function(module, exports, __webpack_require__) {
3523
3513
 
3524
3514
  "use strict";
@@ -3547,17 +3537,17 @@ Object.defineProperty(exports, "__esModule", {
3547
3537
  value: true
3548
3538
  });
3549
3539
 
3550
- __exportStar(__webpack_require__(457), exports);
3540
+ __exportStar(__webpack_require__(463), exports);
3551
3541
 
3552
- __exportStar(__webpack_require__(458), exports);
3542
+ __exportStar(__webpack_require__(464), exports);
3553
3543
 
3554
- __exportStar(__webpack_require__(459), exports);
3544
+ __exportStar(__webpack_require__(465), exports);
3555
3545
 
3556
- __exportStar(__webpack_require__(460), exports);
3546
+ __exportStar(__webpack_require__(466), exports);
3557
3547
 
3558
3548
  /***/ }),
3559
3549
 
3560
- /***/ 457:
3550
+ /***/ 463:
3561
3551
  /***/ (function(module, exports, __webpack_require__) {
3562
3552
 
3563
3553
  "use strict";
@@ -3580,7 +3570,7 @@ exports.SwitchTableCell = SwitchTableCell;
3580
3570
 
3581
3571
  /***/ }),
3582
3572
 
3583
- /***/ 458:
3573
+ /***/ 464:
3584
3574
  /***/ (function(module, exports, __webpack_require__) {
3585
3575
 
3586
3576
  "use strict";
@@ -3591,7 +3581,7 @@ Object.defineProperty(exports, "__esModule", {
3591
3581
  });
3592
3582
  exports.TextCell = void 0;
3593
3583
 
3594
- var React = __webpack_require__(1);
3584
+ var React = __webpack_require__(0);
3595
3585
 
3596
3586
  var Table_1 = __webpack_require__(95);
3597
3587
 
@@ -3616,7 +3606,7 @@ exports.TextCell.displayName = 'TextCell';
3616
3606
 
3617
3607
  /***/ }),
3618
3608
 
3619
- /***/ 459:
3609
+ /***/ 465:
3620
3610
  /***/ (function(module, exports, __webpack_require__) {
3621
3611
 
3622
3612
  "use strict";
@@ -3627,7 +3617,7 @@ Object.defineProperty(exports, "__esModule", {
3627
3617
  });
3628
3618
  exports.ArrayCell = void 0;
3629
3619
 
3630
- var React = __webpack_require__(1);
3620
+ var React = __webpack_require__(0);
3631
3621
 
3632
3622
  var Table_1 = __webpack_require__(95);
3633
3623
 
@@ -3658,7 +3648,7 @@ exports.ArrayCell.displayName = 'ArrayCell';
3658
3648
 
3659
3649
  /***/ }),
3660
3650
 
3661
- /***/ 460:
3651
+ /***/ 466:
3662
3652
  /***/ (function(module, exports, __webpack_require__) {
3663
3653
 
3664
3654
  "use strict";
@@ -3671,7 +3661,7 @@ Object.defineProperty(exports, "__esModule", {
3671
3661
  });
3672
3662
  exports.SparklineCell = exports.validSparklineTypes = void 0;
3673
3663
 
3674
- var React = __webpack_require__(1);
3664
+ var React = __webpack_require__(0);
3675
3665
 
3676
3666
  var Table_1 = __webpack_require__(95);
3677
3667
 
@@ -3751,7 +3741,7 @@ exports.SparklineCell.displayName = 'SparklineCell';
3751
3741
 
3752
3742
  /***/ }),
3753
3743
 
3754
- /***/ 461:
3744
+ /***/ 467:
3755
3745
  /***/ (function(module, exports, __webpack_require__) {
3756
3746
 
3757
3747
  "use strict";
@@ -3760,9 +3750,7 @@ exports.SparklineCell.displayName = 'SparklineCell';
3760
3750
  Object.defineProperty(exports, "__esModule", {
3761
3751
  value: true
3762
3752
  });
3763
- exports.getLastColumnWidth = exports.getColumnWidth = void 0;
3764
-
3765
- var PureTable_1 = __webpack_require__(151);
3753
+ exports.getColumnWidth = void 0;
3766
3754
 
3767
3755
  var getColumnWidth = function getColumnWidth(_ref) {
3768
3756
  var columns = _ref.columns,
@@ -3785,7 +3773,8 @@ var getColumnWidth = function getColumnWidth(_ref) {
3785
3773
 
3786
3774
 
3787
3775
  if (numColumnsWithoutWidth !== 0) {
3788
- return ((_e = tempColumns[columnName]) === null || _e === void 0 ? void 0 : _e.width) + remainingWidth / numColumnsWithoutWidth;
3776
+ // Math.max() was needed because existing tests expected 0 as an outcome so if the calculation is -1 it puts it back up to 0
3777
+ return Math.max(Math.ceil(((_e = tempColumns[columnName]) === null || _e === void 0 ? void 0 : _e.width) + remainingWidth / numColumnsWithoutWidth) - 1, 0);
3789
3778
  } // No columns have a width in the dashboard definition
3790
3779
 
3791
3780
 
@@ -3793,59 +3782,10 @@ var getColumnWidth = function getColumnWidth(_ref) {
3793
3782
  };
3794
3783
 
3795
3784
  exports.getColumnWidth = getColumnWidth;
3796
- /**
3797
- * * Gets the width of the right most column
3798
- * @param containerRefInnerWidth width of the table
3799
- * @param lastShowingTableHeadersID id of the last table header
3800
- * @param columns columns
3801
- * @param tempColumns tempColumns runtime calculation of columns
3802
- * @param firstShowingTableHeadersID id of the first table header
3803
- * @returns number width of the last column
3804
- */
3805
-
3806
- var getLastColumnWidth = function getLastColumnWidth(containerRefInnerWidth, lastShowingTableHeadersID, columns, tempColumns, firstShowingTableHeadersID) {
3807
- var _a, _b, _c, _d; // save the width of the last column from either columns ( first as thats user defined ) then tempColumns ( created at runtime )
3808
-
3809
-
3810
- var knownWidthOfLastColumn = ((_a = columns[lastShowingTableHeadersID]) === null || _a === void 0 ? void 0 : _a.width) || ((_b = tempColumns[lastShowingTableHeadersID]) === null || _b === void 0 ? void 0 : _b.width) || 0;
3811
- var currentWidthSansLastColumn = 0; // calculate the width of all the column except the last column
3812
-
3813
- Object.keys(tempColumns).forEach(function (key) {
3814
- var _a;
3815
-
3816
- if (key !== lastShowingTableHeadersID) {
3817
- currentWidthSansLastColumn += ((_a = tempColumns[key]) === null || _a === void 0 ? void 0 : _a.width) || 0;
3818
- }
3819
- });
3820
- Object.keys(columns).forEach(function (key) {
3821
- var _a, _b, _c;
3822
-
3823
- if (key !== lastShowingTableHeadersID) {
3824
- if (((_a = tempColumns[key]) === null || _a === void 0 ? void 0 : _a.width) && ((_b = columns[key]) === null || _b === void 0 ? void 0 : _b.width)) {
3825
- currentWidthSansLastColumn -= tempColumns[key].width;
3826
- currentWidthSansLastColumn += ((_c = columns[key]) === null || _c === void 0 ? void 0 : _c.width) || 0;
3827
- }
3828
- }
3829
- }); // if the first column is not defined and the last is keep the last as the first will expand
3830
-
3831
- if (!((_c = columns[firstShowingTableHeadersID]) === null || _c === void 0 ? void 0 : _c.width) && ((_d = columns[lastShowingTableHeadersID]) === null || _d === void 0 ? void 0 : _d.width)) {
3832
- return columns[lastShowingTableHeadersID].width;
3833
- } // if the width of the columns plus the last column is smaller than the table return the difference
3834
- // so as to expand the last column
3835
-
3836
-
3837
- if (currentWidthSansLastColumn + knownWidthOfLastColumn < containerRefInnerWidth && knownWidthOfLastColumn) {
3838
- return Math.max(PureTable_1.MINIMUM_COLUMN_SIZE, containerRefInnerWidth - currentWidthSansLastColumn);
3839
- }
3840
-
3841
- return knownWidthOfLastColumn;
3842
- };
3843
-
3844
- exports.getLastColumnWidth = getLastColumnWidth;
3845
3785
 
3846
3786
  /***/ }),
3847
3787
 
3848
- /***/ 462:
3788
+ /***/ 468:
3849
3789
  /***/ (function(module, exports) {
3850
3790
 
3851
3791
  module.exports = require("lodash/debounce");
@@ -3918,14 +3858,14 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
3918
3858
 
3919
3859
  /***/ }),
3920
3860
 
3921
- /***/ 82:
3861
+ /***/ 83:
3922
3862
  /***/ (function(module, exports) {
3923
3863
 
3924
3864
  module.exports = require("@babel/runtime/helpers/typeof");
3925
3865
 
3926
3866
  /***/ }),
3927
3867
 
3928
- /***/ 85:
3868
+ /***/ 86:
3929
3869
  /***/ (function(module, exports) {
3930
3870
 
3931
3871
  module.exports = require("@babel/runtime/helpers/taggedTemplateLiteral");