@splunk/visualizations 26.4.1 → 27.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/Area.config.js +1399 -1590
  2. package/Area.config.js.map +7 -1
  3. package/Area.js +3750 -4822
  4. package/Area.js.map +7 -1
  5. package/Bar.config.js +1423 -1566
  6. package/Bar.config.js.map +7 -1
  7. package/Bar.js +3856 -4884
  8. package/Bar.js.map +7 -1
  9. package/Bubble.config.js +1009 -1200
  10. package/Bubble.config.js.map +7 -1
  11. package/Bubble.js +2768 -4491
  12. package/Bubble.js.map +7 -1
  13. package/ChoroplethSvg.config.js +282 -582
  14. package/ChoroplethSvg.config.js.map +7 -1
  15. package/ChoroplethSvg.js +2032 -3808
  16. package/ChoroplethSvg.js.map +7 -1
  17. package/Column.config.js +1390 -1534
  18. package/Column.config.js.map +7 -1
  19. package/Column.js +3849 -4906
  20. package/Column.js.map +7 -1
  21. package/Ellipse.config.js +443 -774
  22. package/Ellipse.config.js.map +7 -1
  23. package/Ellipse.js +1667 -3327
  24. package/Ellipse.js.map +7 -1
  25. package/Events.config.js +207 -492
  26. package/Events.config.js.map +7 -1
  27. package/Events.js +2643 -4647
  28. package/Events.js.map +7 -1
  29. package/FillerGauge.config.js +420 -775
  30. package/FillerGauge.config.js.map +7 -1
  31. package/FillerGauge.js +2164 -4575
  32. package/FillerGauge.js.map +7 -1
  33. package/Image.config.js +144 -411
  34. package/Image.config.js.map +7 -1
  35. package/Image.js +1423 -3046
  36. package/Image.js.map +7 -1
  37. package/Line.config.js +1421 -1616
  38. package/Line.config.js.map +7 -1
  39. package/Line.js +3790 -4901
  40. package/Line.js.map +7 -1
  41. package/LinkGraph.config.js +390 -632
  42. package/LinkGraph.config.js.map +7 -1
  43. package/LinkGraph.js +5272 -6185
  44. package/LinkGraph.js.map +7 -1
  45. package/MIGRATION.md +6 -0
  46. package/Map.config.js +501 -801
  47. package/Map.config.js.map +7 -1
  48. package/Map.js +3382 -5659
  49. package/Map.js.map +7 -1
  50. package/Markdown.config.js +232 -528
  51. package/Markdown.config.js.map +7 -1
  52. package/Markdown.js +1671 -3212
  53. package/Markdown.js.map +7 -1
  54. package/MarkerGauge.config.js +308 -613
  55. package/MarkerGauge.config.js.map +7 -1
  56. package/MarkerGauge.js +2215 -4531
  57. package/MarkerGauge.js.map +7 -1
  58. package/ParallelCoordinates.config.js +282 -581
  59. package/ParallelCoordinates.config.js.map +7 -1
  60. package/ParallelCoordinates.js +2057 -4718
  61. package/ParallelCoordinates.js.map +7 -1
  62. package/Pie.config.js +278 -547
  63. package/Pie.config.js.map +7 -1
  64. package/Pie.js +2107 -3984
  65. package/Pie.js.map +7 -1
  66. package/Punchcard.config.js +291 -578
  67. package/Punchcard.config.js.map +7 -1
  68. package/Punchcard.js +2734 -5037
  69. package/Punchcard.js.map +7 -1
  70. package/Rectangle.config.js +455 -770
  71. package/Rectangle.config.js.map +7 -1
  72. package/Rectangle.js +1664 -3258
  73. package/Rectangle.js.map +7 -1
  74. package/Sankey.config.js +291 -626
  75. package/Sankey.config.js.map +7 -1
  76. package/Sankey.js +2766 -4908
  77. package/Sankey.js.map +7 -1
  78. package/Scatter.config.js +988 -1180
  79. package/Scatter.config.js.map +7 -1
  80. package/Scatter.js +2801 -4506
  81. package/Scatter.js.map +7 -1
  82. package/SingleValue.config.js +794 -1250
  83. package/SingleValue.config.js.map +7 -1
  84. package/SingleValue.js +4185 -7327
  85. package/SingleValue.js.map +7 -1
  86. package/SingleValueBasic.js +382 -1527
  87. package/SingleValueBasic.js.map +7 -1
  88. package/SingleValueIcon.config.js +757 -1207
  89. package/SingleValueIcon.config.js.map +7 -1
  90. package/SingleValueIcon.js +3427 -6293
  91. package/SingleValueIcon.js.map +7 -1
  92. package/SingleValueRadial.config.js +686 -1121
  93. package/SingleValueRadial.config.js.map +7 -1
  94. package/SingleValueRadial.js +3923 -6994
  95. package/SingleValueRadial.js.map +7 -1
  96. package/SparkLine.js +439 -746
  97. package/SparkLine.js.map +7 -1
  98. package/TRELLIS.md +16 -15
  99. package/Table.config.js +565 -879
  100. package/Table.config.js.map +7 -1
  101. package/Table.js +3260 -5334
  102. package/Table.js.map +7 -1
  103. package/common/Charting.js +617 -1498
  104. package/common/Charting.js.map +7 -1
  105. package/common/ChartingApi.js +46 -170
  106. package/common/ChartingApi.js.map +7 -1
  107. package/common/DocExampleWithVizSandbox.js +270 -473
  108. package/common/DocExampleWithVizSandbox.js.map +7 -1
  109. package/common/EventsDoc.js +172 -464
  110. package/common/EventsDoc.js.map +7 -1
  111. package/common/GaugeMajorTicks.js +249 -347
  112. package/common/GaugeMajorTicks.js.map +7 -1
  113. package/common/GaugeValueMarker.js +201 -311
  114. package/common/GaugeValueMarker.js.map +7 -1
  115. package/common/OptionsDoc.js +351 -911
  116. package/common/OptionsDoc.js.map +7 -1
  117. package/common/OverviewDoc.js +435 -769
  118. package/common/OverviewDoc.js.map +7 -1
  119. package/common/SplunkVisualization.js +116 -259
  120. package/common/SplunkVisualization.js.map +7 -1
  121. package/common/SplunkVisualizationApi.js +40 -156
  122. package/common/SplunkVisualizationApi.js.map +7 -1
  123. package/common/ThemesDoc.js +271 -420
  124. package/common/ThemesDoc.js.map +7 -1
  125. package/common/chartingUtils.js +140 -312
  126. package/common/chartingUtils.js.map +7 -1
  127. package/common/docUtils.js +148 -266
  128. package/common/docUtils.js.map +7 -1
  129. package/common/gaugeUtils.js +280 -808
  130. package/common/gaugeUtils.js.map +7 -1
  131. package/common/shapeUtils.js +106 -211
  132. package/common/shapeUtils.js.map +7 -1
  133. package/common/utils/configUtils.js +126 -252
  134. package/common/utils/configUtils.js.map +7 -1
  135. package/common/utils/dataUtils.js +217 -812
  136. package/common/utils/dataUtils.js.map +7 -1
  137. package/common/utils/featureFlagUtils.js +53 -133
  138. package/common/utils/featureFlagUtils.js.map +7 -1
  139. package/common/utils/hocUtils.js +32 -122
  140. package/common/utils/hocUtils.js.map +7 -1
  141. package/common/utils/mapUtils.js +502 -1337
  142. package/common/utils/mapUtils.js.map +7 -1
  143. package/common/utils/singleValueUtils.js +466 -1013
  144. package/common/utils/singleValueUtils.js.map +7 -1
  145. package/common/utils/testHelper.js +92 -146
  146. package/common/utils/testHelper.js.map +7 -1
  147. package/common/utils/trellisUtils.js +277 -489
  148. package/common/utils/trellisUtils.js.map +7 -1
  149. package/common/utils/urlUtils.js +28 -112
  150. package/common/utils/urlUtils.js.map +7 -1
  151. package/common/withDashboardViz.js +1191 -2431
  152. package/common/withDashboardViz.js.map +7 -1
  153. package/package.json +53 -45
