@splunk/visualizations 26.0.0 → 26.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +103 -19
- package/Area.config.js.map +1 -1
- package/Area.js +646 -243
- package/Area.js.map +1 -1
- package/Bar.config.js +105 -21
- package/Bar.config.js.map +1 -1
- package/Bar.js +653 -237
- package/Bar.js.map +1 -1
- package/Bubble.config.js +95 -21
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +635 -229
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +66 -15
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +589 -211
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +104 -19
- package/Column.config.js.map +1 -1
- package/Column.js +666 -239
- package/Column.js.map +1 -1
- package/Ellipse.config.js +83 -18
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +444 -156
- package/Ellipse.js.map +1 -1
- package/Events.config.js +101 -19
- package/Events.config.js.map +1 -1
- package/Events.js +792 -322
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +97 -28
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +786 -390
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +63 -19
- package/Image.config.js.map +1 -1
- package/Image.js +439 -164
- package/Image.js.map +1 -1
- package/Line.config.js +107 -23
- package/Line.config.js.map +1 -1
- package/Line.js +841 -456
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +73 -23
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +653 -230
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +244 -99
- package/Map.config.js.map +1 -1
- package/Map.js +1223 -612
- package/Map.js.map +1 -1
- package/Markdown.config.js +71 -21
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +477 -202
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +80 -22
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +819 -418
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +73 -19
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +870 -491
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +76 -23
- package/Pie.config.js.map +1 -1
- package/Pie.js +643 -233
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +82 -30
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +863 -387
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +86 -20
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +449 -159
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +85 -23
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +895 -349
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +97 -23
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +639 -234
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +95 -25
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1198 -656
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +287 -226
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +93 -23
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +991 -522
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +100 -27
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1185 -624
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +127 -68
- package/SparkLine.js.map +1 -1
- package/Table.config.js +74 -21
- package/Table.config.js.map +1 -1
- package/Table.js +827 -329
- package/Table.js.map +1 -1
- package/common/Charting.js +152 -69
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +25 -14
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +530 -0
- package/common/DocExampleWithVizSandbox.js.map +1 -0
- package/common/EventsDoc.js +139 -104
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +79 -69
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +54 -45
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +178 -87
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +530 -68
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +47 -20
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +15 -9
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +57 -44
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +52 -20
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +139 -7
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +185 -102
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +28 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +50 -15
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +8 -3
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +4 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -1
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +288 -128
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +242 -197
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -1
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +62 -1
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +3 -1
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +389 -192
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +18 -26
package/Punchcard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -143,11 +143,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
143
143
|
Object.defineProperty(exports, "__esModule", {
|
|
144
144
|
value: true
|
|
145
145
|
});
|
|
146
|
+
|
|
146
147
|
var React = __webpack_require__(1);
|
|
148
|
+
|
|
147
149
|
var styled_components_1 = __webpack_require__(4);
|
|
150
|
+
|
|
148
151
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
152
|
+
|
|
149
153
|
var style_1 = __webpack_require__(14);
|
|
154
|
+
|
|
150
155
|
var colorUtils_1 = __webpack_require__(12);
|
|
156
|
+
|
|
151
157
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
152
158
|
var width = _ref.width;
|
|
153
159
|
return {
|
|
@@ -160,11 +166,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
160
166
|
componentId: "sc-1yhgpod-0"
|
|
161
167
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
162
168
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
163
|
-
});
|
|
164
|
-
|
|
169
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
170
|
+
|
|
165
171
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
166
172
|
var width = _ref2.width,
|
|
167
|
-
|
|
173
|
+
height = _ref2.height;
|
|
168
174
|
return {
|
|
169
175
|
style: Object.assign(Object.assign({}, width && {
|
|
170
176
|
width: (0, style_1.toPx)(width)
|
|
@@ -186,11 +192,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
186
192
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
187
193
|
componentId: "sc-1yhgpod-3"
|
|
188
194
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
195
|
+
|
|
189
196
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
190
197
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
191
198
|
var width = props.width,
|
|
192
|
-
|
|
193
|
-
|
|
199
|
+
height = props.height,
|
|
200
|
+
backgroundColor = props.backgroundColor;
|
|
201
|
+
|
|
194
202
|
if (!height) {
|
|
195
203
|
return React.createElement(Item, {
|
|
196
204
|
"data-test": "item",
|
|
@@ -198,24 +206,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
198
206
|
backgroundColor: backgroundColor
|
|
199
207
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
200
208
|
}
|
|
209
|
+
|
|
201
210
|
return React.createElement(FixSizeItem, {
|
|
202
211
|
"data-test": "fix-size-item",
|
|
203
|
-
"data-splunk-visualization-version": "26.
|
|
212
|
+
"data-splunk-visualization-version": "26.1.1 - b6df0a015",
|
|
204
213
|
width: width,
|
|
205
214
|
height: height,
|
|
206
215
|
backgroundColor: backgroundColor
|
|
207
216
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
208
217
|
var newWidth = _ref3.width,
|
|
209
|
-
|
|
218
|
+
newHeight = _ref3.height;
|
|
210
219
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
211
220
|
width: newWidth,
|
|
212
221
|
height: newHeight
|
|
213
222
|
}));
|
|
214
223
|
})));
|
|
215
224
|
};
|
|
225
|
+
|
|
216
226
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
217
227
|
return FixedSizeContainer;
|
|
218
228
|
};
|
|
229
|
+
|
|
219
230
|
exports.default = withFixedSizeContainer;
|
|
220
231
|
|
|
221
232
|
/***/ }),
|
|
@@ -257,9 +268,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
257
268
|
* @param {DashboardVizType} props.Wrapper
|
|
258
269
|
* @param {DashboardVizType} props.Visualization
|
|
259
270
|
*/
|
|
271
|
+
|
|
260
272
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
261
273
|
var Wrapper = _ref.Wrapper,
|
|
262
|
-
|
|
274
|
+
Visualization = _ref.Visualization;
|
|
263
275
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
264
276
|
extendProperties.forEach(function (prop) {
|
|
265
277
|
if (Visualization[prop]) {
|
|
@@ -268,6 +280,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
268
280
|
}
|
|
269
281
|
});
|
|
270
282
|
};
|
|
283
|
+
|
|
271
284
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
272
285
|
|
|
273
286
|
/***/ }),
|
|
@@ -286,7 +299,7 @@ module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
|
286
299
|
|
|
287
300
|
/***/ }),
|
|
288
301
|
|
|
289
|
-
/***/
|
|
302
|
+
/***/ 171:
|
|
290
303
|
/***/ (function(module, exports) {
|
|
291
304
|
|
|
292
305
|
module.exports = require("lodash/sortBy");
|
|
@@ -321,24 +334,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
321
334
|
|
|
322
335
|
|
|
323
336
|
var _toConsumableArray = __webpack_require__(8);
|
|
337
|
+
|
|
324
338
|
var _defineProperty = __webpack_require__(7);
|
|
339
|
+
|
|
325
340
|
var __rest = this && this.__rest || function (s, e) {
|
|
326
341
|
var t = {};
|
|
342
|
+
|
|
327
343
|
for (var p in s) {
|
|
328
344
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
329
345
|
}
|
|
346
|
+
|
|
330
347
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
331
348
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
332
349
|
}
|
|
333
350
|
return t;
|
|
334
351
|
};
|
|
352
|
+
|
|
335
353
|
Object.defineProperty(exports, "__esModule", {
|
|
336
354
|
value: true
|
|
337
355
|
});
|
|
338
356
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
357
|
+
|
|
339
358
|
var lodash_1 = __webpack_require__(3);
|
|
359
|
+
|
|
340
360
|
var schemaUtils_1 = __webpack_require__(16);
|
|
361
|
+
|
|
341
362
|
var VizBehavior_1 = __webpack_require__(6);
|
|
363
|
+
|
|
342
364
|
var dynamicOptionsDSLType = {
|
|
343
365
|
type: 'string',
|
|
344
366
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -348,20 +370,22 @@ var dynamicOptionsDSLType = {
|
|
|
348
370
|
* @param optionsSchema a visualization's options schema
|
|
349
371
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
350
372
|
*/
|
|
373
|
+
|
|
351
374
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
352
375
|
var enhancedOptionsSchema = {};
|
|
353
376
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
354
377
|
var _a = optionsSchema[key],
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
378
|
+
title = _a.title,
|
|
379
|
+
description = _a.description,
|
|
380
|
+
readOnly = _a.readOnly,
|
|
381
|
+
writeOnly = _a.writeOnly,
|
|
382
|
+
examples = _a.examples,
|
|
383
|
+
defaultValue = _a.default,
|
|
384
|
+
type = _a.type,
|
|
385
|
+
properties = _a.properties,
|
|
386
|
+
patternProperties = _a.patternProperties,
|
|
387
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
388
|
+
|
|
365
389
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
366
390
|
title: title
|
|
367
391
|
}), description !== undefined && {
|
|
@@ -375,12 +399,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
375
399
|
}), defaultValue !== undefined && {
|
|
376
400
|
default: defaultValue
|
|
377
401
|
});
|
|
402
|
+
|
|
378
403
|
if (type === 'object') {
|
|
379
404
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
380
405
|
type: type
|
|
381
406
|
}), properties && {
|
|
382
407
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
383
408
|
});
|
|
409
|
+
|
|
384
410
|
if (patternProperties) {
|
|
385
411
|
var enhancedPatternProperties = {};
|
|
386
412
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -398,6 +424,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
398
424
|
});
|
|
399
425
|
return enhancedOptionsSchema;
|
|
400
426
|
}
|
|
427
|
+
|
|
401
428
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
402
429
|
/**
|
|
403
430
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -406,11 +433,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
406
433
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
407
434
|
* and containing `open: false` for all editor panels in editorConfig
|
|
408
435
|
*/
|
|
436
|
+
|
|
409
437
|
function enhanceConfig(vizConfig) {
|
|
410
438
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
439
|
+
|
|
411
440
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
412
441
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
413
442
|
}
|
|
443
|
+
|
|
414
444
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
415
445
|
return Object.assign(Object.assign({}, config), {
|
|
416
446
|
open: config.open || false
|
|
@@ -418,6 +448,7 @@ function enhanceConfig(vizConfig) {
|
|
|
418
448
|
});
|
|
419
449
|
return enhancedConfig;
|
|
420
450
|
}
|
|
451
|
+
|
|
421
452
|
exports.enhanceConfig = enhanceConfig;
|
|
422
453
|
/**
|
|
423
454
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -425,6 +456,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
425
456
|
* @param vizConfig a Visualization Config
|
|
426
457
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
427
458
|
*/
|
|
459
|
+
|
|
428
460
|
function uncollapseEditorConfig(vizConfig) {
|
|
429
461
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
430
462
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -434,13 +466,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
434
466
|
});
|
|
435
467
|
return editorPanelUncollapsedConfig;
|
|
436
468
|
}
|
|
469
|
+
|
|
437
470
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
471
|
+
|
|
438
472
|
function isDynamicOption(option) {
|
|
439
473
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
440
474
|
}
|
|
441
|
-
|
|
442
|
-
// private helpers to improve readability of getInitialPreset
|
|
475
|
+
|
|
476
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
443
477
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
478
|
+
|
|
444
479
|
/**
|
|
445
480
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
446
481
|
* 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
|
|
@@ -449,6 +484,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
449
484
|
*
|
|
450
485
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
451
486
|
*/
|
|
487
|
+
|
|
452
488
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
453
489
|
var presetContextKeys = Object.keys(presetContext);
|
|
454
490
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -458,6 +494,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
458
494
|
/**
|
|
459
495
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
460
496
|
*/
|
|
497
|
+
|
|
498
|
+
|
|
461
499
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
462
500
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
463
501
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -472,18 +510,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
472
510
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
473
511
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
474
512
|
*/
|
|
513
|
+
|
|
514
|
+
|
|
475
515
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
476
516
|
return presets.find(function (preset) {
|
|
477
517
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
478
518
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
479
519
|
var presetContextKeys = Object.keys(presetContext);
|
|
480
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
481
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
520
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
482
521
|
// if not, then the preset is invalid in config.ts
|
|
522
|
+
|
|
483
523
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
484
524
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
485
525
|
});
|
|
486
526
|
}
|
|
527
|
+
|
|
487
528
|
exports.getInitialPreset = getInitialPreset;
|
|
488
529
|
/**
|
|
489
530
|
* generates number precision values for a Select editor
|
|
@@ -491,6 +532,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
491
532
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
492
533
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
493
534
|
*/
|
|
535
|
+
|
|
494
536
|
function generatePrecisionValues(numPrecisionValues) {
|
|
495
537
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
496
538
|
return {
|
|
@@ -499,6 +541,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
499
541
|
};
|
|
500
542
|
});
|
|
501
543
|
}
|
|
544
|
+
|
|
502
545
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
503
546
|
/**
|
|
504
547
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -508,12 +551,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
508
551
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
509
552
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
510
553
|
*/
|
|
554
|
+
|
|
511
555
|
var insertLayout = function insertLayout(layout, index) {
|
|
512
556
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
513
557
|
layoutItems[_key - 2] = arguments[_key];
|
|
514
558
|
}
|
|
559
|
+
|
|
515
560
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
516
561
|
};
|
|
562
|
+
|
|
517
563
|
exports.insertLayout = insertLayout;
|
|
518
564
|
|
|
519
565
|
/***/ }),
|
|
@@ -591,11 +637,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
591
637
|
value: true
|
|
592
638
|
});
|
|
593
639
|
exports.shouldShowIconPlaceholder = void 0;
|
|
640
|
+
|
|
594
641
|
var React = __webpack_require__(1);
|
|
642
|
+
|
|
595
643
|
var T = __webpack_require__(0);
|
|
644
|
+
|
|
596
645
|
var lodash_1 = __webpack_require__(3);
|
|
646
|
+
|
|
597
647
|
var i18n_1 = __webpack_require__(2);
|
|
648
|
+
|
|
598
649
|
var Message_1 = __webpack_require__(10);
|
|
650
|
+
|
|
599
651
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
600
652
|
/**
|
|
601
653
|
* @method shouldShowIconPlaceholder
|
|
@@ -603,6 +655,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
603
655
|
* @param {boolean} loading
|
|
604
656
|
* @returns {boolean}
|
|
605
657
|
*/
|
|
658
|
+
|
|
659
|
+
|
|
606
660
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
607
661
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
608
662
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -611,6 +665,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
611
665
|
var noFields = fields === undefined;
|
|
612
666
|
return loading || noData || noFields;
|
|
613
667
|
};
|
|
668
|
+
|
|
614
669
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
615
670
|
var propTypes = {
|
|
616
671
|
icon: T.func,
|
|
@@ -625,11 +680,13 @@ var propTypes = {
|
|
|
625
680
|
* @param {IconPlaceholderProps} props
|
|
626
681
|
* @returns {React.ReactElement}
|
|
627
682
|
*/
|
|
683
|
+
|
|
628
684
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
629
685
|
var width = props.width,
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
686
|
+
height = props.height,
|
|
687
|
+
icon = props.icon,
|
|
688
|
+
iconColor = props.iconColor;
|
|
689
|
+
|
|
633
690
|
if (icon) {
|
|
634
691
|
return React.createElement(icon, {
|
|
635
692
|
style: {
|
|
@@ -641,9 +698,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
641
698
|
transform: 'translate(-50%, -50%)'
|
|
642
699
|
},
|
|
643
700
|
width: '50%',
|
|
644
|
-
height: '50%'
|
|
701
|
+
height: '50%',
|
|
702
|
+
'data-test': 'icon-placeholder'
|
|
645
703
|
});
|
|
646
704
|
}
|
|
705
|
+
|
|
647
706
|
return React.createElement(Message_1.default, {
|
|
648
707
|
width: width,
|
|
649
708
|
height: height,
|
|
@@ -651,6 +710,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
651
710
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
652
711
|
});
|
|
653
712
|
};
|
|
713
|
+
|
|
654
714
|
IconPlaceholder.propTypes = propTypes;
|
|
655
715
|
IconPlaceholder.defaultProps = {
|
|
656
716
|
width: '100%',
|
|
@@ -667,21 +727,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
667
727
|
|
|
668
728
|
|
|
669
729
|
var _defineProperty = __webpack_require__(7);
|
|
730
|
+
|
|
670
731
|
Object.defineProperty(exports, "__esModule", {
|
|
671
732
|
value: true
|
|
672
733
|
});
|
|
673
734
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
735
|
+
|
|
674
736
|
var T = __webpack_require__(0);
|
|
737
|
+
|
|
675
738
|
var lodash_1 = __webpack_require__(3);
|
|
676
|
-
|
|
739
|
+
|
|
740
|
+
var DataSource_1 = __webpack_require__(34);
|
|
741
|
+
|
|
677
742
|
exports.SortParamsPropTypes = T.shape({
|
|
678
743
|
currentSortKey: T.string,
|
|
679
744
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
680
745
|
onSort: T.func
|
|
681
746
|
});
|
|
747
|
+
|
|
682
748
|
var getSortingParams = function getSortingParams(_ref) {
|
|
683
749
|
var requestParams = _ref.requestParams,
|
|
684
|
-
|
|
750
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
685
751
|
var currentSortKey;
|
|
686
752
|
var currentSortDir;
|
|
687
753
|
var nextSortDirMap = {
|
|
@@ -690,15 +756,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
690
756
|
none: 'asc'
|
|
691
757
|
};
|
|
692
758
|
var onSort;
|
|
759
|
+
|
|
693
760
|
if (typeof onRequestParamsChange === 'function') {
|
|
694
761
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
695
762
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
696
763
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
697
|
-
}
|
|
698
|
-
|
|
764
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
765
|
+
|
|
766
|
+
|
|
699
767
|
onSort = function onSort(e, _ref2) {
|
|
700
768
|
var sortKey = _ref2.sortKey,
|
|
701
|
-
|
|
769
|
+
sortDir = _ref2.sortDir;
|
|
770
|
+
|
|
702
771
|
if (typeof sortKey === 'string') {
|
|
703
772
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
704
773
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -710,12 +779,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
710
779
|
}
|
|
711
780
|
};
|
|
712
781
|
}
|
|
782
|
+
|
|
713
783
|
return {
|
|
714
784
|
currentSortKey: currentSortKey,
|
|
715
785
|
currentSortDir: currentSortDir,
|
|
716
786
|
onSort: onSort
|
|
717
787
|
};
|
|
718
788
|
};
|
|
789
|
+
|
|
719
790
|
exports.getSortingParams = getSortingParams;
|
|
720
791
|
|
|
721
792
|
/***/ }),
|
|
@@ -726,43 +797,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
726
797
|
"use strict";
|
|
727
798
|
|
|
728
799
|
|
|
800
|
+
Object.defineProperty(exports, "__esModule", {
|
|
801
|
+
value: true
|
|
802
|
+
});
|
|
803
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
804
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
805
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
806
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
807
|
+
|
|
808
|
+
/***/ }),
|
|
809
|
+
|
|
810
|
+
/***/ 35:
|
|
811
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
812
|
+
|
|
813
|
+
"use strict";
|
|
814
|
+
|
|
815
|
+
|
|
729
816
|
Object.defineProperty(exports, "__esModule", {
|
|
730
817
|
value: true
|
|
731
818
|
});
|
|
732
819
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
820
|
+
|
|
733
821
|
var T = __webpack_require__(0);
|
|
822
|
+
|
|
734
823
|
var lodash_1 = __webpack_require__(3);
|
|
824
|
+
|
|
735
825
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
736
826
|
isPaging: T.bool,
|
|
737
827
|
current: T.number,
|
|
738
828
|
totalPages: T.number,
|
|
739
829
|
onChange: T.func
|
|
740
830
|
});
|
|
831
|
+
|
|
741
832
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
742
833
|
var requestParams = _ref.requestParams,
|
|
743
|
-
|
|
744
|
-
|
|
834
|
+
meta = _ref.meta,
|
|
835
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
745
836
|
var totalCount = meta && meta.totalCount || 0;
|
|
746
837
|
var offset = requestParams && requestParams.offset || 0;
|
|
747
838
|
var count = requestParams && requestParams.count;
|
|
748
839
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
749
840
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
750
841
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
842
|
+
|
|
751
843
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
752
844
|
var page = _ref2.page,
|
|
753
|
-
|
|
845
|
+
countArg = _ref2.count;
|
|
754
846
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
847
|
+
|
|
755
848
|
if (typeof countArg === 'number') {
|
|
756
849
|
newParams.count = countArg;
|
|
757
850
|
newParams.offset = 0;
|
|
758
851
|
}
|
|
852
|
+
|
|
759
853
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
854
|
+
|
|
760
855
|
if (typeof page === 'number' && page > 0) {
|
|
761
856
|
newParams.count = pageCount;
|
|
762
857
|
newParams.offset = (page - 1) * pageCount;
|
|
763
858
|
}
|
|
859
|
+
|
|
764
860
|
onRequestParamsChange(newParams);
|
|
765
861
|
};
|
|
862
|
+
|
|
766
863
|
return {
|
|
767
864
|
isPaging: isPaging,
|
|
768
865
|
current: current,
|
|
@@ -770,11 +867,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
770
867
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
771
868
|
};
|
|
772
869
|
};
|
|
870
|
+
|
|
773
871
|
exports.getPaginationParams = getPaginationParams;
|
|
774
872
|
|
|
775
873
|
/***/ }),
|
|
776
874
|
|
|
777
|
-
/***/
|
|
875
|
+
/***/ 36:
|
|
778
876
|
/***/ (function(module, exports, __webpack_require__) {
|
|
779
877
|
|
|
780
878
|
"use strict";
|
|
@@ -785,6 +883,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
785
883
|
});
|
|
786
884
|
exports.VizCategory = void 0;
|
|
787
885
|
var VizCategory;
|
|
886
|
+
|
|
788
887
|
(function (VizCategory) {
|
|
789
888
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
790
889
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -802,67 +901,96 @@ var VizCategory;
|
|
|
802
901
|
|
|
803
902
|
/***/ }),
|
|
804
903
|
|
|
805
|
-
/***/
|
|
904
|
+
/***/ 37:
|
|
806
905
|
/***/ (function(module, exports, __webpack_require__) {
|
|
807
906
|
|
|
808
907
|
"use strict";
|
|
809
908
|
|
|
810
909
|
|
|
811
910
|
var _slicedToArray = __webpack_require__(17);
|
|
911
|
+
|
|
812
912
|
Object.defineProperty(exports, "__esModule", {
|
|
813
913
|
value: true
|
|
814
914
|
});
|
|
915
|
+
|
|
815
916
|
var React = __webpack_require__(1);
|
|
917
|
+
|
|
816
918
|
var lodash_1 = __webpack_require__(3);
|
|
817
|
-
|
|
919
|
+
|
|
920
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
921
|
+
|
|
818
922
|
var Options_1 = __webpack_require__(30);
|
|
819
|
-
|
|
923
|
+
|
|
924
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
925
|
+
|
|
820
926
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
821
|
-
|
|
927
|
+
|
|
928
|
+
var moment_1 = __webpack_require__(40);
|
|
929
|
+
|
|
822
930
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
931
|
+
|
|
823
932
|
var styled_components_1 = __webpack_require__(4);
|
|
933
|
+
|
|
824
934
|
var hocUtils_1 = __webpack_require__(27);
|
|
935
|
+
|
|
825
936
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
826
|
-
|
|
937
|
+
|
|
938
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
939
|
+
|
|
827
940
|
var id_1 = __webpack_require__(25);
|
|
828
|
-
|
|
941
|
+
|
|
942
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
943
|
+
|
|
829
944
|
var VizBehavior_1 = __webpack_require__(6);
|
|
945
|
+
|
|
830
946
|
var getSorting_1 = __webpack_require__(33);
|
|
831
|
-
|
|
947
|
+
|
|
948
|
+
var getPagination_1 = __webpack_require__(35);
|
|
949
|
+
|
|
832
950
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
951
|
+
|
|
833
952
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
953
|
+
|
|
834
954
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
955
|
+
|
|
835
956
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
836
957
|
/**
|
|
837
958
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
838
959
|
* @param {DashboardVizOpts} opts
|
|
839
960
|
* @returns {HOC}
|
|
840
961
|
*/
|
|
962
|
+
|
|
963
|
+
|
|
841
964
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
842
965
|
var ReactViz = opts.ReactViz,
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
966
|
+
vizConfig = opts.vizConfig,
|
|
967
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
968
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
969
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
970
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
971
|
+
|
|
848
972
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
849
973
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
974
|
+
|
|
850
975
|
var DashboardViz = function DashboardViz(props) {
|
|
851
976
|
var _a;
|
|
977
|
+
|
|
852
978
|
var mode = props.mode,
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
979
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
980
|
+
dataSources = props.dataSources,
|
|
981
|
+
options = props.options,
|
|
982
|
+
_props$context = props.context,
|
|
983
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
984
|
+
width = props.width,
|
|
985
|
+
height = props.height,
|
|
986
|
+
onComputedProps = props.onComputedProps,
|
|
987
|
+
onEventTrigger = props.onEventTrigger,
|
|
988
|
+
theme = props.theme,
|
|
989
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
990
|
+
|
|
864
991
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
865
|
-
|
|
992
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
993
|
+
|
|
866
994
|
if (serializedTimezone) {
|
|
867
995
|
/*
|
|
868
996
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -876,38 +1004,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
876
1004
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
877
1005
|
}
|
|
878
1006
|
}
|
|
1007
|
+
|
|
879
1008
|
var themeFunc = function themeFunc(themeVar) {
|
|
880
1009
|
var _a, _b;
|
|
1010
|
+
|
|
881
1011
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
882
1012
|
};
|
|
1013
|
+
|
|
883
1014
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1015
|
+
|
|
884
1016
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1017
|
+
theme: theme
|
|
1018
|
+
}),
|
|
1019
|
+
currentThemeFamily = _ref.family,
|
|
1020
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1021
|
+
currentThemeDensity = _ref.density;
|
|
1022
|
+
|
|
890
1023
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1024
|
+
|
|
891
1025
|
var _React$useState = React.useState({}),
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1026
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1027
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1028
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1029
|
+
|
|
1030
|
+
|
|
895
1031
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1032
|
+
|
|
896
1033
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
897
|
-
|
|
898
|
-
|
|
1034
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1035
|
+
visualizationID = _React$useState4[0];
|
|
1036
|
+
|
|
899
1037
|
var _React$useState5 = React.useState({}),
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1038
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1039
|
+
dataSourcesInState = _React$useState6[0],
|
|
1040
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1041
|
+
|
|
903
1042
|
var _React$useState7 = React.useState(),
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1043
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1044
|
+
dataFramesInState = _React$useState8[0],
|
|
1045
|
+
setDataFramesInState = _React$useState8[1];
|
|
1046
|
+
|
|
907
1047
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1048
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1049
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1050
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1051
|
+
|
|
911
1052
|
var isMounted = React.useRef(true);
|
|
912
1053
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
913
1054
|
try {
|
|
@@ -932,11 +1073,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
932
1073
|
});
|
|
933
1074
|
} else {
|
|
934
1075
|
var dataFrames = dataFramesInState;
|
|
1076
|
+
|
|
935
1077
|
if (dataSources !== dataSourcesInState) {
|
|
936
1078
|
setDataSourcesInState(dataSources);
|
|
937
1079
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
938
1080
|
setDataFramesInState(dataFrames);
|
|
939
1081
|
}
|
|
1082
|
+
|
|
940
1083
|
return Options_1.Options.evaluate({
|
|
941
1084
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
942
1085
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -947,21 +1090,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
947
1090
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
948
1091
|
return {};
|
|
949
1092
|
}
|
|
1093
|
+
|
|
950
1094
|
return {};
|
|
951
1095
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
952
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
953
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1096
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
954
1097
|
// if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
|
|
955
1098
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1099
|
+
|
|
956
1100
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
957
1101
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1102
|
+
|
|
958
1103
|
if (isTrellisFeatureFlagOn && ((_a = vizConfig === null || vizConfig === void 0 ? void 0 : vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(VizBehavior_1.VizBehavior.TRELLIS)) && (clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.splitByLayout) === VizBehavior_1.VizBehavior.TRELLIS) {
|
|
959
1104
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
960
1105
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
961
1106
|
});
|
|
962
|
-
}
|
|
963
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1107
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
964
1108
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1109
|
+
|
|
1110
|
+
|
|
965
1111
|
React.useEffect(function () {
|
|
966
1112
|
onComputedProps(clonedEvaluatedOptions);
|
|
967
1113
|
});
|
|
@@ -971,53 +1117,68 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
971
1117
|
isMounted.current = false;
|
|
972
1118
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
973
1119
|
}
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
// present warning message if any required props are missing
|
|
1120
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1121
|
+
}, []); // present warning message if any required props are missing
|
|
1122
|
+
|
|
978
1123
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
979
|
-
|
|
980
|
-
|
|
1124
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1125
|
+
supports = vizConfig.supports;
|
|
981
1126
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1127
|
+
|
|
982
1128
|
if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
|
|
983
1129
|
) {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1130
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1131
|
+
"data-test": "missing-props-message",
|
|
1132
|
+
width: width,
|
|
1133
|
+
height: height,
|
|
1134
|
+
missingProps: missing,
|
|
1135
|
+
backgroundColor: bgColorFromTheme
|
|
1136
|
+
});
|
|
1137
|
+
} // events
|
|
1138
|
+
|
|
1139
|
+
|
|
993
1140
|
var eventCallbackProps = {};
|
|
1141
|
+
|
|
994
1142
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
995
1143
|
var supportedEvents = vizConfig.events;
|
|
996
1144
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
997
|
-
var
|
|
998
|
-
|
|
999
|
-
|
|
1145
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
1146
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
1147
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
1148
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
1000
1149
|
// then remove these lines
|
|
1001
|
-
|
|
1150
|
+
|
|
1002
1151
|
var payload = {};
|
|
1152
|
+
|
|
1003
1153
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1004
1154
|
payloadKeys.forEach(function (p) {
|
|
1005
1155
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1006
1156
|
});
|
|
1007
1157
|
}
|
|
1158
|
+
|
|
1008
1159
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1009
1160
|
if (ev && ev.payload) {
|
|
1010
1161
|
payload = ev.payload;
|
|
1011
1162
|
}
|
|
1163
|
+
|
|
1012
1164
|
return onEventTrigger({
|
|
1013
1165
|
originalEvent: ev,
|
|
1014
1166
|
payload: payload,
|
|
1015
1167
|
type: eventName
|
|
1016
1168
|
});
|
|
1017
1169
|
};
|
|
1170
|
+
|
|
1171
|
+
if (parentKeys) {
|
|
1172
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
1173
|
+
var newObject = {};
|
|
1174
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
1175
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1018
1178
|
});
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1179
|
+
} // compute pure viz props which are not from options
|
|
1180
|
+
|
|
1181
|
+
|
|
1021
1182
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1022
1183
|
themeFunc: themeFunc
|
|
1023
1184
|
}));
|
|
@@ -1035,15 +1196,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1035
1196
|
* In future, we could automatically detect which all datasources are being used
|
|
1036
1197
|
* and bind those magically to pagination/sorting behavior.
|
|
1037
1198
|
*/
|
|
1199
|
+
|
|
1038
1200
|
var dataSourceMetadata = {};
|
|
1039
1201
|
var OptionKey = 'paginateDataSourceKey';
|
|
1040
1202
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1203
|
+
|
|
1041
1204
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1042
1205
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1043
1206
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1207
|
+
|
|
1044
1208
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1045
1209
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1046
1210
|
};
|
|
1211
|
+
|
|
1047
1212
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1048
1213
|
requestParams: requestParams,
|
|
1049
1214
|
meta: meta,
|
|
@@ -1058,115 +1223,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1058
1223
|
sortParams: sortParams,
|
|
1059
1224
|
paginatorParams: paginatorParams
|
|
1060
1225
|
};
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1226
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1227
|
+
|
|
1228
|
+
|
|
1063
1229
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1064
1230
|
return null;
|
|
1065
1231
|
}
|
|
1232
|
+
|
|
1066
1233
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1067
1234
|
mode: mode,
|
|
1068
1235
|
width: width,
|
|
1069
1236
|
height: height
|
|
1070
1237
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1071
1238
|
};
|
|
1239
|
+
|
|
1072
1240
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1073
1241
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1074
1242
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1075
1243
|
theme: {}
|
|
1076
|
-
});
|
|
1077
|
-
|
|
1078
|
-
DashboardViz.config = vizConfig;
|
|
1079
|
-
|
|
1244
|
+
}); // attach viz config
|
|
1245
|
+
|
|
1246
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1247
|
+
|
|
1080
1248
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1081
1249
|
};
|
|
1250
|
+
|
|
1082
1251
|
exports.default = withDashboardViz;
|
|
1083
1252
|
|
|
1084
1253
|
/***/ }),
|
|
1085
1254
|
|
|
1086
|
-
/***/
|
|
1255
|
+
/***/ 38:
|
|
1087
1256
|
/***/ (function(module, exports) {
|
|
1088
1257
|
|
|
1089
1258
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1090
1259
|
|
|
1091
1260
|
/***/ }),
|
|
1092
1261
|
|
|
1093
|
-
/***/
|
|
1262
|
+
/***/ 39:
|
|
1094
1263
|
/***/ (function(module, exports) {
|
|
1095
1264
|
|
|
1096
1265
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1097
1266
|
|
|
1098
1267
|
/***/ }),
|
|
1099
1268
|
|
|
1100
|
-
/***/
|
|
1269
|
+
/***/ 4:
|
|
1101
1270
|
/***/ (function(module, exports) {
|
|
1102
1271
|
|
|
1103
|
-
module.exports = require("
|
|
1272
|
+
module.exports = require("styled-components");
|
|
1104
1273
|
|
|
1105
1274
|
/***/ }),
|
|
1106
1275
|
|
|
1107
|
-
/***/
|
|
1276
|
+
/***/ 40:
|
|
1108
1277
|
/***/ (function(module, exports) {
|
|
1109
1278
|
|
|
1110
|
-
module.exports = require("
|
|
1279
|
+
module.exports = require("@splunk/moment");
|
|
1111
1280
|
|
|
1112
1281
|
/***/ }),
|
|
1113
1282
|
|
|
1114
|
-
/***/
|
|
1283
|
+
/***/ 41:
|
|
1115
1284
|
/***/ (function(module, exports) {
|
|
1116
1285
|
|
|
1117
1286
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1118
1287
|
|
|
1119
1288
|
/***/ }),
|
|
1120
1289
|
|
|
1121
|
-
/***/
|
|
1290
|
+
/***/ 42:
|
|
1122
1291
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1123
1292
|
|
|
1124
1293
|
"use strict";
|
|
1125
1294
|
|
|
1126
1295
|
|
|
1127
1296
|
var _classCallCheck = __webpack_require__(9);
|
|
1297
|
+
|
|
1128
1298
|
Object.defineProperty(exports, "__esModule", {
|
|
1129
1299
|
value: true
|
|
1130
1300
|
});
|
|
1131
1301
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1132
1302
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1303
|
+
|
|
1133
1304
|
var T = __webpack_require__(0);
|
|
1305
|
+
|
|
1134
1306
|
var lodash_1 = __webpack_require__(3);
|
|
1135
|
-
|
|
1136
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1307
|
+
|
|
1308
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1309
|
+
|
|
1310
|
+
|
|
1137
1311
|
exports.INITIAL_WIDTH = 250;
|
|
1138
1312
|
exports.INITIAL_HEIGHT = 250;
|
|
1139
1313
|
/**
|
|
1140
1314
|
* A Splunk visualization
|
|
1141
1315
|
*/
|
|
1316
|
+
|
|
1142
1317
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1143
1318
|
_classCallCheck(this, SplunkVisualization);
|
|
1144
1319
|
};
|
|
1320
|
+
|
|
1145
1321
|
SplunkVisualization.propTypes = {
|
|
1146
1322
|
/**
|
|
1147
1323
|
* display mode
|
|
1148
1324
|
*/
|
|
1149
1325
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1326
|
+
|
|
1150
1327
|
/**
|
|
1151
1328
|
* width in pixel or string, defaults to 100%
|
|
1152
1329
|
*/
|
|
1153
1330
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1331
|
+
|
|
1154
1332
|
/**
|
|
1155
1333
|
* height in pixel or string
|
|
1156
1334
|
*/
|
|
1157
1335
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1336
|
+
|
|
1158
1337
|
/**
|
|
1159
1338
|
* visualization context used for dynamic option evaluation
|
|
1160
1339
|
*/
|
|
1161
1340
|
context: T.object,
|
|
1341
|
+
|
|
1162
1342
|
/**
|
|
1163
1343
|
* visualization formatting options
|
|
1164
1344
|
*/
|
|
1165
1345
|
options: T.object,
|
|
1346
|
+
|
|
1166
1347
|
/**
|
|
1167
1348
|
* A callback to update formatting options
|
|
1168
1349
|
*/
|
|
1169
1350
|
onOptionsChange: T.func,
|
|
1351
|
+
|
|
1170
1352
|
/**
|
|
1171
1353
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1172
1354
|
*/
|
|
@@ -1175,6 +1357,7 @@ SplunkVisualization.propTypes = {
|
|
|
1175
1357
|
* current request params
|
|
1176
1358
|
*/
|
|
1177
1359
|
requestParams: T.object,
|
|
1360
|
+
|
|
1178
1361
|
/**
|
|
1179
1362
|
* current dataset
|
|
1180
1363
|
*/
|
|
@@ -1182,6 +1365,7 @@ SplunkVisualization.propTypes = {
|
|
|
1182
1365
|
fields: T.array,
|
|
1183
1366
|
columns: T.array
|
|
1184
1367
|
}),
|
|
1368
|
+
|
|
1185
1369
|
/**
|
|
1186
1370
|
* error
|
|
1187
1371
|
*/
|
|
@@ -1189,29 +1373,35 @@ SplunkVisualization.propTypes = {
|
|
|
1189
1373
|
level: T.string,
|
|
1190
1374
|
message: T.string
|
|
1191
1375
|
}),
|
|
1376
|
+
|
|
1192
1377
|
/**
|
|
1193
1378
|
* meta data that came with the dataset
|
|
1194
1379
|
*/
|
|
1195
1380
|
meta: T.object
|
|
1196
1381
|
})),
|
|
1382
|
+
|
|
1197
1383
|
/**
|
|
1198
1384
|
* A callback to trigger event
|
|
1199
1385
|
*/
|
|
1200
1386
|
onEventTrigger: T.func,
|
|
1387
|
+
|
|
1201
1388
|
/**
|
|
1202
1389
|
* Inform viz if there are handlers listening to events
|
|
1203
1390
|
*/
|
|
1204
1391
|
hasEventHandlers: T.bool,
|
|
1392
|
+
|
|
1205
1393
|
/**
|
|
1206
1394
|
* A callback to communicate computed props to a consumer
|
|
1207
1395
|
*/
|
|
1208
1396
|
onComputedProps: T.func,
|
|
1397
|
+
|
|
1209
1398
|
/**
|
|
1210
1399
|
* A callback to obtain visualization api
|
|
1211
1400
|
*/
|
|
1212
1401
|
vizActionHandlerRef: T.func,
|
|
1213
1402
|
loading: T.bool,
|
|
1214
1403
|
theme: T.object,
|
|
1404
|
+
|
|
1215
1405
|
/**
|
|
1216
1406
|
* A callback to request new data with updated request params
|
|
1217
1407
|
*/
|
|
@@ -1220,6 +1410,7 @@ SplunkVisualization.propTypes = {
|
|
|
1220
1410
|
/**
|
|
1221
1411
|
*
|
|
1222
1412
|
*/
|
|
1413
|
+
|
|
1223
1414
|
SplunkVisualization.defaultProps = {
|
|
1224
1415
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1225
1416
|
width: '100%',
|
|
@@ -1248,26 +1439,29 @@ exports.default = SplunkVisualization;
|
|
|
1248
1439
|
|
|
1249
1440
|
/***/ }),
|
|
1250
1441
|
|
|
1251
|
-
/***/
|
|
1442
|
+
/***/ 43:
|
|
1252
1443
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1253
1444
|
|
|
1254
1445
|
"use strict";
|
|
1255
1446
|
|
|
1256
1447
|
|
|
1257
1448
|
var _classCallCheck = __webpack_require__(9);
|
|
1449
|
+
|
|
1258
1450
|
var _createClass = __webpack_require__(18);
|
|
1451
|
+
|
|
1259
1452
|
Object.defineProperty(exports, "__esModule", {
|
|
1260
1453
|
value: true
|
|
1261
1454
|
});
|
|
1262
1455
|
exports.DefaultVizActionHandler = void 0;
|
|
1456
|
+
|
|
1263
1457
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1264
1458
|
function DefaultVizActionHandler() {
|
|
1265
1459
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1266
1460
|
}
|
|
1461
|
+
|
|
1267
1462
|
_createClass(DefaultVizActionHandler, [{
|
|
1268
1463
|
key: "focus",
|
|
1269
|
-
value: function focus() {
|
|
1270
|
-
// noop
|
|
1464
|
+
value: function focus() {// noop
|
|
1271
1465
|
}
|
|
1272
1466
|
}, {
|
|
1273
1467
|
key: "snapshot",
|
|
@@ -1275,23 +1469,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1275
1469
|
return null; // noop
|
|
1276
1470
|
}
|
|
1277
1471
|
}]);
|
|
1472
|
+
|
|
1278
1473
|
return DefaultVizActionHandler;
|
|
1279
1474
|
}();
|
|
1280
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1281
1475
|
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
/***/ 43:
|
|
1285
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1286
|
-
|
|
1287
|
-
"use strict";
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1291
|
-
value: true
|
|
1292
|
-
});
|
|
1293
|
-
exports.validSortDirs = void 0;
|
|
1294
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1476
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1295
1477
|
|
|
1296
1478
|
/***/ }),
|
|
1297
1479
|
|
|
@@ -1305,7 +1487,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1305
1487
|
value: true
|
|
1306
1488
|
});
|
|
1307
1489
|
exports.useDeepMemo = void 0;
|
|
1490
|
+
|
|
1308
1491
|
var react_1 = __webpack_require__(1);
|
|
1492
|
+
|
|
1309
1493
|
var lodash_1 = __webpack_require__(3);
|
|
1310
1494
|
/**
|
|
1311
1495
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1320,16 +1504,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1320
1504
|
* @param fn the function to be executed and
|
|
1321
1505
|
* @param dependencies an array of dependencies
|
|
1322
1506
|
*/
|
|
1507
|
+
|
|
1508
|
+
|
|
1323
1509
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1324
1510
|
var ref = (0, react_1.useRef)();
|
|
1511
|
+
|
|
1325
1512
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1326
1513
|
ref.current = {
|
|
1327
1514
|
dependencies: dependencies,
|
|
1328
1515
|
value: fn()
|
|
1329
1516
|
};
|
|
1330
1517
|
}
|
|
1518
|
+
|
|
1331
1519
|
return ref.current.value;
|
|
1332
1520
|
};
|
|
1521
|
+
|
|
1333
1522
|
exports.useDeepMemo = useDeepMemo;
|
|
1334
1523
|
|
|
1335
1524
|
/***/ }),
|
|
@@ -1342,35 +1531,48 @@ exports.useDeepMemo = useDeepMemo;
|
|
|
1342
1531
|
|
|
1343
1532
|
var __rest = this && this.__rest || function (s, e) {
|
|
1344
1533
|
var t = {};
|
|
1534
|
+
|
|
1345
1535
|
for (var p in s) {
|
|
1346
1536
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1347
1537
|
}
|
|
1538
|
+
|
|
1348
1539
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1349
1540
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1350
1541
|
}
|
|
1351
1542
|
return t;
|
|
1352
1543
|
};
|
|
1544
|
+
|
|
1353
1545
|
Object.defineProperty(exports, "__esModule", {
|
|
1354
1546
|
value: true
|
|
1355
1547
|
});
|
|
1356
1548
|
exports.themes = exports.computeVizProps = exports.PurePunchcard = exports.config = void 0;
|
|
1549
|
+
|
|
1357
1550
|
var lodash_1 = __webpack_require__(3);
|
|
1551
|
+
|
|
1358
1552
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1553
|
+
|
|
1359
1554
|
var config_1 = __webpack_require__(445);
|
|
1360
|
-
|
|
1555
|
+
|
|
1556
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
1557
|
+
|
|
1361
1558
|
var Punchcard_1 = __webpack_require__(446);
|
|
1559
|
+
|
|
1362
1560
|
var punchcardUtils_1 = __webpack_require__(454);
|
|
1561
|
+
|
|
1363
1562
|
exports.config = config_1.default;
|
|
1364
1563
|
exports.PurePunchcard = Punchcard_1.default;
|
|
1365
1564
|
var validOptions = Object.keys(exports.config.optionsSchema);
|
|
1565
|
+
|
|
1366
1566
|
var computeVizProps = function computeVizProps(_a) {
|
|
1367
1567
|
var onPointClick = _a.onPointClick,
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1568
|
+
onLegendClick = _a.onLegendClick,
|
|
1569
|
+
x = _a.x,
|
|
1570
|
+
y = _a.y,
|
|
1571
|
+
category = _a.category,
|
|
1572
|
+
otherOptions = __rest(_a, ["onPointClick", "onLegendClick", "x", "y", "category"]);
|
|
1573
|
+
|
|
1373
1574
|
var options = (0, lodash_1.chain)(otherOptions).pick(validOptions).thru(punchcardUtils_1.convertToPunchcardProperties).value();
|
|
1575
|
+
|
|
1374
1576
|
if (options.seriesColors && typeof options.seriesColors === 'string') {
|
|
1375
1577
|
try {
|
|
1376
1578
|
options.seriesColors = JSON.parse(options.seriesColors);
|
|
@@ -1378,6 +1580,7 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
1378
1580
|
options.seriesColors = visualization_color_palettes_1.VIZ_CATEGORICAL;
|
|
1379
1581
|
}
|
|
1380
1582
|
}
|
|
1583
|
+
|
|
1381
1584
|
return Object.assign({
|
|
1382
1585
|
onPointClick: onPointClick,
|
|
1383
1586
|
onLegendClick: onLegendClick,
|
|
@@ -1387,6 +1590,7 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
1387
1590
|
category: category && category.map(String)
|
|
1388
1591
|
}, options);
|
|
1389
1592
|
};
|
|
1593
|
+
|
|
1390
1594
|
exports.computeVizProps = computeVizProps;
|
|
1391
1595
|
var viz = (0, withDashboardViz_1.default)({
|
|
1392
1596
|
ReactViz: Punchcard_1.default,
|
|
@@ -1407,24 +1611,35 @@ exports.default = viz;
|
|
|
1407
1611
|
Object.defineProperty(exports, "__esModule", {
|
|
1408
1612
|
value: true
|
|
1409
1613
|
});
|
|
1614
|
+
|
|
1410
1615
|
var i18n_1 = __webpack_require__(2);
|
|
1616
|
+
|
|
1411
1617
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1618
|
+
|
|
1412
1619
|
var visualization_icons_1 = __webpack_require__(52);
|
|
1620
|
+
|
|
1413
1621
|
var placeholders_1 = __webpack_require__(50);
|
|
1622
|
+
|
|
1414
1623
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1624
|
+
|
|
1415
1625
|
var pick_1 = __webpack_require__(23);
|
|
1626
|
+
|
|
1416
1627
|
var variables_1 = __webpack_require__(11);
|
|
1628
|
+
|
|
1417
1629
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1418
|
-
|
|
1630
|
+
|
|
1631
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
1632
|
+
|
|
1419
1633
|
var configUtils_1 = __webpack_require__(20);
|
|
1634
|
+
|
|
1420
1635
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
1636
|
+
|
|
1421
1637
|
var dataContract = {
|
|
1422
1638
|
requiredDataSources: [{
|
|
1423
1639
|
name: 'primary',
|
|
1424
1640
|
description: 'DataSource that powers the visualization'
|
|
1425
1641
|
}],
|
|
1426
|
-
optionalDataSources: [
|
|
1427
|
-
// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1642
|
+
optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1428
1643
|
// {
|
|
1429
1644
|
// name: 'annotation',
|
|
1430
1645
|
// description: 'DataSource that populate event annotations',
|
|
@@ -1659,8 +1874,7 @@ var editorConfig = [{
|
|
|
1659
1874
|
value: 'categorical'
|
|
1660
1875
|
}]
|
|
1661
1876
|
}
|
|
1662
|
-
}], [
|
|
1663
|
-
// This should be hidden in categorical color mode
|
|
1877
|
+
}], [// This should be hidden in categorical color mode
|
|
1664
1878
|
{
|
|
1665
1879
|
label: (0, i18n_1._)('Color by field'),
|
|
1666
1880
|
editor: 'editor.columnSelector',
|
|
@@ -1706,16 +1920,19 @@ var editorConfig = [{
|
|
|
1706
1920
|
/**
|
|
1707
1921
|
* visualization configuration
|
|
1708
1922
|
*/
|
|
1923
|
+
|
|
1709
1924
|
var config = {
|
|
1710
1925
|
/**
|
|
1711
1926
|
* unique viz key
|
|
1712
1927
|
*/
|
|
1713
1928
|
key: 'splunk.punchcard',
|
|
1929
|
+
|
|
1714
1930
|
/**
|
|
1715
1931
|
* viz name
|
|
1716
1932
|
*/
|
|
1717
1933
|
name: (0, i18n_1._)('Punchcard'),
|
|
1718
1934
|
category: VizCategory_1.VizCategory.CORRELATION,
|
|
1935
|
+
|
|
1719
1936
|
/**
|
|
1720
1937
|
* viz icon
|
|
1721
1938
|
*/
|
|
@@ -1749,23 +1966,41 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
|
1749
1966
|
|
|
1750
1967
|
|
|
1751
1968
|
var _defineProperty = __webpack_require__(7);
|
|
1969
|
+
|
|
1752
1970
|
var _slicedToArray = __webpack_require__(17);
|
|
1971
|
+
|
|
1753
1972
|
Object.defineProperty(exports, "__esModule", {
|
|
1754
1973
|
value: true
|
|
1755
1974
|
});
|
|
1975
|
+
|
|
1756
1976
|
var React = __webpack_require__(1);
|
|
1977
|
+
|
|
1757
1978
|
var styled_components_1 = __webpack_require__(4);
|
|
1979
|
+
|
|
1758
1980
|
var T = __webpack_require__(0);
|
|
1981
|
+
|
|
1759
1982
|
var lodash_1 = __webpack_require__(3);
|
|
1983
|
+
|
|
1984
|
+
var types_1 = __webpack_require__(83);
|
|
1985
|
+
|
|
1760
1986
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
1987
|
+
|
|
1761
1988
|
var style_1 = __webpack_require__(14);
|
|
1989
|
+
|
|
1762
1990
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1991
|
+
|
|
1763
1992
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
1993
|
+
|
|
1764
1994
|
var sortUtils_1 = __webpack_require__(447);
|
|
1995
|
+
|
|
1765
1996
|
var PunchcardAxis_1 = __webpack_require__(448);
|
|
1997
|
+
|
|
1766
1998
|
var PunchcardChartArea_1 = __webpack_require__(449);
|
|
1999
|
+
|
|
1767
2000
|
var PunchcardLegend_1 = __webpack_require__(452);
|
|
2001
|
+
|
|
1768
2002
|
var PunchcardGridLines_1 = __webpack_require__(453);
|
|
2003
|
+
|
|
1769
2004
|
var Container = styled_components_1.default.div.withConfig({
|
|
1770
2005
|
displayName: "Punchcard__Container",
|
|
1771
2006
|
componentId: "orvtgq-0"
|
|
@@ -1792,72 +2027,81 @@ var PunchcardSVG = styled_components_1.default.svg.withConfig({
|
|
|
1792
2027
|
})(["", ";"], function (props) {
|
|
1793
2028
|
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
1794
2029
|
});
|
|
2030
|
+
|
|
1795
2031
|
var Punchcard = function Punchcard(props) {
|
|
1796
2032
|
var _React$useState = React.useState(null),
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
2033
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2034
|
+
selectedX = _React$useState2[0],
|
|
2035
|
+
setSelectedX = _React$useState2[1];
|
|
2036
|
+
|
|
1800
2037
|
var _React$useState3 = React.useState(null),
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
2038
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2039
|
+
selectedY = _React$useState4[0],
|
|
2040
|
+
setSelectedY = _React$useState4[1];
|
|
2041
|
+
|
|
1804
2042
|
var _React$useState5 = React.useState(null),
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
2043
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2044
|
+
selectedCategory = _React$useState6[0],
|
|
2045
|
+
setSelectedCategory = _React$useState6[1];
|
|
2046
|
+
|
|
1808
2047
|
var handleMouseLeave = function handleMouseLeave() {
|
|
1809
2048
|
setSelectedX(null);
|
|
1810
2049
|
setSelectedY(null);
|
|
1811
2050
|
setSelectedCategory(null);
|
|
1812
2051
|
};
|
|
2052
|
+
|
|
1813
2053
|
var handleLegendHover = function handleLegendHover(category) {
|
|
1814
2054
|
setSelectedX(null);
|
|
1815
2055
|
setSelectedY(null);
|
|
1816
2056
|
setSelectedCategory(category);
|
|
1817
2057
|
};
|
|
2058
|
+
|
|
1818
2059
|
var handleXAxisHover = function handleXAxisHover(xValue) {
|
|
1819
2060
|
setSelectedX(xValue);
|
|
1820
2061
|
setSelectedY(null);
|
|
1821
2062
|
setSelectedCategory(null);
|
|
1822
2063
|
};
|
|
2064
|
+
|
|
1823
2065
|
var handleYAxisHover = function handleYAxisHover(yValue) {
|
|
1824
2066
|
setSelectedX(null);
|
|
1825
2067
|
setSelectedY(yValue);
|
|
1826
2068
|
setSelectedCategory(null);
|
|
1827
2069
|
};
|
|
2070
|
+
|
|
1828
2071
|
var handleBubbleHover = function handleBubbleHover(xValue, yValue, category) {
|
|
1829
2072
|
setSelectedX(xValue);
|
|
1830
2073
|
setSelectedY(yValue);
|
|
1831
2074
|
setSelectedCategory(category);
|
|
1832
2075
|
};
|
|
2076
|
+
|
|
1833
2077
|
var backgroundColor = props.backgroundColor,
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
2078
|
+
showBubbleLabels = props.showBubbleLabels,
|
|
2079
|
+
bubbleRowScale = props.bubbleRowScale,
|
|
2080
|
+
bubbleScale = props.bubbleScale,
|
|
2081
|
+
category = props.category,
|
|
2082
|
+
categoryField = props.categoryField,
|
|
2083
|
+
colorMode = props.colorMode,
|
|
2084
|
+
seriesColors = props.seriesColors,
|
|
2085
|
+
bubbleColor = props.bubbleColor,
|
|
2086
|
+
minBubbleColorIntensity = props.minBubbleColorIntensity,
|
|
2087
|
+
height = props.height,
|
|
2088
|
+
showMaxValuePulsation = props.showMaxValuePulsation,
|
|
2089
|
+
isBubbleSizeDynamic = props.isBubbleSizeDynamic,
|
|
2090
|
+
minBubbleSize = props.minBubbleSize,
|
|
2091
|
+
maxBubbleSize = props.maxBubbleSize,
|
|
2092
|
+
maxBubbleRadius = props.maxBubbleRadius,
|
|
2093
|
+
minBubbleRadius = props.minBubbleRadius,
|
|
2094
|
+
useDefaultSort = props.useDefaultSort,
|
|
2095
|
+
showLegend = props.showLegend,
|
|
2096
|
+
size = props.size,
|
|
2097
|
+
sizeField = props.sizeField,
|
|
2098
|
+
width = props.width,
|
|
2099
|
+
x = props.x,
|
|
2100
|
+
y = props.y,
|
|
2101
|
+
xField = props.xField,
|
|
2102
|
+
yField = props.yField,
|
|
2103
|
+
onPointClick = props.onPointClick,
|
|
2104
|
+
onLegendClick = props.onLegendClick;
|
|
1861
2105
|
var calculatedColorMode = category ? colorMode : punchcardUtils_1.COLOR_MODE_TYPES.SEQUENTIAL;
|
|
1862
2106
|
var displayLegend = showLegend && calculatedColorMode === punchcardUtils_1.COLOR_MODE_TYPES.CATEGORICAL;
|
|
1863
2107
|
var uniqX = useDefaultSort ? (0, sortUtils_1.sortAxis)((0, lodash_1.uniq)(x.map(function (v) {
|
|
@@ -1867,13 +2111,18 @@ var Punchcard = function Punchcard(props) {
|
|
|
1867
2111
|
return "".concat(v);
|
|
1868
2112
|
}))) : (0, lodash_1.uniq)(y);
|
|
1869
2113
|
var uniqCategory = (0, lodash_1.uniq)(category);
|
|
2114
|
+
var bubbleSizes = size.map(function (v) {
|
|
2115
|
+
return (0, types_1.isNumber)(v) ? Number(v) : null;
|
|
2116
|
+
});
|
|
1870
2117
|
var colorCategoryMapping = (0, punchcardUtils_1.getColorCategoryMapping)({
|
|
1871
2118
|
category: uniqCategory,
|
|
1872
2119
|
colorMode: calculatedColorMode,
|
|
1873
2120
|
seriesColors: seriesColors
|
|
1874
2121
|
});
|
|
2122
|
+
|
|
1875
2123
|
var handlePointClick = function handlePointClick(sizeValue) {
|
|
1876
2124
|
var _rowData;
|
|
2125
|
+
|
|
1877
2126
|
var rowData = (_rowData = {}, _defineProperty(_rowData, "row.".concat(xField, ".value"), selectedX), _defineProperty(_rowData, "row.".concat(yField, ".value"), selectedY), _defineProperty(_rowData, "row.".concat(sizeField, ".value"), sizeValue), _rowData);
|
|
1878
2127
|
if (categoryField) rowData["row.".concat(categoryField, ".value")] = selectedCategory;
|
|
1879
2128
|
onPointClick({
|
|
@@ -1884,6 +2133,7 @@ var Punchcard = function Punchcard(props) {
|
|
|
1884
2133
|
}, rowData)
|
|
1885
2134
|
});
|
|
1886
2135
|
};
|
|
2136
|
+
|
|
1887
2137
|
var handleLegendClick = function handleLegendClick() {
|
|
1888
2138
|
onLegendClick({
|
|
1889
2139
|
type: 'legend.click',
|
|
@@ -1892,35 +2142,40 @@ var Punchcard = function Punchcard(props) {
|
|
|
1892
2142
|
}
|
|
1893
2143
|
});
|
|
1894
2144
|
};
|
|
2145
|
+
|
|
1895
2146
|
var renderVisualization = function renderVisualization(_ref) {
|
|
1896
2147
|
var containerWidth = _ref.width,
|
|
1897
|
-
|
|
2148
|
+
containerHeight = _ref.height;
|
|
2149
|
+
|
|
1898
2150
|
var _ref2 = (0, punchcardUtils_1.getChartAreaDimensions)({
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2151
|
+
containerWidth: containerWidth,
|
|
2152
|
+
containerHeight: containerHeight,
|
|
2153
|
+
displayLegend: displayLegend
|
|
2154
|
+
}),
|
|
2155
|
+
xAxisStartY = _ref2.xAxisStartY,
|
|
2156
|
+
yAxisStartX = _ref2.yAxisStartX,
|
|
2157
|
+
chartAreaStartX = _ref2.chartAreaStartX,
|
|
2158
|
+
chartAreaStartY = _ref2.chartAreaStartY,
|
|
2159
|
+
chartAreaEndX = _ref2.chartAreaEndX,
|
|
2160
|
+
chartAreaEndY = _ref2.chartAreaEndY,
|
|
2161
|
+
legendStartX = _ref2.legendStartX;
|
|
2162
|
+
|
|
1910
2163
|
var _ref3 = (0, punchcardUtils_1.getScales)({
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2164
|
+
values: uniqX,
|
|
2165
|
+
start: chartAreaStartX,
|
|
2166
|
+
end: chartAreaEndX
|
|
2167
|
+
}),
|
|
2168
|
+
xScale = _ref3.scale,
|
|
2169
|
+
xPositionScale = _ref3.positionScale;
|
|
2170
|
+
|
|
1917
2171
|
var _ref4 = (0, punchcardUtils_1.getScales)({
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
2172
|
+
values: uniqY,
|
|
2173
|
+
start: chartAreaStartY,
|
|
2174
|
+
end: chartAreaEndY
|
|
2175
|
+
}),
|
|
2176
|
+
yScale = _ref4.scale,
|
|
2177
|
+
yPositionScale = _ref4.positionScale;
|
|
2178
|
+
|
|
1924
2179
|
var minBand = Math.min(xScale.bandwidth(), yScale.bandwidth());
|
|
1925
2180
|
return React.createElement(PunchcardWrapper, {
|
|
1926
2181
|
backgroundColor: backgroundColor
|
|
@@ -1987,7 +2242,7 @@ var Punchcard = function Punchcard(props) {
|
|
|
1987
2242
|
selectedCategory: selectedCategory,
|
|
1988
2243
|
selectedX: selectedX,
|
|
1989
2244
|
selectedY: selectedY,
|
|
1990
|
-
size:
|
|
2245
|
+
size: bubbleSizes,
|
|
1991
2246
|
x: x,
|
|
1992
2247
|
xScale: xPositionScale,
|
|
1993
2248
|
y: y,
|
|
@@ -2000,6 +2255,7 @@ var Punchcard = function Punchcard(props) {
|
|
|
2000
2255
|
values: "0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"
|
|
2001
2256
|
})))));
|
|
2002
2257
|
};
|
|
2258
|
+
|
|
2003
2259
|
return React.createElement(Container, {
|
|
2004
2260
|
backgroundColor: backgroundColor,
|
|
2005
2261
|
height: height,
|
|
@@ -2008,6 +2264,7 @@ var Punchcard = function Punchcard(props) {
|
|
|
2008
2264
|
return renderVisualization(containerDimension);
|
|
2009
2265
|
}));
|
|
2010
2266
|
};
|
|
2267
|
+
|
|
2011
2268
|
var propTypes = {
|
|
2012
2269
|
backgroundColor: T.string,
|
|
2013
2270
|
showBubbleLabels: T.oneOf(Object.values(punchcardUtils_1.BUBBLE_LABELS_TYPES)),
|
|
@@ -2035,7 +2292,7 @@ var propTypes = {
|
|
|
2035
2292
|
// implemented in config file using requiredProps
|
|
2036
2293
|
x: T.arrayOf(T.oneOfType([T.string, T.number])),
|
|
2037
2294
|
y: T.arrayOf(T.oneOfType([T.string, T.number])),
|
|
2038
|
-
size: T.arrayOf(T.number),
|
|
2295
|
+
size: T.arrayOf(T.oneOfType([T.string, T.number])),
|
|
2039
2296
|
xField: T.string,
|
|
2040
2297
|
yField: T.string,
|
|
2041
2298
|
onPointClick: T.func,
|
|
@@ -2091,7 +2348,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2091
2348
|
/* harmony import */ var lodash_findIndex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_findIndex__WEBPACK_IMPORTED_MODULE_0__);
|
|
2092
2349
|
/* harmony import */ var lodash_find__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(113);
|
|
2093
2350
|
/* harmony import */ var lodash_find__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_find__WEBPACK_IMPORTED_MODULE_1__);
|
|
2094
|
-
/* harmony import */ var lodash_sortBy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
2351
|
+
/* harmony import */ var lodash_sortBy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(171);
|
|
2095
2352
|
/* harmony import */ var lodash_sortBy__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_sortBy__WEBPACK_IMPORTED_MODULE_2__);
|
|
2096
2353
|
/* harmony import */ var lodash_flattenDeep__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(139);
|
|
2097
2354
|
/* harmony import */ var lodash_flattenDeep__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_flattenDeep__WEBPACK_IMPORTED_MODULE_3__);
|
|
@@ -2190,78 +2447,82 @@ var TIME_RANGES = {
|
|
|
2190
2447
|
'sun.': true
|
|
2191
2448
|
}]
|
|
2192
2449
|
};
|
|
2193
|
-
|
|
2194
2450
|
/**
|
|
2195
2451
|
* Sort axis labels by weekday
|
|
2196
2452
|
* @param {array} axis - string array
|
|
2197
2453
|
* @return {array} - string array. If those are not weekday strings, return []
|
|
2198
2454
|
*/
|
|
2455
|
+
|
|
2199
2456
|
var sortedByWeekday = function sortedByWeekday(axis) {
|
|
2200
2457
|
var sortedAxis = [];
|
|
2201
2458
|
var notWeekDay = lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(axis, function (value) {
|
|
2202
2459
|
var lowerValue = value.toLowerCase();
|
|
2203
2460
|
var index = lodash_findIndex__WEBPACK_IMPORTED_MODULE_0___default()(TIME_RANGES.wday, lowerValue);
|
|
2461
|
+
|
|
2204
2462
|
if (index === -1) {
|
|
2205
2463
|
// if the axis contains any value not inside weekdays, then don't treat it as weekdays
|
|
2206
2464
|
return true;
|
|
2207
2465
|
}
|
|
2466
|
+
|
|
2208
2467
|
if (sortedAxis[index]) {
|
|
2209
2468
|
sortedAxis[index] = [sortedAxis[index], value];
|
|
2210
2469
|
} else {
|
|
2211
2470
|
sortedAxis[index] = value;
|
|
2212
2471
|
}
|
|
2472
|
+
|
|
2213
2473
|
return false;
|
|
2214
2474
|
});
|
|
2215
2475
|
return notWeekDay ? [] : lodash_flattenDeep__WEBPACK_IMPORTED_MODULE_3___default()(sortedAxis.filter(Boolean));
|
|
2216
2476
|
};
|
|
2217
|
-
|
|
2218
2477
|
/**
|
|
2219
2478
|
* Sort axis labels by month
|
|
2220
2479
|
* @param {array} axis - string array
|
|
2221
2480
|
* @return {array} - string array. If those are not month strings, return []
|
|
2222
2481
|
*/
|
|
2482
|
+
|
|
2223
2483
|
var sortedByMonth = function sortedByMonth(axis) {
|
|
2224
2484
|
var sortedAxis = [];
|
|
2225
2485
|
var notMonth = lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(axis, function (value) {
|
|
2226
2486
|
var lowerValue = value.toLowerCase();
|
|
2227
2487
|
var index = lodash_findIndex__WEBPACK_IMPORTED_MODULE_0___default()(TIME_RANGES.month, lowerValue);
|
|
2488
|
+
|
|
2228
2489
|
if (index === -1) {
|
|
2229
2490
|
// if the axis contains any value not inside month, then don't treat it as month
|
|
2230
2491
|
return true;
|
|
2231
2492
|
}
|
|
2493
|
+
|
|
2232
2494
|
if (sortedAxis[index]) {
|
|
2233
2495
|
sortedAxis[index] = [sortedAxis[index], value];
|
|
2234
2496
|
} else {
|
|
2235
2497
|
sortedAxis[index] = value;
|
|
2236
2498
|
}
|
|
2499
|
+
|
|
2237
2500
|
return false;
|
|
2238
2501
|
});
|
|
2239
2502
|
return notMonth ? [] : lodash_flattenDeep__WEBPACK_IMPORTED_MODULE_3___default()(sortedAxis.filter(Boolean));
|
|
2240
2503
|
};
|
|
2241
|
-
|
|
2242
2504
|
/**
|
|
2243
2505
|
* Sort axis labels by date time
|
|
2244
2506
|
* @param {array} axis - string array
|
|
2245
2507
|
* @return {array} - string array. If those are not in acceptTimeFormat or formatted date, return []
|
|
2246
2508
|
*/
|
|
2509
|
+
|
|
2247
2510
|
var sortedByDTime = function sortedByDTime(axis) {
|
|
2248
2511
|
// valid time format 01:00 am, 01:00:00, 01:00
|
|
2249
|
-
var acceptTimeFormat = [/^([0-1])?\d( )?(am|pm)$/i,
|
|
2250
|
-
|
|
2251
|
-
/^([0-
|
|
2252
|
-
// 01:00 am, 01:00am, 1:00am
|
|
2253
|
-
/^([0-2])?\d:([0-5]\d:)?[0-5]\d$/,
|
|
2254
|
-
// 01:00:00, 1:00:00, 23:00
|
|
2512
|
+
var acceptTimeFormat = [/^([0-1])?\d( )?(am|pm)$/i, // 1am, 1 am, 12am, 12 am
|
|
2513
|
+
/^([0-1])?\d:[0-5]\d( )?(am|pm)$/i, // 01:00 am, 01:00am, 1:00am
|
|
2514
|
+
/^([0-2])?\d:([0-5]\d:)?[0-5]\d$/, // 01:00:00, 1:00:00, 23:00
|
|
2255
2515
|
/^([0-2])?\d:[0-5]\d:[0-5]\d( )?(am|pm)$/i // 01:00:00 am, 1:00:00am
|
|
2256
2516
|
];
|
|
2257
|
-
|
|
2258
2517
|
var sortArr = [];
|
|
2259
2518
|
var notDate = lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(axis, function (value) {
|
|
2260
2519
|
if (!Number.isNaN(Number(value))) {
|
|
2261
2520
|
return true;
|
|
2262
|
-
}
|
|
2263
|
-
|
|
2521
|
+
} // should accept long date: 2019-03-02, Mar 2 2019, ..., 2019-01-01T00:00:00.000Z
|
|
2522
|
+
|
|
2523
|
+
|
|
2264
2524
|
var convertedDate = new Date(value);
|
|
2525
|
+
|
|
2265
2526
|
if (!Number.isNaN(Number(convertedDate))) {
|
|
2266
2527
|
sortArr.push({
|
|
2267
2528
|
epoch: convertedDate,
|
|
@@ -2269,19 +2530,23 @@ var sortedByDTime = function sortedByDTime(axis) {
|
|
|
2269
2530
|
});
|
|
2270
2531
|
return false;
|
|
2271
2532
|
}
|
|
2533
|
+
|
|
2272
2534
|
var acceptedTime = acceptTimeFormat.find(function (format) {
|
|
2273
2535
|
return format.test(value);
|
|
2274
2536
|
});
|
|
2537
|
+
|
|
2275
2538
|
if (acceptedTime) {
|
|
2276
2539
|
var midday = /(am|pm)$/i;
|
|
2277
2540
|
var reformatTime = value;
|
|
2278
2541
|
var containsMidday = value.match(midday);
|
|
2542
|
+
|
|
2279
2543
|
if (containsMidday) {
|
|
2280
2544
|
// for time format like 01:00 am and 1 am
|
|
2281
2545
|
reformatTime = value.split(midday).slice(0, -1);
|
|
2282
2546
|
reformatTime[0] = "".concat(reformatTime[0].trim(), ":00");
|
|
2283
2547
|
reformatTime = reformatTime.join(' ');
|
|
2284
2548
|
}
|
|
2549
|
+
|
|
2285
2550
|
convertedDate = new Date("1970/01/01 ".concat(reformatTime));
|
|
2286
2551
|
sortArr.push({
|
|
2287
2552
|
epoch: convertedDate,
|
|
@@ -2289,55 +2554,66 @@ var sortedByDTime = function sortedByDTime(axis) {
|
|
|
2289
2554
|
});
|
|
2290
2555
|
return false;
|
|
2291
2556
|
}
|
|
2557
|
+
|
|
2292
2558
|
return true;
|
|
2293
2559
|
});
|
|
2560
|
+
|
|
2294
2561
|
if (notDate) {
|
|
2295
2562
|
return [];
|
|
2296
2563
|
}
|
|
2564
|
+
|
|
2297
2565
|
return lodash_sortBy__WEBPACK_IMPORTED_MODULE_2___default()(sortArr, function (val) {
|
|
2298
2566
|
return val.epoch;
|
|
2299
2567
|
}).map(function (val) {
|
|
2300
2568
|
return val.original;
|
|
2301
2569
|
});
|
|
2302
2570
|
};
|
|
2303
|
-
|
|
2304
2571
|
/**
|
|
2305
2572
|
* Sort axis labels by digits or alphabetical order
|
|
2306
2573
|
* @param {array} axis - string array
|
|
2307
2574
|
* @return {array} - string array.
|
|
2308
2575
|
* If those inputs are numbers, then return in digits order. Otherwise, return array based on alphabetical order
|
|
2309
2576
|
*/
|
|
2577
|
+
|
|
2310
2578
|
var sortByDigitOrAlpha = function sortByDigitOrAlpha(axis) {
|
|
2311
2579
|
// 10, 10.0, 10.1, not accept 10,000.0
|
|
2312
2580
|
var coercedIsFinite = function coercedIsFinite(num) {
|
|
2313
2581
|
return Number.isFinite(Number(num));
|
|
2314
2582
|
};
|
|
2583
|
+
|
|
2315
2584
|
if (Object(lodash__WEBPACK_IMPORTED_MODULE_4__["every"])(axis, coercedIsFinite)) {
|
|
2316
2585
|
return axis.sort(function (a, b) {
|
|
2317
2586
|
return Number(a) - Number(b);
|
|
2318
2587
|
});
|
|
2319
2588
|
}
|
|
2589
|
+
|
|
2320
2590
|
return axis.sort();
|
|
2321
2591
|
};
|
|
2322
|
-
|
|
2323
2592
|
/**
|
|
2324
2593
|
* Sort axis based on the priority: time measures, numbers, strings in ascending order
|
|
2325
2594
|
* @param {array} axis - string array
|
|
2326
2595
|
* @return {array} - string array
|
|
2327
2596
|
*/
|
|
2597
|
+
|
|
2328
2598
|
var sortAxis = function sortAxis(axis) {
|
|
2329
2599
|
var sortedTimeAxis = sortedByDTime(axis);
|
|
2600
|
+
|
|
2330
2601
|
if (sortedTimeAxis.length) {
|
|
2331
2602
|
return sortedTimeAxis;
|
|
2332
2603
|
}
|
|
2604
|
+
|
|
2333
2605
|
var sortedWeekdays = sortedByWeekday(axis);
|
|
2606
|
+
|
|
2334
2607
|
if (sortedWeekdays.length) {
|
|
2335
2608
|
return sortedWeekdays;
|
|
2336
2609
|
}
|
|
2610
|
+
|
|
2337
2611
|
var sortedMonths = sortedByMonth(axis);
|
|
2612
|
+
|
|
2338
2613
|
if (sortedMonths.length) {
|
|
2339
2614
|
return sortedMonths;
|
|
2340
2615
|
}
|
|
2616
|
+
|
|
2341
2617
|
return sortByDigitOrAlpha(axis);
|
|
2342
2618
|
};
|
|
2343
2619
|
|
|
@@ -2352,12 +2628,19 @@ var sortAxis = function sortAxis(axis) {
|
|
|
2352
2628
|
Object.defineProperty(exports, "__esModule", {
|
|
2353
2629
|
value: true
|
|
2354
2630
|
});
|
|
2631
|
+
|
|
2355
2632
|
var React = __webpack_require__(1);
|
|
2633
|
+
|
|
2356
2634
|
var T = __webpack_require__(0);
|
|
2635
|
+
|
|
2357
2636
|
var styled_components_1 = __webpack_require__(4);
|
|
2637
|
+
|
|
2358
2638
|
var pick_1 = __webpack_require__(23);
|
|
2639
|
+
|
|
2359
2640
|
var variables_1 = __webpack_require__(11);
|
|
2641
|
+
|
|
2360
2642
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
2643
|
+
|
|
2361
2644
|
var AxisLabelText = styled_components_1.default.text.withConfig({
|
|
2362
2645
|
displayName: "PunchcardAxis__AxisLabelText",
|
|
2363
2646
|
componentId: "sc-1jv7cdw-0"
|
|
@@ -2370,21 +2653,22 @@ var AxisLabelText = styled_components_1.default.text.withConfig({
|
|
|
2370
2653
|
}, function (props) {
|
|
2371
2654
|
return props.muted ? 0.15 : 1;
|
|
2372
2655
|
});
|
|
2656
|
+
|
|
2373
2657
|
var PunchcardAxis = function PunchcardAxis(props) {
|
|
2374
2658
|
var labels = props.labels,
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2659
|
+
handleMouseEnter = props.handleMouseEnter,
|
|
2660
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
2661
|
+
orientation = props.orientation,
|
|
2662
|
+
scale = props.scale,
|
|
2663
|
+
selected = props.selected,
|
|
2664
|
+
startPositionX = props.startPositionX,
|
|
2665
|
+
startPositionY = props.startPositionY;
|
|
2382
2666
|
return React.createElement("g", null, labels.map(function (label, index) {
|
|
2383
2667
|
// Space between labels either in x or y direction depending on orientation
|
|
2384
2668
|
var positionDelta = index * scale.bandwidth() + scale.bandwidth() / 2;
|
|
2385
2669
|
var xPosition = orientation === punchcardUtils_1.AXIS_ORIENTATION_TYPES.VERTICAL ? startPositionX : startPositionX + positionDelta;
|
|
2386
|
-
var yPosition = orientation === punchcardUtils_1.AXIS_ORIENTATION_TYPES.VERTICAL ? startPositionY + positionDelta : startPositionY;
|
|
2387
|
-
|
|
2670
|
+
var yPosition = orientation === punchcardUtils_1.AXIS_ORIENTATION_TYPES.VERTICAL ? startPositionY + positionDelta : startPositionY; // create padding between x-axis labels
|
|
2671
|
+
|
|
2388
2672
|
var xAxisWidthScale = scale.copy().paddingInner(0.1).round(true);
|
|
2389
2673
|
var truncatedLabel = orientation === punchcardUtils_1.AXIS_ORIENTATION_TYPES.VERTICAL ? (0, punchcardUtils_1.truncateAxisLabelText)({
|
|
2390
2674
|
label: "".concat(label)
|
|
@@ -2405,6 +2689,7 @@ var PunchcardAxis = function PunchcardAxis(props) {
|
|
|
2405
2689
|
}, React.createElement("title", null, label), truncatedLabel);
|
|
2406
2690
|
}));
|
|
2407
2691
|
};
|
|
2692
|
+
|
|
2408
2693
|
var propTypes = {
|
|
2409
2694
|
labels: T.arrayOf(T.oneOfType([T.string, T.number])).isRequired,
|
|
2410
2695
|
handleMouseEnter: T.func,
|
|
@@ -2442,42 +2727,50 @@ exports.default = PunchcardAxis;
|
|
|
2442
2727
|
|
|
2443
2728
|
|
|
2444
2729
|
var _toConsumableArray = __webpack_require__(8);
|
|
2730
|
+
|
|
2445
2731
|
var _slicedToArray = __webpack_require__(17);
|
|
2732
|
+
|
|
2446
2733
|
Object.defineProperty(exports, "__esModule", {
|
|
2447
2734
|
value: true
|
|
2448
2735
|
});
|
|
2736
|
+
|
|
2449
2737
|
var React = __webpack_require__(1);
|
|
2738
|
+
|
|
2450
2739
|
var T = __webpack_require__(0);
|
|
2740
|
+
|
|
2451
2741
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
2742
|
+
|
|
2452
2743
|
var PunchcardRow_1 = __webpack_require__(450);
|
|
2744
|
+
|
|
2453
2745
|
var PunchcardChartArea = function PunchcardChartArea(props) {
|
|
2454
2746
|
var showBubbleLabels = props.showBubbleLabels,
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2747
|
+
bubbleRowScale = props.bubbleRowScale,
|
|
2748
|
+
bubbleScale = props.bubbleScale,
|
|
2749
|
+
category = props.category,
|
|
2750
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
2751
|
+
colorMode = props.colorMode,
|
|
2752
|
+
bubbleColor = props.bubbleColor,
|
|
2753
|
+
handleMouseEnter = props.handleMouseEnter,
|
|
2754
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
2755
|
+
isBubbleSizeDynamic = props.isBubbleSizeDynamic,
|
|
2756
|
+
minBubbleColorIntensity = props.minBubbleColorIntensity,
|
|
2757
|
+
minBand = props.minBand,
|
|
2758
|
+
minBubbleSize = props.minBubbleSize,
|
|
2759
|
+
maxBubbleSize = props.maxBubbleSize,
|
|
2760
|
+
maxBubbleRadius = props.maxBubbleRadius,
|
|
2761
|
+
minBubbleRadius = props.minBubbleRadius,
|
|
2762
|
+
showMaxValuePulsation = props.showMaxValuePulsation,
|
|
2763
|
+
selectedCategory = props.selectedCategory,
|
|
2764
|
+
selectedX = props.selectedX,
|
|
2765
|
+
selectedY = props.selectedY,
|
|
2766
|
+
size = props.size,
|
|
2767
|
+
x = props.x,
|
|
2768
|
+
xScale = props.xScale,
|
|
2769
|
+
y = props.y,
|
|
2770
|
+
yScale = props.yScale,
|
|
2771
|
+
handlePointClick = props.handlePointClick;
|
|
2480
2772
|
/** @type {Object<String\|Number, import('./utils/punchcardUtils').RowData>} */
|
|
2773
|
+
|
|
2481
2774
|
var dataByRows = (0, punchcardUtils_1.getDataByRows)({
|
|
2482
2775
|
bubbleRowScale: bubbleRowScale,
|
|
2483
2776
|
bubbleScale: bubbleScale,
|
|
@@ -2498,15 +2791,16 @@ var PunchcardChartArea = function PunchcardChartArea(props) {
|
|
|
2498
2791
|
});
|
|
2499
2792
|
return React.createElement("g", null, Object.entries(dataByRows).map(function (_ref) {
|
|
2500
2793
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
2501
|
-
|
|
2502
|
-
|
|
2794
|
+
row = _ref2[0],
|
|
2795
|
+
rowData = _ref2[1];
|
|
2796
|
+
|
|
2503
2797
|
var rowXValues = rowData.rowXValues,
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2798
|
+
rowSizeValues = rowData.rowSizeValues,
|
|
2799
|
+
rowCategoryValues = rowData.rowCategoryValues,
|
|
2800
|
+
rowColorValues = rowData.rowColorValues,
|
|
2801
|
+
rowFillOpacityValues = rowData.rowFillOpacityValues,
|
|
2802
|
+
rowSizeScale = rowData.rowSizeScale,
|
|
2803
|
+
rowRadiusValues = rowData.rowRadiusValues;
|
|
2510
2804
|
var yPosition = yScale(row);
|
|
2511
2805
|
return React.createElement(PunchcardRow_1.default, {
|
|
2512
2806
|
key: row,
|
|
@@ -2532,6 +2826,7 @@ var PunchcardChartArea = function PunchcardChartArea(props) {
|
|
|
2532
2826
|
});
|
|
2533
2827
|
}));
|
|
2534
2828
|
};
|
|
2829
|
+
|
|
2535
2830
|
var propTypes = {
|
|
2536
2831
|
showBubbleLabels: T.oneOf(Object.values(punchcardUtils_1.BUBBLE_LABELS_TYPES)),
|
|
2537
2832
|
bubbleRowScale: T.oneOf(Object.values(punchcardUtils_1.BUBBLE_ROW_SCALE_TYPES)),
|
|
@@ -2607,19 +2902,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2607
2902
|
value: true
|
|
2608
2903
|
});
|
|
2609
2904
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2905
|
+
|
|
2610
2906
|
var React = __webpack_require__(1);
|
|
2907
|
+
|
|
2611
2908
|
var T = __webpack_require__(0);
|
|
2909
|
+
|
|
2612
2910
|
var i18n_1 = __webpack_require__(2);
|
|
2911
|
+
|
|
2613
2912
|
var Message_1 = __webpack_require__(10);
|
|
2913
|
+
|
|
2614
2914
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2615
2915
|
/**
|
|
2616
2916
|
* @method isMissing
|
|
2617
2917
|
* @param {any} v
|
|
2618
2918
|
* @returns {boolean} true if the input value === null or undefined
|
|
2619
2919
|
*/
|
|
2920
|
+
|
|
2921
|
+
|
|
2620
2922
|
var isMissing = function isMissing(v) {
|
|
2621
2923
|
return v === null || v === undefined;
|
|
2622
2924
|
};
|
|
2925
|
+
|
|
2623
2926
|
exports.isMissing = isMissing;
|
|
2624
2927
|
/**
|
|
2625
2928
|
* @method misskingKeys
|
|
@@ -2627,11 +2930,13 @@ exports.isMissing = isMissing;
|
|
|
2627
2930
|
* @param {object} target
|
|
2628
2931
|
* @returns {string[]} the keys of missing required props
|
|
2629
2932
|
*/
|
|
2933
|
+
|
|
2630
2934
|
var missingKeys = function missingKeys(keys, target) {
|
|
2631
2935
|
return keys.filter(function (k) {
|
|
2632
2936
|
return (0, exports.isMissing)(target[k]);
|
|
2633
2937
|
});
|
|
2634
2938
|
};
|
|
2939
|
+
|
|
2635
2940
|
exports.missingKeys = missingKeys;
|
|
2636
2941
|
var propTypes = {
|
|
2637
2942
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -2645,10 +2950,11 @@ var propTypes = {
|
|
|
2645
2950
|
* @param {MissingPropsProps} props
|
|
2646
2951
|
* @returns {React.ReactElement}
|
|
2647
2952
|
*/
|
|
2953
|
+
|
|
2648
2954
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
2649
2955
|
var width = props.width,
|
|
2650
|
-
|
|
2651
|
-
|
|
2956
|
+
height = props.height,
|
|
2957
|
+
missingProps = props.missingProps;
|
|
2652
2958
|
return React.createElement(Message_1.default, {
|
|
2653
2959
|
"data-test": "message",
|
|
2654
2960
|
width: width,
|
|
@@ -2656,6 +2962,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
2656
2962
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
2657
2963
|
});
|
|
2658
2964
|
};
|
|
2965
|
+
|
|
2659
2966
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
2660
2967
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
2661
2968
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -2675,30 +2982,36 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
2675
2982
|
Object.defineProperty(exports, "__esModule", {
|
|
2676
2983
|
value: true
|
|
2677
2984
|
});
|
|
2985
|
+
|
|
2678
2986
|
var React = __webpack_require__(1);
|
|
2987
|
+
|
|
2679
2988
|
var T = __webpack_require__(0);
|
|
2989
|
+
|
|
2680
2990
|
var styled_components_1 = __webpack_require__(4);
|
|
2991
|
+
|
|
2681
2992
|
var PunchcardBubble_1 = __webpack_require__(451);
|
|
2993
|
+
|
|
2682
2994
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
2995
|
+
|
|
2683
2996
|
var PunchcardRow = function PunchcardRow(props) {
|
|
2684
2997
|
var showBubbleLabels = props.showBubbleLabels,
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2998
|
+
category = props.category,
|
|
2999
|
+
colors = props.colors,
|
|
3000
|
+
_handleMouseEnter = props.handleMouseEnter,
|
|
3001
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3002
|
+
maxSizeValue = props.maxSizeValue,
|
|
3003
|
+
opacities = props.opacities,
|
|
3004
|
+
radiusValues = props.radiusValues,
|
|
3005
|
+
selectedCategory = props.selectedCategory,
|
|
3006
|
+
selectedX = props.selectedX,
|
|
3007
|
+
selectedY = props.selectedY,
|
|
3008
|
+
showMaxValuePulsation = props.showMaxValuePulsation,
|
|
3009
|
+
size = props.size,
|
|
3010
|
+
x = props.x,
|
|
3011
|
+
xScale = props.xScale,
|
|
3012
|
+
yPosition = props.yPosition,
|
|
3013
|
+
yValue = props.yValue,
|
|
3014
|
+
handlePointClick = props.handlePointClick;
|
|
2702
3015
|
return React.createElement("g", null, x.map(function (xValue, index) {
|
|
2703
3016
|
var sizeValue = size[index];
|
|
2704
3017
|
var categoryValue = category[index];
|
|
@@ -2744,6 +3057,7 @@ var PunchcardRow = function PunchcardRow(props) {
|
|
|
2744
3057
|
});
|
|
2745
3058
|
}));
|
|
2746
3059
|
};
|
|
3060
|
+
|
|
2747
3061
|
var propTypes = {
|
|
2748
3062
|
showBubbleLabels: T.oneOf(Object.values(punchcardUtils_1.BUBBLE_LABELS_TYPES)),
|
|
2749
3063
|
category: T.arrayOf(T.string),
|
|
@@ -2798,17 +3112,27 @@ exports.default = (0, styled_components_1.withTheme)(PunchcardRow);
|
|
|
2798
3112
|
|
|
2799
3113
|
|
|
2800
3114
|
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
3115
|
+
|
|
2801
3116
|
var _templateObject, _templateObject2;
|
|
3117
|
+
|
|
2802
3118
|
Object.defineProperty(exports, "__esModule", {
|
|
2803
3119
|
value: true
|
|
2804
3120
|
});
|
|
3121
|
+
|
|
2805
3122
|
var React = __webpack_require__(1);
|
|
3123
|
+
|
|
2806
3124
|
var T = __webpack_require__(0);
|
|
3125
|
+
|
|
2807
3126
|
var styled_components_1 = __webpack_require__(4);
|
|
3127
|
+
|
|
2808
3128
|
var pick_1 = __webpack_require__(23);
|
|
3129
|
+
|
|
2809
3130
|
var variables_1 = __webpack_require__(11);
|
|
3131
|
+
|
|
2810
3132
|
var numberUtils_1 = __webpack_require__(31);
|
|
3133
|
+
|
|
2811
3134
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
3135
|
+
|
|
2812
3136
|
var BubbleCircle = styled_components_1.default.circle.withConfig({
|
|
2813
3137
|
displayName: "PunchcardBubble__BubbleCircle",
|
|
2814
3138
|
componentId: "sc-1jmms9f-0"
|
|
@@ -2818,8 +3142,8 @@ var BubbleCircle = styled_components_1.default.circle.withConfig({
|
|
|
2818
3142
|
enterprise: {
|
|
2819
3143
|
light: variables_1.default.white,
|
|
2820
3144
|
dark: variables_1.default.contentColorInverted // enterprise.textColor
|
|
2821
|
-
},
|
|
2822
3145
|
|
|
3146
|
+
},
|
|
2823
3147
|
prisma: variables_1.default.contentColorActive
|
|
2824
3148
|
})(props) : props.color;
|
|
2825
3149
|
}, function (props) {
|
|
@@ -2827,9 +3151,11 @@ var BubbleCircle = styled_components_1.default.circle.withConfig({
|
|
|
2827
3151
|
}, function (props) {
|
|
2828
3152
|
return props.outline ? props.color : 'none';
|
|
2829
3153
|
});
|
|
3154
|
+
|
|
2830
3155
|
var pulsateAnimation = function pulsateAnimation(r) {
|
|
2831
3156
|
return (0, styled_components_1.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 41% {\n opacity: 0;\n r: ", ";\n }\n 100% {\n opacity: 0;\n r: ", ";\n }\n"])), r + 5, r + 5);
|
|
2832
3157
|
};
|
|
3158
|
+
|
|
2833
3159
|
var PulsateBubble = (0, styled_components_1.default)(BubbleCircle)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n animation: ", " 2.4s linear 0.4s infinite;\n"])), function (props) {
|
|
2834
3160
|
return pulsateAnimation(props.r);
|
|
2835
3161
|
});
|
|
@@ -2866,30 +3192,34 @@ var BubbleLabelText = styled_components_1.default.text.withConfig({
|
|
|
2866
3192
|
var MIN_BUBBLE_SIZE_TO_DISPLAY_LABEL = 13;
|
|
2867
3193
|
var MAX_DISPLAYABLE_VALUE = 99499999999999;
|
|
2868
3194
|
var VALUE_OVERFLOW_TEXT = '99T+';
|
|
3195
|
+
|
|
2869
3196
|
var PunchcardBubble = function PunchcardBubble(props) {
|
|
2870
3197
|
var showBubbleLabel = props.showBubbleLabel,
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
3198
|
+
color = props.color,
|
|
3199
|
+
cx = props.cx,
|
|
3200
|
+
cy = props.cy,
|
|
3201
|
+
fillOpacity = props.fillOpacity,
|
|
3202
|
+
handleMouseEnter = props.handleMouseEnter,
|
|
3203
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3204
|
+
hover = props.hover,
|
|
3205
|
+
muted = props.muted,
|
|
3206
|
+
pulsate = props.pulsate,
|
|
3207
|
+
value = props.value,
|
|
3208
|
+
r = props.r,
|
|
3209
|
+
handlePointClick = props.handlePointClick;
|
|
2883
3210
|
var outline = value < 0;
|
|
2884
3211
|
var showPulsateBubble = pulsate && !muted && !hover;
|
|
2885
3212
|
var displayLabel = hover || showBubbleLabel && r >= MIN_BUBBLE_SIZE_TO_DISPLAY_LABEL;
|
|
2886
3213
|
var bubbleLabelValueText = value <= MAX_DISPLAYABLE_VALUE ? (0, numberUtils_1.formatNumber)(value, 0, {
|
|
2887
3214
|
useTrendUnits: true
|
|
2888
3215
|
}) : VALUE_OVERFLOW_TEXT;
|
|
3216
|
+
|
|
2889
3217
|
if (hover) {
|
|
2890
3218
|
bubbleLabelValueText = (0, numberUtils_1.formatNumber)(value, 2);
|
|
2891
3219
|
}
|
|
3220
|
+
|
|
2892
3221
|
return React.createElement(BubbleGroup, {
|
|
3222
|
+
"data-test": "bubble",
|
|
2893
3223
|
muted: muted,
|
|
2894
3224
|
onMouseEnter: handleMouseEnter,
|
|
2895
3225
|
onMouseLeave: handleMouseLeave,
|
|
@@ -2919,6 +3249,7 @@ var PunchcardBubble = function PunchcardBubble(props) {
|
|
|
2919
3249
|
displayLabel: displayLabel
|
|
2920
3250
|
}, bubbleLabelValueText));
|
|
2921
3251
|
};
|
|
3252
|
+
|
|
2922
3253
|
var propTypes = {
|
|
2923
3254
|
showBubbleLabel: T.bool,
|
|
2924
3255
|
color: T.string,
|
|
@@ -2964,11 +3295,17 @@ exports.default = PunchcardBubble;
|
|
|
2964
3295
|
Object.defineProperty(exports, "__esModule", {
|
|
2965
3296
|
value: true
|
|
2966
3297
|
});
|
|
3298
|
+
|
|
2967
3299
|
var React = __webpack_require__(1);
|
|
3300
|
+
|
|
2968
3301
|
var T = __webpack_require__(0);
|
|
3302
|
+
|
|
2969
3303
|
var styled_components_1 = __webpack_require__(4);
|
|
3304
|
+
|
|
2970
3305
|
var pick_1 = __webpack_require__(23);
|
|
3306
|
+
|
|
2971
3307
|
var variables_1 = __webpack_require__(11);
|
|
3308
|
+
|
|
2972
3309
|
var LEGEND_ITEM_VERTICAL_SPACER = 25;
|
|
2973
3310
|
var LEGEND_ITEM_HORIZONTAL_SPACER = 10;
|
|
2974
3311
|
var LEGEND_RECT_WIDTH = 5;
|
|
@@ -2994,17 +3331,18 @@ var LegendText = styled_components_1.default.text.withConfig({
|
|
|
2994
3331
|
enterprise: variables_1.default.textColor,
|
|
2995
3332
|
prisma: variables_1.default.contentColorDefault
|
|
2996
3333
|
}));
|
|
3334
|
+
|
|
2997
3335
|
var PunchcardLegend = function PunchcardLegend(props) {
|
|
2998
3336
|
var category = props.category,
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3337
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
3338
|
+
handleMouseEnter = props.handleMouseEnter,
|
|
3339
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3340
|
+
selected = props.selected,
|
|
3341
|
+
startPositionX = props.startPositionX,
|
|
3342
|
+
startPositionY = props.startPositionY,
|
|
3343
|
+
containerWidth = props.containerWidth,
|
|
3344
|
+
containerHeight = props.containerHeight,
|
|
3345
|
+
handleLegendClick = props.handleLegendClick;
|
|
3008
3346
|
var legendWidth = containerWidth - LEGEND_OFFSET_RIGHT - startPositionX;
|
|
3009
3347
|
var legendHeight = containerHeight - LEGEND_OFFSET_BOTTOM;
|
|
3010
3348
|
return React.createElement("svg", {
|
|
@@ -3035,6 +3373,7 @@ var PunchcardLegend = function PunchcardLegend(props) {
|
|
|
3035
3373
|
}, React.createElement("title", null, c), c));
|
|
3036
3374
|
})));
|
|
3037
3375
|
};
|
|
3376
|
+
|
|
3038
3377
|
var propTypes = {
|
|
3039
3378
|
category: T.arrayOf(T.string),
|
|
3040
3379
|
colorCategoryMapping: T.func.isRequired,
|
|
@@ -3075,13 +3414,20 @@ exports.default = PunchcardLegend;
|
|
|
3075
3414
|
Object.defineProperty(exports, "__esModule", {
|
|
3076
3415
|
value: true
|
|
3077
3416
|
});
|
|
3417
|
+
|
|
3078
3418
|
var React = __webpack_require__(1);
|
|
3419
|
+
|
|
3079
3420
|
var T = __webpack_require__(0);
|
|
3421
|
+
|
|
3080
3422
|
var styled_components_1 = __webpack_require__(4);
|
|
3423
|
+
|
|
3081
3424
|
var lodash_1 = __webpack_require__(3);
|
|
3425
|
+
|
|
3082
3426
|
var pick_1 = __webpack_require__(23);
|
|
3083
|
-
|
|
3084
|
-
// was previously lineColor in themeRegistry
|
|
3427
|
+
|
|
3428
|
+
var variables_1 = __webpack_require__(11); // was previously lineColor in themeRegistry
|
|
3429
|
+
|
|
3430
|
+
|
|
3085
3431
|
var GridLine = styled_components_1.default.line.withConfig({
|
|
3086
3432
|
displayName: "PunchcardGridLines__GridLine",
|
|
3087
3433
|
componentId: "sc-12y1iif-0"
|
|
@@ -3092,13 +3438,14 @@ var GridLine = styled_components_1.default.line.withConfig({
|
|
|
3092
3438
|
},
|
|
3093
3439
|
prisma: variables_1.default.interactiveColorBackgroundDisabled
|
|
3094
3440
|
}));
|
|
3441
|
+
|
|
3095
3442
|
var PunchcardGridLines = function PunchcardGridLines(props) {
|
|
3096
3443
|
var xStartPosition = props.xStartPosition,
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3444
|
+
xEndPosition = props.xEndPosition,
|
|
3445
|
+
yStartPosition = props.yStartPosition,
|
|
3446
|
+
yEndPosition = props.yEndPosition,
|
|
3447
|
+
xDelta = props.xDelta,
|
|
3448
|
+
yDelta = props.yDelta;
|
|
3102
3449
|
var yGridLinesXPositions = (0, lodash_1.range)(xStartPosition, xEndPosition + 1, xDelta);
|
|
3103
3450
|
var xGridLinesYPositions = (0, lodash_1.range)(yStartPosition, yEndPosition + 1, yDelta);
|
|
3104
3451
|
return React.createElement("g", {
|
|
@@ -3121,6 +3468,7 @@ var PunchcardGridLines = function PunchcardGridLines(props) {
|
|
|
3121
3468
|
});
|
|
3122
3469
|
}));
|
|
3123
3470
|
};
|
|
3471
|
+
|
|
3124
3472
|
var propTypes = {
|
|
3125
3473
|
xStartPosition: T.number,
|
|
3126
3474
|
xEndPosition: T.number,
|
|
@@ -3153,8 +3501,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3153
3501
|
value: true
|
|
3154
3502
|
});
|
|
3155
3503
|
exports.convertToPunchcardProperties = exports.mapToOldKey = exports.punchcardOptionValuesMapping = void 0;
|
|
3504
|
+
|
|
3156
3505
|
var lodash_1 = __webpack_require__(3);
|
|
3157
|
-
|
|
3506
|
+
|
|
3507
|
+
var chartingUtils_1 = __webpack_require__(57);
|
|
3508
|
+
|
|
3158
3509
|
var punchcardOptionsMapping = {
|
|
3159
3510
|
legendDisplay: 'showLegend',
|
|
3160
3511
|
bubbleLabelDisplay: 'showBubbleLabels',
|
|
@@ -3165,9 +3516,9 @@ var punchcardOptionsMapping = {
|
|
|
3165
3516
|
bubbleRadiusMin: 'minBubbleRadius',
|
|
3166
3517
|
bubbleSizeMax: 'maxBubbleSize',
|
|
3167
3518
|
bubbleSizeMin: 'minBubbleSize'
|
|
3168
|
-
};
|
|
3169
|
-
// key value mapping of what options (and their corresponding values) which
|
|
3519
|
+
}; // key value mapping of what options (and their corresponding values) which
|
|
3170
3520
|
// we expose in config.ts to property values PurePunchcard understands
|
|
3521
|
+
|
|
3171
3522
|
exports.punchcardOptionValuesMapping = {
|
|
3172
3523
|
showLegend: {
|
|
3173
3524
|
right: true,
|
|
@@ -3186,11 +3537,13 @@ exports.punchcardOptionValuesMapping = {
|
|
|
3186
3537
|
* @param {Object} options
|
|
3187
3538
|
* @returns {Object}
|
|
3188
3539
|
*/
|
|
3540
|
+
|
|
3189
3541
|
var mapToOldKey = function mapToOldKey(options) {
|
|
3190
3542
|
return (0, lodash_1.mapKeys)(options, function (val, key) {
|
|
3191
3543
|
return punchcardOptionsMapping[key] ? punchcardOptionsMapping[key] : key;
|
|
3192
3544
|
});
|
|
3193
3545
|
};
|
|
3546
|
+
|
|
3194
3547
|
exports.mapToOldKey = mapToOldKey;
|
|
3195
3548
|
/**
|
|
3196
3549
|
* Chained helper for mapping the option properties (and values) we expose in config.ts into property values that PurePunchcard accepts
|
|
@@ -3199,9 +3552,11 @@ exports.mapToOldKey = mapToOldKey;
|
|
|
3199
3552
|
* @param {Object} originalOptions
|
|
3200
3553
|
* @returns {Object}
|
|
3201
3554
|
*/
|
|
3555
|
+
|
|
3202
3556
|
var convertToPunchcardProperties = function convertToPunchcardProperties(originalOptions) {
|
|
3203
3557
|
return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru((0, chartingUtils_1.mapToValues)(exports.punchcardOptionValuesMapping)).value();
|
|
3204
3558
|
};
|
|
3559
|
+
|
|
3205
3560
|
exports.convertToPunchcardProperties = convertToPunchcardProperties;
|
|
3206
3561
|
|
|
3207
3562
|
/***/ }),
|
|
@@ -3215,15 +3570,19 @@ exports.convertToPunchcardProperties = convertToPunchcardProperties;
|
|
|
3215
3570
|
Object.defineProperty(exports, "__esModule", {
|
|
3216
3571
|
value: true
|
|
3217
3572
|
});
|
|
3573
|
+
|
|
3218
3574
|
var React = __webpack_require__(1);
|
|
3575
|
+
|
|
3219
3576
|
var styled_components_1 = __webpack_require__(4);
|
|
3577
|
+
|
|
3220
3578
|
var hocUtils_1 = __webpack_require__(15);
|
|
3579
|
+
|
|
3221
3580
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3222
3581
|
displayName: "withEditModeCover__Cover",
|
|
3223
3582
|
componentId: "sc-1gsbnxb-0"
|
|
3224
3583
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3225
3584
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3226
|
-
'data-splunk-visualization-version': "26.
|
|
3585
|
+
'data-splunk-visualization-version': "26.1.1 - b6df0a015"
|
|
3227
3586
|
}).withConfig({
|
|
3228
3587
|
displayName: "withEditModeCover__Blocker",
|
|
3229
3588
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3234,6 +3593,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3234
3593
|
* @param {ExtendedDashViz} Visualization
|
|
3235
3594
|
* @returns {ExtendedDashViz} Wrapper
|
|
3236
3595
|
*/
|
|
3596
|
+
|
|
3237
3597
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3238
3598
|
var Wrapper = function Wrapper(props) {
|
|
3239
3599
|
var mode = props.mode;
|
|
@@ -3242,12 +3602,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3242
3602
|
"data-test": "edit-mode-cover"
|
|
3243
3603
|
}));
|
|
3244
3604
|
};
|
|
3605
|
+
|
|
3245
3606
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3246
3607
|
Wrapper: Wrapper,
|
|
3247
3608
|
Visualization: Visualization
|
|
3248
3609
|
});
|
|
3249
3610
|
return Wrapper;
|
|
3250
3611
|
};
|
|
3612
|
+
|
|
3251
3613
|
exports.default = withEditModeCover;
|
|
3252
3614
|
|
|
3253
3615
|
/***/ }),
|
|
@@ -3261,27 +3623,37 @@ exports.default = withEditModeCover;
|
|
|
3261
3623
|
Object.defineProperty(exports, "__esModule", {
|
|
3262
3624
|
value: true
|
|
3263
3625
|
});
|
|
3626
|
+
|
|
3264
3627
|
var React = __webpack_require__(1);
|
|
3628
|
+
|
|
3265
3629
|
var colorUtils_1 = __webpack_require__(12);
|
|
3630
|
+
|
|
3266
3631
|
var variables_1 = __webpack_require__(11);
|
|
3632
|
+
|
|
3267
3633
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
3634
|
+
|
|
3268
3635
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3636
|
+
|
|
3269
3637
|
var hocUtils_1 = __webpack_require__(15);
|
|
3638
|
+
|
|
3270
3639
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3271
3640
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3272
3641
|
var config = Visualization.config;
|
|
3273
3642
|
var themes = config.themes;
|
|
3643
|
+
|
|
3274
3644
|
var Wrapper = function Wrapper(props) {
|
|
3275
3645
|
var _a, _b;
|
|
3646
|
+
|
|
3276
3647
|
var dataSources = props.dataSources,
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3648
|
+
loading = props.loading,
|
|
3649
|
+
options = props.options,
|
|
3650
|
+
height = props.height,
|
|
3651
|
+
width = props.width;
|
|
3281
3652
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3282
3653
|
var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
|
|
3283
3654
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3284
3655
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
3656
|
+
|
|
3285
3657
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3286
3658
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3287
3659
|
"data-test": "icon-placeholder",
|
|
@@ -3292,14 +3664,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3292
3664
|
iconColor: iconColor
|
|
3293
3665
|
});
|
|
3294
3666
|
}
|
|
3667
|
+
|
|
3295
3668
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3296
3669
|
};
|
|
3670
|
+
|
|
3297
3671
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3298
3672
|
Wrapper: Wrapper,
|
|
3299
3673
|
Visualization: Visualization
|
|
3300
3674
|
});
|
|
3301
3675
|
return Wrapper;
|
|
3302
3676
|
};
|
|
3677
|
+
|
|
3303
3678
|
exports.default = withPlaceholder;
|
|
3304
3679
|
|
|
3305
3680
|
/***/ }),
|
|
@@ -3334,11 +3709,13 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
3334
3709
|
Object.defineProperty(exports, "__esModule", {
|
|
3335
3710
|
value: true
|
|
3336
3711
|
});
|
|
3712
|
+
|
|
3337
3713
|
var i18n_1 = __webpack_require__(2);
|
|
3714
|
+
|
|
3338
3715
|
var background = function background(_ref) {
|
|
3339
3716
|
var label = _ref.label,
|
|
3340
|
-
|
|
3341
|
-
|
|
3717
|
+
themes = _ref.themes,
|
|
3718
|
+
labelPosition = _ref.labelPosition;
|
|
3342
3719
|
return [{
|
|
3343
3720
|
label: (0, i18n_1._)(label || 'Background'),
|
|
3344
3721
|
option: 'backgroundColor',
|
|
@@ -3349,31 +3726,37 @@ var background = function background(_ref) {
|
|
|
3349
3726
|
}
|
|
3350
3727
|
}];
|
|
3351
3728
|
};
|
|
3729
|
+
|
|
3352
3730
|
exports.default = background;
|
|
3353
3731
|
|
|
3354
3732
|
/***/ }),
|
|
3355
3733
|
|
|
3356
|
-
/***/
|
|
3734
|
+
/***/ 57:
|
|
3357
3735
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3358
3736
|
|
|
3359
3737
|
"use strict";
|
|
3360
3738
|
|
|
3361
3739
|
|
|
3362
3740
|
var _toConsumableArray = __webpack_require__(8);
|
|
3741
|
+
|
|
3363
3742
|
var __rest = this && this.__rest || function (s, e) {
|
|
3364
3743
|
var t = {};
|
|
3744
|
+
|
|
3365
3745
|
for (var p in s) {
|
|
3366
3746
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
3367
3747
|
}
|
|
3748
|
+
|
|
3368
3749
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3369
3750
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
3370
3751
|
}
|
|
3371
3752
|
return t;
|
|
3372
3753
|
};
|
|
3754
|
+
|
|
3373
3755
|
Object.defineProperty(exports, "__esModule", {
|
|
3374
3756
|
value: true
|
|
3375
3757
|
});
|
|
3376
3758
|
exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
|
|
3759
|
+
|
|
3377
3760
|
var lodash_1 = __webpack_require__(3);
|
|
3378
3761
|
/**
|
|
3379
3762
|
* Get formatted annotations
|
|
@@ -3384,10 +3767,12 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3384
3767
|
* @param {Array} options.annotationLabel
|
|
3385
3768
|
* @returns {Array}
|
|
3386
3769
|
*/
|
|
3770
|
+
|
|
3771
|
+
|
|
3387
3772
|
var getAnnotations = function getAnnotations(_ref) {
|
|
3388
3773
|
var annotationX = _ref.annotationX,
|
|
3389
|
-
|
|
3390
|
-
|
|
3774
|
+
annotationColor = _ref.annotationColor,
|
|
3775
|
+
annotationLabel = _ref.annotationLabel;
|
|
3391
3776
|
return annotationX && annotationX.length ? annotationX.map(function (timestamp, i) {
|
|
3392
3777
|
return {
|
|
3393
3778
|
color: annotationColor && annotationColor[i],
|
|
@@ -3396,6 +3781,7 @@ var getAnnotations = function getAnnotations(_ref) {
|
|
|
3396
3781
|
};
|
|
3397
3782
|
}) : [];
|
|
3398
3783
|
};
|
|
3784
|
+
|
|
3399
3785
|
exports.getAnnotations = getAnnotations;
|
|
3400
3786
|
/**
|
|
3401
3787
|
* Truncate the result set to given limit
|
|
@@ -3404,20 +3790,25 @@ exports.getAnnotations = getAnnotations;
|
|
|
3404
3790
|
* @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']
|
|
3405
3791
|
* @returns {Object}
|
|
3406
3792
|
*/
|
|
3793
|
+
|
|
3407
3794
|
var truncateData = function truncateData(dataSet, truncationLimit) {
|
|
3408
3795
|
if (!dataSet) {
|
|
3409
3796
|
return null;
|
|
3410
3797
|
}
|
|
3798
|
+
|
|
3411
3799
|
var limit = parseInt(truncationLimit, 10);
|
|
3800
|
+
|
|
3412
3801
|
if (!limit || limit <= 0) {
|
|
3413
3802
|
return dataSet;
|
|
3414
3803
|
}
|
|
3804
|
+
|
|
3415
3805
|
var truncatedData = Object.assign({}, dataSet);
|
|
3416
3806
|
truncatedData.columns = truncatedData.columns.map(function (columnData) {
|
|
3417
3807
|
return columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData;
|
|
3418
3808
|
});
|
|
3419
3809
|
return truncatedData;
|
|
3420
3810
|
};
|
|
3811
|
+
|
|
3421
3812
|
exports.truncateData = truncateData;
|
|
3422
3813
|
/**
|
|
3423
3814
|
* Helper method to update the option values into the values that SC accepts
|
|
@@ -3425,12 +3816,14 @@ exports.truncateData = truncateData;
|
|
|
3425
3816
|
* @param {Object} options
|
|
3426
3817
|
* @returns {Object}
|
|
3427
3818
|
*/
|
|
3819
|
+
|
|
3428
3820
|
var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
3429
3821
|
return function (options) {
|
|
3430
3822
|
var convertedOptions = Object.assign({}, options);
|
|
3431
3823
|
Object.keys(optionValuesSCMapping).forEach(function (key) {
|
|
3432
3824
|
if ((0, lodash_1.has)(options, key)) {
|
|
3433
3825
|
var updatedValue = optionValuesSCMapping[key][options[key]];
|
|
3826
|
+
|
|
3434
3827
|
if (!(0, lodash_1.isUndefined)(updatedValue)) {
|
|
3435
3828
|
convertedOptions[key] = updatedValue;
|
|
3436
3829
|
}
|
|
@@ -3439,6 +3832,7 @@ var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
|
3439
3832
|
return convertedOptions;
|
|
3440
3833
|
};
|
|
3441
3834
|
};
|
|
3835
|
+
|
|
3442
3836
|
exports.mapToValues = mapToValues;
|
|
3443
3837
|
/**
|
|
3444
3838
|
* Helper method to process options related to y2Fields
|
|
@@ -3446,18 +3840,23 @@ exports.mapToValues = mapToValues;
|
|
|
3446
3840
|
* @param {Object} originalOptions
|
|
3447
3841
|
* @returns {Object}
|
|
3448
3842
|
*/
|
|
3843
|
+
|
|
3449
3844
|
var convertY2AxisOptions = function convertY2AxisOptions(_a) {
|
|
3450
3845
|
var y2Fields = _a.y2Fields,
|
|
3451
|
-
|
|
3846
|
+
originalOptions = __rest(_a, ["y2Fields"]);
|
|
3847
|
+
|
|
3452
3848
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
3849
|
+
|
|
3453
3850
|
if (y2Fields) {
|
|
3454
3851
|
convertedOptions['axisY2.enabled'] = true;
|
|
3455
3852
|
convertedOptions['axisY2.fields'] = (0, lodash_1.isArray)(y2Fields) ? y2Fields.filter(function (name) {
|
|
3456
3853
|
return name;
|
|
3457
3854
|
}).join(',') : y2Fields;
|
|
3458
3855
|
}
|
|
3856
|
+
|
|
3459
3857
|
return convertedOptions;
|
|
3460
3858
|
};
|
|
3859
|
+
|
|
3461
3860
|
exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
3462
3861
|
/**
|
|
3463
3862
|
* Helper method to format value for overlayFields
|
|
@@ -3465,9 +3864,11 @@ exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
|
3465
3864
|
* @param {Object} originalOptions
|
|
3466
3865
|
* @returns {Object}
|
|
3467
3866
|
*/
|
|
3867
|
+
|
|
3468
3868
|
var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
3469
3869
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
3470
3870
|
var overlayFields = originalOptions.overlayFields;
|
|
3871
|
+
|
|
3471
3872
|
if (overlayFields) {
|
|
3472
3873
|
convertedOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
|
|
3473
3874
|
return field;
|
|
@@ -3475,17 +3876,21 @@ var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
|
3475
3876
|
return field.trim();
|
|
3476
3877
|
}).join(',') : overlayFields;
|
|
3477
3878
|
}
|
|
3879
|
+
|
|
3478
3880
|
return convertedOptions;
|
|
3479
3881
|
};
|
|
3882
|
+
|
|
3480
3883
|
exports.convertOverlayFields = convertOverlayFields;
|
|
3481
3884
|
/**
|
|
3482
3885
|
* checks whether data is multi series data
|
|
3483
3886
|
* @param {array} data array
|
|
3484
3887
|
* @return {Boolean}
|
|
3485
3888
|
*/
|
|
3889
|
+
|
|
3486
3890
|
var isMultiSeriesData = function isMultiSeriesData(data) {
|
|
3487
3891
|
return Array.isArray(data) && Array.isArray(data[0]);
|
|
3488
3892
|
};
|
|
3893
|
+
|
|
3489
3894
|
exports.isMultiSeriesData = isMultiSeriesData;
|
|
3490
3895
|
/**
|
|
3491
3896
|
* checks whether data is multi series data and returns value as array
|
|
@@ -3493,19 +3898,22 @@ exports.isMultiSeriesData = isMultiSeriesData;
|
|
|
3493
3898
|
* @param {*} value to return as array
|
|
3494
3899
|
* @return {array}
|
|
3495
3900
|
*/
|
|
3901
|
+
|
|
3496
3902
|
var toArrayForSeries = function toArrayForSeries(data, value) {
|
|
3497
3903
|
return (0, exports.isMultiSeriesData)(data) ? value : [value];
|
|
3498
3904
|
};
|
|
3905
|
+
|
|
3499
3906
|
exports.toArrayForSeries = toArrayForSeries;
|
|
3907
|
+
|
|
3500
3908
|
var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
3501
3909
|
var _ref2$x = _ref2.x,
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3910
|
+
x = _ref2$x === void 0 ? [] : _ref2$x,
|
|
3911
|
+
_ref2$y = _ref2.y,
|
|
3912
|
+
y = _ref2$y === void 0 ? [] : _ref2$y,
|
|
3913
|
+
xField = _ref2.xField,
|
|
3914
|
+
yFields = _ref2.yFields,
|
|
3915
|
+
y2 = _ref2.y2,
|
|
3916
|
+
y2Fields = _ref2.y2Fields;
|
|
3509
3917
|
var columns = [x.map(String)].concat(_toConsumableArray((0, exports.toArrayForSeries)(y, y).map(function (series) {
|
|
3510
3918
|
return series.map(String);
|
|
3511
3919
|
})));
|
|
@@ -3516,10 +3924,10 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
3516
3924
|
return {
|
|
3517
3925
|
name: field
|
|
3518
3926
|
};
|
|
3519
|
-
})));
|
|
3520
|
-
// splunk-charting requires y2 to be part of columns
|
|
3927
|
+
}))); // splunk-charting requires y2 to be part of columns
|
|
3521
3928
|
// when y & y2 options are configured with different (mutually exclusive) series
|
|
3522
3929
|
// y2 columns need to be added to columns
|
|
3930
|
+
|
|
3523
3931
|
if (y2Fields) {
|
|
3524
3932
|
var y2FieldsArray = (0, exports.toArrayForSeries)(y2, y2Fields);
|
|
3525
3933
|
var y2AsArray = (0, exports.toArrayForSeries)(y2, y2).map(function (series) {
|
|
@@ -3534,11 +3942,13 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
3534
3942
|
}
|
|
3535
3943
|
});
|
|
3536
3944
|
}
|
|
3945
|
+
|
|
3537
3946
|
return {
|
|
3538
3947
|
columns: columns,
|
|
3539
3948
|
fields: fields
|
|
3540
3949
|
};
|
|
3541
3950
|
};
|
|
3951
|
+
|
|
3542
3952
|
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
3543
3953
|
|
|
3544
3954
|
/***/ }),
|
|
@@ -3561,6 +3971,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3561
3971
|
});
|
|
3562
3972
|
exports.VizBehavior = void 0;
|
|
3563
3973
|
var VizBehavior;
|
|
3974
|
+
|
|
3564
3975
|
(function (VizBehavior) {
|
|
3565
3976
|
/**
|
|
3566
3977
|
* Dynamic Options Behavior.
|
|
@@ -3580,6 +3991,7 @@ var VizBehavior;
|
|
|
3580
3991
|
* missing.
|
|
3581
3992
|
* @type {string}
|
|
3582
3993
|
*/
|
|
3994
|
+
|
|
3583
3995
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
3584
3996
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
3585
3997
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -3601,6 +4013,13 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
3601
4013
|
|
|
3602
4014
|
/***/ }),
|
|
3603
4015
|
|
|
4016
|
+
/***/ 83:
|
|
4017
|
+
/***/ (function(module, exports) {
|
|
4018
|
+
|
|
4019
|
+
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
4020
|
+
|
|
4021
|
+
/***/ }),
|
|
4022
|
+
|
|
3604
4023
|
/***/ 9:
|
|
3605
4024
|
/***/ (function(module, exports) {
|
|
3606
4025
|
|
|
@@ -3608,7 +4027,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
3608
4027
|
|
|
3609
4028
|
/***/ }),
|
|
3610
4029
|
|
|
3611
|
-
/***/
|
|
4030
|
+
/***/ 93:
|
|
3612
4031
|
/***/ (function(module, exports) {
|
|
3613
4032
|
|
|
3614
4033
|
module.exports = require("d3-scale");
|
|
@@ -3622,15 +4041,20 @@ module.exports = require("d3-scale");
|
|
|
3622
4041
|
|
|
3623
4042
|
|
|
3624
4043
|
var _slicedToArray = __webpack_require__(17);
|
|
4044
|
+
|
|
3625
4045
|
Object.defineProperty(exports, "__esModule", {
|
|
3626
4046
|
value: true
|
|
3627
4047
|
});
|
|
3628
4048
|
exports.truncateAxisLabelText = exports.isBubbleSelected = exports.isSomethingSelected = exports.getDataByRows = exports.createValueScale = exports.getScales = exports.getChartAreaDimensions = exports.getColorCategoryMapping = exports.GRAYSCALE_FILTER_ID = exports.BUBBLE_LABELS_TYPES = exports.COLOR_MODE_TYPES = exports.BUBBLE_SCALE_TYPES = exports.BUBBLE_ROW_SCALE_TYPES = exports.AXIS_ORIENTATION_TYPES = void 0;
|
|
3629
|
-
|
|
4049
|
+
|
|
4050
|
+
var d3_scale_1 = __webpack_require__(93);
|
|
3630
4051
|
/**
|
|
3631
4052
|
* @enum {AXIS_ORIENTATION_TYPES}
|
|
3632
4053
|
*/
|
|
4054
|
+
|
|
4055
|
+
|
|
3633
4056
|
var AXIS_ORIENTATION_TYPES;
|
|
4057
|
+
|
|
3634
4058
|
(function (AXIS_ORIENTATION_TYPES) {
|
|
3635
4059
|
AXIS_ORIENTATION_TYPES["VERTICAL"] = "vertical";
|
|
3636
4060
|
AXIS_ORIENTATION_TYPES["HORIZONTAL"] = "horizontal";
|
|
@@ -3638,7 +4062,10 @@ var AXIS_ORIENTATION_TYPES;
|
|
|
3638
4062
|
/**
|
|
3639
4063
|
* @enum {BUBBLE_ROW_SCALE_TYPES}
|
|
3640
4064
|
*/
|
|
4065
|
+
|
|
4066
|
+
|
|
3641
4067
|
var BUBBLE_ROW_SCALE_TYPES;
|
|
4068
|
+
|
|
3642
4069
|
(function (BUBBLE_ROW_SCALE_TYPES) {
|
|
3643
4070
|
BUBBLE_ROW_SCALE_TYPES["GLOBAL"] = "global";
|
|
3644
4071
|
BUBBLE_ROW_SCALE_TYPES["ROW"] = "row";
|
|
@@ -3646,7 +4073,10 @@ var BUBBLE_ROW_SCALE_TYPES;
|
|
|
3646
4073
|
/**
|
|
3647
4074
|
* @enum {BUBBLE_SCALE_TYPES}
|
|
3648
4075
|
*/
|
|
4076
|
+
|
|
4077
|
+
|
|
3649
4078
|
var BUBBLE_SCALE_TYPES;
|
|
4079
|
+
|
|
3650
4080
|
(function (BUBBLE_SCALE_TYPES) {
|
|
3651
4081
|
BUBBLE_SCALE_TYPES["RADIUS"] = "radius";
|
|
3652
4082
|
BUBBLE_SCALE_TYPES["AREA"] = "area";
|
|
@@ -3654,7 +4084,10 @@ var BUBBLE_SCALE_TYPES;
|
|
|
3654
4084
|
/**
|
|
3655
4085
|
* @enum {COLOR_MODE_TYPES}
|
|
3656
4086
|
*/
|
|
4087
|
+
|
|
4088
|
+
|
|
3657
4089
|
var COLOR_MODE_TYPES;
|
|
4090
|
+
|
|
3658
4091
|
(function (COLOR_MODE_TYPES) {
|
|
3659
4092
|
COLOR_MODE_TYPES["SEQUENTIAL"] = "sequential";
|
|
3660
4093
|
COLOR_MODE_TYPES["CATEGORICAL"] = "categorical";
|
|
@@ -3662,7 +4095,10 @@ var COLOR_MODE_TYPES;
|
|
|
3662
4095
|
/**
|
|
3663
4096
|
* @enum {BUBBLE_LABELS_TYPES}
|
|
3664
4097
|
*/
|
|
4098
|
+
|
|
4099
|
+
|
|
3665
4100
|
var BUBBLE_LABELS_TYPES;
|
|
4101
|
+
|
|
3666
4102
|
(function (BUBBLE_LABELS_TYPES) {
|
|
3667
4103
|
BUBBLE_LABELS_TYPES["ALL"] = "all";
|
|
3668
4104
|
BUBBLE_LABELS_TYPES["MAX"] = "max";
|
|
@@ -3671,6 +4107,8 @@ var BUBBLE_LABELS_TYPES;
|
|
|
3671
4107
|
/**
|
|
3672
4108
|
* @string GRAYSCALE_FILTER_ID
|
|
3673
4109
|
*/
|
|
4110
|
+
|
|
4111
|
+
|
|
3674
4112
|
exports.GRAYSCALE_FILTER_ID = "punchcard-grayscale-filter-id-".concat(Math.floor(Math.random() * 1000));
|
|
3675
4113
|
var X_AXIS_HEIGHT = 15;
|
|
3676
4114
|
var Y_AXIS_WIDTH = 77;
|
|
@@ -3686,15 +4124,19 @@ var HORIZONTAL_SPACE_FOR_SINGLE_CHAR = 6;
|
|
|
3686
4124
|
* @param {Array<String>} seriesColors
|
|
3687
4125
|
* @return {Function} colorCategoryMapping
|
|
3688
4126
|
*/
|
|
4127
|
+
|
|
3689
4128
|
var getColorCategoryMapping = function getColorCategoryMapping(_ref) {
|
|
3690
4129
|
var category = _ref.category,
|
|
3691
|
-
|
|
3692
|
-
|
|
4130
|
+
colorMode = _ref.colorMode,
|
|
4131
|
+
seriesColors = _ref.seriesColors;
|
|
4132
|
+
|
|
3693
4133
|
if (colorMode === COLOR_MODE_TYPES.SEQUENTIAL) {
|
|
3694
4134
|
return null;
|
|
3695
4135
|
}
|
|
4136
|
+
|
|
3696
4137
|
return (0, d3_scale_1.scaleOrdinal)().domain(category).range(seriesColors).unknown(seriesColors[0]);
|
|
3697
4138
|
};
|
|
4139
|
+
|
|
3698
4140
|
exports.getColorCategoryMapping = getColorCategoryMapping;
|
|
3699
4141
|
/**
|
|
3700
4142
|
* get punchcard dimensions given container width and height
|
|
@@ -3711,18 +4153,21 @@ exports.getColorCategoryMapping = getColorCategoryMapping;
|
|
|
3711
4153
|
* @return {Number} dimensions.chartAreaEndX
|
|
3712
4154
|
* @return {Number} dimensions.chartAreaEndY
|
|
3713
4155
|
*/
|
|
4156
|
+
|
|
3714
4157
|
var getChartAreaDimensions = function getChartAreaDimensions(_ref2) {
|
|
3715
4158
|
var containerWidth = _ref2.containerWidth,
|
|
3716
|
-
|
|
3717
|
-
|
|
4159
|
+
containerHeight = _ref2.containerHeight,
|
|
4160
|
+
displayLegend = _ref2.displayLegend;
|
|
3718
4161
|
var yAxisStartX = MARGIN;
|
|
3719
4162
|
var chartAreaStartX = yAxisStartX + Y_AXIS_WIDTH + MARGIN;
|
|
3720
4163
|
var chartAreaEndX = containerWidth - MARGIN;
|
|
3721
4164
|
var legendStartX = null;
|
|
4165
|
+
|
|
3722
4166
|
if (displayLegend) {
|
|
3723
4167
|
legendStartX = containerWidth - LEGEND_WIDTH;
|
|
3724
4168
|
chartAreaEndX = legendStartX - MARGIN;
|
|
3725
4169
|
}
|
|
4170
|
+
|
|
3726
4171
|
var chartAreaStartY = MARGIN;
|
|
3727
4172
|
var xAxisStartY = containerHeight - X_AXIS_HEIGHT - MARGIN;
|
|
3728
4173
|
var chartAreaEndY = xAxisStartY - MARGIN;
|
|
@@ -3736,6 +4181,7 @@ var getChartAreaDimensions = function getChartAreaDimensions(_ref2) {
|
|
|
3736
4181
|
legendStartX: legendStartX
|
|
3737
4182
|
};
|
|
3738
4183
|
};
|
|
4184
|
+
|
|
3739
4185
|
exports.getChartAreaDimensions = getChartAreaDimensions;
|
|
3740
4186
|
/**
|
|
3741
4187
|
* gets a scale used to map values to x or y plane
|
|
@@ -3748,20 +4194,23 @@ exports.getChartAreaDimensions = getChartAreaDimensions;
|
|
|
3748
4194
|
* @return {Function} scales.scale function to return beginning of band
|
|
3749
4195
|
* @return {Function} scales.positionScale function to return middle of band
|
|
3750
4196
|
*/
|
|
4197
|
+
|
|
3751
4198
|
var getScales = function getScales(_ref3) {
|
|
3752
4199
|
var values = _ref3.values,
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
var scale = (0, d3_scale_1.scaleBand)().domain(values).range([start, end]);
|
|
3756
|
-
|
|
4200
|
+
start = _ref3.start,
|
|
4201
|
+
end = _ref3.end;
|
|
4202
|
+
var scale = (0, d3_scale_1.scaleBand)().domain(values).range([start, end]); // Returns the middle of the band
|
|
4203
|
+
|
|
3757
4204
|
var positionScale = function positionScale(value) {
|
|
3758
4205
|
return scale(value) + scale.bandwidth() / 2;
|
|
3759
4206
|
};
|
|
4207
|
+
|
|
3760
4208
|
return {
|
|
3761
4209
|
scale: scale,
|
|
3762
4210
|
positionScale: positionScale
|
|
3763
4211
|
};
|
|
3764
4212
|
};
|
|
4213
|
+
|
|
3765
4214
|
exports.getScales = getScales;
|
|
3766
4215
|
/**
|
|
3767
4216
|
* Maps an array of values to a percentage
|
|
@@ -3770,6 +4219,7 @@ exports.getScales = getScales;
|
|
|
3770
4219
|
* @param {Array<Number>} values
|
|
3771
4220
|
* @return {Function} radiusScale
|
|
3772
4221
|
*/
|
|
4222
|
+
|
|
3773
4223
|
var createValueScale = function createValueScale(values) {
|
|
3774
4224
|
var absValuesWithoutZero = [];
|
|
3775
4225
|
values.forEach(function (value) {
|
|
@@ -3780,6 +4230,7 @@ var createValueScale = function createValueScale(values) {
|
|
|
3780
4230
|
});
|
|
3781
4231
|
return (0, d3_scale_1.scaleLinear)().domain([Math.min.apply(Math, absValuesWithoutZero), Math.max.apply(Math, absValuesWithoutZero)]).range([0, 1]).clamp(true).unknown(0);
|
|
3782
4232
|
};
|
|
4233
|
+
|
|
3783
4234
|
exports.createValueScale = createValueScale;
|
|
3784
4235
|
/**
|
|
3785
4236
|
* Given a dataset, partition it by row and for each row:
|
|
@@ -3804,23 +4255,24 @@ exports.createValueScale = createValueScale;
|
|
|
3804
4255
|
* @param {Number} minBubbleRadius // Used when !isBubbleSizeDynamic
|
|
3805
4256
|
* @return {Object<String\|Number, RowData>} dataByRows
|
|
3806
4257
|
*/
|
|
4258
|
+
|
|
3807
4259
|
var getDataByRows = function getDataByRows(_ref4) {
|
|
3808
4260
|
var bubbleRowScale = _ref4.bubbleRowScale,
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
4261
|
+
bubbleScale = _ref4.bubbleScale,
|
|
4262
|
+
category = _ref4.category,
|
|
4263
|
+
colorCategoryMapping = _ref4.colorCategoryMapping,
|
|
4264
|
+
colorMode = _ref4.colorMode,
|
|
4265
|
+
bubbleColor = _ref4.bubbleColor,
|
|
4266
|
+
minBubbleColorIntensity = _ref4.minBubbleColorIntensity,
|
|
4267
|
+
size = _ref4.size,
|
|
4268
|
+
x = _ref4.x,
|
|
4269
|
+
y = _ref4.y,
|
|
4270
|
+
isBubbleSizeDynamic = _ref4.isBubbleSizeDynamic,
|
|
4271
|
+
minBubbleSize = _ref4.minBubbleSize,
|
|
4272
|
+
maxBubbleSize = _ref4.maxBubbleSize,
|
|
4273
|
+
minBand = _ref4.minBand,
|
|
4274
|
+
maxBubbleRadius = _ref4.maxBubbleRadius,
|
|
4275
|
+
minBubbleRadius = _ref4.minBubbleRadius;
|
|
3824
4276
|
var dataByRows = {};
|
|
3825
4277
|
var minRadius = isBubbleSizeDynamic ? minBand / 2 * minBubbleSize : minBubbleRadius;
|
|
3826
4278
|
var maxRadius = isBubbleSizeDynamic ? minBand / 2 * maxBubbleSize : maxBubbleRadius;
|
|
@@ -3828,25 +4280,30 @@ var getDataByRows = function getDataByRows(_ref4) {
|
|
|
3828
4280
|
var maxArea = Math.PI * Math.pow(maxRadius, 2);
|
|
3829
4281
|
var isBubbleColorAnArray = Array.isArray(bubbleColor);
|
|
3830
4282
|
var globalSizeScale = (0, exports.createValueScale)(size);
|
|
4283
|
+
|
|
3831
4284
|
var getRadiusValue = function getRadiusValue(value, sizeScale) {
|
|
3832
4285
|
return bubbleScale === BUBBLE_SCALE_TYPES.RADIUS ? (maxRadius - minRadius) * sizeScale(Math.abs(value)) + minRadius : Math.sqrt(((maxArea - minArea) * sizeScale(Math.abs(value)) + minArea) / Math.PI);
|
|
3833
4286
|
};
|
|
4287
|
+
|
|
3834
4288
|
var getColorValue = function getColorValue(c) {
|
|
3835
4289
|
return colorMode === COLOR_MODE_TYPES.CATEGORICAL ? colorCategoryMapping(c) : bubbleColor;
|
|
3836
4290
|
};
|
|
4291
|
+
|
|
3837
4292
|
var getOpacityValue = function getOpacityValue(value, sizeScale) {
|
|
3838
4293
|
return colorMode === COLOR_MODE_TYPES.CATEGORICAL || isBubbleColorAnArray ? 1 : sizeScale(Math.abs(value)) * (1 - minBubbleColorIntensity) + minBubbleColorIntensity;
|
|
3839
4294
|
};
|
|
4295
|
+
|
|
3840
4296
|
y.forEach(function (yValue, index) {
|
|
3841
4297
|
var xValue = x[index];
|
|
3842
4298
|
var sizeValue = size[index];
|
|
3843
4299
|
var categoryValue = category && category[index] ? category[index] : null;
|
|
3844
|
-
var bubbleColorValue = colorMode === COLOR_MODE_TYPES.SEQUENTIAL && isBubbleColorAnArray ? bubbleColor[index] : getColorValue(categoryValue);
|
|
3845
|
-
|
|
4300
|
+
var bubbleColorValue = colorMode === COLOR_MODE_TYPES.SEQUENTIAL && isBubbleColorAnArray ? bubbleColor[index] : getColorValue(categoryValue); // if we find an invalid data point here (x, y or size is null or undefined), we ignore it
|
|
4301
|
+
|
|
3846
4302
|
if (xValue == null || yValue == null || sizeValue == null) {
|
|
3847
4303
|
return;
|
|
3848
|
-
}
|
|
3849
|
-
|
|
4304
|
+
} // initialize rowData
|
|
4305
|
+
|
|
4306
|
+
|
|
3850
4307
|
if (!dataByRows[yValue]) {
|
|
3851
4308
|
dataByRows[yValue] = {
|
|
3852
4309
|
rowXValues: [],
|
|
@@ -3858,30 +4315,34 @@ var getDataByRows = function getDataByRows(_ref4) {
|
|
|
3858
4315
|
rowRadiusValues: []
|
|
3859
4316
|
};
|
|
3860
4317
|
}
|
|
4318
|
+
|
|
3861
4319
|
dataByRows[yValue].rowXValues.push(xValue);
|
|
3862
4320
|
dataByRows[yValue].rowSizeValues.push(sizeValue);
|
|
3863
4321
|
dataByRows[yValue].rowCategoryValues.push(categoryValue);
|
|
3864
4322
|
dataByRows[yValue].rowColorValues.push(bubbleColorValue);
|
|
3865
4323
|
dataByRows[yValue].rowFillOpacityValues.push(getOpacityValue(size[index], dataByRows[yValue].rowSizeScale));
|
|
3866
4324
|
dataByRows[yValue].rowRadiusValues.push(getRadiusValue(size[index], dataByRows[yValue].rowSizeScale));
|
|
3867
|
-
});
|
|
3868
|
-
|
|
4325
|
+
}); // If we are using row scaling we need to recalculate opacity, radius and size scale
|
|
4326
|
+
|
|
3869
4327
|
if (bubbleRowScale === BUBBLE_ROW_SCALE_TYPES.ROW) {
|
|
3870
4328
|
Object.entries(dataByRows).forEach(function (_ref5) {
|
|
3871
4329
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
3872
|
-
|
|
3873
|
-
|
|
4330
|
+
row = _ref6[0],
|
|
4331
|
+
rowData = _ref6[1];
|
|
4332
|
+
|
|
3874
4333
|
var rowSizeScale = (0, exports.createValueScale)(rowData.rowSizeValues);
|
|
3875
|
-
dataByRows[row].rowSizeScale = rowSizeScale;
|
|
3876
|
-
|
|
4334
|
+
dataByRows[row].rowSizeScale = rowSizeScale; // Fill in opacity and radius values based on row scale
|
|
4335
|
+
|
|
3877
4336
|
rowData.rowSizeValues.forEach(function (rowSizeValue, index) {
|
|
3878
4337
|
dataByRows[row].rowFillOpacityValues[index] = getOpacityValue(rowData.rowSizeValues[index], rowSizeScale);
|
|
3879
4338
|
dataByRows[row].rowRadiusValues[index] = getRadiusValue(rowData.rowSizeValues[index], rowSizeScale);
|
|
3880
4339
|
});
|
|
3881
4340
|
});
|
|
3882
4341
|
}
|
|
4342
|
+
|
|
3883
4343
|
return dataByRows;
|
|
3884
4344
|
};
|
|
4345
|
+
|
|
3885
4346
|
exports.getDataByRows = getDataByRows;
|
|
3886
4347
|
/**
|
|
3887
4348
|
* Given selected dimensions
|
|
@@ -3893,12 +4354,14 @@ exports.getDataByRows = getDataByRows;
|
|
|
3893
4354
|
* @param {String} selectedCategory
|
|
3894
4355
|
* @return {Boolean}
|
|
3895
4356
|
*/
|
|
4357
|
+
|
|
3896
4358
|
var isSomethingSelected = function isSomethingSelected(_ref7) {
|
|
3897
4359
|
var selectedX = _ref7.selectedX,
|
|
3898
|
-
|
|
3899
|
-
|
|
4360
|
+
selectedY = _ref7.selectedY,
|
|
4361
|
+
selectedCategory = _ref7.selectedCategory;
|
|
3900
4362
|
return selectedX !== null || selectedY !== null || selectedCategory !== null;
|
|
3901
4363
|
};
|
|
4364
|
+
|
|
3902
4365
|
exports.isSomethingSelected = isSomethingSelected;
|
|
3903
4366
|
/**
|
|
3904
4367
|
* Given selected dimensions and a specific bubble's values
|
|
@@ -3913,24 +4376,30 @@ exports.isSomethingSelected = isSomethingSelected;
|
|
|
3913
4376
|
* @param {Boolean} categoryValue
|
|
3914
4377
|
* @return {Boolean}
|
|
3915
4378
|
*/
|
|
4379
|
+
|
|
3916
4380
|
var isBubbleSelected = function isBubbleSelected(_ref8) {
|
|
3917
4381
|
var selectedX = _ref8.selectedX,
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
4382
|
+
selectedY = _ref8.selectedY,
|
|
4383
|
+
selectedCategory = _ref8.selectedCategory,
|
|
4384
|
+
xValue = _ref8.xValue,
|
|
4385
|
+
yValue = _ref8.yValue,
|
|
4386
|
+
categoryValue = _ref8.categoryValue;
|
|
4387
|
+
|
|
3923
4388
|
if (selectedX !== null && xValue !== selectedX) {
|
|
3924
4389
|
return false;
|
|
3925
4390
|
}
|
|
4391
|
+
|
|
3926
4392
|
if (selectedY !== null && yValue !== selectedY) {
|
|
3927
4393
|
return false;
|
|
3928
4394
|
}
|
|
4395
|
+
|
|
3929
4396
|
if (selectedCategory !== null && categoryValue !== selectedCategory) {
|
|
3930
4397
|
return false;
|
|
3931
4398
|
}
|
|
4399
|
+
|
|
3932
4400
|
return true;
|
|
3933
4401
|
};
|
|
4402
|
+
|
|
3934
4403
|
exports.isBubbleSelected = isBubbleSelected;
|
|
3935
4404
|
/**
|
|
3936
4405
|
* Given text and available width, the truncateAxisLabelText will ellipsize
|
|
@@ -3941,28 +4410,35 @@ exports.isBubbleSelected = isBubbleSelected;
|
|
|
3941
4410
|
* @param {Number} widthInPX - Available width to render the text
|
|
3942
4411
|
* @param {('ellipsisStart' | 'ellipsisEnd')} axisLabelOverflowMode - Truncate start or end of the text
|
|
3943
4412
|
*/
|
|
4413
|
+
|
|
3944
4414
|
var truncateAxisLabelText = function truncateAxisLabelText(_ref9) {
|
|
3945
4415
|
var label = _ref9.label,
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4416
|
+
_ref9$widthInPX = _ref9.widthInPX,
|
|
4417
|
+
widthInPX = _ref9$widthInPX === void 0 ? Y_AXIS_WIDTH : _ref9$widthInPX,
|
|
4418
|
+
_ref9$axisLabelOverfl = _ref9.axisLabelOverflowMode,
|
|
4419
|
+
axisLabelOverflowMode = _ref9$axisLabelOverfl === void 0 ? 'ellipsisEnd' : _ref9$axisLabelOverfl;
|
|
3950
4420
|
// convert available width to number of characters that can be rendered.
|
|
3951
4421
|
var availableLength = Math.floor(widthInPX / HORIZONTAL_SPACE_FOR_SINGLE_CHAR);
|
|
4422
|
+
|
|
3952
4423
|
if (label.length <= availableLength) {
|
|
3953
4424
|
return label;
|
|
3954
|
-
}
|
|
3955
|
-
// return empty string if available space cannot accomodate
|
|
4425
|
+
} // return empty string if available space cannot accomodate
|
|
3956
4426
|
// at least one label character
|
|
4427
|
+
|
|
4428
|
+
|
|
3957
4429
|
if (availableLength < 'X...'.length) {
|
|
3958
4430
|
return '';
|
|
3959
4431
|
}
|
|
4432
|
+
|
|
3960
4433
|
var endMarker = Math.max(0, availableLength - '...'.length);
|
|
4434
|
+
|
|
3961
4435
|
if (axisLabelOverflowMode === 'ellipsisStart') {
|
|
3962
4436
|
return "...".concat(label.slice(-endMarker));
|
|
3963
4437
|
}
|
|
4438
|
+
|
|
3964
4439
|
return "".concat(label.slice(0, endMarker), "...");
|
|
3965
4440
|
};
|
|
4441
|
+
|
|
3966
4442
|
exports.truncateAxisLabelText = truncateAxisLabelText;
|
|
3967
4443
|
|
|
3968
4444
|
/***/ })
|