@@ -1,1640 +1,759 @@
1
- /*!
2
- * Copyright © 2024 Splunk Inc.
3
- * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
- * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
- */
6
- module.exports =
7
- /******/ (function(modules) { // webpackBootstrap
8
- /******/ // The module cache
9
- /******/ var installedModules = {};
10
- /******/
11
- /******/ // The require function
12
- /******/ function __webpack_require__(moduleId) {
13
- /******/
14
- /******/ // Check if module is in cache
15
- /******/ if(installedModules[moduleId]) {
16
- /******/ return installedModules[moduleId].exports;
17
- /******/ }
18
- /******/ // Create a new module (and put it into the cache)
19
- /******/ var module = installedModules[moduleId] = {
20
- /******/ i: moduleId,
21
- /******/ l: false,
22
- /******/ exports: {}
23
- /******/ };
24
- /******/
25
- /******/ // Execute the module function
26
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
27
- /******/
28
- /******/ // Flag the module as loaded
29
- /******/ module.l = true;
30
- /******/
31
- /******/ // Return the exports of the module
32
- /******/ return module.exports;
33
- /******/ }
34
- /******/
35
- /******/
36
- /******/ // expose the modules object (__webpack_modules__)
37
- /******/ __webpack_require__.m = modules;
38
- /******/
39
- /******/ // expose the module cache
40
- /******/ __webpack_require__.c = installedModules;
41
- /******/
42
- /******/ // define getter function for harmony exports
43
- /******/ __webpack_require__.d = function(exports, name, getter) {
44
- /******/ if(!__webpack_require__.o(exports, name)) {
45
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
46
- /******/ }
47
- /******/ };
48
- /******/
49
- /******/ // define __esModule on exports
50
- /******/ __webpack_require__.r = function(exports) {
51
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
52
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
53
- /******/ }
54
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
55
- /******/ };
56
- /******/
57
- /******/ // create a fake namespace object
58
- /******/ // mode & 1: value is a module id, require it
59
- /******/ // mode & 2: merge all properties of value into the ns
60
- /******/ // mode & 4: return value when already ns object
61
- /******/ // mode & 8|1: behave like require
62
- /******/ __webpack_require__.t = function(value, mode) {
63
- /******/ if(mode & 1) value = __webpack_require__(value);
64
- /******/ if(mode & 8) return value;
65
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
66
- /******/ var ns = Object.create(null);
67
- /******/ __webpack_require__.r(ns);
68
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
69
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
70
- /******/ return ns;
71
- /******/ };
72
- /******/
73
- /******/ // getDefaultExport function for compatibility with non-harmony modules
74
- /******/ __webpack_require__.n = function(module) {
75
- /******/ var getter = module && module.__esModule ?
76
- /******/ function getDefault() { return module['default']; } :
77
- /******/ function getModuleExports() { return module; };
78
- /******/ __webpack_require__.d(getter, 'a', getter);
79
- /******/ return getter;
80
- /******/ };
81
- /******/
82
- /******/ // Object.prototype.hasOwnProperty.call
83
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
84
- /******/
85
- /******/ // __webpack_public_path__
86
- /******/ __webpack_require__.p = "";
87
- /******/
88
- /******/
89
- /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 73);
91
- /******/ })
92
- /************************************************************************/
93
- /******/ ([
94
- /* 0 */
95
- /***/ (function(module, exports) {
96
-
97
- module.exports = require("react");
98
-
99
- /***/ }),
100
- /* 1 */
101
- /***/ (function(module, exports) {
102
-
103
- module.exports = require("prop-types");
104
-
105
- /***/ }),
106
- /* 2 */
107
- /***/ (function(module, exports) {
108
-
109
- module.exports = require("styled-components");
110
-
111
- /***/ }),
112
- /* 3 */
113
- /***/ (function(module, exports) {
114
-
115
- module.exports = require("lodash");
116
-
117
- /***/ }),
118
- /* 4 */
119
- /***/ (function(module, exports) {
120
-
121
- module.exports = require("@babel/runtime/helpers/classCallCheck");
122
-
123
- /***/ }),
124
- /* 5 */
125
- /***/ (function(module, exports) {
126
-
127
- module.exports = require("@splunk/ui-utils/i18n");
128
-
129
- /***/ }),
130
- /* 6 */,
131
- /* 7 */
132
- /***/ (function(module, exports) {
133
-
134
- module.exports = require("@babel/runtime/helpers/createClass");
135
-
136
- /***/ }),
137
- /* 8 */,
138
- /* 9 */
139
- /***/ (function(module, exports) {
140
-
141
- module.exports = require("@splunk/visualizations-shared/numberUtils");
142
-
143
- /***/ }),
144
- /* 10 */,
145
- /* 11 */,
146
- /* 12 */,
147
- /* 13 */,
148
- /* 14 */
149
- /***/ (function(module, exports, __webpack_require__) {
150
-
151
- "use strict";
152
-
153
-
154
- var _classCallCheck = __webpack_require__(4);
155
-
156
- var _createClass = __webpack_require__(7);
157
-
158
- Object.defineProperty(exports, "__esModule", {
159
- value: true
160
- });
161
- exports.DefaultVizActionHandler = void 0;
162
-
163
- var DefaultVizActionHandler = /*#__PURE__*/function () {
164
- function DefaultVizActionHandler() {
165
- _classCallCheck(this, DefaultVizActionHandler);
166
- }
167
-
168
- _createClass(DefaultVizActionHandler, [{
169
- key: "focus",
170
- value: function focus() {// noop
171
- }
172
- }, {
173
- key: "snapshot",
174
- value: function snapshot() {
175
- return null; // noop
176
- }
177
- }]);
178
-
179
- return DefaultVizActionHandler;
180
- }();
181
-
182
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
183
-
184
- /***/ }),
185
- /* 15 */,
186
- /* 16 */,
187
- /* 17 */,
188
- /* 18 */
189
- /***/ (function(module, exports, __webpack_require__) {
190
-
191
- "use strict";
192
-
193
-
194
- Object.defineProperty(exports, "__esModule", {
195
- value: true
196
- });
197
- exports.VizBehavior = void 0;
198
- var VizBehavior;
199
-
200
- (function (VizBehavior) {
201
- /**
202
- * Dynamic Options Behavior.
203
- * This allows visualization options to be powered by data
204
- *
205
- * **Example**
206
- *
207
- * sparklineValues: ">primary|seriesByIndex(0)"
208
- * would configure sparklineValues with an array of data points
209
- * coming from the first series in the primary datasource
210
- *
211
- */
212
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
213
- VizBehavior["EVENTS"] = "events";
214
- VizBehavior["DOWNSAMPLING"] = "downsampling";
215
- /**
216
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
217
- * missing.
218
- * @type {string}
219
- */
220
-
221
- VizBehavior["PLACEHOLDER"] = "placeholder";
222
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
223
- VizBehavior["TRELLIS"] = "trellis";
224
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
225
-
226
- /***/ }),
227
- /* 19 */
228
- /***/ (function(module, exports, __webpack_require__) {
229
-
230
- "use strict";
231
-
232
-
233
- Object.defineProperty(exports, "__esModule", {
234
- value: true
235
- });
236
- exports.VizCategory = void 0;
237
- var VizCategory;
238
-
239
- (function (VizCategory) {
240
- VizCategory["SINGLE_VALUE"] = "Single Value";
241
- VizCategory["TRENDS"] = "Trends";
242
- VizCategory["COMPARISONS"] = "Comparisons";
243
- VizCategory["TABLE"] = "Table";
244
- VizCategory["GAUGE"] = "Gauge";
245
- VizCategory["DISTRIBUTIONS"] = "Distributions";
246
- VizCategory["CHOROPLETH"] = "Choropleth Maps";
247
- VizCategory["SHAPES"] = "Shapes";
248
- VizCategory["MISC"] = "misc";
249
- VizCategory["FLOW"] = "Flow";
250
- VizCategory["CORRELATION"] = "Correlation";
251
- VizCategory["SPATIAL"] = "Spatial";
252
- })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
253
-
254
- /***/ }),
255
- /* 20 */,
256
- /* 21 */,
257
- /* 22 */,
258
- /* 23 */,
259
- /* 24 */
260
- /***/ (function(module, exports) {
261
-
262
- module.exports = require("@splunk/visualizations-shared/Message");
263
-
264
- /***/ }),
265
- /* 25 */
266
- /***/ (function(module, exports, __webpack_require__) {
267
-
268
- "use strict";
269
-
270
-
271
- Object.defineProperty(exports, "__esModule", {
272
- value: true
273
- });
274
- exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
275
-
276
- var numberUtils_1 = __webpack_require__(9);
277
-
278
- var interfaces_1 = __webpack_require__(32); // TODO: utilize this fn in ParallelCoordinates
279
-
280
-
281
- var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
282
- if (!columns || !columns[0] || !columns[0].length) return [];
283
- var data = [];
284
-
285
- var _loop = function _loop(i) {
286
- var newObj = {};
287
- fields.forEach(function (field, index) {
288
- var fieldName = typeof field === 'string' ? field : field.name;
289
-
290
- if (columns[index][i] === '') {
291
- newObj[fieldName] = null;
292
- } else {
293
- newObj[fieldName] = columns[index][i];
294
- }
295
- });
296
- data.push(newObj);
297
- };
298
-
299
- for (var i = 0; i < columns[0].length; i += 1) {
300
- _loop(i);
301
- }
302
-
303
- return data;
304
- };
305
-
306
- exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
307
- // the spikes and overall shape of the chart
308
- // Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
309
- // Modifications include:
310
- // 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
311
- // 2) Convert to camel case
312
- // 3) Convert to TS and also return the indices of the points that are in the downsampled result.
313
- // 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
314
- // that should be used in case of a tie of the max area in a bucket
315
-
316
- var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
317
- var dataLength = data.length;
318
- var downsampledIndices = [];
319
-
320
- if (threshold >= dataLength || threshold === 0) {
321
- var allIndices = data.map(function (values, index) {
322
- return index;
323
- });
324
- return {
325
- downsampledData: data,
326
- downsampledIndices: allIndices
327
- }; // Nothing to do
328
- }
329
-
330
- var sampled = [];
331
- var sampledIndex = 0; // Bucket size. Leave room for start and end data points
332
-
333
- var every = (dataLength - 2) / (threshold - 2);
334
- var a = 0; // Initially a is the first point in the triangle
335
-
336
- var maxAreaPoint;
337
- var maxArea;
338
- var area;
339
- var nextA;
340
- sampled.push(data[a]); // Always add the first point
341
-
342
- downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
343
-
344
- for (var i = 0; i < threshold - 2; i++) {
345
- // Calculate point average for next bucket (containing c)
346
- var avgX = 0;
347
- var avgY = 0;
348
- var avgRangeStart = Math.floor((i + 1) * every) + 1;
349
- var avgRangeEnd = Math.floor((i + 2) * every) + 1;
350
- avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
351
- var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
352
-
353
- for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
354
- avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
355
-
356
- avgY += data[avgRangeStart][1] * 1;
357
- }
358
-
359
- avgX /= avgRangeLength;
360
- avgY /= avgRangeLength; // Get the range for this bucket
361
-
362
- var rangeOffs = Math.floor((i + 0) * every) + 1;
363
- var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
364
-
365
- var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
366
-
367
- var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
368
-
369
- maxArea = area = -1;
370
- var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
371
-
372
- for (; rangeOffs < rangeTo; rangeOffs++) {
373
- // Calculate triangle area over three buckets
374
- area = Math.abs((pointAX - avgX) * (data[rangeOffs][1] - pointAY) - (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)) * 0.5; // Modification: try to downsample the least amount of points possible when there are multiple series
375
- // If all points in a bucket have the same area, prioritize the one with an x index
376
- // that also existed from another series so we don't add another point unnecessarily.
377
- // By default LTTB picks the leftmost point in the bucket
378
-
379
- if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
380
- maxArea = area;
381
- maxAreaPoint = data[rangeOffs];
382
- nextA = rangeOffs; // Next a is this b
383
- // Modification: save the index of the point with the most area
384
-
385
- maxAreaIndex = rangeOffs;
386
- }
387
- } // eslint-disable-next-line no-plusplus
388
-
389
-
390
- sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
391
-
392
- downsampledIndices.push(maxAreaIndex);
393
- a = nextA; // This a is the next a (chosen b)
394
- } // eslint-disable-next-line no-plusplus
395
-
396
-
397
- sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
398
-
399
- downsampledIndices.push(dataLength - 1);
400
- return {
401
- downsampledData: sampled,
402
- downsampledIndices: downsampledIndices
403
- };
404
- };
405
- /**
406
- * Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
407
- * if at least one of the values in the column can be loosely coerced to a number.
408
- * If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
409
- * returns that it cannot downsample the column.
410
- */
411
-
412
-
413
- var strictlyCoerceYColumn = function strictlyCoerceYColumn(column, options) {
414
- var isNullCoercionEnabled = options.nullValueDisplay === 'zero'; // Splunk charting allows for numbers in formats such as negative hex that
415
- // Number() does not support and also allows loose coercion of hex numbers (but not other formats)
416
- // We want to identify columns which contain at least one value that can be loosely coerced
417
-
418
- var canLooselyCoerceSomeValues = column.findIndex(function (value) {
419
- return (0, numberUtils_1.startsWithNumber)("".concat(value)) || isNullCoercionEnabled && value === null;
420
- }) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
421
-
422
- var coercedColumn = [];
423
- var canDownsampleColumn = !column.some(function (value) {
424
- var coercedValue = Number(value);
425
- var coerceValueToZero = isNullCoercionEnabled && value === null; // if it can't be parsed or isn't safe, fail
426
-
427
- if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number' && !coerceValueToZero) {
428
- return true;
429
- } // save value and continue to next
430
-
431
-
432
- coercedColumn.push(coercedValue);
433
- return false;
434
- });
435
- return {
436
- canDownsampleColumn: canDownsampleColumn,
437
- canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
438
- coercedColumn: canDownsampleColumn ? coercedColumn : []
439
- };
440
- };
441
- /**
442
- * Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
443
- * Only strictly increasing x-columns are eligible for downsampling.
444
- * If the column is not eligible for downsampling, returns an empty array.
445
- */
446
-
447
-
448
- var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
449
- if (fieldType === 'number') {
450
- var coercedXColumn = column.map(function (xValue) {
451
- return Number(xValue);
452
- });
453
-
454
- if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
455
- return coercedXColumn;
456
- }
457
- } else if (fieldType === 'time') {
458
- var _coercedXColumn = column.map(function (xValue) {
459
- return new Date(xValue);
460
- });
461
-
462
- if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
463
- return _coercedXColumn;
464
- }
465
- }
466
-
467
- return [];
468
- };
469
-
470
- var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
471
- var vizConfig = _ref.vizConfig;
472
-
473
- var _a;
474
-
475
- return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
476
- };
477
-
478
- exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
479
-
480
- var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
481
- var firstIndex = _ref2.firstIndex,
482
- lastIndex = _ref2.lastIndex,
483
- dataSources = _ref2.dataSources,
484
- width = _ref2.width;
485
-
486
- var _a, _b, _c;
487
-
488
- var window = lastIndex - firstIndex + 1;
489
- var ratio = Math.round(Number(((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns[0]) === null || _c === void 0 ? void 0 : _c.length) / window) * 10) / 10;
490
- return Math.round(ratio * Number(width));
491
- };
492
-
493
- exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
494
- /**
495
- * Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
496
- * then returns the width of the visualization.
497
- *
498
- * Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
499
- * data sources. Returns null if the chart event's dataset does not match the passed in primary data source or if the chart is zoomed
500
- * in for a categorical chart.
501
- */
502
-
503
- var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
504
- var enableSearchZoom = _ref3.enableSearchZoom,
505
- dataSources = _ref3.dataSources,
506
- selectChartEvent = _ref3.selectChartEvent,
507
- width = _ref3.width,
508
- xField = _ref3.xField;
509
-
510
- var _a, _b, _c;
511
-
512
- if (enableSearchZoom || !selectChartEvent) {
513
- return Number(width);
514
- }
515
-
516
- var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
517
-
518
- if (!primaryDataSource) {
519
- return null;
520
- }
521
-
522
- var startXIndex = selectChartEvent.startXIndex,
523
- endXIndex = selectChartEvent.endXIndex,
524
- currentTarget = selectChartEvent.currentTarget;
525
-
526
- try {
527
- var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
528
- return field.name === xField;
529
- });
530
- var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
531
- return field === xField;
532
- });
533
-
534
- if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
535
- return null;
536
- }
537
-
538
- var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
539
- var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
540
- var firstIndex = fullSeries.findIndex(function (x) {
541
- return downsampledSeries[startXIndex] === x;
542
- });
543
- var lastIndex = fullSeries.findIndex(function (x) {
544
- return downsampledSeries[endXIndex] === x;
545
- });
546
-
547
- if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
548
- return (0, exports.calculateThresholdOnRangeSelect)({
549
- firstIndex: firstIndex,
550
- lastIndex: lastIndex,
551
- dataSources: dataSources,
552
- width: width
553
- });
554
- }
555
- } catch (e) {
556
- // eslint-disable-next-line no-console
557
- console.error('Error occurred while setting downsample threshold on range select event', e);
558
- }
559
-
560
- return null;
561
- };
562
-
563
- exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
564
-
565
- var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
566
- return column.every(function (value, index) {
567
- if (fieldType === 'number') {
568
- if (Number.isNaN(value)) {
569
- return false;
570
- }
571
- }
572
-
573
- if (fieldType === 'time') {
574
- if (Number.isNaN(value.getTime())) {
575
- return false;
576
- }
577
- }
578
-
579
- if (index === 0) {
580
- return true;
581
- }
582
-
583
- return value > column[index - 1];
584
- });
585
- };
586
- /**
587
- * Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
588
- * displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
589
- *
590
- * If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
591
- * If not all columns can be downsampled, then returns empty arrays for both x and y
592
- */
593
-
594
-
595
- var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes, options) {
596
- var xColumn = [];
597
- var yColumns = [];
598
- var canDownsample = !ds.data.fields.some(function (field, index) {
599
- var _a, _b;
600
-
601
- var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
602
- var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
603
- var column = ds.data.columns[index];
604
- var hasDisplayedColumnThatCantBeDownsampled = false;
605
-
606
- if (fieldName === xField) {
607
- xColumn = strictlyCoerceXColumn(column, fieldType);
608
- } else if (yFields.has(fieldName)) {
609
- var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index], options),
610
- coercedColumn = _strictlyCoerceYColum.coercedColumn,
611
- canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
612
- canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
613
- // be downsampled using LTTB
614
-
615
-
616
- hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
617
-
618
- if (hasDisplayedColumnThatCantBeDownsampled) {
619
- return true;
620
- }
621
-
622
- if (canDownsampleColumn) {
623
- yColumns.push(coercedColumn);
624
- }
625
- }
626
-
627
- return false;
628
- });
629
-
630
- if (canDownsample) {
631
- return {
632
- xColumn: xColumn,
633
- yColumns: yColumns
634
- };
635
- }
636
-
637
- return {
638
- xColumn: [],
639
- yColumns: []
640
- };
641
- };
642
-
643
- var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
644
- var sortedIndices = Array.from(indices).sort(function (a, b) {
645
- return a - b;
646
- });
647
- var slicedColumns = [];
648
- ds.data.columns.forEach(function (column) {
649
- var slicedColumn = [];
650
- sortedIndices.forEach(function (index) {
651
- slicedColumn.push(column[index]);
652
- });
653
- slicedColumns.push(slicedColumn);
654
- }); // update data columns with downsampled columns
655
-
656
- return Object.assign(Object.assign({}, ds), {
657
- data: Object.assign(Object.assign({}, ds.data), {
658
- columns: slicedColumns
659
- })
660
- });
661
- };
662
-
663
- var downsampleDataSources = function downsampleDataSources(_ref4) {
664
- var dataSources = _ref4.dataSources,
665
- threshold = _ref4.threshold,
666
- options = _ref4.options;
667
-
668
- var _a, _b, _c;
669
-
670
- var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
671
-
672
- var numPoints = (_c = (_b = (_a = primaryDS === null || primaryDS === void 0 ? void 0 : primaryDS.data) === null || _a === void 0 ? void 0 : _a.columns[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
673
-
674
- if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
675
- return dataSources;
676
- }
677
-
678
- var xField = options.xField,
679
- yFields = options.yFields,
680
- fieldTypes = options.fieldTypes;
681
-
682
- if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
683
- return dataSources;
684
- }
685
-
686
- var nonInternalYFields = new Set(yFields.filter(function (yField) {
687
- return !yField.startsWith('_');
688
- }));
689
- var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
690
- // At the worst case, each series has non-overlapping downsampled pts
691
- // which will mean that all points will be included in the downsampled result
692
- // This will just lead to additional overhead due to coercing each
693
- // x and y field to number
694
-
695
- if (maxPointsInDownsample >= numPoints) {
696
- return dataSources;
697
- }
698
-
699
- var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes, options),
700
- xColumn = _tryToCoerceAllDispla.xColumn,
701
- yColumns = _tryToCoerceAllDispla.yColumns;
702
-
703
- if (!yColumns.length || !xColumn.length) {
704
- return dataSources;
705
- }
706
-
707
- var downsampledDataSources = Object.assign({}, dataSources);
708
- var downsampledIndices = new Set();
709
- yColumns.forEach(function (yColumn, columnIndex) {
710
- // perform LTTB downsampling for current series, LTTB takes an [x, y] pair
711
- var xyPair = yColumn.map(function (yValue, index) {
712
- return [xColumn[index], yValue];
713
- });
714
-
715
- try {
716
- var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
717
- downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
718
-
719
- downsampledIndicesForSeries.forEach(function (downsampleIndex) {
720
- return downsampledIndices.add(downsampleIndex);
721
- });
722
- } catch (e) {
723
- // eslint-disable-next-line no-console
724
- console.error("Error occurred while downsampling column ".concat(columnIndex), e);
725
- }
726
- }); // update data columns with downsampled columns
727
-
728
- downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
729
- return downsampledDataSources;
730
- };
731
-
732
- exports.downsampleDataSources = downsampleDataSources;
733
-
734
- /***/ }),
735
- /* 26 */
736
- /***/ (function(module, exports, __webpack_require__) {
737
-
738
- "use strict";
739
-
740
-
741
- Object.defineProperty(exports, "__esModule", {
742
- value: true
743
- });
744
- exports.validOutputModes = exports.validSortDirs = void 0;
745
- exports.validSortDirs = ['asc', 'desc', 'none'];
746
- exports.validOutputModes = ['json_cols', 'json'];
747
-
748
- /***/ }),
749
- /* 27 */,
750
- /* 28 */
751
- /***/ (function(module, exports) {
752
-
753
- module.exports = require("@splunk/visualization-context/TimezoneContext");
754
-
755
- /***/ }),
756
- /* 29 */
757
- /***/ (function(module, exports) {
758
-
759
- module.exports = require("@splunk/visualizations-shared/style");
760
-
761
- /***/ }),
762
- /* 30 */
763
- /***/ (function(module, exports, __webpack_require__) {
764
-
765
- "use strict";
766
-
767
-
768
- var _classCallCheck = __webpack_require__(4);
769
-
770
- var _createClass = __webpack_require__(7);
771
-
772
- Object.defineProperty(exports, "__esModule", {
773
- value: true
774
- });
775
- exports.ChartingApiFunctional = void 0;
776
-
777
- var ChartingApiFunctional = /*#__PURE__*/function () {
778
- // eslint-disable-next-line no-useless-constructor
779
- function ChartingApiFunctional(chartRef) {
780
- _classCallCheck(this, ChartingApiFunctional);
781
-
782
- this.chartRef = chartRef;
783
- }
784
- /**
785
- * Allows users to programmatically highlight a point on the chart
786
- *
787
- * @memberof ChartingApiFunctional
788
- */
789
-
790
-
791
- _createClass(ChartingApiFunctional, [{
792
- key: "highlight",
793
- value: function highlight() {
794
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
795
- xValue: '',
796
- seriesName: ''
797
- },
798
- xValue = _ref.xValue,
799
- seriesName = _ref.seriesName;
800
-
801
- this.getChart().highlight(xValue, seriesName);
802
- }
803
- /**
804
- * Allows users to programmatically unhighlight all points on the chart
805
- *
806
- * @memberof ChartingApiFunctional
807
- */
808
-
809
- }, {
810
- key: "unHighlight",
811
- value: function unHighlight() {
812
- this.getChart().unHighlight();
813
- } // returns chart object
814
-
815
- }, {
816
- key: "getChart",
817
- value: function getChart() {
818
- var _a;
819
-
820
- return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
821
- }
822
- }]);
823
-
824
- return ChartingApiFunctional;
825
- }();
826
-
827
- exports.ChartingApiFunctional = ChartingApiFunctional;
828
-
829
- /***/ }),
830
- /* 31 */
831
- /***/ (function(module, exports, __webpack_require__) {
832
-
833
- "use strict";
834
-
835
-
836
- Object.defineProperty(exports, "__esModule", {
837
- value: true
838
- });
839
-
840
- var react_1 = __webpack_require__(0);
841
-
842
- function usePrevious(value) {
843
- var ref = (0, react_1.useRef)();
844
- (0, react_1.useEffect)(function () {
845
- ref.current = value;
846
- });
847
- return ref.current;
848
- }
849
-
850
- exports.default = usePrevious;
851
-
852
- /***/ }),
853
- /* 32 */
854
- /***/ (function(module, exports, __webpack_require__) {
855
-
856
- "use strict";
857
-
858
-
859
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
860
- if (k2 === undefined) k2 = k;
861
- var desc = Object.getOwnPropertyDescriptor(m, k);
862
-
863
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
864
- desc = {
865
- enumerable: true,
866
- get: function get() {
867
- return m[k];
868
- }
869
- };
870
- }
871
-
872
- Object.defineProperty(o, k2, desc);
873
- } : function (o, m, k, k2) {
874
- if (k2 === undefined) k2 = k;
875
- o[k2] = m[k];
876
- });
877
-
878
- var __exportStar = this && this.__exportStar || function (m, exports) {
879
- for (var p in m) {
880
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
881
- }
882
- };
883
-
884
- Object.defineProperty(exports, "__esModule", {
885
- value: true
886
- });
887
-
888
- __exportStar(__webpack_require__(33), exports);
889
-
890
- __exportStar(__webpack_require__(34), exports);
891
-
892
- __exportStar(__webpack_require__(26), exports);
893
-
894
- __exportStar(__webpack_require__(35), exports);
895
-
896
- __exportStar(__webpack_require__(36), exports);
897
-
898
- __exportStar(__webpack_require__(37), exports);
899
-
900
- __exportStar(__webpack_require__(38), exports);
901
-
902
- __exportStar(__webpack_require__(39), exports);
903
-
904
- __exportStar(__webpack_require__(40), exports);
905
-
906
- __exportStar(__webpack_require__(14), exports);
907
-
908
- __exportStar(__webpack_require__(18), exports);
909
-
910
- __exportStar(__webpack_require__(19), exports);
911
-
912
- __exportStar(__webpack_require__(41), exports);
913
-
914
- __exportStar(__webpack_require__(42), exports);
915
-
916
- __exportStar(__webpack_require__(43), exports);
917
-
918
- __exportStar(__webpack_require__(44), exports);
919
-
920
- __exportStar(__webpack_require__(45), exports);
921
-
922
- __exportStar(__webpack_require__(46), exports);
923
-
924
- /***/ }),
925
- /* 33 */
926
- /***/ (function(module, exports, __webpack_require__) {
927
-
928
- "use strict";
929
-
930
-
931
- Object.defineProperty(exports, "__esModule", {
932
- value: true
1
+ /* Copyright © 2020 Splunk Inc.
2
+ SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
3
+ in part without a valid written license from Splunk Inc. is PROHIBITED. */
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __defProps = Object.defineProperties;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
+ var __getProtoOf = Object.getPrototypeOf;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
14
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
+ var __spreadValues = (a, b) => {
16
+ for (var prop in b || (b = {}))
17
+ if (__hasOwnProp.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ if (__getOwnPropSymbols)
20
+ for (var prop of __getOwnPropSymbols(b)) {
21
+ if (__propIsEnum.call(b, prop))
22
+ __defNormalProp(a, prop, b[prop]);
23
+ }
24
+ return a;
25
+ };
26
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
+ var __export = (target, all) => {
28
+ for (var name in all)
29
+ __defProp(target, name, { get: all[name], enumerable: true });
30
+ };
31
+ var __copyProps = (to, from, except, desc) => {
32
+ if (from && typeof from === "object" || typeof from === "function") {
33
+ for (let key of __getOwnPropNames(from))
34
+ if (!__hasOwnProp.call(to, key) && key !== except)
35
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
36
+ }
37
+ return to;
38
+ };
39
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
40
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
41
+ // If the importer is in node compatibility mode or this is not an ESM
42
+ // file that has been converted to a CommonJS file using a Babel-
43
+ // compatible transform (i.e. "__esModule" has not been set), then set
44
+ // "default" to the CommonJS "module.exports" for node compatibility.
45
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
46
+ mod
47
+ ));
48
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
+
50
+ // src/common/Charting.tsx
51
+ var Charting_exports = {};
52
+ __export(Charting_exports, {
53
+ NO_INPLACE_PROPS: () => NO_INPLACE_PROPS,
54
+ appendTrellisToPayload: () => appendTrellisToPayload,
55
+ canUpdateInPlace: () => canUpdateInPlace,
56
+ changedOptions: () => changedOptions,
57
+ default: () => Charting_default,
58
+ updateRowPayload: () => updateRowPayload
933
59
  });
60
+ module.exports = __toCommonJS(Charting_exports);
934
61
 
935
- /***/ }),
936
- /* 34 */
937
- /***/ (function(module, exports, __webpack_require__) {
938
-
939
- "use strict";
940
-
941
- /**
942
- * A data structure used at runtime to wire up a visualization.
943
- */
944
-
945
- Object.defineProperty(exports, "__esModule", {
946
- value: true
62
+ // esm-externals:lodash
63
+ var lodash_exports = {};
64
+ __export(lodash_exports, {
65
+ default: () => lodash_default
947
66
  });
948
-
949
- /***/ }),
950
- /* 35 */
951
- /***/ (function(module, exports, __webpack_require__) {
952
-
953
- "use strict";
954
-
955
-
956
- Object.defineProperty(exports, "__esModule", {
957
- value: true
67
+ var defaultImport = __toESM(require("lodash"));
68
+ __reExport(lodash_exports, require("lodash"));
69
+ var lodash_default = "default" in defaultImport ? defaultImport.default : defaultImport;
70
+
71
+ // esm-externals:@splunk/ui-utils/i18n
72
+ var i18n_exports = {};
73
+ __export(i18n_exports, {
74
+ default: () => i18n_default
958
75
  });
959
-
960
- /***/ }),
961
- /* 36 */
962
- /***/ (function(module, exports, __webpack_require__) {
963
-
964
- "use strict";
965
-
966
-
967
- Object.defineProperty(exports, "__esModule", {
968
- value: true
76
+ var defaultImport2 = __toESM(require("@splunk/ui-utils/i18n"));
77
+ __reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
78
+ var i18n_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
79
+
80
+ // esm-externals:@splunk/visualization-color-palettes
81
+ var visualization_color_palettes_exports = {};
82
+ __export(visualization_color_palettes_exports, {
83
+ default: () => visualization_color_palettes_default
969
84
  });
970
-
971
- /***/ }),
972
- /* 37 */
973
- /***/ (function(module, exports, __webpack_require__) {
974
-
975
- "use strict";
976
-
977
-
978
- Object.defineProperty(exports, "__esModule", {
979
- value: true
85
+ var defaultImport3 = __toESM(require("@splunk/visualization-color-palettes"));
86
+ __reExport(visualization_color_palettes_exports, require("@splunk/visualization-color-palettes"));
87
+ var visualization_color_palettes_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
88
+
89
+ // esm-externals:react
90
+ var react_exports = {};
91
+ __export(react_exports, {
92
+ default: () => react_default
980
93
  });
981
-
982
- /***/ }),
983
- /* 38 */
984
- /***/ (function(module, exports, __webpack_require__) {
985
-
986
- "use strict";
987
-
988
-
989
- Object.defineProperty(exports, "__esModule", {
990
- value: true
94
+ var defaultImport4 = __toESM(require("react"));
95
+ __reExport(react_exports, require("react"));
96
+ var react_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
97
+
98
+ // esm-externals:prop-types
99
+ var prop_types_exports = {};
100
+ __export(prop_types_exports, {
101
+ default: () => prop_types_default
991
102
  });
992
-
993
- /***/ }),
994
- /* 39 */
995
- /***/ (function(module, exports, __webpack_require__) {
996
-
997
- "use strict";
998
-
999
-
1000
- Object.defineProperty(exports, "__esModule", {
1001
- value: true
103
+ var defaultImport5 = __toESM(require("prop-types"));
104
+ __reExport(prop_types_exports, require("prop-types"));
105
+ var prop_types_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
106
+
107
+ // esm-externals:react-event-listener
108
+ var react_event_listener_exports = {};
109
+ __export(react_event_listener_exports, {
110
+ default: () => react_event_listener_default
1002
111
  });
1003
-
1004
- /***/ }),
1005
- /* 40 */
1006
- /***/ (function(module, exports, __webpack_require__) {
1007
-
1008
- "use strict";
1009
-
1010
-
1011
- Object.defineProperty(exports, "__esModule", {
1012
- value: true
112
+ var defaultImport6 = __toESM(require("react-event-listener"));
113
+ __reExport(react_event_listener_exports, require("react-event-listener"));
114
+ var react_event_listener_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
115
+
116
+ // esm-externals:@splunk/visualizations-shared/i18n
117
+ var i18n_exports2 = {};
118
+ __export(i18n_exports2, {
119
+ default: () => i18n_default2
1013
120
  });
1014
-
1015
- /***/ }),
1016
- /* 41 */
1017
- /***/ (function(module, exports, __webpack_require__) {
1018
-
1019
- "use strict";
1020
-
1021
-
1022
- Object.defineProperty(exports, "__esModule", {
1023
- value: true
121
+ var defaultImport7 = __toESM(require("@splunk/visualizations-shared/i18n"));
122
+ __reExport(i18n_exports2, require("@splunk/visualizations-shared/i18n"));
123
+ var i18n_default2 = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
124
+
125
+ // esm-externals:@splunk/charting-bundle
126
+ var charting_bundle_exports = {};
127
+ __export(charting_bundle_exports, {
128
+ default: () => charting_bundle_default
1024
129
  });
1025
-
1026
- /***/ }),
1027
- /* 42 */
1028
- /***/ (function(module, exports, __webpack_require__) {
1029
-
1030
- "use strict";
1031
-
1032
-
1033
- Object.defineProperty(exports, "__esModule", {
1034
- value: true
130
+ var defaultImport8 = __toESM(require("@splunk/charting-bundle"));
131
+ __reExport(charting_bundle_exports, require("@splunk/charting-bundle"));
132
+ var charting_bundle_default = "default" in defaultImport8 ? defaultImport8.default : defaultImport8;
133
+
134
+ // esm-externals:@splunk/visualization-context/TimezoneContext
135
+ var TimezoneContext_exports = {};
136
+ __export(TimezoneContext_exports, {
137
+ default: () => TimezoneContext_default
1035
138
  });
1036
-
1037
- /***/ }),
1038
- /* 43 */
1039
- /***/ (function(module, exports, __webpack_require__) {
1040
-
1041
- "use strict";
1042
-
1043
-
1044
- Object.defineProperty(exports, "__esModule", {
1045
- value: true
139
+ var defaultImport9 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
140
+ __reExport(TimezoneContext_exports, require("@splunk/visualization-context/TimezoneContext"));
141
+ var TimezoneContext_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
142
+
143
+ // esm-externals:@splunk/visualizations-shared/style
144
+ var style_exports = {};
145
+ __export(style_exports, {
146
+ default: () => style_default
1046
147
  });
1047
-
1048
- /***/ }),
1049
- /* 44 */
1050
- /***/ (function(module, exports, __webpack_require__) {
1051
-
1052
- "use strict";
1053
-
1054
-
1055
- Object.defineProperty(exports, "__esModule", {
1056
- value: true
148
+ var defaultImport10 = __toESM(require("@splunk/visualizations-shared/style"));
149
+ __reExport(style_exports, require("@splunk/visualizations-shared/style"));
150
+ var style_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
151
+
152
+ // esm-externals:styled-components
153
+ var styled_components_exports = {};
154
+ __export(styled_components_exports, {
155
+ default: () => styled_components_default
1057
156
  });
1058
-
1059
- /***/ }),
1060
- /* 45 */
1061
- /***/ (function(module, exports, __webpack_require__) {
1062
-
1063
- "use strict";
1064
-
1065
-
1066
- Object.defineProperty(exports, "__esModule", {
1067
- value: true
157
+ var defaultImport11 = __toESM(require("styled-components"));
158
+ __reExport(styled_components_exports, require("styled-components"));
159
+ var styled_components_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
160
+
161
+ // esm-externals:@splunk/visualizations-shared/Message
162
+ var Message_exports = {};
163
+ __export(Message_exports, {
164
+ default: () => Message_default
1068
165
  });
1069
-
1070
- /***/ }),
1071
- /* 46 */
1072
- /***/ (function(module, exports, __webpack_require__) {
1073
-
1074
- "use strict";
1075
-
1076
-
1077
- Object.defineProperty(exports, "__esModule", {
1078
- value: true
166
+ var defaultImport12 = __toESM(require("@splunk/visualizations-shared/Message"));
167
+ __reExport(Message_exports, require("@splunk/visualizations-shared/Message"));
168
+ var Message_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
169
+
170
+ // esm-externals:@splunk/themes/useSplunkTheme
171
+ var useSplunkTheme_exports = {};
172
+ __export(useSplunkTheme_exports, {
173
+ default: () => useSplunkTheme_default
1079
174
  });
1080
-
1081
- /***/ }),
1082
- /* 47 */,
1083
- /* 48 */,
1084
- /* 49 */,
1085
- /* 50 */,
1086
- /* 51 */,
1087
- /* 52 */,
1088
- /* 53 */,
1089
- /* 54 */,
1090
- /* 55 */,
1091
- /* 56 */,
1092
- /* 57 */,
1093
- /* 58 */,
1094
- /* 59 */,
1095
- /* 60 */,
1096
- /* 61 */,
1097
- /* 62 */,
1098
- /* 63 */,
1099
- /* 64 */,
1100
- /* 65 */,
1101
- /* 66 */,
1102
- /* 67 */,
1103
- /* 68 */,
1104
- /* 69 */,
1105
- /* 70 */,
1106
- /* 71 */,
1107
- /* 72 */,
1108
- /* 73 */
1109
- /***/ (function(module, exports, __webpack_require__) {
1110
-
1111
- "use strict";
1112
-
1113
-
1114
- Object.defineProperty(exports, "__esModule", {
1115
- value: true
175
+ var defaultImport13 = __toESM(require("@splunk/themes/useSplunkTheme"));
176
+ __reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
177
+ var useSplunkTheme_default = "default" in defaultImport13 ? defaultImport13.default : defaultImport13;
178
+
179
+ // esm-externals:@splunk/visualizations-shared/themeUtils
180
+ var themeUtils_exports = {};
181
+ __export(themeUtils_exports, {
182
+ default: () => themeUtils_default
1116
183
  });
1117
- exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
1118
- /* eslint-disable react/no-unused-prop-types */
1119
-
1120
- var lodash_1 = __webpack_require__(3);
1121
-
1122
- var i18n_1 = __webpack_require__(5);
1123
-
1124
- var visualization_color_palettes_1 = __webpack_require__(74);
1125
-
1126
- var react_1 = __webpack_require__(0);
1127
-
1128
- var React = __webpack_require__(0);
1129
-
1130
- var T = __webpack_require__(1);
1131
-
1132
- var react_event_listener_1 = __webpack_require__(75);
1133
-
1134
- __webpack_require__(76); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
1135
-
1136
-
1137
- var charting_bundle_1 = __webpack_require__(77);
1138
-
1139
- var TimezoneContext_1 = __webpack_require__(28);
1140
-
1141
- var style_1 = __webpack_require__(29);
1142
-
1143
- var styled_components_1 = __webpack_require__(2);
1144
-
1145
- var Message_1 = __webpack_require__(24);
1146
-
1147
- var useSplunkTheme_1 = __webpack_require__(78);
1148
-
1149
- var themeUtils_1 = __webpack_require__(79);
1150
-
1151
- var ChartingApi_1 = __webpack_require__(30);
184
+ var defaultImport14 = __toESM(require("@splunk/visualizations-shared/themeUtils"));
185
+ __reExport(themeUtils_exports, require("@splunk/visualizations-shared/themeUtils"));
186
+ var themeUtils_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
187
+
188
+ // esm-externals:@splunk/visualization-schemas
189
+ var visualization_schemas_exports = {};
190
+ __export(visualization_schemas_exports, {
191
+ default: () => visualization_schemas_default
192
+ });
193
+ var defaultImport15 = __toESM(require("@splunk/visualization-schemas"));
194
+ __reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
195
+ var visualization_schemas_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
1152
196
 
1153
- var usePrevious_1 = __webpack_require__(31);
197
+ // src/common/ChartingApi.ts
198
+ var ChartingApiFunctional = class {
199
+ // eslint-disable-next-line no-useless-constructor
200
+ constructor(chartRef) {
201
+ this.chartRef = chartRef;
202
+ }
203
+ /**
204
+ * Allows users to programmatically highlight a point on the chart
205
+ *
206
+ * @memberof ChartingApiFunctional
207
+ */
208
+ highlight({ xValue, seriesName } = { xValue: "", seriesName: "" }) {
209
+ this.getChart().highlight(xValue, seriesName);
210
+ }
211
+ /**
212
+ * Allows users to programmatically unhighlight all points on the chart
213
+ *
214
+ * @memberof ChartingApiFunctional
215
+ */
216
+ unHighlight() {
217
+ this.getChart().unHighlight();
218
+ }
219
+ // returns chart object
220
+ getChart() {
221
+ var _a;
222
+ return (_a = this.chartRef) == null ? void 0 : _a.current;
223
+ }
224
+ };
1154
225
 
1155
- var useEventCallback_1 = __webpack_require__(80);
226
+ // src/common/hooks/usePrevious.ts
227
+ function usePrevious(value) {
228
+ const ref = (0, react_exports.useRef)();
229
+ (0, react_exports.useEffect)(() => {
230
+ ref.current = value;
231
+ });
232
+ return ref.current;
233
+ }
1156
234
 
1157
- var dataUtils_1 = __webpack_require__(25);
235
+ // src/common/hooks/useEventCallback.tsx
236
+ var useEventCallback = (fn) => {
237
+ const ref = (0, react_exports.useRef)(fn);
238
+ (0, react_exports.useLayoutEffect)(() => {
239
+ ref.current = fn;
240
+ });
241
+ return (0, react_exports.useCallback)((...args) => ref.current(...args), []);
242
+ };
243
+ var useEventCallback_default = useEventCallback;
1158
244
 
1159
- exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
245
+ // esm-externals:@splunk/visualizations-shared/numberUtils
246
+ var numberUtils_exports = {};
247
+ __export(numberUtils_exports, {
248
+ default: () => numberUtils_default
249
+ });
250
+ var defaultImport16 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
251
+ __reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
252
+ var numberUtils_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
253
+
254
+ // src/common/utils/dataUtils.ts
255
+ var calculateThresholdOnRangeSelect = ({
256
+ firstIndex,
257
+ lastIndex,
258
+ dataSources,
259
+ width
260
+ }) => {
261
+ var _a, _b, _c;
262
+ const window2 = lastIndex - firstIndex + 1;
263
+ const ratio = Math.round(Number(((_c = (_b = (_a = dataSources == null ? void 0 : dataSources.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.columns[0]) == null ? void 0 : _c.length) / window2) * 10) / 10;
264
+ return Math.round(ratio * Number(width));
265
+ };
266
+ var calculateDownsamplingThreshold = ({
267
+ enableSearchZoom,
268
+ dataSources,
269
+ selectChartEvent,
270
+ width,
271
+ xField
272
+ }) => {
273
+ var _a, _b, _c;
274
+ if (enableSearchZoom || !selectChartEvent) {
275
+ return Number(width);
276
+ }
277
+ const primaryDataSource = dataSources == null ? void 0 : dataSources.primary;
278
+ if (!primaryDataSource) {
279
+ return null;
280
+ }
281
+ const { startXIndex, endXIndex, currentTarget } = selectChartEvent;
282
+ try {
283
+ const xFieldIndex = (_a = primaryDataSource == null ? void 0 : primaryDataSource.data) == null ? void 0 : _a.fields.findIndex((field) => {
284
+ return field.name === xField;
285
+ });
286
+ const downsampledXFieldIndex = (_b = currentTarget.dataSet) == null ? void 0 : _b.fields.findIndex((field) => field === xField);
287
+ if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
288
+ return null;
289
+ }
290
+ const fullSeries = (_c = primaryDataSource == null ? void 0 : primaryDataSource.data) == null ? void 0 : _c.columns[xFieldIndex];
291
+ const downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
292
+ const firstIndex = fullSeries.findIndex((x) => {
293
+ return downsampledSeries[startXIndex] === x;
294
+ });
295
+ const lastIndex = fullSeries.findIndex((x) => {
296
+ return downsampledSeries[endXIndex] === x;
297
+ });
298
+ if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
299
+ return calculateThresholdOnRangeSelect({
300
+ firstIndex,
301
+ lastIndex,
302
+ dataSources,
303
+ width
304
+ });
305
+ }
306
+ } catch (e) {
307
+ console.error("Error occurred while setting downsample threshold on range select event", e);
308
+ }
309
+ return null;
310
+ };
1160
311
 
1161
- var changedOptions = function changedOptions(curOptions, nextOptions) {
1162
- return Object.keys(curOptions).filter(function (key) {
1163
- return !(key in nextOptions);
1164
- }).concat(Object.keys(nextOptions).filter(function (key) {
1165
- return !(key in curOptions) || curOptions[key] !== nextOptions[key];
1166
- }));
312
+ // esm-externals:@splunk/visualization-context/FeatureFlagContext
313
+ var FeatureFlagContext_exports = {};
314
+ __export(FeatureFlagContext_exports, {
315
+ default: () => FeatureFlagContext_default
316
+ });
317
+ var defaultImport17 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
318
+ __reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
319
+ var FeatureFlagContext_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
320
+
321
+ // src/common/hooks/useTrellisEnabled.ts
322
+ var useTrellisFeatureFlagOn = () => {
323
+ const context = (0, react_exports.useContext)(FeatureFlagContext_default);
324
+ return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
325
+ };
326
+ var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
327
+ const trellisFeatureEnabled = useTrellisFeatureFlagOn();
328
+ return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
1167
329
  };
1168
330
 
1169
- exports.changedOptions = changedOptions;
331
+ // src/common/components/TrellisTitle.tsx
332
+ var TRELLIS_TITLE_HEIGHT = 28;
333
+ var TrellisTitleText = styled_components_default.div`
334
+ margin-left: 10px;
335
+ margin-right: 10px;
336
+ padding-top: 8px;
337
+ text-overflow: ellipsis;
338
+ white-space: nowrap;
339
+ overflow: hidden;
340
+ `;
341
+ var TrellisTitleDiv = styled_components_default.div`
342
+ height: ${TRELLIS_TITLE_HEIGHT}px;
343
+ font-size: 14px;
344
+ font-weight: 700;
345
+ color: ${(props) => props.fontColor};
346
+ background-color: ${(props) => props.backgroundColor};
347
+ box-shadow: 0 1px ${(props) => props.backgroundColor}; // this is added to avoid a 1px gap between title and viz divs that showed up intermittently because of pixel rounding error in chrome.
348
+ `;
349
+ var TrellisTitle = (props) => {
350
+ const titleText = String(props.trellisKey).toString();
351
+ return /* @__PURE__ */ react_exports.createElement(
352
+ TrellisTitleDiv,
353
+ {
354
+ fontColor: props.fontColor,
355
+ backgroundColor: props.backgroundColor,
356
+ "data-test": "trellis-title",
357
+ title: titleText
358
+ },
359
+ /* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
360
+ );
361
+ };
1170
362
 
1171
- var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
1172
- // if either of the options are undefined
1173
- // it cannot update in place.
363
+ // src/common/Charting.tsx
364
+ var NO_INPLACE_PROPS = [
365
+ "chart",
366
+ "chart.orientation",
367
+ "layout.splitSeries",
368
+ "chart.style",
369
+ "legend.placement"
370
+ ];
371
+ var appendTrellisToPayload = (props, payload) => {
372
+ if (props.trellisSplitBy) {
373
+ payload["trellis.name"] = props.trellisSplitBy;
374
+ }
375
+ if (props.trellisKey) {
376
+ payload["trellis.value"] = props.trellisKey;
377
+ }
378
+ return payload;
379
+ };
380
+ var changedOptions = (curOptions, nextOptions) => Object.keys(curOptions).filter((key) => !(key in nextOptions)).concat(
381
+ Object.keys(nextOptions).filter(
382
+ (key) => !(key in curOptions) || curOptions[key] !== nextOptions[key]
383
+ )
384
+ );
385
+ var canUpdateInPlace = (curOptions, nextOptions) => {
1174
386
  if (!curOptions || !nextOptions) {
1175
387
  return false;
1176
388
  }
1177
-
1178
- return !exports.NO_INPLACE_PROPS.some(function (p) {
1179
- return curOptions[p] !== nextOptions[p];
1180
- }) && !(0, exports.changedOptions)(curOptions, nextOptions).some(function (p) {
1181
- return p.toLowerCase().endsWith('color');
1182
- });
389
+ return !NO_INPLACE_PROPS.some((p) => curOptions[p] !== nextOptions[p]) && !changedOptions(curOptions, nextOptions).some((p) => p.toLowerCase().endsWith("color"));
1183
390
  };
1184
-
1185
- exports.canUpdateInPlace = canUpdateInPlace; // create 'row' payloads from 'rowContext' in the flattened format:
1186
- // row.<fieldname>.value
1187
-
1188
- var updateRowPayload = function updateRowPayload(chartEventRowContext, payload) {
1189
- Object.keys(chartEventRowContext || {}).forEach(function (key) {
1190
- // eslint-disable-next-line no-param-reassign
1191
- payload["".concat(key, ".value")] = chartEventRowContext[key];
391
+ var updateRowPayload = (chartEventRowContext, payload) => {
392
+ Object.keys(chartEventRowContext || {}).forEach((key) => {
393
+ payload[`${key}.value`] = chartEventRowContext[key];
1192
394
  });
1193
395
  return payload;
1194
396
  };
1195
-
1196
- exports.updateRowPayload = updateRowPayload;
1197
- var VizChartEventType;
1198
-
1199
- (function (VizChartEventType) {
1200
- VizChartEventType["POINT_CLICK"] = "point.click";
1201
- VizChartEventType["POINT_MOUSE_OUT"] = "point.mouseout";
1202
- VizChartEventType["POINT_MOUSE_OVER"] = "point.mouseover";
1203
- VizChartEventType["LEGEND_CLICK"] = "legend.click";
1204
- })(VizChartEventType || (VizChartEventType = {})); // @TODO(pwied): remove after HC upgrade to 8+
1205
- // .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug
1206
- // caused by the accessibility plugin
1207
- // https://github.com/highcharts/highcharts/issues/12883
1208
-
1209
-
1210
- var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
1211
- return {
1212
- 'data-test': 'charting-container',
1213
- width: props.width,
1214
- height: props.height
1215
- };
1216
- }).withConfig({
1217
- displayName: "Charting__ChartingContainer",
1218
- componentId: "sc-3wbgm0-0"
1219
- })(["& .highcharts-a11y-proxy-container{pointer-events:none;}overflow:hidden;position:relative;", ";"], function (props) {
1220
- return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
1221
- });
397
+ var ChartingContainer = styled_components_default.div.attrs((props) => ({
398
+ "data-test": "charting-container",
399
+ width: props.width,
400
+ height: props.height
401
+ }))`
402
+ & .highcharts-a11y-proxy-container {
403
+ pointer-events: none;
404
+ }
405
+ overflow: hidden;
406
+ position: relative;
407
+ ${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
408
+ `;
1222
409
  var propTypes = {
1223
- width: T.oneOfType([T.string, T.number]),
1224
- height: T.oneOfType([T.string, T.number]),
1225
- options: T.object,
1226
- chartData: T.object,
1227
- onEventTrigger: T.func,
1228
- onClick: T.func,
1229
- onSelect: T.func,
1230
- onPointMouseOver: T.func,
1231
- onPointMouseOut: T.func,
1232
- style: T.object,
1233
- colorPalette: T.array,
1234
- visualizationApiRef: T.func,
1235
- themeKey: T.string,
1236
- originalDataSources: T.object,
1237
- onDownsamplingThresholdChange: T.func,
1238
- xField: T.string,
1239
- y2Fields: T.array
410
+ width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
411
+ height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
412
+ options: prop_types_exports.object,
413
+ chartData: prop_types_exports.object,
414
+ onEventTrigger: prop_types_exports.func,
415
+ onClick: prop_types_exports.func,
416
+ onSelect: prop_types_exports.func,
417
+ onPointMouseOver: prop_types_exports.func,
418
+ onPointMouseOut: prop_types_exports.func,
419
+ style: prop_types_exports.object,
420
+ colorPalette: prop_types_exports.array,
421
+ visualizationApiRef: prop_types_exports.func,
422
+ themeKey: prop_types_exports.string,
423
+ originalDataSources: prop_types_exports.object,
424
+ onDownsamplingThresholdChange: prop_types_exports.func,
425
+ xField: prop_types_exports.string,
426
+ y2Fields: prop_types_exports.array,
427
+ splitByLayout: prop_types_exports.oneOf(Object.values(visualization_schemas_exports.LAYOUT_TYPE)),
428
+ trellisKey: prop_types_exports.string,
429
+ trellisSplitBy: prop_types_exports.string,
430
+ backgroundColor: prop_types_exports.string,
431
+ defaultFontColor: prop_types_exports.string
1240
432
  };
1241
-
1242
- var Charting = function Charting(props) {
433
+ var Charting = (props) => {
1243
434
  var _a, _b;
1244
-
1245
- var container = (0, react_1.useRef)(null);
1246
- var needsInit = (0, react_1.useRef)(true);
1247
- var chart = (0, react_1.useRef)();
1248
- var needsRedraw = (0, react_1.useRef)(true);
1249
- var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
1250
- var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
1251
- var selectChartEvent = (0, react_1.useRef)(null);
1252
-
1253
- var computeChartingSize = function computeChartingSize() {
435
+ const container = (0, react_exports.useRef)(null);
436
+ const needsInit = (0, react_exports.useRef)(true);
437
+ const chart = (0, react_exports.useRef)();
438
+ const needsRedraw = (0, react_exports.useRef)(true);
439
+ const api = (0, react_exports.useRef)(new ChartingApiFunctional(chart));
440
+ const timezone = (0, react_exports.useContext)(TimezoneContext_default);
441
+ const selectChartEvent = (0, react_exports.useRef)(null);
442
+ const trellisEnabled = useTrellisEnabled(props.splitByLayout);
443
+ const computeChartingSize = () => {
1254
444
  if (container.current) {
1255
- var rect = container.current.getBoundingClientRect();
445
+ const rect = container.current.getBoundingClientRect();
1256
446
  return {
1257
447
  height: rect.height,
1258
448
  width: rect.width
1259
449
  };
1260
450
  }
1261
-
1262
451
  return {};
1263
452
  };
1264
-
1265
- var splunkTheme = (0, useSplunkTheme_1.default)();
1266
- var themeKey = props.themeKey ? props.themeKey : (0, themeUtils_1.getChartingThemeKey)({
1267
- splunkThemeV1: splunkTheme
1268
- });
1269
- var width = props.width,
1270
- height = props.height,
1271
- style = props.style,
1272
- chartData = props.chartData,
1273
- options = props.options,
1274
- colorPalette = props.colorPalette,
1275
- onClick = props.onClick,
1276
- onSelect = props.onSelect,
1277
- onPointMouseOut = props.onPointMouseOut,
1278
- onPointMouseOver = props.onPointMouseOver,
1279
- onEventTrigger = props.onEventTrigger,
1280
- originalDataSources = props.originalDataSources,
1281
- onDownsamplingThresholdChange = props.onDownsamplingThresholdChange,
1282
- xField = props.xField;
1283
- var prevOptions = (0, usePrevious_1.default)(options);
1284
- var prevTimezone = (0, usePrevious_1.default)(timezone);
1285
-
1286
- var handleClick = function handleClick(chartEvent, type) {
1287
- var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
453
+ const splunkTheme = useSplunkTheme_default();
454
+ const themeKey = props.themeKey ? props.themeKey : (0, themeUtils_exports.getChartingThemeKey)({ splunkThemeV1: splunkTheme });
455
+ const {
456
+ width,
457
+ height,
458
+ style,
459
+ chartData,
460
+ options,
461
+ colorPalette,
462
+ onClick,
463
+ onSelect,
464
+ onPointMouseOut,
465
+ onPointMouseOver,
466
+ onEventTrigger,
467
+ originalDataSources,
468
+ onDownsamplingThresholdChange,
469
+ xField,
470
+ backgroundColor,
471
+ defaultFontColor,
472
+ trellisKey
473
+ } = props;
474
+ const prevOptions = usePrevious(options);
475
+ const prevTimezone = usePrevious(timezone);
476
+ const handleClick = (chartEvent, type) => {
477
+ let payload = (0, lodash_exports.pick)(
478
+ chartEvent,
479
+ "name2",
480
+ "value2",
481
+ "_span",
482
+ "modifierKey"
483
+ );
1288
484
  payload.name = payload.name2;
1289
485
  delete payload.name2;
1290
-
1291
- if (type === VizChartEventType.POINT_CLICK) {
486
+ if (type === "point.click" /* POINT_CLICK */) {
1292
487
  payload.value = payload.value2;
1293
488
  delete payload.value2;
1294
- payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
489
+ payload = updateRowPayload(chartEvent.rowContext, payload);
1295
490
  }
1296
-
491
+ payload = appendTrellisToPayload(props, payload);
1297
492
  onClick({
1298
- type: type,
493
+ type,
1299
494
  originalEvent: chartEvent,
1300
- payload: payload
495
+ payload
1301
496
  });
1302
497
  };
1303
-
1304
- var destroyChart = function destroyChart() {
498
+ const destroyChart = () => {
1305
499
  if (chart.current) {
1306
500
  chart.current.destroy();
1307
501
  chart.current = null;
1308
502
  }
1309
-
1310
503
  needsRedraw.current = true;
1311
504
  needsInit.current = true;
1312
505
  };
1313
-
1314
- var enableSearchZoom = (_b = (_a = chartData === null || chartData === void 0 ? void 0 : chartData.chartDataOptions) === null || _a === void 0 ? void 0 : _a.enableSearchZoom) !== null && _b !== void 0 ? _b : false;
1315
- var recalculateDownsamplingThreshold = React.useCallback(function () {
506
+ const enableSearchZoom = (_b = (_a = chartData == null ? void 0 : chartData.chartDataOptions) == null ? void 0 : _a.enableSearchZoom) != null ? _b : false;
507
+ const recalculateDownsamplingThreshold = react_exports.useCallback(() => {
1316
508
  if (!onDownsamplingThresholdChange || !xField) {
1317
509
  return;
1318
510
  }
1319
-
1320
- var newThreshold = (0, dataUtils_1.calculateDownsamplingThreshold)({
1321
- enableSearchZoom: enableSearchZoom,
511
+ const newThreshold = calculateDownsamplingThreshold({
512
+ enableSearchZoom,
1322
513
  dataSources: originalDataSources,
1323
514
  width: Number(width),
1324
515
  selectChartEvent: selectChartEvent.current,
1325
- xField: xField
516
+ xField
1326
517
  });
1327
-
1328
518
  if (Number.isFinite(newThreshold)) {
1329
519
  onDownsamplingThresholdChange(newThreshold);
1330
520
  }
1331
521
  }, [enableSearchZoom, originalDataSources, onDownsamplingThresholdChange, width, xField]);
1332
- React.useEffect(function () {
522
+ react_exports.useEffect(() => {
1333
523
  recalculateDownsamplingThreshold();
1334
- }, [recalculateDownsamplingThreshold]); // useEventCallback is used for these handlers to make sure that they are a stable reference and
1335
- // we always use the latest version of the callback
1336
- // Since chart drawing is debounced, there is a race condition where a stale callback may be called
1337
- // if a prop changes and the event handler is called before the chart redraws. This means that
1338
- // it will use the old callback rather than the newer one, which can lead to inaccurate results
1339
-
1340
- var handleSelect = (0, useEventCallback_1.default)(function (chartEvent) {
524
+ }, [recalculateDownsamplingThreshold]);
525
+ const handleSelect = useEventCallback_default((chartEvent) => {
1341
526
  selectChartEvent.current = chartEvent;
1342
- recalculateDownsamplingThreshold(); // todo: need change this after breaking all visualizations
1343
-
1344
- if (onSelect && typeof onSelect === 'function') {
527
+ recalculateDownsamplingThreshold();
528
+ const payload = appendTrellisToPayload(
529
+ props,
530
+ (0, lodash_exports.pick)(chartEvent, "startXIndex", "endXIndex", "startXValue", "endXValue")
531
+ );
532
+ if (onSelect && typeof onSelect === "function") {
1345
533
  onSelect({
1346
- type: 'range.select',
534
+ type: "range.select",
1347
535
  originalEvent: chartEvent,
1348
- payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
536
+ payload
1349
537
  });
1350
538
  return;
1351
- } // the chartEvent here is a jQuery event
1352
-
1353
-
539
+ }
1354
540
  onEventTrigger({
1355
- type: 'range.select',
1356
- originalEvent: chartEvent,
1357
- payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
1358
- });
1359
- });
1360
- var handlePointMouseOut = (0, useEventCallback_1.default)(function (chartEvent, type) {
1361
- var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
1362
- payload.name = payload.name2;
1363
- delete payload.name2;
1364
- payload.value = payload.value2;
1365
- delete payload.value2;
1366
- payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
1367
- onPointMouseOut({
1368
- type: type,
1369
- originalEvent: chartEvent,
1370
- payload: payload
1371
- });
1372
- });
1373
- var handlePointMouseOver = (0, useEventCallback_1.default)(function (chartEvent, type) {
1374
- var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
1375
- payload.name = payload.name2;
1376
- delete payload.name2;
1377
- payload.value = payload.value2;
1378
- delete payload.value2;
1379
- payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
1380
- onPointMouseOver({
1381
- type: type,
541
+ type: "range.select",
1382
542
  originalEvent: chartEvent,
1383
- payload: payload
543
+ payload
1384
544
  });
1385
545
  });
1386
-
1387
- var drawChart = function drawChart() {
1388
- var updatedOptions = Object.assign(Object.assign({}, options), {
1389
- shouldColorizeTooltipData: false
1390
- });
1391
- var computedChartSize = computeChartingSize();
1392
- var computedWidth = computedChartSize.width;
1393
- var computedHeight = computedChartSize.height;
1394
- var serializedTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone;
1395
- var ianaTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone;
1396
- var utcOffset = timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset;
1397
-
546
+ const handlePointMouseOut = useEventCallback_default(
547
+ (chartEvent, type) => {
548
+ let payload = (0, lodash_exports.pick)(
549
+ chartEvent,
550
+ "name2",
551
+ "value2",
552
+ "_span",
553
+ "modifierKey",
554
+ "tooltipContext"
555
+ );
556
+ payload.name = payload.name2;
557
+ delete payload.name2;
558
+ payload.value = payload.value2;
559
+ delete payload.value2;
560
+ payload = appendTrellisToPayload(props, updateRowPayload(chartEvent.rowContext, payload));
561
+ onPointMouseOut({
562
+ type,
563
+ originalEvent: chartEvent,
564
+ payload
565
+ });
566
+ }
567
+ );
568
+ const handlePointMouseOver = useEventCallback_default(
569
+ (chartEvent, type) => {
570
+ let payload = (0, lodash_exports.pick)(
571
+ chartEvent,
572
+ "name2",
573
+ "value2",
574
+ "_span",
575
+ "modifierKey",
576
+ "tooltipContext"
577
+ );
578
+ payload.name = payload.name2;
579
+ delete payload.name2;
580
+ payload.value = payload.value2;
581
+ delete payload.value2;
582
+ payload = appendTrellisToPayload(props, updateRowPayload(chartEvent.rowContext, payload));
583
+ onPointMouseOver({
584
+ type,
585
+ originalEvent: chartEvent,
586
+ payload
587
+ });
588
+ }
589
+ );
590
+ const drawChart = () => {
591
+ const updatedOptions = __spreadProps(__spreadValues({}, options), { shouldColorizeTooltipData: false });
592
+ const computedChartSize = computeChartingSize();
593
+ const computedWidth = computedChartSize.width;
594
+ const computedHeight = computedChartSize.height;
595
+ const serializedTimezone = timezone == null ? void 0 : timezone.serializedTimezone;
596
+ const ianaTimezone = timezone == null ? void 0 : timezone.ianaTimezone;
597
+ const utcOffset = timezone == null ? void 0 : timezone.utcOffset;
1398
598
  if (!computedWidth || !computedHeight) {
1399
599
  return;
1400
600
  }
1401
-
1402
601
  if (!chartData || !Object.keys(chartData).length) {
1403
602
  return;
1404
- } // splunk-charting layers configuration option updates.
1405
- // when an option is removed it needs to be set to an empty string
1406
- // to override the previous configuration
1407
-
1408
-
603
+ }
1409
604
  if (prevOptions) {
1410
- Object.keys(prevOptions).forEach(function (key) {
1411
- if (prevOptions[key] && updatedOptions[key] === undefined) {
1412
- updatedOptions[key] = '';
605
+ Object.keys(prevOptions).forEach((key) => {
606
+ if (prevOptions[key] && updatedOptions[key] === void 0) {
607
+ updatedOptions[key] = "";
1413
608
  }
1414
609
  });
1415
610
  }
1416
-
1417
611
  try {
1418
612
  if (needsInit.current) {
1419
613
  destroyChart();
1420
- charting_bundle_1.default.setTheme(themeKey);
1421
-
614
+ charting_bundle_default.setTheme(themeKey);
1422
615
  if (colorPalette.length > 0) {
1423
- charting_bundle_1.default.setColorPalette(colorPalette);
616
+ charting_bundle_default.setColorPalette(colorPalette);
1424
617
  }
1425
-
1426
- chart.current = charting_bundle_1.default.createChart(container.current, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedOptions), {
1427
- drilldown: 'all'
1428
- }), typeof serializedTimezone === 'string' && {
1429
- 'time.serializedTz': serializedTimezone
1430
- }), typeof ianaTimezone === 'string' && {
1431
- 'time.ianaTimezone': ianaTimezone
1432
- }), typeof utcOffset === 'number' && {
1433
- 'time.timezoneOffset': utcOffset
1434
- })); // bind event handlers
1435
-
1436
- chart.current.on('pointClick', function (e) {
1437
- handleClick(e, VizChartEventType.POINT_CLICK);
618
+ chart.current = charting_bundle_default.createChart(container.current, __spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, updatedOptions), {
619
+ drilldown: "all"
620
+ }), typeof serializedTimezone === "string" && {
621
+ "time.serializedTz": serializedTimezone
622
+ }), typeof ianaTimezone === "string" && {
623
+ "time.ianaTimezone": ianaTimezone
624
+ }), typeof utcOffset === "number" && {
625
+ "time.timezoneOffset": utcOffset
626
+ }));
627
+ chart.current.on("pointClick", (e) => {
628
+ handleClick(e, "point.click" /* POINT_CLICK */);
1438
629
  });
1439
- chart.current.on('pointMouseOver', function (e) {
1440
- handlePointMouseOver(e, VizChartEventType.POINT_MOUSE_OVER);
630
+ chart.current.on("pointMouseOver", (e) => {
631
+ handlePointMouseOver(e, "point.mouseover" /* POINT_MOUSE_OVER */);
1441
632
  });
1442
- chart.current.on('pointMouseOut', function (e) {
1443
- handlePointMouseOut(e, VizChartEventType.POINT_MOUSE_OUT);
633
+ chart.current.on("pointMouseOut", (e) => {
634
+ handlePointMouseOut(e, "point.mouseout" /* POINT_MOUSE_OUT */);
1444
635
  });
1445
- chart.current.on('legendClick', function (e) {
1446
- handleClick(e, VizChartEventType.LEGEND_CLICK);
636
+ chart.current.on("legendClick", (e) => {
637
+ handleClick(e, "legend.click" /* LEGEND_CLICK */);
1447
638
  });
1448
- chart.current.on('chartRangeSelect', handleSelect);
639
+ chart.current.on("chartRangeSelect", handleSelect);
1449
640
  }
1450
-
1451
641
  if (needsRedraw.current) {
1452
- charting_bundle_1.default.setTheme(themeKey);
1453
-
642
+ charting_bundle_default.setTheme(themeKey);
1454
643
  if (colorPalette.length > 0) {
1455
- charting_bundle_1.default.setColorPalette(colorPalette);
644
+ charting_bundle_default.setColorPalette(colorPalette);
1456
645
  }
1457
-
1458
- chart.current.prepareAndDraw(chartData, updatedOptions, function () {
646
+ const payload = appendTrellisToPayload(props, {
647
+ width,
648
+ height,
649
+ currentTime: (/* @__PURE__ */ new Date()).getTime()
650
+ });
651
+ chart.current.prepareAndDraw(chartData, updatedOptions, () => {
1459
652
  onEventTrigger({
1460
- type: 'viz.renderedWithData',
1461
- payload: {
1462
- width: width,
1463
- height: height,
1464
- currentTime: new Date().getTime()
1465
- }
653
+ type: "viz.renderedWithData",
654
+ payload
1466
655
  });
1467
656
  });
1468
657
  }
1469
-
1470
658
  if (chart.current) {
1471
659
  if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
1472
660
  chart.current.resize(computedWidth, computedHeight);
1473
661
  }
1474
662
  }
1475
-
1476
663
  needsInit.current = false;
1477
664
  needsRedraw.current = false;
1478
665
  } catch (e) {
1479
- window.console.error('Caught error rendering chart:', e);
666
+ window.console.error("Caught error rendering chart:", e);
1480
667
  }
1481
668
  };
1482
-
1483
- var debouncedDrawChart = (0, lodash_1.debounce)(drawChart, 5);
1484
-
1485
- var onContainerMount = function onContainerMount(chartingContainer) {
669
+ const debouncedDrawChart = (0, lodash_exports.debounce)(drawChart, 5);
670
+ const onContainerMount = (chartingContainer) => {
1486
671
  container.current = chartingContainer;
1487
672
  debouncedDrawChart();
1488
673
  };
1489
-
1490
- var prevTheme = (0, usePrevious_1.default)(themeKey);
1491
- var prevOnClick = (0, usePrevious_1.default)(onClick);
1492
- (0, react_1.useEffect)(function () {
674
+ const prevTheme = usePrevious(themeKey);
675
+ const prevOnClick = usePrevious(onClick);
676
+ (0, react_exports.useEffect)(() => {
1493
677
  debouncedDrawChart();
1494
678
  props.visualizationApiRef(api.current);
1495
- return function () {
679
+ return () => {
1496
680
  props.visualizationApiRef(null);
1497
681
  destroyChart();
1498
682
  };
1499
683
  }, []);
1500
- (0, react_1.useEffect)(function () {
1501
- // TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme
1502
- // seems like redraw doesn't suffice to update the background colors
1503
- if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
684
+ (0, react_exports.useEffect)(() => {
685
+ if (!chart.current || !canUpdateInPlace(prevOptions, options) || // timezone is a simple object so this comparison should be fast
1504
686
  JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
1505
687
  needsInit.current = true;
1506
- } // need to immediately call drawChart upon an option or chartData change
1507
- // otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
1508
-
1509
-
688
+ }
1510
689
  needsRedraw.current = true;
1511
690
  drawChart();
1512
- }, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone, timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset, timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone, themeKey, onClick]);
1513
- return React.createElement(ChartingContainer, {
1514
- style: style,
1515
- ref: onContainerMount,
1516
- width: width,
1517
- height: height
1518
- }, React.createElement(react_event_listener_1.default, {
1519
- target: window,
1520
- onResize: debouncedDrawChart
1521
- }));
691
+ }, [
692
+ JSON.stringify(options),
693
+ JSON.stringify(chartData.toJSON()),
694
+ JSON.stringify(chartData.annotations),
695
+ timezone == null ? void 0 : timezone.ianaTimezone,
696
+ timezone == null ? void 0 : timezone.utcOffset,
697
+ timezone == null ? void 0 : timezone.serializedTimezone,
698
+ themeKey,
699
+ onClick
700
+ ]);
701
+ return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
702
+ TrellisTitle,
703
+ {
704
+ trellisKey,
705
+ backgroundColor,
706
+ fontColor: defaultFontColor
707
+ }
708
+ ), /* @__PURE__ */ react_exports.createElement(
709
+ ChartingContainer,
710
+ {
711
+ style,
712
+ ref: onContainerMount,
713
+ width,
714
+ height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height
715
+ },
716
+ /* @__PURE__ */ react_exports.createElement(react_event_listener_default, { target: window, onResize: debouncedDrawChart })
717
+ ));
1522
718
  };
1523
-
1524
719
  var defaultProps = {
1525
- width: '100%',
720
+ width: "100%",
1526
721
  height: 250,
1527
722
  options: {},
1528
723
  style: {},
1529
724
  // todo: need remove it
1530
- onEventTrigger: lodash_1.noop,
1531
- onClick: lodash_1.noop,
1532
- onSelect: lodash_1.noop,
1533
- onPointMouseOver: lodash_1.noop,
1534
- onPointMouseOut: lodash_1.noop,
1535
- colorPalette: visualization_color_palettes_1.VIZ_CATEGORICAL,
1536
- visualizationApiRef: lodash_1.noop,
725
+ onEventTrigger: lodash_exports.noop,
726
+ onClick: lodash_exports.noop,
727
+ onSelect: lodash_exports.noop,
728
+ onPointMouseOver: lodash_exports.noop,
729
+ onPointMouseOut: lodash_exports.noop,
730
+ colorPalette: visualization_color_palettes_exports.VIZ_CATEGORICAL,
731
+ visualizationApiRef: lodash_exports.noop,
1537
732
  chartData: null,
1538
733
  themeKey: null,
1539
734
  onDownsamplingThresholdChange: null,
1540
735
  originalDataSources: null,
1541
736
  xField: null,
1542
- y2Fields: []
737
+ y2Fields: [],
738
+ splitByLayout: void 0,
739
+ trellisKey: void 0,
740
+ trellisSplitBy: void 0,
741
+ backgroundColor: "",
742
+ defaultFontColor: ""
1543
743
  };
1544
744
  Charting.propTypes = propTypes;
1545
- Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
1546
-
1547
- var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
1548
- var Wrapper = function Wrapper(props) {
1549
- var chartData = props.chartData;
1550
-
1551
- if (!chartData) {
1552
- return React.createElement(Message_1.default, {
1553
- message: (0, i18n_1._)('No DataSource'),
1554
- level: "warning"
1555
- });
1556
- }
1557
-
1558
- if (chartData && !Object.keys(chartData).length) {
1559
- return React.createElement(Message_1.default, {
1560
- message: (0, i18n_1._)('No Result'),
1561
- level: "info"
1562
- });
1563
- }
1564
-
1565
- return React.createElement(Chart, Object.assign({}, props));
1566
- };
1567
-
1568
- Wrapper.displayName = 'ChartingWrapper';
1569
- Wrapper.propTypes = propTypes;
1570
- Wrapper.defaultProps = defaultProps;
1571
- return Wrapper;
1572
- }; // export default Charting;
1573
-
1574
-
1575
- exports.default = withEmptyChartMessage(Charting);
1576
-
1577
- /***/ }),
1578
- /* 74 */
1579
- /***/ (function(module, exports) {
1580
-
1581
- module.exports = require("@splunk/visualization-color-palettes");
1582
-
1583
- /***/ }),
1584
- /* 75 */
1585
- /***/ (function(module, exports) {
1586
-
1587
- module.exports = require("react-event-listener");
1588
-
1589
- /***/ }),
1590
- /* 76 */
1591
- /***/ (function(module, exports) {
1592
-
1593
- module.exports = require("@splunk/visualizations-shared/i18n");
1594
-
1595
- /***/ }),
1596
- /* 77 */
1597
- /***/ (function(module, exports) {
1598
-
1599
- module.exports = require("@splunk/charting-bundle");
1600
-
1601
- /***/ }),
1602
- /* 78 */
1603
- /***/ (function(module, exports) {
1604
-
1605
- module.exports = require("@splunk/themes/useSplunkTheme");
1606
-
1607
- /***/ }),
1608
- /* 79 */
1609
- /***/ (function(module, exports) {
1610
-
1611
- module.exports = require("@splunk/visualizations-shared/themeUtils");
1612
-
1613
- /***/ }),
1614
- /* 80 */
1615
- /***/ (function(module, exports, __webpack_require__) {
1616
-
1617
- "use strict";
1618
-
1619
-
1620
- Object.defineProperty(exports, "__esModule", {
1621
- value: true
1622
- });
1623
-
1624
- var react_1 = __webpack_require__(0);
1625
-
1626
- var useEventCallback = function useEventCallback(fn) {
1627
- var ref = (0, react_1.useRef)(fn);
1628
- (0, react_1.useLayoutEffect)(function () {
1629
- ref.current = fn;
1630
- });
1631
- return (0, react_1.useCallback)(function () {
1632
- return ref.current.apply(ref, arguments);
1633
- }, []);
745
+ Charting.defaultProps = defaultProps;
746
+ var ChartingWrapper = (props) => {
747
+ const { chartData } = props;
748
+ if (!chartData) {
749
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { message: (0, i18n_exports._)("No DataSource"), level: "warning" });
750
+ }
751
+ if (!Object.keys(chartData).length) {
752
+ return /* @__PURE__ */ react_exports.createElement(Message_default, { message: (0, i18n_exports._)("No Result"), level: "info" });
753
+ }
754
+ return /* @__PURE__ */ react_exports.createElement(Charting, __spreadValues({}, props));
1634
755
  };
1635
-
1636
- exports.default = useEventCallback;
1637
-
1638
- /***/ })
1639
- /******/ ]);
1640
- //# sourceMappingURL=Charting.js.map
756
+ ChartingWrapper.propTypes = propTypes;
757
+ ChartingWrapper.defaultProps = defaultProps;
758
+ var Charting_default = ChartingWrapper;
759
+ //# sourceMappingURL=Charting.js.map