@splunk/visualizations 26.0.0 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
package/Punchcard.js
CHANGED
|
@@ -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.0 - fc8bf8d77",
|
|
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
|
/***/ }),
|
|
@@ -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: {
|
|
@@ -644,6 +701,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
644
701
|
height: '50%'
|
|
645
702
|
});
|
|
646
703
|
}
|
|
704
|
+
|
|
647
705
|
return React.createElement(Message_1.default, {
|
|
648
706
|
width: width,
|
|
649
707
|
height: height,
|
|
@@ -651,6 +709,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
651
709
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
652
710
|
});
|
|
653
711
|
};
|
|
712
|
+
|
|
654
713
|
IconPlaceholder.propTypes = propTypes;
|
|
655
714
|
IconPlaceholder.defaultProps = {
|
|
656
715
|
width: '100%',
|
|
@@ -667,21 +726,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
667
726
|
|
|
668
727
|
|
|
669
728
|
var _defineProperty = __webpack_require__(7);
|
|
729
|
+
|
|
670
730
|
Object.defineProperty(exports, "__esModule", {
|
|
671
731
|
value: true
|
|
672
732
|
});
|
|
673
733
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
734
|
+
|
|
674
735
|
var T = __webpack_require__(0);
|
|
736
|
+
|
|
675
737
|
var lodash_1 = __webpack_require__(3);
|
|
676
|
-
|
|
738
|
+
|
|
739
|
+
var DataSource_1 = __webpack_require__(34);
|
|
740
|
+
|
|
677
741
|
exports.SortParamsPropTypes = T.shape({
|
|
678
742
|
currentSortKey: T.string,
|
|
679
743
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
680
744
|
onSort: T.func
|
|
681
745
|
});
|
|
746
|
+
|
|
682
747
|
var getSortingParams = function getSortingParams(_ref) {
|
|
683
748
|
var requestParams = _ref.requestParams,
|
|
684
|
-
|
|
749
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
685
750
|
var currentSortKey;
|
|
686
751
|
var currentSortDir;
|
|
687
752
|
var nextSortDirMap = {
|
|
@@ -690,15 +755,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
690
755
|
none: 'asc'
|
|
691
756
|
};
|
|
692
757
|
var onSort;
|
|
758
|
+
|
|
693
759
|
if (typeof onRequestParamsChange === 'function') {
|
|
694
760
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
695
761
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
696
762
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
697
|
-
}
|
|
698
|
-
|
|
763
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
764
|
+
|
|
765
|
+
|
|
699
766
|
onSort = function onSort(e, _ref2) {
|
|
700
767
|
var sortKey = _ref2.sortKey,
|
|
701
|
-
|
|
768
|
+
sortDir = _ref2.sortDir;
|
|
769
|
+
|
|
702
770
|
if (typeof sortKey === 'string') {
|
|
703
771
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
704
772
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -710,12 +778,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
710
778
|
}
|
|
711
779
|
};
|
|
712
780
|
}
|
|
781
|
+
|
|
713
782
|
return {
|
|
714
783
|
currentSortKey: currentSortKey,
|
|
715
784
|
currentSortDir: currentSortDir,
|
|
716
785
|
onSort: onSort
|
|
717
786
|
};
|
|
718
787
|
};
|
|
788
|
+
|
|
719
789
|
exports.getSortingParams = getSortingParams;
|
|
720
790
|
|
|
721
791
|
/***/ }),
|
|
@@ -726,43 +796,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
726
796
|
"use strict";
|
|
727
797
|
|
|
728
798
|
|
|
799
|
+
Object.defineProperty(exports, "__esModule", {
|
|
800
|
+
value: true
|
|
801
|
+
});
|
|
802
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
803
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
804
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
805
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
806
|
+
|
|
807
|
+
/***/ }),
|
|
808
|
+
|
|
809
|
+
/***/ 35:
|
|
810
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
811
|
+
|
|
812
|
+
"use strict";
|
|
813
|
+
|
|
814
|
+
|
|
729
815
|
Object.defineProperty(exports, "__esModule", {
|
|
730
816
|
value: true
|
|
731
817
|
});
|
|
732
818
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
819
|
+
|
|
733
820
|
var T = __webpack_require__(0);
|
|
821
|
+
|
|
734
822
|
var lodash_1 = __webpack_require__(3);
|
|
823
|
+
|
|
735
824
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
736
825
|
isPaging: T.bool,
|
|
737
826
|
current: T.number,
|
|
738
827
|
totalPages: T.number,
|
|
739
828
|
onChange: T.func
|
|
740
829
|
});
|
|
830
|
+
|
|
741
831
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
742
832
|
var requestParams = _ref.requestParams,
|
|
743
|
-
|
|
744
|
-
|
|
833
|
+
meta = _ref.meta,
|
|
834
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
745
835
|
var totalCount = meta && meta.totalCount || 0;
|
|
746
836
|
var offset = requestParams && requestParams.offset || 0;
|
|
747
837
|
var count = requestParams && requestParams.count;
|
|
748
838
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
749
839
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
750
840
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
841
|
+
|
|
751
842
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
752
843
|
var page = _ref2.page,
|
|
753
|
-
|
|
844
|
+
countArg = _ref2.count;
|
|
754
845
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
846
|
+
|
|
755
847
|
if (typeof countArg === 'number') {
|
|
756
848
|
newParams.count = countArg;
|
|
757
849
|
newParams.offset = 0;
|
|
758
850
|
}
|
|
851
|
+
|
|
759
852
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
853
|
+
|
|
760
854
|
if (typeof page === 'number' && page > 0) {
|
|
761
855
|
newParams.count = pageCount;
|
|
762
856
|
newParams.offset = (page - 1) * pageCount;
|
|
763
857
|
}
|
|
858
|
+
|
|
764
859
|
onRequestParamsChange(newParams);
|
|
765
860
|
};
|
|
861
|
+
|
|
766
862
|
return {
|
|
767
863
|
isPaging: isPaging,
|
|
768
864
|
current: current,
|
|
@@ -770,11 +866,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
770
866
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
771
867
|
};
|
|
772
868
|
};
|
|
869
|
+
|
|
773
870
|
exports.getPaginationParams = getPaginationParams;
|
|
774
871
|
|
|
775
872
|
/***/ }),
|
|
776
873
|
|
|
777
|
-
/***/
|
|
874
|
+
/***/ 36:
|
|
778
875
|
/***/ (function(module, exports, __webpack_require__) {
|
|
779
876
|
|
|
780
877
|
"use strict";
|
|
@@ -785,6 +882,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
785
882
|
});
|
|
786
883
|
exports.VizCategory = void 0;
|
|
787
884
|
var VizCategory;
|
|
885
|
+
|
|
788
886
|
(function (VizCategory) {
|
|
789
887
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
790
888
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -802,67 +900,96 @@ var VizCategory;
|
|
|
802
900
|
|
|
803
901
|
/***/ }),
|
|
804
902
|
|
|
805
|
-
/***/
|
|
903
|
+
/***/ 37:
|
|
806
904
|
/***/ (function(module, exports, __webpack_require__) {
|
|
807
905
|
|
|
808
906
|
"use strict";
|
|
809
907
|
|
|
810
908
|
|
|
811
909
|
var _slicedToArray = __webpack_require__(17);
|
|
910
|
+
|
|
812
911
|
Object.defineProperty(exports, "__esModule", {
|
|
813
912
|
value: true
|
|
814
913
|
});
|
|
914
|
+
|
|
815
915
|
var React = __webpack_require__(1);
|
|
916
|
+
|
|
816
917
|
var lodash_1 = __webpack_require__(3);
|
|
817
|
-
|
|
918
|
+
|
|
919
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
920
|
+
|
|
818
921
|
var Options_1 = __webpack_require__(30);
|
|
819
|
-
|
|
922
|
+
|
|
923
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
924
|
+
|
|
820
925
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
821
|
-
|
|
926
|
+
|
|
927
|
+
var moment_1 = __webpack_require__(40);
|
|
928
|
+
|
|
822
929
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
930
|
+
|
|
823
931
|
var styled_components_1 = __webpack_require__(4);
|
|
932
|
+
|
|
824
933
|
var hocUtils_1 = __webpack_require__(27);
|
|
934
|
+
|
|
825
935
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
826
|
-
|
|
936
|
+
|
|
937
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
938
|
+
|
|
827
939
|
var id_1 = __webpack_require__(25);
|
|
828
|
-
|
|
940
|
+
|
|
941
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
942
|
+
|
|
829
943
|
var VizBehavior_1 = __webpack_require__(6);
|
|
944
|
+
|
|
830
945
|
var getSorting_1 = __webpack_require__(33);
|
|
831
|
-
|
|
946
|
+
|
|
947
|
+
var getPagination_1 = __webpack_require__(35);
|
|
948
|
+
|
|
832
949
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
950
|
+
|
|
833
951
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
952
|
+
|
|
834
953
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
954
|
+
|
|
835
955
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
836
956
|
/**
|
|
837
957
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
838
958
|
* @param {DashboardVizOpts} opts
|
|
839
959
|
* @returns {HOC}
|
|
840
960
|
*/
|
|
961
|
+
|
|
962
|
+
|
|
841
963
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
842
964
|
var ReactViz = opts.ReactViz,
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
965
|
+
vizConfig = opts.vizConfig,
|
|
966
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
967
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
968
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
969
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
970
|
+
|
|
848
971
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
849
972
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
973
|
+
|
|
850
974
|
var DashboardViz = function DashboardViz(props) {
|
|
851
975
|
var _a;
|
|
976
|
+
|
|
852
977
|
var mode = props.mode,
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
978
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
979
|
+
dataSources = props.dataSources,
|
|
980
|
+
options = props.options,
|
|
981
|
+
_props$context = props.context,
|
|
982
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
983
|
+
width = props.width,
|
|
984
|
+
height = props.height,
|
|
985
|
+
onComputedProps = props.onComputedProps,
|
|
986
|
+
onEventTrigger = props.onEventTrigger,
|
|
987
|
+
theme = props.theme,
|
|
988
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
989
|
+
|
|
864
990
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
865
|
-
|
|
991
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
992
|
+
|
|
866
993
|
if (serializedTimezone) {
|
|
867
994
|
/*
|
|
868
995
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -876,38 +1003,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
876
1003
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
877
1004
|
}
|
|
878
1005
|
}
|
|
1006
|
+
|
|
879
1007
|
var themeFunc = function themeFunc(themeVar) {
|
|
880
1008
|
var _a, _b;
|
|
1009
|
+
|
|
881
1010
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
882
1011
|
};
|
|
1012
|
+
|
|
883
1013
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1014
|
+
|
|
884
1015
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1016
|
+
theme: theme
|
|
1017
|
+
}),
|
|
1018
|
+
currentThemeFamily = _ref.family,
|
|
1019
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1020
|
+
currentThemeDensity = _ref.density;
|
|
1021
|
+
|
|
890
1022
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1023
|
+
|
|
891
1024
|
var _React$useState = React.useState({}),
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1025
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1026
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1027
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1028
|
+
|
|
1029
|
+
|
|
895
1030
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1031
|
+
|
|
896
1032
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
897
|
-
|
|
898
|
-
|
|
1033
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1034
|
+
visualizationID = _React$useState4[0];
|
|
1035
|
+
|
|
899
1036
|
var _React$useState5 = React.useState({}),
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1037
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1038
|
+
dataSourcesInState = _React$useState6[0],
|
|
1039
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1040
|
+
|
|
903
1041
|
var _React$useState7 = React.useState(),
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1042
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1043
|
+
dataFramesInState = _React$useState8[0],
|
|
1044
|
+
setDataFramesInState = _React$useState8[1];
|
|
1045
|
+
|
|
907
1046
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1047
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1048
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1049
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1050
|
+
|
|
911
1051
|
var isMounted = React.useRef(true);
|
|
912
1052
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
913
1053
|
try {
|
|
@@ -932,11 +1072,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
932
1072
|
});
|
|
933
1073
|
} else {
|
|
934
1074
|
var dataFrames = dataFramesInState;
|
|
1075
|
+
|
|
935
1076
|
if (dataSources !== dataSourcesInState) {
|
|
936
1077
|
setDataSourcesInState(dataSources);
|
|
937
1078
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
938
1079
|
setDataFramesInState(dataFrames);
|
|
939
1080
|
}
|
|
1081
|
+
|
|
940
1082
|
return Options_1.Options.evaluate({
|
|
941
1083
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
942
1084
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -947,21 +1089,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
947
1089
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
948
1090
|
return {};
|
|
949
1091
|
}
|
|
1092
|
+
|
|
950
1093
|
return {};
|
|
951
1094
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
952
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
953
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1095
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
954
1096
|
// 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
1097
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1098
|
+
|
|
956
1099
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
957
1100
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1101
|
+
|
|
958
1102
|
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
1103
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
960
1104
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
961
1105
|
});
|
|
962
|
-
}
|
|
963
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1106
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
964
1107
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1108
|
+
|
|
1109
|
+
|
|
965
1110
|
React.useEffect(function () {
|
|
966
1111
|
onComputedProps(clonedEvaluatedOptions);
|
|
967
1112
|
});
|
|
@@ -971,44 +1116,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
971
1116
|
isMounted.current = false;
|
|
972
1117
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
973
1118
|
}
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
// present warning message if any required props are missing
|
|
1119
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1120
|
+
}, []); // present warning message if any required props are missing
|
|
1121
|
+
|
|
978
1122
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
979
|
-
|
|
980
|
-
|
|
1123
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1124
|
+
supports = vizConfig.supports;
|
|
981
1125
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1126
|
+
|
|
982
1127
|
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
1128
|
) {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1129
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1130
|
+
"data-test": "missing-props-message",
|
|
1131
|
+
width: width,
|
|
1132
|
+
height: height,
|
|
1133
|
+
missingProps: missing,
|
|
1134
|
+
backgroundColor: bgColorFromTheme
|
|
1135
|
+
});
|
|
1136
|
+
} // events
|
|
1137
|
+
|
|
1138
|
+
|
|
993
1139
|
var eventCallbackProps = {};
|
|
1140
|
+
|
|
994
1141
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
995
1142
|
var supportedEvents = vizConfig.events;
|
|
996
1143
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
997
1144
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
998
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
999
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1145
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1000
1146
|
// then remove these lines
|
|
1147
|
+
|
|
1001
1148
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1002
1149
|
var payload = {};
|
|
1150
|
+
|
|
1003
1151
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1004
1152
|
payloadKeys.forEach(function (p) {
|
|
1005
1153
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1006
1154
|
});
|
|
1007
1155
|
}
|
|
1156
|
+
|
|
1008
1157
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1009
1158
|
if (ev && ev.payload) {
|
|
1010
1159
|
payload = ev.payload;
|
|
1011
1160
|
}
|
|
1161
|
+
|
|
1012
1162
|
return onEventTrigger({
|
|
1013
1163
|
originalEvent: ev,
|
|
1014
1164
|
payload: payload,
|
|
@@ -1016,8 +1166,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1016
1166
|
});
|
|
1017
1167
|
};
|
|
1018
1168
|
});
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1169
|
+
} // compute pure viz props which are not from options
|
|
1170
|
+
|
|
1171
|
+
|
|
1021
1172
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1022
1173
|
themeFunc: themeFunc
|
|
1023
1174
|
}));
|
|
@@ -1035,15 +1186,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1035
1186
|
* In future, we could automatically detect which all datasources are being used
|
|
1036
1187
|
* and bind those magically to pagination/sorting behavior.
|
|
1037
1188
|
*/
|
|
1189
|
+
|
|
1038
1190
|
var dataSourceMetadata = {};
|
|
1039
1191
|
var OptionKey = 'paginateDataSourceKey';
|
|
1040
1192
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1193
|
+
|
|
1041
1194
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1042
1195
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1043
1196
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1197
|
+
|
|
1044
1198
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1045
1199
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1046
1200
|
};
|
|
1201
|
+
|
|
1047
1202
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1048
1203
|
requestParams: requestParams,
|
|
1049
1204
|
meta: meta,
|
|
@@ -1058,115 +1213,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1058
1213
|
sortParams: sortParams,
|
|
1059
1214
|
paginatorParams: paginatorParams
|
|
1060
1215
|
};
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1216
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1217
|
+
|
|
1218
|
+
|
|
1063
1219
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1064
1220
|
return null;
|
|
1065
1221
|
}
|
|
1222
|
+
|
|
1066
1223
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1067
1224
|
mode: mode,
|
|
1068
1225
|
width: width,
|
|
1069
1226
|
height: height
|
|
1070
1227
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1071
1228
|
};
|
|
1229
|
+
|
|
1072
1230
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1073
1231
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1074
1232
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1075
1233
|
theme: {}
|
|
1076
|
-
});
|
|
1077
|
-
|
|
1078
|
-
DashboardViz.config = vizConfig;
|
|
1079
|
-
|
|
1234
|
+
}); // attach viz config
|
|
1235
|
+
|
|
1236
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1237
|
+
|
|
1080
1238
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1081
1239
|
};
|
|
1240
|
+
|
|
1082
1241
|
exports.default = withDashboardViz;
|
|
1083
1242
|
|
|
1084
1243
|
/***/ }),
|
|
1085
1244
|
|
|
1086
|
-
/***/
|
|
1245
|
+
/***/ 38:
|
|
1087
1246
|
/***/ (function(module, exports) {
|
|
1088
1247
|
|
|
1089
1248
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1090
1249
|
|
|
1091
1250
|
/***/ }),
|
|
1092
1251
|
|
|
1093
|
-
/***/
|
|
1252
|
+
/***/ 39:
|
|
1094
1253
|
/***/ (function(module, exports) {
|
|
1095
1254
|
|
|
1096
1255
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1097
1256
|
|
|
1098
1257
|
/***/ }),
|
|
1099
1258
|
|
|
1100
|
-
/***/
|
|
1259
|
+
/***/ 4:
|
|
1101
1260
|
/***/ (function(module, exports) {
|
|
1102
1261
|
|
|
1103
|
-
module.exports = require("
|
|
1262
|
+
module.exports = require("styled-components");
|
|
1104
1263
|
|
|
1105
1264
|
/***/ }),
|
|
1106
1265
|
|
|
1107
|
-
/***/
|
|
1266
|
+
/***/ 40:
|
|
1108
1267
|
/***/ (function(module, exports) {
|
|
1109
1268
|
|
|
1110
|
-
module.exports = require("
|
|
1269
|
+
module.exports = require("@splunk/moment");
|
|
1111
1270
|
|
|
1112
1271
|
/***/ }),
|
|
1113
1272
|
|
|
1114
|
-
/***/
|
|
1273
|
+
/***/ 41:
|
|
1115
1274
|
/***/ (function(module, exports) {
|
|
1116
1275
|
|
|
1117
1276
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1118
1277
|
|
|
1119
1278
|
/***/ }),
|
|
1120
1279
|
|
|
1121
|
-
/***/
|
|
1280
|
+
/***/ 42:
|
|
1122
1281
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1123
1282
|
|
|
1124
1283
|
"use strict";
|
|
1125
1284
|
|
|
1126
1285
|
|
|
1127
1286
|
var _classCallCheck = __webpack_require__(9);
|
|
1287
|
+
|
|
1128
1288
|
Object.defineProperty(exports, "__esModule", {
|
|
1129
1289
|
value: true
|
|
1130
1290
|
});
|
|
1131
1291
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1132
1292
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1293
|
+
|
|
1133
1294
|
var T = __webpack_require__(0);
|
|
1295
|
+
|
|
1134
1296
|
var lodash_1 = __webpack_require__(3);
|
|
1135
|
-
|
|
1136
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1297
|
+
|
|
1298
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1299
|
+
|
|
1300
|
+
|
|
1137
1301
|
exports.INITIAL_WIDTH = 250;
|
|
1138
1302
|
exports.INITIAL_HEIGHT = 250;
|
|
1139
1303
|
/**
|
|
1140
1304
|
* A Splunk visualization
|
|
1141
1305
|
*/
|
|
1306
|
+
|
|
1142
1307
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1143
1308
|
_classCallCheck(this, SplunkVisualization);
|
|
1144
1309
|
};
|
|
1310
|
+
|
|
1145
1311
|
SplunkVisualization.propTypes = {
|
|
1146
1312
|
/**
|
|
1147
1313
|
* display mode
|
|
1148
1314
|
*/
|
|
1149
1315
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1316
|
+
|
|
1150
1317
|
/**
|
|
1151
1318
|
* width in pixel or string, defaults to 100%
|
|
1152
1319
|
*/
|
|
1153
1320
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1321
|
+
|
|
1154
1322
|
/**
|
|
1155
1323
|
* height in pixel or string
|
|
1156
1324
|
*/
|
|
1157
1325
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1326
|
+
|
|
1158
1327
|
/**
|
|
1159
1328
|
* visualization context used for dynamic option evaluation
|
|
1160
1329
|
*/
|
|
1161
1330
|
context: T.object,
|
|
1331
|
+
|
|
1162
1332
|
/**
|
|
1163
1333
|
* visualization formatting options
|
|
1164
1334
|
*/
|
|
1165
1335
|
options: T.object,
|
|
1336
|
+
|
|
1166
1337
|
/**
|
|
1167
1338
|
* A callback to update formatting options
|
|
1168
1339
|
*/
|
|
1169
1340
|
onOptionsChange: T.func,
|
|
1341
|
+
|
|
1170
1342
|
/**
|
|
1171
1343
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1172
1344
|
*/
|
|
@@ -1175,6 +1347,7 @@ SplunkVisualization.propTypes = {
|
|
|
1175
1347
|
* current request params
|
|
1176
1348
|
*/
|
|
1177
1349
|
requestParams: T.object,
|
|
1350
|
+
|
|
1178
1351
|
/**
|
|
1179
1352
|
* current dataset
|
|
1180
1353
|
*/
|
|
@@ -1182,6 +1355,7 @@ SplunkVisualization.propTypes = {
|
|
|
1182
1355
|
fields: T.array,
|
|
1183
1356
|
columns: T.array
|
|
1184
1357
|
}),
|
|
1358
|
+
|
|
1185
1359
|
/**
|
|
1186
1360
|
* error
|
|
1187
1361
|
*/
|
|
@@ -1189,29 +1363,35 @@ SplunkVisualization.propTypes = {
|
|
|
1189
1363
|
level: T.string,
|
|
1190
1364
|
message: T.string
|
|
1191
1365
|
}),
|
|
1366
|
+
|
|
1192
1367
|
/**
|
|
1193
1368
|
* meta data that came with the dataset
|
|
1194
1369
|
*/
|
|
1195
1370
|
meta: T.object
|
|
1196
1371
|
})),
|
|
1372
|
+
|
|
1197
1373
|
/**
|
|
1198
1374
|
* A callback to trigger event
|
|
1199
1375
|
*/
|
|
1200
1376
|
onEventTrigger: T.func,
|
|
1377
|
+
|
|
1201
1378
|
/**
|
|
1202
1379
|
* Inform viz if there are handlers listening to events
|
|
1203
1380
|
*/
|
|
1204
1381
|
hasEventHandlers: T.bool,
|
|
1382
|
+
|
|
1205
1383
|
/**
|
|
1206
1384
|
* A callback to communicate computed props to a consumer
|
|
1207
1385
|
*/
|
|
1208
1386
|
onComputedProps: T.func,
|
|
1387
|
+
|
|
1209
1388
|
/**
|
|
1210
1389
|
* A callback to obtain visualization api
|
|
1211
1390
|
*/
|
|
1212
1391
|
vizActionHandlerRef: T.func,
|
|
1213
1392
|
loading: T.bool,
|
|
1214
1393
|
theme: T.object,
|
|
1394
|
+
|
|
1215
1395
|
/**
|
|
1216
1396
|
* A callback to request new data with updated request params
|
|
1217
1397
|
*/
|
|
@@ -1220,6 +1400,7 @@ SplunkVisualization.propTypes = {
|
|
|
1220
1400
|
/**
|
|
1221
1401
|
*
|
|
1222
1402
|
*/
|
|
1403
|
+
|
|
1223
1404
|
SplunkVisualization.defaultProps = {
|
|
1224
1405
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1225
1406
|
width: '100%',
|
|
@@ -1248,26 +1429,29 @@ exports.default = SplunkVisualization;
|
|
|
1248
1429
|
|
|
1249
1430
|
/***/ }),
|
|
1250
1431
|
|
|
1251
|
-
/***/
|
|
1432
|
+
/***/ 43:
|
|
1252
1433
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1253
1434
|
|
|
1254
1435
|
"use strict";
|
|
1255
1436
|
|
|
1256
1437
|
|
|
1257
1438
|
var _classCallCheck = __webpack_require__(9);
|
|
1439
|
+
|
|
1258
1440
|
var _createClass = __webpack_require__(18);
|
|
1441
|
+
|
|
1259
1442
|
Object.defineProperty(exports, "__esModule", {
|
|
1260
1443
|
value: true
|
|
1261
1444
|
});
|
|
1262
1445
|
exports.DefaultVizActionHandler = void 0;
|
|
1446
|
+
|
|
1263
1447
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1264
1448
|
function DefaultVizActionHandler() {
|
|
1265
1449
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1266
1450
|
}
|
|
1451
|
+
|
|
1267
1452
|
_createClass(DefaultVizActionHandler, [{
|
|
1268
1453
|
key: "focus",
|
|
1269
|
-
value: function focus() {
|
|
1270
|
-
// noop
|
|
1454
|
+
value: function focus() {// noop
|
|
1271
1455
|
}
|
|
1272
1456
|
}, {
|
|
1273
1457
|
key: "snapshot",
|
|
@@ -1275,23 +1459,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1275
1459
|
return null; // noop
|
|
1276
1460
|
}
|
|
1277
1461
|
}]);
|
|
1462
|
+
|
|
1278
1463
|
return DefaultVizActionHandler;
|
|
1279
1464
|
}();
|
|
1280
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1281
1465
|
|
|
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'];
|
|
1466
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1295
1467
|
|
|
1296
1468
|
/***/ }),
|
|
1297
1469
|
|
|
@@ -1305,7 +1477,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1305
1477
|
value: true
|
|
1306
1478
|
});
|
|
1307
1479
|
exports.useDeepMemo = void 0;
|
|
1480
|
+
|
|
1308
1481
|
var react_1 = __webpack_require__(1);
|
|
1482
|
+
|
|
1309
1483
|
var lodash_1 = __webpack_require__(3);
|
|
1310
1484
|
/**
|
|
1311
1485
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1320,16 +1494,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1320
1494
|
* @param fn the function to be executed and
|
|
1321
1495
|
* @param dependencies an array of dependencies
|
|
1322
1496
|
*/
|
|
1497
|
+
|
|
1498
|
+
|
|
1323
1499
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1324
1500
|
var ref = (0, react_1.useRef)();
|
|
1501
|
+
|
|
1325
1502
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1326
1503
|
ref.current = {
|
|
1327
1504
|
dependencies: dependencies,
|
|
1328
1505
|
value: fn()
|
|
1329
1506
|
};
|
|
1330
1507
|
}
|
|
1508
|
+
|
|
1331
1509
|
return ref.current.value;
|
|
1332
1510
|
};
|
|
1511
|
+
|
|
1333
1512
|
exports.useDeepMemo = useDeepMemo;
|
|
1334
1513
|
|
|
1335
1514
|
/***/ }),
|
|
@@ -1342,35 +1521,48 @@ exports.useDeepMemo = useDeepMemo;
|
|
|
1342
1521
|
|
|
1343
1522
|
var __rest = this && this.__rest || function (s, e) {
|
|
1344
1523
|
var t = {};
|
|
1524
|
+
|
|
1345
1525
|
for (var p in s) {
|
|
1346
1526
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1347
1527
|
}
|
|
1528
|
+
|
|
1348
1529
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1349
1530
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1350
1531
|
}
|
|
1351
1532
|
return t;
|
|
1352
1533
|
};
|
|
1534
|
+
|
|
1353
1535
|
Object.defineProperty(exports, "__esModule", {
|
|
1354
1536
|
value: true
|
|
1355
1537
|
});
|
|
1356
1538
|
exports.themes = exports.computeVizProps = exports.PurePunchcard = exports.config = void 0;
|
|
1539
|
+
|
|
1357
1540
|
var lodash_1 = __webpack_require__(3);
|
|
1541
|
+
|
|
1358
1542
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1543
|
+
|
|
1359
1544
|
var config_1 = __webpack_require__(445);
|
|
1360
|
-
|
|
1545
|
+
|
|
1546
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
1547
|
+
|
|
1361
1548
|
var Punchcard_1 = __webpack_require__(446);
|
|
1549
|
+
|
|
1362
1550
|
var punchcardUtils_1 = __webpack_require__(454);
|
|
1551
|
+
|
|
1363
1552
|
exports.config = config_1.default;
|
|
1364
1553
|
exports.PurePunchcard = Punchcard_1.default;
|
|
1365
1554
|
var validOptions = Object.keys(exports.config.optionsSchema);
|
|
1555
|
+
|
|
1366
1556
|
var computeVizProps = function computeVizProps(_a) {
|
|
1367
1557
|
var onPointClick = _a.onPointClick,
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1558
|
+
onLegendClick = _a.onLegendClick,
|
|
1559
|
+
x = _a.x,
|
|
1560
|
+
y = _a.y,
|
|
1561
|
+
category = _a.category,
|
|
1562
|
+
otherOptions = __rest(_a, ["onPointClick", "onLegendClick", "x", "y", "category"]);
|
|
1563
|
+
|
|
1373
1564
|
var options = (0, lodash_1.chain)(otherOptions).pick(validOptions).thru(punchcardUtils_1.convertToPunchcardProperties).value();
|
|
1565
|
+
|
|
1374
1566
|
if (options.seriesColors && typeof options.seriesColors === 'string') {
|
|
1375
1567
|
try {
|
|
1376
1568
|
options.seriesColors = JSON.parse(options.seriesColors);
|
|
@@ -1378,6 +1570,7 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
1378
1570
|
options.seriesColors = visualization_color_palettes_1.VIZ_CATEGORICAL;
|
|
1379
1571
|
}
|
|
1380
1572
|
}
|
|
1573
|
+
|
|
1381
1574
|
return Object.assign({
|
|
1382
1575
|
onPointClick: onPointClick,
|
|
1383
1576
|
onLegendClick: onLegendClick,
|
|
@@ -1387,6 +1580,7 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
1387
1580
|
category: category && category.map(String)
|
|
1388
1581
|
}, options);
|
|
1389
1582
|
};
|
|
1583
|
+
|
|
1390
1584
|
exports.computeVizProps = computeVizProps;
|
|
1391
1585
|
var viz = (0, withDashboardViz_1.default)({
|
|
1392
1586
|
ReactViz: Punchcard_1.default,
|
|
@@ -1407,24 +1601,35 @@ exports.default = viz;
|
|
|
1407
1601
|
Object.defineProperty(exports, "__esModule", {
|
|
1408
1602
|
value: true
|
|
1409
1603
|
});
|
|
1604
|
+
|
|
1410
1605
|
var i18n_1 = __webpack_require__(2);
|
|
1606
|
+
|
|
1411
1607
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1608
|
+
|
|
1412
1609
|
var visualization_icons_1 = __webpack_require__(52);
|
|
1610
|
+
|
|
1413
1611
|
var placeholders_1 = __webpack_require__(50);
|
|
1612
|
+
|
|
1414
1613
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1614
|
+
|
|
1415
1615
|
var pick_1 = __webpack_require__(23);
|
|
1616
|
+
|
|
1416
1617
|
var variables_1 = __webpack_require__(11);
|
|
1618
|
+
|
|
1417
1619
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1418
|
-
|
|
1620
|
+
|
|
1621
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
1622
|
+
|
|
1419
1623
|
var configUtils_1 = __webpack_require__(20);
|
|
1624
|
+
|
|
1420
1625
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
1626
|
+
|
|
1421
1627
|
var dataContract = {
|
|
1422
1628
|
requiredDataSources: [{
|
|
1423
1629
|
name: 'primary',
|
|
1424
1630
|
description: 'DataSource that powers the visualization'
|
|
1425
1631
|
}],
|
|
1426
|
-
optionalDataSources: [
|
|
1427
|
-
// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1632
|
+
optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1428
1633
|
// {
|
|
1429
1634
|
// name: 'annotation',
|
|
1430
1635
|
// description: 'DataSource that populate event annotations',
|
|
@@ -1659,8 +1864,7 @@ var editorConfig = [{
|
|
|
1659
1864
|
value: 'categorical'
|
|
1660
1865
|
}]
|
|
1661
1866
|
}
|
|
1662
|
-
}], [
|
|
1663
|
-
// This should be hidden in categorical color mode
|
|
1867
|
+
}], [// This should be hidden in categorical color mode
|
|
1664
1868
|
{
|
|
1665
1869
|
label: (0, i18n_1._)('Color by field'),
|
|
1666
1870
|
editor: 'editor.columnSelector',
|
|
@@ -1706,16 +1910,19 @@ var editorConfig = [{
|
|
|
1706
1910
|
/**
|
|
1707
1911
|
* visualization configuration
|
|
1708
1912
|
*/
|
|
1913
|
+
|
|
1709
1914
|
var config = {
|
|
1710
1915
|
/**
|
|
1711
1916
|
* unique viz key
|
|
1712
1917
|
*/
|
|
1713
1918
|
key: 'splunk.punchcard',
|
|
1919
|
+
|
|
1714
1920
|
/**
|
|
1715
1921
|
* viz name
|
|
1716
1922
|
*/
|
|
1717
1923
|
name: (0, i18n_1._)('Punchcard'),
|
|
1718
1924
|
category: VizCategory_1.VizCategory.CORRELATION,
|
|
1925
|
+
|
|
1719
1926
|
/**
|
|
1720
1927
|
* viz icon
|
|
1721
1928
|
*/
|
|
@@ -1749,23 +1956,41 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
|
1749
1956
|
|
|
1750
1957
|
|
|
1751
1958
|
var _defineProperty = __webpack_require__(7);
|
|
1959
|
+
|
|
1752
1960
|
var _slicedToArray = __webpack_require__(17);
|
|
1961
|
+
|
|
1753
1962
|
Object.defineProperty(exports, "__esModule", {
|
|
1754
1963
|
value: true
|
|
1755
1964
|
});
|
|
1965
|
+
|
|
1756
1966
|
var React = __webpack_require__(1);
|
|
1967
|
+
|
|
1757
1968
|
var styled_components_1 = __webpack_require__(4);
|
|
1969
|
+
|
|
1758
1970
|
var T = __webpack_require__(0);
|
|
1971
|
+
|
|
1759
1972
|
var lodash_1 = __webpack_require__(3);
|
|
1973
|
+
|
|
1974
|
+
var types_1 = __webpack_require__(83);
|
|
1975
|
+
|
|
1760
1976
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
1977
|
+
|
|
1761
1978
|
var style_1 = __webpack_require__(14);
|
|
1979
|
+
|
|
1762
1980
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1981
|
+
|
|
1763
1982
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
1983
|
+
|
|
1764
1984
|
var sortUtils_1 = __webpack_require__(447);
|
|
1985
|
+
|
|
1765
1986
|
var PunchcardAxis_1 = __webpack_require__(448);
|
|
1987
|
+
|
|
1766
1988
|
var PunchcardChartArea_1 = __webpack_require__(449);
|
|
1989
|
+
|
|
1767
1990
|
var PunchcardLegend_1 = __webpack_require__(452);
|
|
1991
|
+
|
|
1768
1992
|
var PunchcardGridLines_1 = __webpack_require__(453);
|
|
1993
|
+
|
|
1769
1994
|
var Container = styled_components_1.default.div.withConfig({
|
|
1770
1995
|
displayName: "Punchcard__Container",
|
|
1771
1996
|
componentId: "orvtgq-0"
|
|
@@ -1792,72 +2017,81 @@ var PunchcardSVG = styled_components_1.default.svg.withConfig({
|
|
|
1792
2017
|
})(["", ";"], function (props) {
|
|
1793
2018
|
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
1794
2019
|
});
|
|
2020
|
+
|
|
1795
2021
|
var Punchcard = function Punchcard(props) {
|
|
1796
2022
|
var _React$useState = React.useState(null),
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
2023
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2024
|
+
selectedX = _React$useState2[0],
|
|
2025
|
+
setSelectedX = _React$useState2[1];
|
|
2026
|
+
|
|
1800
2027
|
var _React$useState3 = React.useState(null),
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
2028
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2029
|
+
selectedY = _React$useState4[0],
|
|
2030
|
+
setSelectedY = _React$useState4[1];
|
|
2031
|
+
|
|
1804
2032
|
var _React$useState5 = React.useState(null),
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
2033
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2034
|
+
selectedCategory = _React$useState6[0],
|
|
2035
|
+
setSelectedCategory = _React$useState6[1];
|
|
2036
|
+
|
|
1808
2037
|
var handleMouseLeave = function handleMouseLeave() {
|
|
1809
2038
|
setSelectedX(null);
|
|
1810
2039
|
setSelectedY(null);
|
|
1811
2040
|
setSelectedCategory(null);
|
|
1812
2041
|
};
|
|
2042
|
+
|
|
1813
2043
|
var handleLegendHover = function handleLegendHover(category) {
|
|
1814
2044
|
setSelectedX(null);
|
|
1815
2045
|
setSelectedY(null);
|
|
1816
2046
|
setSelectedCategory(category);
|
|
1817
2047
|
};
|
|
2048
|
+
|
|
1818
2049
|
var handleXAxisHover = function handleXAxisHover(xValue) {
|
|
1819
2050
|
setSelectedX(xValue);
|
|
1820
2051
|
setSelectedY(null);
|
|
1821
2052
|
setSelectedCategory(null);
|
|
1822
2053
|
};
|
|
2054
|
+
|
|
1823
2055
|
var handleYAxisHover = function handleYAxisHover(yValue) {
|
|
1824
2056
|
setSelectedX(null);
|
|
1825
2057
|
setSelectedY(yValue);
|
|
1826
2058
|
setSelectedCategory(null);
|
|
1827
2059
|
};
|
|
2060
|
+
|
|
1828
2061
|
var handleBubbleHover = function handleBubbleHover(xValue, yValue, category) {
|
|
1829
2062
|
setSelectedX(xValue);
|
|
1830
2063
|
setSelectedY(yValue);
|
|
1831
2064
|
setSelectedCategory(category);
|
|
1832
2065
|
};
|
|
2066
|
+
|
|
1833
2067
|
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
|
-
|
|
2068
|
+
showBubbleLabels = props.showBubbleLabels,
|
|
2069
|
+
bubbleRowScale = props.bubbleRowScale,
|
|
2070
|
+
bubbleScale = props.bubbleScale,
|
|
2071
|
+
category = props.category,
|
|
2072
|
+
categoryField = props.categoryField,
|
|
2073
|
+
colorMode = props.colorMode,
|
|
2074
|
+
seriesColors = props.seriesColors,
|
|
2075
|
+
bubbleColor = props.bubbleColor,
|
|
2076
|
+
minBubbleColorIntensity = props.minBubbleColorIntensity,
|
|
2077
|
+
height = props.height,
|
|
2078
|
+
showMaxValuePulsation = props.showMaxValuePulsation,
|
|
2079
|
+
isBubbleSizeDynamic = props.isBubbleSizeDynamic,
|
|
2080
|
+
minBubbleSize = props.minBubbleSize,
|
|
2081
|
+
maxBubbleSize = props.maxBubbleSize,
|
|
2082
|
+
maxBubbleRadius = props.maxBubbleRadius,
|
|
2083
|
+
minBubbleRadius = props.minBubbleRadius,
|
|
2084
|
+
useDefaultSort = props.useDefaultSort,
|
|
2085
|
+
showLegend = props.showLegend,
|
|
2086
|
+
size = props.size,
|
|
2087
|
+
sizeField = props.sizeField,
|
|
2088
|
+
width = props.width,
|
|
2089
|
+
x = props.x,
|
|
2090
|
+
y = props.y,
|
|
2091
|
+
xField = props.xField,
|
|
2092
|
+
yField = props.yField,
|
|
2093
|
+
onPointClick = props.onPointClick,
|
|
2094
|
+
onLegendClick = props.onLegendClick;
|
|
1861
2095
|
var calculatedColorMode = category ? colorMode : punchcardUtils_1.COLOR_MODE_TYPES.SEQUENTIAL;
|
|
1862
2096
|
var displayLegend = showLegend && calculatedColorMode === punchcardUtils_1.COLOR_MODE_TYPES.CATEGORICAL;
|
|
1863
2097
|
var uniqX = useDefaultSort ? (0, sortUtils_1.sortAxis)((0, lodash_1.uniq)(x.map(function (v) {
|
|
@@ -1867,13 +2101,18 @@ var Punchcard = function Punchcard(props) {
|
|
|
1867
2101
|
return "".concat(v);
|
|
1868
2102
|
}))) : (0, lodash_1.uniq)(y);
|
|
1869
2103
|
var uniqCategory = (0, lodash_1.uniq)(category);
|
|
2104
|
+
var bubbleSizes = size.map(function (v) {
|
|
2105
|
+
return (0, types_1.isNumber)(v) ? Number(v) : 0;
|
|
2106
|
+
});
|
|
1870
2107
|
var colorCategoryMapping = (0, punchcardUtils_1.getColorCategoryMapping)({
|
|
1871
2108
|
category: uniqCategory,
|
|
1872
2109
|
colorMode: calculatedColorMode,
|
|
1873
2110
|
seriesColors: seriesColors
|
|
1874
2111
|
});
|
|
2112
|
+
|
|
1875
2113
|
var handlePointClick = function handlePointClick(sizeValue) {
|
|
1876
2114
|
var _rowData;
|
|
2115
|
+
|
|
1877
2116
|
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
2117
|
if (categoryField) rowData["row.".concat(categoryField, ".value")] = selectedCategory;
|
|
1879
2118
|
onPointClick({
|
|
@@ -1884,6 +2123,7 @@ var Punchcard = function Punchcard(props) {
|
|
|
1884
2123
|
}, rowData)
|
|
1885
2124
|
});
|
|
1886
2125
|
};
|
|
2126
|
+
|
|
1887
2127
|
var handleLegendClick = function handleLegendClick() {
|
|
1888
2128
|
onLegendClick({
|
|
1889
2129
|
type: 'legend.click',
|
|
@@ -1892,35 +2132,40 @@ var Punchcard = function Punchcard(props) {
|
|
|
1892
2132
|
}
|
|
1893
2133
|
});
|
|
1894
2134
|
};
|
|
2135
|
+
|
|
1895
2136
|
var renderVisualization = function renderVisualization(_ref) {
|
|
1896
2137
|
var containerWidth = _ref.width,
|
|
1897
|
-
|
|
2138
|
+
containerHeight = _ref.height;
|
|
2139
|
+
|
|
1898
2140
|
var _ref2 = (0, punchcardUtils_1.getChartAreaDimensions)({
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2141
|
+
containerWidth: containerWidth,
|
|
2142
|
+
containerHeight: containerHeight,
|
|
2143
|
+
displayLegend: displayLegend
|
|
2144
|
+
}),
|
|
2145
|
+
xAxisStartY = _ref2.xAxisStartY,
|
|
2146
|
+
yAxisStartX = _ref2.yAxisStartX,
|
|
2147
|
+
chartAreaStartX = _ref2.chartAreaStartX,
|
|
2148
|
+
chartAreaStartY = _ref2.chartAreaStartY,
|
|
2149
|
+
chartAreaEndX = _ref2.chartAreaEndX,
|
|
2150
|
+
chartAreaEndY = _ref2.chartAreaEndY,
|
|
2151
|
+
legendStartX = _ref2.legendStartX;
|
|
2152
|
+
|
|
1910
2153
|
var _ref3 = (0, punchcardUtils_1.getScales)({
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2154
|
+
values: uniqX,
|
|
2155
|
+
start: chartAreaStartX,
|
|
2156
|
+
end: chartAreaEndX
|
|
2157
|
+
}),
|
|
2158
|
+
xScale = _ref3.scale,
|
|
2159
|
+
xPositionScale = _ref3.positionScale;
|
|
2160
|
+
|
|
1917
2161
|
var _ref4 = (0, punchcardUtils_1.getScales)({
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
2162
|
+
values: uniqY,
|
|
2163
|
+
start: chartAreaStartY,
|
|
2164
|
+
end: chartAreaEndY
|
|
2165
|
+
}),
|
|
2166
|
+
yScale = _ref4.scale,
|
|
2167
|
+
yPositionScale = _ref4.positionScale;
|
|
2168
|
+
|
|
1924
2169
|
var minBand = Math.min(xScale.bandwidth(), yScale.bandwidth());
|
|
1925
2170
|
return React.createElement(PunchcardWrapper, {
|
|
1926
2171
|
backgroundColor: backgroundColor
|
|
@@ -1987,7 +2232,7 @@ var Punchcard = function Punchcard(props) {
|
|
|
1987
2232
|
selectedCategory: selectedCategory,
|
|
1988
2233
|
selectedX: selectedX,
|
|
1989
2234
|
selectedY: selectedY,
|
|
1990
|
-
size:
|
|
2235
|
+
size: bubbleSizes,
|
|
1991
2236
|
x: x,
|
|
1992
2237
|
xScale: xPositionScale,
|
|
1993
2238
|
y: y,
|
|
@@ -2000,6 +2245,7 @@ var Punchcard = function Punchcard(props) {
|
|
|
2000
2245
|
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
2246
|
})))));
|
|
2002
2247
|
};
|
|
2248
|
+
|
|
2003
2249
|
return React.createElement(Container, {
|
|
2004
2250
|
backgroundColor: backgroundColor,
|
|
2005
2251
|
height: height,
|
|
@@ -2008,6 +2254,7 @@ var Punchcard = function Punchcard(props) {
|
|
|
2008
2254
|
return renderVisualization(containerDimension);
|
|
2009
2255
|
}));
|
|
2010
2256
|
};
|
|
2257
|
+
|
|
2011
2258
|
var propTypes = {
|
|
2012
2259
|
backgroundColor: T.string,
|
|
2013
2260
|
showBubbleLabels: T.oneOf(Object.values(punchcardUtils_1.BUBBLE_LABELS_TYPES)),
|
|
@@ -2035,7 +2282,7 @@ var propTypes = {
|
|
|
2035
2282
|
// implemented in config file using requiredProps
|
|
2036
2283
|
x: T.arrayOf(T.oneOfType([T.string, T.number])),
|
|
2037
2284
|
y: T.arrayOf(T.oneOfType([T.string, T.number])),
|
|
2038
|
-
size: T.arrayOf(T.number),
|
|
2285
|
+
size: T.arrayOf(T.oneOfType([T.string, T.number])),
|
|
2039
2286
|
xField: T.string,
|
|
2040
2287
|
yField: T.string,
|
|
2041
2288
|
onPointClick: T.func,
|
|
@@ -2190,78 +2437,82 @@ var TIME_RANGES = {
|
|
|
2190
2437
|
'sun.': true
|
|
2191
2438
|
}]
|
|
2192
2439
|
};
|
|
2193
|
-
|
|
2194
2440
|
/**
|
|
2195
2441
|
* Sort axis labels by weekday
|
|
2196
2442
|
* @param {array} axis - string array
|
|
2197
2443
|
* @return {array} - string array. If those are not weekday strings, return []
|
|
2198
2444
|
*/
|
|
2445
|
+
|
|
2199
2446
|
var sortedByWeekday = function sortedByWeekday(axis) {
|
|
2200
2447
|
var sortedAxis = [];
|
|
2201
2448
|
var notWeekDay = lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(axis, function (value) {
|
|
2202
2449
|
var lowerValue = value.toLowerCase();
|
|
2203
2450
|
var index = lodash_findIndex__WEBPACK_IMPORTED_MODULE_0___default()(TIME_RANGES.wday, lowerValue);
|
|
2451
|
+
|
|
2204
2452
|
if (index === -1) {
|
|
2205
2453
|
// if the axis contains any value not inside weekdays, then don't treat it as weekdays
|
|
2206
2454
|
return true;
|
|
2207
2455
|
}
|
|
2456
|
+
|
|
2208
2457
|
if (sortedAxis[index]) {
|
|
2209
2458
|
sortedAxis[index] = [sortedAxis[index], value];
|
|
2210
2459
|
} else {
|
|
2211
2460
|
sortedAxis[index] = value;
|
|
2212
2461
|
}
|
|
2462
|
+
|
|
2213
2463
|
return false;
|
|
2214
2464
|
});
|
|
2215
2465
|
return notWeekDay ? [] : lodash_flattenDeep__WEBPACK_IMPORTED_MODULE_3___default()(sortedAxis.filter(Boolean));
|
|
2216
2466
|
};
|
|
2217
|
-
|
|
2218
2467
|
/**
|
|
2219
2468
|
* Sort axis labels by month
|
|
2220
2469
|
* @param {array} axis - string array
|
|
2221
2470
|
* @return {array} - string array. If those are not month strings, return []
|
|
2222
2471
|
*/
|
|
2472
|
+
|
|
2223
2473
|
var sortedByMonth = function sortedByMonth(axis) {
|
|
2224
2474
|
var sortedAxis = [];
|
|
2225
2475
|
var notMonth = lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(axis, function (value) {
|
|
2226
2476
|
var lowerValue = value.toLowerCase();
|
|
2227
2477
|
var index = lodash_findIndex__WEBPACK_IMPORTED_MODULE_0___default()(TIME_RANGES.month, lowerValue);
|
|
2478
|
+
|
|
2228
2479
|
if (index === -1) {
|
|
2229
2480
|
// if the axis contains any value not inside month, then don't treat it as month
|
|
2230
2481
|
return true;
|
|
2231
2482
|
}
|
|
2483
|
+
|
|
2232
2484
|
if (sortedAxis[index]) {
|
|
2233
2485
|
sortedAxis[index] = [sortedAxis[index], value];
|
|
2234
2486
|
} else {
|
|
2235
2487
|
sortedAxis[index] = value;
|
|
2236
2488
|
}
|
|
2489
|
+
|
|
2237
2490
|
return false;
|
|
2238
2491
|
});
|
|
2239
2492
|
return notMonth ? [] : lodash_flattenDeep__WEBPACK_IMPORTED_MODULE_3___default()(sortedAxis.filter(Boolean));
|
|
2240
2493
|
};
|
|
2241
|
-
|
|
2242
2494
|
/**
|
|
2243
2495
|
* Sort axis labels by date time
|
|
2244
2496
|
* @param {array} axis - string array
|
|
2245
2497
|
* @return {array} - string array. If those are not in acceptTimeFormat or formatted date, return []
|
|
2246
2498
|
*/
|
|
2499
|
+
|
|
2247
2500
|
var sortedByDTime = function sortedByDTime(axis) {
|
|
2248
2501
|
// 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
|
|
2502
|
+
var acceptTimeFormat = [/^([0-1])?\d( )?(am|pm)$/i, // 1am, 1 am, 12am, 12 am
|
|
2503
|
+
/^([0-1])?\d:[0-5]\d( )?(am|pm)$/i, // 01:00 am, 01:00am, 1:00am
|
|
2504
|
+
/^([0-2])?\d:([0-5]\d:)?[0-5]\d$/, // 01:00:00, 1:00:00, 23:00
|
|
2255
2505
|
/^([0-2])?\d:[0-5]\d:[0-5]\d( )?(am|pm)$/i // 01:00:00 am, 1:00:00am
|
|
2256
2506
|
];
|
|
2257
|
-
|
|
2258
2507
|
var sortArr = [];
|
|
2259
2508
|
var notDate = lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(axis, function (value) {
|
|
2260
2509
|
if (!Number.isNaN(Number(value))) {
|
|
2261
2510
|
return true;
|
|
2262
|
-
}
|
|
2263
|
-
|
|
2511
|
+
} // should accept long date: 2019-03-02, Mar 2 2019, ..., 2019-01-01T00:00:00.000Z
|
|
2512
|
+
|
|
2513
|
+
|
|
2264
2514
|
var convertedDate = new Date(value);
|
|
2515
|
+
|
|
2265
2516
|
if (!Number.isNaN(Number(convertedDate))) {
|
|
2266
2517
|
sortArr.push({
|
|
2267
2518
|
epoch: convertedDate,
|
|
@@ -2269,19 +2520,23 @@ var sortedByDTime = function sortedByDTime(axis) {
|
|
|
2269
2520
|
});
|
|
2270
2521
|
return false;
|
|
2271
2522
|
}
|
|
2523
|
+
|
|
2272
2524
|
var acceptedTime = acceptTimeFormat.find(function (format) {
|
|
2273
2525
|
return format.test(value);
|
|
2274
2526
|
});
|
|
2527
|
+
|
|
2275
2528
|
if (acceptedTime) {
|
|
2276
2529
|
var midday = /(am|pm)$/i;
|
|
2277
2530
|
var reformatTime = value;
|
|
2278
2531
|
var containsMidday = value.match(midday);
|
|
2532
|
+
|
|
2279
2533
|
if (containsMidday) {
|
|
2280
2534
|
// for time format like 01:00 am and 1 am
|
|
2281
2535
|
reformatTime = value.split(midday).slice(0, -1);
|
|
2282
2536
|
reformatTime[0] = "".concat(reformatTime[0].trim(), ":00");
|
|
2283
2537
|
reformatTime = reformatTime.join(' ');
|
|
2284
2538
|
}
|
|
2539
|
+
|
|
2285
2540
|
convertedDate = new Date("1970/01/01 ".concat(reformatTime));
|
|
2286
2541
|
sortArr.push({
|
|
2287
2542
|
epoch: convertedDate,
|
|
@@ -2289,55 +2544,66 @@ var sortedByDTime = function sortedByDTime(axis) {
|
|
|
2289
2544
|
});
|
|
2290
2545
|
return false;
|
|
2291
2546
|
}
|
|
2547
|
+
|
|
2292
2548
|
return true;
|
|
2293
2549
|
});
|
|
2550
|
+
|
|
2294
2551
|
if (notDate) {
|
|
2295
2552
|
return [];
|
|
2296
2553
|
}
|
|
2554
|
+
|
|
2297
2555
|
return lodash_sortBy__WEBPACK_IMPORTED_MODULE_2___default()(sortArr, function (val) {
|
|
2298
2556
|
return val.epoch;
|
|
2299
2557
|
}).map(function (val) {
|
|
2300
2558
|
return val.original;
|
|
2301
2559
|
});
|
|
2302
2560
|
};
|
|
2303
|
-
|
|
2304
2561
|
/**
|
|
2305
2562
|
* Sort axis labels by digits or alphabetical order
|
|
2306
2563
|
* @param {array} axis - string array
|
|
2307
2564
|
* @return {array} - string array.
|
|
2308
2565
|
* If those inputs are numbers, then return in digits order. Otherwise, return array based on alphabetical order
|
|
2309
2566
|
*/
|
|
2567
|
+
|
|
2310
2568
|
var sortByDigitOrAlpha = function sortByDigitOrAlpha(axis) {
|
|
2311
2569
|
// 10, 10.0, 10.1, not accept 10,000.0
|
|
2312
2570
|
var coercedIsFinite = function coercedIsFinite(num) {
|
|
2313
2571
|
return Number.isFinite(Number(num));
|
|
2314
2572
|
};
|
|
2573
|
+
|
|
2315
2574
|
if (Object(lodash__WEBPACK_IMPORTED_MODULE_4__["every"])(axis, coercedIsFinite)) {
|
|
2316
2575
|
return axis.sort(function (a, b) {
|
|
2317
2576
|
return Number(a) - Number(b);
|
|
2318
2577
|
});
|
|
2319
2578
|
}
|
|
2579
|
+
|
|
2320
2580
|
return axis.sort();
|
|
2321
2581
|
};
|
|
2322
|
-
|
|
2323
2582
|
/**
|
|
2324
2583
|
* Sort axis based on the priority: time measures, numbers, strings in ascending order
|
|
2325
2584
|
* @param {array} axis - string array
|
|
2326
2585
|
* @return {array} - string array
|
|
2327
2586
|
*/
|
|
2587
|
+
|
|
2328
2588
|
var sortAxis = function sortAxis(axis) {
|
|
2329
2589
|
var sortedTimeAxis = sortedByDTime(axis);
|
|
2590
|
+
|
|
2330
2591
|
if (sortedTimeAxis.length) {
|
|
2331
2592
|
return sortedTimeAxis;
|
|
2332
2593
|
}
|
|
2594
|
+
|
|
2333
2595
|
var sortedWeekdays = sortedByWeekday(axis);
|
|
2596
|
+
|
|
2334
2597
|
if (sortedWeekdays.length) {
|
|
2335
2598
|
return sortedWeekdays;
|
|
2336
2599
|
}
|
|
2600
|
+
|
|
2337
2601
|
var sortedMonths = sortedByMonth(axis);
|
|
2602
|
+
|
|
2338
2603
|
if (sortedMonths.length) {
|
|
2339
2604
|
return sortedMonths;
|
|
2340
2605
|
}
|
|
2606
|
+
|
|
2341
2607
|
return sortByDigitOrAlpha(axis);
|
|
2342
2608
|
};
|
|
2343
2609
|
|
|
@@ -2352,12 +2618,19 @@ var sortAxis = function sortAxis(axis) {
|
|
|
2352
2618
|
Object.defineProperty(exports, "__esModule", {
|
|
2353
2619
|
value: true
|
|
2354
2620
|
});
|
|
2621
|
+
|
|
2355
2622
|
var React = __webpack_require__(1);
|
|
2623
|
+
|
|
2356
2624
|
var T = __webpack_require__(0);
|
|
2625
|
+
|
|
2357
2626
|
var styled_components_1 = __webpack_require__(4);
|
|
2627
|
+
|
|
2358
2628
|
var pick_1 = __webpack_require__(23);
|
|
2629
|
+
|
|
2359
2630
|
var variables_1 = __webpack_require__(11);
|
|
2631
|
+
|
|
2360
2632
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
2633
|
+
|
|
2361
2634
|
var AxisLabelText = styled_components_1.default.text.withConfig({
|
|
2362
2635
|
displayName: "PunchcardAxis__AxisLabelText",
|
|
2363
2636
|
componentId: "sc-1jv7cdw-0"
|
|
@@ -2370,21 +2643,22 @@ var AxisLabelText = styled_components_1.default.text.withConfig({
|
|
|
2370
2643
|
}, function (props) {
|
|
2371
2644
|
return props.muted ? 0.15 : 1;
|
|
2372
2645
|
});
|
|
2646
|
+
|
|
2373
2647
|
var PunchcardAxis = function PunchcardAxis(props) {
|
|
2374
2648
|
var labels = props.labels,
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2649
|
+
handleMouseEnter = props.handleMouseEnter,
|
|
2650
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
2651
|
+
orientation = props.orientation,
|
|
2652
|
+
scale = props.scale,
|
|
2653
|
+
selected = props.selected,
|
|
2654
|
+
startPositionX = props.startPositionX,
|
|
2655
|
+
startPositionY = props.startPositionY;
|
|
2382
2656
|
return React.createElement("g", null, labels.map(function (label, index) {
|
|
2383
2657
|
// Space between labels either in x or y direction depending on orientation
|
|
2384
2658
|
var positionDelta = index * scale.bandwidth() + scale.bandwidth() / 2;
|
|
2385
2659
|
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
|
-
|
|
2660
|
+
var yPosition = orientation === punchcardUtils_1.AXIS_ORIENTATION_TYPES.VERTICAL ? startPositionY + positionDelta : startPositionY; // create padding between x-axis labels
|
|
2661
|
+
|
|
2388
2662
|
var xAxisWidthScale = scale.copy().paddingInner(0.1).round(true);
|
|
2389
2663
|
var truncatedLabel = orientation === punchcardUtils_1.AXIS_ORIENTATION_TYPES.VERTICAL ? (0, punchcardUtils_1.truncateAxisLabelText)({
|
|
2390
2664
|
label: "".concat(label)
|
|
@@ -2405,6 +2679,7 @@ var PunchcardAxis = function PunchcardAxis(props) {
|
|
|
2405
2679
|
}, React.createElement("title", null, label), truncatedLabel);
|
|
2406
2680
|
}));
|
|
2407
2681
|
};
|
|
2682
|
+
|
|
2408
2683
|
var propTypes = {
|
|
2409
2684
|
labels: T.arrayOf(T.oneOfType([T.string, T.number])).isRequired,
|
|
2410
2685
|
handleMouseEnter: T.func,
|
|
@@ -2442,42 +2717,50 @@ exports.default = PunchcardAxis;
|
|
|
2442
2717
|
|
|
2443
2718
|
|
|
2444
2719
|
var _toConsumableArray = __webpack_require__(8);
|
|
2720
|
+
|
|
2445
2721
|
var _slicedToArray = __webpack_require__(17);
|
|
2722
|
+
|
|
2446
2723
|
Object.defineProperty(exports, "__esModule", {
|
|
2447
2724
|
value: true
|
|
2448
2725
|
});
|
|
2726
|
+
|
|
2449
2727
|
var React = __webpack_require__(1);
|
|
2728
|
+
|
|
2450
2729
|
var T = __webpack_require__(0);
|
|
2730
|
+
|
|
2451
2731
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
2732
|
+
|
|
2452
2733
|
var PunchcardRow_1 = __webpack_require__(450);
|
|
2734
|
+
|
|
2453
2735
|
var PunchcardChartArea = function PunchcardChartArea(props) {
|
|
2454
2736
|
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
|
-
|
|
2737
|
+
bubbleRowScale = props.bubbleRowScale,
|
|
2738
|
+
bubbleScale = props.bubbleScale,
|
|
2739
|
+
category = props.category,
|
|
2740
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
2741
|
+
colorMode = props.colorMode,
|
|
2742
|
+
bubbleColor = props.bubbleColor,
|
|
2743
|
+
handleMouseEnter = props.handleMouseEnter,
|
|
2744
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
2745
|
+
isBubbleSizeDynamic = props.isBubbleSizeDynamic,
|
|
2746
|
+
minBubbleColorIntensity = props.minBubbleColorIntensity,
|
|
2747
|
+
minBand = props.minBand,
|
|
2748
|
+
minBubbleSize = props.minBubbleSize,
|
|
2749
|
+
maxBubbleSize = props.maxBubbleSize,
|
|
2750
|
+
maxBubbleRadius = props.maxBubbleRadius,
|
|
2751
|
+
minBubbleRadius = props.minBubbleRadius,
|
|
2752
|
+
showMaxValuePulsation = props.showMaxValuePulsation,
|
|
2753
|
+
selectedCategory = props.selectedCategory,
|
|
2754
|
+
selectedX = props.selectedX,
|
|
2755
|
+
selectedY = props.selectedY,
|
|
2756
|
+
size = props.size,
|
|
2757
|
+
x = props.x,
|
|
2758
|
+
xScale = props.xScale,
|
|
2759
|
+
y = props.y,
|
|
2760
|
+
yScale = props.yScale,
|
|
2761
|
+
handlePointClick = props.handlePointClick;
|
|
2480
2762
|
/** @type {Object<String\|Number, import('./utils/punchcardUtils').RowData>} */
|
|
2763
|
+
|
|
2481
2764
|
var dataByRows = (0, punchcardUtils_1.getDataByRows)({
|
|
2482
2765
|
bubbleRowScale: bubbleRowScale,
|
|
2483
2766
|
bubbleScale: bubbleScale,
|
|
@@ -2498,15 +2781,16 @@ var PunchcardChartArea = function PunchcardChartArea(props) {
|
|
|
2498
2781
|
});
|
|
2499
2782
|
return React.createElement("g", null, Object.entries(dataByRows).map(function (_ref) {
|
|
2500
2783
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
2501
|
-
|
|
2502
|
-
|
|
2784
|
+
row = _ref2[0],
|
|
2785
|
+
rowData = _ref2[1];
|
|
2786
|
+
|
|
2503
2787
|
var rowXValues = rowData.rowXValues,
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2788
|
+
rowSizeValues = rowData.rowSizeValues,
|
|
2789
|
+
rowCategoryValues = rowData.rowCategoryValues,
|
|
2790
|
+
rowColorValues = rowData.rowColorValues,
|
|
2791
|
+
rowFillOpacityValues = rowData.rowFillOpacityValues,
|
|
2792
|
+
rowSizeScale = rowData.rowSizeScale,
|
|
2793
|
+
rowRadiusValues = rowData.rowRadiusValues;
|
|
2510
2794
|
var yPosition = yScale(row);
|
|
2511
2795
|
return React.createElement(PunchcardRow_1.default, {
|
|
2512
2796
|
key: row,
|
|
@@ -2532,6 +2816,7 @@ var PunchcardChartArea = function PunchcardChartArea(props) {
|
|
|
2532
2816
|
});
|
|
2533
2817
|
}));
|
|
2534
2818
|
};
|
|
2819
|
+
|
|
2535
2820
|
var propTypes = {
|
|
2536
2821
|
showBubbleLabels: T.oneOf(Object.values(punchcardUtils_1.BUBBLE_LABELS_TYPES)),
|
|
2537
2822
|
bubbleRowScale: T.oneOf(Object.values(punchcardUtils_1.BUBBLE_ROW_SCALE_TYPES)),
|
|
@@ -2607,19 +2892,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2607
2892
|
value: true
|
|
2608
2893
|
});
|
|
2609
2894
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2895
|
+
|
|
2610
2896
|
var React = __webpack_require__(1);
|
|
2897
|
+
|
|
2611
2898
|
var T = __webpack_require__(0);
|
|
2899
|
+
|
|
2612
2900
|
var i18n_1 = __webpack_require__(2);
|
|
2901
|
+
|
|
2613
2902
|
var Message_1 = __webpack_require__(10);
|
|
2903
|
+
|
|
2614
2904
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2615
2905
|
/**
|
|
2616
2906
|
* @method isMissing
|
|
2617
2907
|
* @param {any} v
|
|
2618
2908
|
* @returns {boolean} true if the input value === null or undefined
|
|
2619
2909
|
*/
|
|
2910
|
+
|
|
2911
|
+
|
|
2620
2912
|
var isMissing = function isMissing(v) {
|
|
2621
2913
|
return v === null || v === undefined;
|
|
2622
2914
|
};
|
|
2915
|
+
|
|
2623
2916
|
exports.isMissing = isMissing;
|
|
2624
2917
|
/**
|
|
2625
2918
|
* @method misskingKeys
|
|
@@ -2627,11 +2920,13 @@ exports.isMissing = isMissing;
|
|
|
2627
2920
|
* @param {object} target
|
|
2628
2921
|
* @returns {string[]} the keys of missing required props
|
|
2629
2922
|
*/
|
|
2923
|
+
|
|
2630
2924
|
var missingKeys = function missingKeys(keys, target) {
|
|
2631
2925
|
return keys.filter(function (k) {
|
|
2632
2926
|
return (0, exports.isMissing)(target[k]);
|
|
2633
2927
|
});
|
|
2634
2928
|
};
|
|
2929
|
+
|
|
2635
2930
|
exports.missingKeys = missingKeys;
|
|
2636
2931
|
var propTypes = {
|
|
2637
2932
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -2645,10 +2940,11 @@ var propTypes = {
|
|
|
2645
2940
|
* @param {MissingPropsProps} props
|
|
2646
2941
|
* @returns {React.ReactElement}
|
|
2647
2942
|
*/
|
|
2943
|
+
|
|
2648
2944
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
2649
2945
|
var width = props.width,
|
|
2650
|
-
|
|
2651
|
-
|
|
2946
|
+
height = props.height,
|
|
2947
|
+
missingProps = props.missingProps;
|
|
2652
2948
|
return React.createElement(Message_1.default, {
|
|
2653
2949
|
"data-test": "message",
|
|
2654
2950
|
width: width,
|
|
@@ -2656,6 +2952,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
2656
2952
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
2657
2953
|
});
|
|
2658
2954
|
};
|
|
2955
|
+
|
|
2659
2956
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
2660
2957
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
2661
2958
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -2675,30 +2972,36 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
2675
2972
|
Object.defineProperty(exports, "__esModule", {
|
|
2676
2973
|
value: true
|
|
2677
2974
|
});
|
|
2975
|
+
|
|
2678
2976
|
var React = __webpack_require__(1);
|
|
2977
|
+
|
|
2679
2978
|
var T = __webpack_require__(0);
|
|
2979
|
+
|
|
2680
2980
|
var styled_components_1 = __webpack_require__(4);
|
|
2981
|
+
|
|
2681
2982
|
var PunchcardBubble_1 = __webpack_require__(451);
|
|
2983
|
+
|
|
2682
2984
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
2985
|
+
|
|
2683
2986
|
var PunchcardRow = function PunchcardRow(props) {
|
|
2684
2987
|
var showBubbleLabels = props.showBubbleLabels,
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2988
|
+
category = props.category,
|
|
2989
|
+
colors = props.colors,
|
|
2990
|
+
_handleMouseEnter = props.handleMouseEnter,
|
|
2991
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
2992
|
+
maxSizeValue = props.maxSizeValue,
|
|
2993
|
+
opacities = props.opacities,
|
|
2994
|
+
radiusValues = props.radiusValues,
|
|
2995
|
+
selectedCategory = props.selectedCategory,
|
|
2996
|
+
selectedX = props.selectedX,
|
|
2997
|
+
selectedY = props.selectedY,
|
|
2998
|
+
showMaxValuePulsation = props.showMaxValuePulsation,
|
|
2999
|
+
size = props.size,
|
|
3000
|
+
x = props.x,
|
|
3001
|
+
xScale = props.xScale,
|
|
3002
|
+
yPosition = props.yPosition,
|
|
3003
|
+
yValue = props.yValue,
|
|
3004
|
+
handlePointClick = props.handlePointClick;
|
|
2702
3005
|
return React.createElement("g", null, x.map(function (xValue, index) {
|
|
2703
3006
|
var sizeValue = size[index];
|
|
2704
3007
|
var categoryValue = category[index];
|
|
@@ -2744,6 +3047,7 @@ var PunchcardRow = function PunchcardRow(props) {
|
|
|
2744
3047
|
});
|
|
2745
3048
|
}));
|
|
2746
3049
|
};
|
|
3050
|
+
|
|
2747
3051
|
var propTypes = {
|
|
2748
3052
|
showBubbleLabels: T.oneOf(Object.values(punchcardUtils_1.BUBBLE_LABELS_TYPES)),
|
|
2749
3053
|
category: T.arrayOf(T.string),
|
|
@@ -2798,17 +3102,27 @@ exports.default = (0, styled_components_1.withTheme)(PunchcardRow);
|
|
|
2798
3102
|
|
|
2799
3103
|
|
|
2800
3104
|
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
3105
|
+
|
|
2801
3106
|
var _templateObject, _templateObject2;
|
|
3107
|
+
|
|
2802
3108
|
Object.defineProperty(exports, "__esModule", {
|
|
2803
3109
|
value: true
|
|
2804
3110
|
});
|
|
3111
|
+
|
|
2805
3112
|
var React = __webpack_require__(1);
|
|
3113
|
+
|
|
2806
3114
|
var T = __webpack_require__(0);
|
|
3115
|
+
|
|
2807
3116
|
var styled_components_1 = __webpack_require__(4);
|
|
3117
|
+
|
|
2808
3118
|
var pick_1 = __webpack_require__(23);
|
|
3119
|
+
|
|
2809
3120
|
var variables_1 = __webpack_require__(11);
|
|
3121
|
+
|
|
2810
3122
|
var numberUtils_1 = __webpack_require__(31);
|
|
3123
|
+
|
|
2811
3124
|
var punchcardUtils_1 = __webpack_require__(99);
|
|
3125
|
+
|
|
2812
3126
|
var BubbleCircle = styled_components_1.default.circle.withConfig({
|
|
2813
3127
|
displayName: "PunchcardBubble__BubbleCircle",
|
|
2814
3128
|
componentId: "sc-1jmms9f-0"
|
|
@@ -2818,8 +3132,8 @@ var BubbleCircle = styled_components_1.default.circle.withConfig({
|
|
|
2818
3132
|
enterprise: {
|
|
2819
3133
|
light: variables_1.default.white,
|
|
2820
3134
|
dark: variables_1.default.contentColorInverted // enterprise.textColor
|
|
2821
|
-
},
|
|
2822
3135
|
|
|
3136
|
+
},
|
|
2823
3137
|
prisma: variables_1.default.contentColorActive
|
|
2824
3138
|
})(props) : props.color;
|
|
2825
3139
|
}, function (props) {
|
|
@@ -2827,9 +3141,11 @@ var BubbleCircle = styled_components_1.default.circle.withConfig({
|
|
|
2827
3141
|
}, function (props) {
|
|
2828
3142
|
return props.outline ? props.color : 'none';
|
|
2829
3143
|
});
|
|
3144
|
+
|
|
2830
3145
|
var pulsateAnimation = function pulsateAnimation(r) {
|
|
2831
3146
|
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
3147
|
};
|
|
3148
|
+
|
|
2833
3149
|
var PulsateBubble = (0, styled_components_1.default)(BubbleCircle)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n animation: ", " 2.4s linear 0.4s infinite;\n"])), function (props) {
|
|
2834
3150
|
return pulsateAnimation(props.r);
|
|
2835
3151
|
});
|
|
@@ -2866,29 +3182,32 @@ var BubbleLabelText = styled_components_1.default.text.withConfig({
|
|
|
2866
3182
|
var MIN_BUBBLE_SIZE_TO_DISPLAY_LABEL = 13;
|
|
2867
3183
|
var MAX_DISPLAYABLE_VALUE = 99499999999999;
|
|
2868
3184
|
var VALUE_OVERFLOW_TEXT = '99T+';
|
|
3185
|
+
|
|
2869
3186
|
var PunchcardBubble = function PunchcardBubble(props) {
|
|
2870
3187
|
var showBubbleLabel = props.showBubbleLabel,
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
3188
|
+
color = props.color,
|
|
3189
|
+
cx = props.cx,
|
|
3190
|
+
cy = props.cy,
|
|
3191
|
+
fillOpacity = props.fillOpacity,
|
|
3192
|
+
handleMouseEnter = props.handleMouseEnter,
|
|
3193
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3194
|
+
hover = props.hover,
|
|
3195
|
+
muted = props.muted,
|
|
3196
|
+
pulsate = props.pulsate,
|
|
3197
|
+
value = props.value,
|
|
3198
|
+
r = props.r,
|
|
3199
|
+
handlePointClick = props.handlePointClick;
|
|
2883
3200
|
var outline = value < 0;
|
|
2884
3201
|
var showPulsateBubble = pulsate && !muted && !hover;
|
|
2885
3202
|
var displayLabel = hover || showBubbleLabel && r >= MIN_BUBBLE_SIZE_TO_DISPLAY_LABEL;
|
|
2886
3203
|
var bubbleLabelValueText = value <= MAX_DISPLAYABLE_VALUE ? (0, numberUtils_1.formatNumber)(value, 0, {
|
|
2887
3204
|
useTrendUnits: true
|
|
2888
3205
|
}) : VALUE_OVERFLOW_TEXT;
|
|
3206
|
+
|
|
2889
3207
|
if (hover) {
|
|
2890
3208
|
bubbleLabelValueText = (0, numberUtils_1.formatNumber)(value, 2);
|
|
2891
3209
|
}
|
|
3210
|
+
|
|
2892
3211
|
return React.createElement(BubbleGroup, {
|
|
2893
3212
|
muted: muted,
|
|
2894
3213
|
onMouseEnter: handleMouseEnter,
|
|
@@ -2919,6 +3238,7 @@ var PunchcardBubble = function PunchcardBubble(props) {
|
|
|
2919
3238
|
displayLabel: displayLabel
|
|
2920
3239
|
}, bubbleLabelValueText));
|
|
2921
3240
|
};
|
|
3241
|
+
|
|
2922
3242
|
var propTypes = {
|
|
2923
3243
|
showBubbleLabel: T.bool,
|
|
2924
3244
|
color: T.string,
|
|
@@ -2964,11 +3284,17 @@ exports.default = PunchcardBubble;
|
|
|
2964
3284
|
Object.defineProperty(exports, "__esModule", {
|
|
2965
3285
|
value: true
|
|
2966
3286
|
});
|
|
3287
|
+
|
|
2967
3288
|
var React = __webpack_require__(1);
|
|
3289
|
+
|
|
2968
3290
|
var T = __webpack_require__(0);
|
|
3291
|
+
|
|
2969
3292
|
var styled_components_1 = __webpack_require__(4);
|
|
3293
|
+
|
|
2970
3294
|
var pick_1 = __webpack_require__(23);
|
|
3295
|
+
|
|
2971
3296
|
var variables_1 = __webpack_require__(11);
|
|
3297
|
+
|
|
2972
3298
|
var LEGEND_ITEM_VERTICAL_SPACER = 25;
|
|
2973
3299
|
var LEGEND_ITEM_HORIZONTAL_SPACER = 10;
|
|
2974
3300
|
var LEGEND_RECT_WIDTH = 5;
|
|
@@ -2994,17 +3320,18 @@ var LegendText = styled_components_1.default.text.withConfig({
|
|
|
2994
3320
|
enterprise: variables_1.default.textColor,
|
|
2995
3321
|
prisma: variables_1.default.contentColorDefault
|
|
2996
3322
|
}));
|
|
3323
|
+
|
|
2997
3324
|
var PunchcardLegend = function PunchcardLegend(props) {
|
|
2998
3325
|
var category = props.category,
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3326
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
3327
|
+
handleMouseEnter = props.handleMouseEnter,
|
|
3328
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3329
|
+
selected = props.selected,
|
|
3330
|
+
startPositionX = props.startPositionX,
|
|
3331
|
+
startPositionY = props.startPositionY,
|
|
3332
|
+
containerWidth = props.containerWidth,
|
|
3333
|
+
containerHeight = props.containerHeight,
|
|
3334
|
+
handleLegendClick = props.handleLegendClick;
|
|
3008
3335
|
var legendWidth = containerWidth - LEGEND_OFFSET_RIGHT - startPositionX;
|
|
3009
3336
|
var legendHeight = containerHeight - LEGEND_OFFSET_BOTTOM;
|
|
3010
3337
|
return React.createElement("svg", {
|
|
@@ -3035,6 +3362,7 @@ var PunchcardLegend = function PunchcardLegend(props) {
|
|
|
3035
3362
|
}, React.createElement("title", null, c), c));
|
|
3036
3363
|
})));
|
|
3037
3364
|
};
|
|
3365
|
+
|
|
3038
3366
|
var propTypes = {
|
|
3039
3367
|
category: T.arrayOf(T.string),
|
|
3040
3368
|
colorCategoryMapping: T.func.isRequired,
|
|
@@ -3075,13 +3403,20 @@ exports.default = PunchcardLegend;
|
|
|
3075
3403
|
Object.defineProperty(exports, "__esModule", {
|
|
3076
3404
|
value: true
|
|
3077
3405
|
});
|
|
3406
|
+
|
|
3078
3407
|
var React = __webpack_require__(1);
|
|
3408
|
+
|
|
3079
3409
|
var T = __webpack_require__(0);
|
|
3410
|
+
|
|
3080
3411
|
var styled_components_1 = __webpack_require__(4);
|
|
3412
|
+
|
|
3081
3413
|
var lodash_1 = __webpack_require__(3);
|
|
3414
|
+
|
|
3082
3415
|
var pick_1 = __webpack_require__(23);
|
|
3083
|
-
|
|
3084
|
-
// was previously lineColor in themeRegistry
|
|
3416
|
+
|
|
3417
|
+
var variables_1 = __webpack_require__(11); // was previously lineColor in themeRegistry
|
|
3418
|
+
|
|
3419
|
+
|
|
3085
3420
|
var GridLine = styled_components_1.default.line.withConfig({
|
|
3086
3421
|
displayName: "PunchcardGridLines__GridLine",
|
|
3087
3422
|
componentId: "sc-12y1iif-0"
|
|
@@ -3092,13 +3427,14 @@ var GridLine = styled_components_1.default.line.withConfig({
|
|
|
3092
3427
|
},
|
|
3093
3428
|
prisma: variables_1.default.interactiveColorBackgroundDisabled
|
|
3094
3429
|
}));
|
|
3430
|
+
|
|
3095
3431
|
var PunchcardGridLines = function PunchcardGridLines(props) {
|
|
3096
3432
|
var xStartPosition = props.xStartPosition,
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3433
|
+
xEndPosition = props.xEndPosition,
|
|
3434
|
+
yStartPosition = props.yStartPosition,
|
|
3435
|
+
yEndPosition = props.yEndPosition,
|
|
3436
|
+
xDelta = props.xDelta,
|
|
3437
|
+
yDelta = props.yDelta;
|
|
3102
3438
|
var yGridLinesXPositions = (0, lodash_1.range)(xStartPosition, xEndPosition + 1, xDelta);
|
|
3103
3439
|
var xGridLinesYPositions = (0, lodash_1.range)(yStartPosition, yEndPosition + 1, yDelta);
|
|
3104
3440
|
return React.createElement("g", {
|
|
@@ -3121,6 +3457,7 @@ var PunchcardGridLines = function PunchcardGridLines(props) {
|
|
|
3121
3457
|
});
|
|
3122
3458
|
}));
|
|
3123
3459
|
};
|
|
3460
|
+
|
|
3124
3461
|
var propTypes = {
|
|
3125
3462
|
xStartPosition: T.number,
|
|
3126
3463
|
xEndPosition: T.number,
|
|
@@ -3153,8 +3490,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3153
3490
|
value: true
|
|
3154
3491
|
});
|
|
3155
3492
|
exports.convertToPunchcardProperties = exports.mapToOldKey = exports.punchcardOptionValuesMapping = void 0;
|
|
3493
|
+
|
|
3156
3494
|
var lodash_1 = __webpack_require__(3);
|
|
3495
|
+
|
|
3157
3496
|
var chartingUtils_1 = __webpack_require__(56);
|
|
3497
|
+
|
|
3158
3498
|
var punchcardOptionsMapping = {
|
|
3159
3499
|
legendDisplay: 'showLegend',
|
|
3160
3500
|
bubbleLabelDisplay: 'showBubbleLabels',
|
|
@@ -3165,9 +3505,9 @@ var punchcardOptionsMapping = {
|
|
|
3165
3505
|
bubbleRadiusMin: 'minBubbleRadius',
|
|
3166
3506
|
bubbleSizeMax: 'maxBubbleSize',
|
|
3167
3507
|
bubbleSizeMin: 'minBubbleSize'
|
|
3168
|
-
};
|
|
3169
|
-
// key value mapping of what options (and their corresponding values) which
|
|
3508
|
+
}; // key value mapping of what options (and their corresponding values) which
|
|
3170
3509
|
// we expose in config.ts to property values PurePunchcard understands
|
|
3510
|
+
|
|
3171
3511
|
exports.punchcardOptionValuesMapping = {
|
|
3172
3512
|
showLegend: {
|
|
3173
3513
|
right: true,
|
|
@@ -3186,11 +3526,13 @@ exports.punchcardOptionValuesMapping = {
|
|
|
3186
3526
|
* @param {Object} options
|
|
3187
3527
|
* @returns {Object}
|
|
3188
3528
|
*/
|
|
3529
|
+
|
|
3189
3530
|
var mapToOldKey = function mapToOldKey(options) {
|
|
3190
3531
|
return (0, lodash_1.mapKeys)(options, function (val, key) {
|
|
3191
3532
|
return punchcardOptionsMapping[key] ? punchcardOptionsMapping[key] : key;
|
|
3192
3533
|
});
|
|
3193
3534
|
};
|
|
3535
|
+
|
|
3194
3536
|
exports.mapToOldKey = mapToOldKey;
|
|
3195
3537
|
/**
|
|
3196
3538
|
* Chained helper for mapping the option properties (and values) we expose in config.ts into property values that PurePunchcard accepts
|
|
@@ -3199,9 +3541,11 @@ exports.mapToOldKey = mapToOldKey;
|
|
|
3199
3541
|
* @param {Object} originalOptions
|
|
3200
3542
|
* @returns {Object}
|
|
3201
3543
|
*/
|
|
3544
|
+
|
|
3202
3545
|
var convertToPunchcardProperties = function convertToPunchcardProperties(originalOptions) {
|
|
3203
3546
|
return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru((0, chartingUtils_1.mapToValues)(exports.punchcardOptionValuesMapping)).value();
|
|
3204
3547
|
};
|
|
3548
|
+
|
|
3205
3549
|
exports.convertToPunchcardProperties = convertToPunchcardProperties;
|
|
3206
3550
|
|
|
3207
3551
|
/***/ }),
|
|
@@ -3215,15 +3559,19 @@ exports.convertToPunchcardProperties = convertToPunchcardProperties;
|
|
|
3215
3559
|
Object.defineProperty(exports, "__esModule", {
|
|
3216
3560
|
value: true
|
|
3217
3561
|
});
|
|
3562
|
+
|
|
3218
3563
|
var React = __webpack_require__(1);
|
|
3564
|
+
|
|
3219
3565
|
var styled_components_1 = __webpack_require__(4);
|
|
3566
|
+
|
|
3220
3567
|
var hocUtils_1 = __webpack_require__(15);
|
|
3568
|
+
|
|
3221
3569
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3222
3570
|
displayName: "withEditModeCover__Cover",
|
|
3223
3571
|
componentId: "sc-1gsbnxb-0"
|
|
3224
3572
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3225
3573
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3226
|
-
'data-splunk-visualization-version': "26.
|
|
3574
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
3227
3575
|
}).withConfig({
|
|
3228
3576
|
displayName: "withEditModeCover__Blocker",
|
|
3229
3577
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3234,6 +3582,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3234
3582
|
* @param {ExtendedDashViz} Visualization
|
|
3235
3583
|
* @returns {ExtendedDashViz} Wrapper
|
|
3236
3584
|
*/
|
|
3585
|
+
|
|
3237
3586
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3238
3587
|
var Wrapper = function Wrapper(props) {
|
|
3239
3588
|
var mode = props.mode;
|
|
@@ -3242,12 +3591,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3242
3591
|
"data-test": "edit-mode-cover"
|
|
3243
3592
|
}));
|
|
3244
3593
|
};
|
|
3594
|
+
|
|
3245
3595
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3246
3596
|
Wrapper: Wrapper,
|
|
3247
3597
|
Visualization: Visualization
|
|
3248
3598
|
});
|
|
3249
3599
|
return Wrapper;
|
|
3250
3600
|
};
|
|
3601
|
+
|
|
3251
3602
|
exports.default = withEditModeCover;
|
|
3252
3603
|
|
|
3253
3604
|
/***/ }),
|
|
@@ -3261,27 +3612,37 @@ exports.default = withEditModeCover;
|
|
|
3261
3612
|
Object.defineProperty(exports, "__esModule", {
|
|
3262
3613
|
value: true
|
|
3263
3614
|
});
|
|
3615
|
+
|
|
3264
3616
|
var React = __webpack_require__(1);
|
|
3617
|
+
|
|
3265
3618
|
var colorUtils_1 = __webpack_require__(12);
|
|
3619
|
+
|
|
3266
3620
|
var variables_1 = __webpack_require__(11);
|
|
3621
|
+
|
|
3267
3622
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
3623
|
+
|
|
3268
3624
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3625
|
+
|
|
3269
3626
|
var hocUtils_1 = __webpack_require__(15);
|
|
3627
|
+
|
|
3270
3628
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3271
3629
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3272
3630
|
var config = Visualization.config;
|
|
3273
3631
|
var themes = config.themes;
|
|
3632
|
+
|
|
3274
3633
|
var Wrapper = function Wrapper(props) {
|
|
3275
3634
|
var _a, _b;
|
|
3635
|
+
|
|
3276
3636
|
var dataSources = props.dataSources,
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3637
|
+
loading = props.loading,
|
|
3638
|
+
options = props.options,
|
|
3639
|
+
height = props.height,
|
|
3640
|
+
width = props.width;
|
|
3281
3641
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3282
3642
|
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
3643
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3284
3644
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
3645
|
+
|
|
3285
3646
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3286
3647
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3287
3648
|
"data-test": "icon-placeholder",
|
|
@@ -3292,14 +3653,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3292
3653
|
iconColor: iconColor
|
|
3293
3654
|
});
|
|
3294
3655
|
}
|
|
3656
|
+
|
|
3295
3657
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3296
3658
|
};
|
|
3659
|
+
|
|
3297
3660
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3298
3661
|
Wrapper: Wrapper,
|
|
3299
3662
|
Visualization: Visualization
|
|
3300
3663
|
});
|
|
3301
3664
|
return Wrapper;
|
|
3302
3665
|
};
|
|
3666
|
+
|
|
3303
3667
|
exports.default = withPlaceholder;
|
|
3304
3668
|
|
|
3305
3669
|
/***/ }),
|
|
@@ -3334,11 +3698,13 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
3334
3698
|
Object.defineProperty(exports, "__esModule", {
|
|
3335
3699
|
value: true
|
|
3336
3700
|
});
|
|
3701
|
+
|
|
3337
3702
|
var i18n_1 = __webpack_require__(2);
|
|
3703
|
+
|
|
3338
3704
|
var background = function background(_ref) {
|
|
3339
3705
|
var label = _ref.label,
|
|
3340
|
-
|
|
3341
|
-
|
|
3706
|
+
themes = _ref.themes,
|
|
3707
|
+
labelPosition = _ref.labelPosition;
|
|
3342
3708
|
return [{
|
|
3343
3709
|
label: (0, i18n_1._)(label || 'Background'),
|
|
3344
3710
|
option: 'backgroundColor',
|
|
@@ -3349,6 +3715,7 @@ var background = function background(_ref) {
|
|
|
3349
3715
|
}
|
|
3350
3716
|
}];
|
|
3351
3717
|
};
|
|
3718
|
+
|
|
3352
3719
|
exports.default = background;
|
|
3353
3720
|
|
|
3354
3721
|
/***/ }),
|
|
@@ -3360,20 +3727,25 @@ exports.default = background;
|
|
|
3360
3727
|
|
|
3361
3728
|
|
|
3362
3729
|
var _toConsumableArray = __webpack_require__(8);
|
|
3730
|
+
|
|
3363
3731
|
var __rest = this && this.__rest || function (s, e) {
|
|
3364
3732
|
var t = {};
|
|
3733
|
+
|
|
3365
3734
|
for (var p in s) {
|
|
3366
3735
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
3367
3736
|
}
|
|
3737
|
+
|
|
3368
3738
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3369
3739
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
3370
3740
|
}
|
|
3371
3741
|
return t;
|
|
3372
3742
|
};
|
|
3743
|
+
|
|
3373
3744
|
Object.defineProperty(exports, "__esModule", {
|
|
3374
3745
|
value: true
|
|
3375
3746
|
});
|
|
3376
3747
|
exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
|
|
3748
|
+
|
|
3377
3749
|
var lodash_1 = __webpack_require__(3);
|
|
3378
3750
|
/**
|
|
3379
3751
|
* Get formatted annotations
|
|
@@ -3384,10 +3756,12 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3384
3756
|
* @param {Array} options.annotationLabel
|
|
3385
3757
|
* @returns {Array}
|
|
3386
3758
|
*/
|
|
3759
|
+
|
|
3760
|
+
|
|
3387
3761
|
var getAnnotations = function getAnnotations(_ref) {
|
|
3388
3762
|
var annotationX = _ref.annotationX,
|
|
3389
|
-
|
|
3390
|
-
|
|
3763
|
+
annotationColor = _ref.annotationColor,
|
|
3764
|
+
annotationLabel = _ref.annotationLabel;
|
|
3391
3765
|
return annotationX && annotationX.length ? annotationX.map(function (timestamp, i) {
|
|
3392
3766
|
return {
|
|
3393
3767
|
color: annotationColor && annotationColor[i],
|
|
@@ -3396,6 +3770,7 @@ var getAnnotations = function getAnnotations(_ref) {
|
|
|
3396
3770
|
};
|
|
3397
3771
|
}) : [];
|
|
3398
3772
|
};
|
|
3773
|
+
|
|
3399
3774
|
exports.getAnnotations = getAnnotations;
|
|
3400
3775
|
/**
|
|
3401
3776
|
* Truncate the result set to given limit
|
|
@@ -3404,20 +3779,25 @@ exports.getAnnotations = getAnnotations;
|
|
|
3404
3779
|
* @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']
|
|
3405
3780
|
* @returns {Object}
|
|
3406
3781
|
*/
|
|
3782
|
+
|
|
3407
3783
|
var truncateData = function truncateData(dataSet, truncationLimit) {
|
|
3408
3784
|
if (!dataSet) {
|
|
3409
3785
|
return null;
|
|
3410
3786
|
}
|
|
3787
|
+
|
|
3411
3788
|
var limit = parseInt(truncationLimit, 10);
|
|
3789
|
+
|
|
3412
3790
|
if (!limit || limit <= 0) {
|
|
3413
3791
|
return dataSet;
|
|
3414
3792
|
}
|
|
3793
|
+
|
|
3415
3794
|
var truncatedData = Object.assign({}, dataSet);
|
|
3416
3795
|
truncatedData.columns = truncatedData.columns.map(function (columnData) {
|
|
3417
3796
|
return columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData;
|
|
3418
3797
|
});
|
|
3419
3798
|
return truncatedData;
|
|
3420
3799
|
};
|
|
3800
|
+
|
|
3421
3801
|
exports.truncateData = truncateData;
|
|
3422
3802
|
/**
|
|
3423
3803
|
* Helper method to update the option values into the values that SC accepts
|
|
@@ -3425,12 +3805,14 @@ exports.truncateData = truncateData;
|
|
|
3425
3805
|
* @param {Object} options
|
|
3426
3806
|
* @returns {Object}
|
|
3427
3807
|
*/
|
|
3808
|
+
|
|
3428
3809
|
var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
3429
3810
|
return function (options) {
|
|
3430
3811
|
var convertedOptions = Object.assign({}, options);
|
|
3431
3812
|
Object.keys(optionValuesSCMapping).forEach(function (key) {
|
|
3432
3813
|
if ((0, lodash_1.has)(options, key)) {
|
|
3433
3814
|
var updatedValue = optionValuesSCMapping[key][options[key]];
|
|
3815
|
+
|
|
3434
3816
|
if (!(0, lodash_1.isUndefined)(updatedValue)) {
|
|
3435
3817
|
convertedOptions[key] = updatedValue;
|
|
3436
3818
|
}
|
|
@@ -3439,6 +3821,7 @@ var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
|
3439
3821
|
return convertedOptions;
|
|
3440
3822
|
};
|
|
3441
3823
|
};
|
|
3824
|
+
|
|
3442
3825
|
exports.mapToValues = mapToValues;
|
|
3443
3826
|
/**
|
|
3444
3827
|
* Helper method to process options related to y2Fields
|
|
@@ -3446,18 +3829,23 @@ exports.mapToValues = mapToValues;
|
|
|
3446
3829
|
* @param {Object} originalOptions
|
|
3447
3830
|
* @returns {Object}
|
|
3448
3831
|
*/
|
|
3832
|
+
|
|
3449
3833
|
var convertY2AxisOptions = function convertY2AxisOptions(_a) {
|
|
3450
3834
|
var y2Fields = _a.y2Fields,
|
|
3451
|
-
|
|
3835
|
+
originalOptions = __rest(_a, ["y2Fields"]);
|
|
3836
|
+
|
|
3452
3837
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
3838
|
+
|
|
3453
3839
|
if (y2Fields) {
|
|
3454
3840
|
convertedOptions['axisY2.enabled'] = true;
|
|
3455
3841
|
convertedOptions['axisY2.fields'] = (0, lodash_1.isArray)(y2Fields) ? y2Fields.filter(function (name) {
|
|
3456
3842
|
return name;
|
|
3457
3843
|
}).join(',') : y2Fields;
|
|
3458
3844
|
}
|
|
3845
|
+
|
|
3459
3846
|
return convertedOptions;
|
|
3460
3847
|
};
|
|
3848
|
+
|
|
3461
3849
|
exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
3462
3850
|
/**
|
|
3463
3851
|
* Helper method to format value for overlayFields
|
|
@@ -3465,9 +3853,11 @@ exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
|
3465
3853
|
* @param {Object} originalOptions
|
|
3466
3854
|
* @returns {Object}
|
|
3467
3855
|
*/
|
|
3856
|
+
|
|
3468
3857
|
var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
3469
3858
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
3470
3859
|
var overlayFields = originalOptions.overlayFields;
|
|
3860
|
+
|
|
3471
3861
|
if (overlayFields) {
|
|
3472
3862
|
convertedOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
|
|
3473
3863
|
return field;
|
|
@@ -3475,17 +3865,21 @@ var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
|
3475
3865
|
return field.trim();
|
|
3476
3866
|
}).join(',') : overlayFields;
|
|
3477
3867
|
}
|
|
3868
|
+
|
|
3478
3869
|
return convertedOptions;
|
|
3479
3870
|
};
|
|
3871
|
+
|
|
3480
3872
|
exports.convertOverlayFields = convertOverlayFields;
|
|
3481
3873
|
/**
|
|
3482
3874
|
* checks whether data is multi series data
|
|
3483
3875
|
* @param {array} data array
|
|
3484
3876
|
* @return {Boolean}
|
|
3485
3877
|
*/
|
|
3878
|
+
|
|
3486
3879
|
var isMultiSeriesData = function isMultiSeriesData(data) {
|
|
3487
3880
|
return Array.isArray(data) && Array.isArray(data[0]);
|
|
3488
3881
|
};
|
|
3882
|
+
|
|
3489
3883
|
exports.isMultiSeriesData = isMultiSeriesData;
|
|
3490
3884
|
/**
|
|
3491
3885
|
* checks whether data is multi series data and returns value as array
|
|
@@ -3493,19 +3887,22 @@ exports.isMultiSeriesData = isMultiSeriesData;
|
|
|
3493
3887
|
* @param {*} value to return as array
|
|
3494
3888
|
* @return {array}
|
|
3495
3889
|
*/
|
|
3890
|
+
|
|
3496
3891
|
var toArrayForSeries = function toArrayForSeries(data, value) {
|
|
3497
3892
|
return (0, exports.isMultiSeriesData)(data) ? value : [value];
|
|
3498
3893
|
};
|
|
3894
|
+
|
|
3499
3895
|
exports.toArrayForSeries = toArrayForSeries;
|
|
3896
|
+
|
|
3500
3897
|
var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
3501
3898
|
var _ref2$x = _ref2.x,
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3899
|
+
x = _ref2$x === void 0 ? [] : _ref2$x,
|
|
3900
|
+
_ref2$y = _ref2.y,
|
|
3901
|
+
y = _ref2$y === void 0 ? [] : _ref2$y,
|
|
3902
|
+
xField = _ref2.xField,
|
|
3903
|
+
yFields = _ref2.yFields,
|
|
3904
|
+
y2 = _ref2.y2,
|
|
3905
|
+
y2Fields = _ref2.y2Fields;
|
|
3509
3906
|
var columns = [x.map(String)].concat(_toConsumableArray((0, exports.toArrayForSeries)(y, y).map(function (series) {
|
|
3510
3907
|
return series.map(String);
|
|
3511
3908
|
})));
|
|
@@ -3516,10 +3913,10 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
3516
3913
|
return {
|
|
3517
3914
|
name: field
|
|
3518
3915
|
};
|
|
3519
|
-
})));
|
|
3520
|
-
// splunk-charting requires y2 to be part of columns
|
|
3916
|
+
}))); // splunk-charting requires y2 to be part of columns
|
|
3521
3917
|
// when y & y2 options are configured with different (mutually exclusive) series
|
|
3522
3918
|
// y2 columns need to be added to columns
|
|
3919
|
+
|
|
3523
3920
|
if (y2Fields) {
|
|
3524
3921
|
var y2FieldsArray = (0, exports.toArrayForSeries)(y2, y2Fields);
|
|
3525
3922
|
var y2AsArray = (0, exports.toArrayForSeries)(y2, y2).map(function (series) {
|
|
@@ -3534,11 +3931,13 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
3534
3931
|
}
|
|
3535
3932
|
});
|
|
3536
3933
|
}
|
|
3934
|
+
|
|
3537
3935
|
return {
|
|
3538
3936
|
columns: columns,
|
|
3539
3937
|
fields: fields
|
|
3540
3938
|
};
|
|
3541
3939
|
};
|
|
3940
|
+
|
|
3542
3941
|
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
3543
3942
|
|
|
3544
3943
|
/***/ }),
|
|
@@ -3561,6 +3960,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3561
3960
|
});
|
|
3562
3961
|
exports.VizBehavior = void 0;
|
|
3563
3962
|
var VizBehavior;
|
|
3963
|
+
|
|
3564
3964
|
(function (VizBehavior) {
|
|
3565
3965
|
/**
|
|
3566
3966
|
* Dynamic Options Behavior.
|
|
@@ -3580,6 +3980,7 @@ var VizBehavior;
|
|
|
3580
3980
|
* missing.
|
|
3581
3981
|
* @type {string}
|
|
3582
3982
|
*/
|
|
3983
|
+
|
|
3583
3984
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
3584
3985
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
3585
3986
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -3601,6 +4002,13 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
3601
4002
|
|
|
3602
4003
|
/***/ }),
|
|
3603
4004
|
|
|
4005
|
+
/***/ 83:
|
|
4006
|
+
/***/ (function(module, exports) {
|
|
4007
|
+
|
|
4008
|
+
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
4009
|
+
|
|
4010
|
+
/***/ }),
|
|
4011
|
+
|
|
3604
4012
|
/***/ 9:
|
|
3605
4013
|
/***/ (function(module, exports) {
|
|
3606
4014
|
|
|
@@ -3608,7 +4016,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
3608
4016
|
|
|
3609
4017
|
/***/ }),
|
|
3610
4018
|
|
|
3611
|
-
/***/
|
|
4019
|
+
/***/ 93:
|
|
3612
4020
|
/***/ (function(module, exports) {
|
|
3613
4021
|
|
|
3614
4022
|
module.exports = require("d3-scale");
|
|
@@ -3622,15 +4030,20 @@ module.exports = require("d3-scale");
|
|
|
3622
4030
|
|
|
3623
4031
|
|
|
3624
4032
|
var _slicedToArray = __webpack_require__(17);
|
|
4033
|
+
|
|
3625
4034
|
Object.defineProperty(exports, "__esModule", {
|
|
3626
4035
|
value: true
|
|
3627
4036
|
});
|
|
3628
4037
|
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
|
-
|
|
4038
|
+
|
|
4039
|
+
var d3_scale_1 = __webpack_require__(93);
|
|
3630
4040
|
/**
|
|
3631
4041
|
* @enum {AXIS_ORIENTATION_TYPES}
|
|
3632
4042
|
*/
|
|
4043
|
+
|
|
4044
|
+
|
|
3633
4045
|
var AXIS_ORIENTATION_TYPES;
|
|
4046
|
+
|
|
3634
4047
|
(function (AXIS_ORIENTATION_TYPES) {
|
|
3635
4048
|
AXIS_ORIENTATION_TYPES["VERTICAL"] = "vertical";
|
|
3636
4049
|
AXIS_ORIENTATION_TYPES["HORIZONTAL"] = "horizontal";
|
|
@@ -3638,7 +4051,10 @@ var AXIS_ORIENTATION_TYPES;
|
|
|
3638
4051
|
/**
|
|
3639
4052
|
* @enum {BUBBLE_ROW_SCALE_TYPES}
|
|
3640
4053
|
*/
|
|
4054
|
+
|
|
4055
|
+
|
|
3641
4056
|
var BUBBLE_ROW_SCALE_TYPES;
|
|
4057
|
+
|
|
3642
4058
|
(function (BUBBLE_ROW_SCALE_TYPES) {
|
|
3643
4059
|
BUBBLE_ROW_SCALE_TYPES["GLOBAL"] = "global";
|
|
3644
4060
|
BUBBLE_ROW_SCALE_TYPES["ROW"] = "row";
|
|
@@ -3646,7 +4062,10 @@ var BUBBLE_ROW_SCALE_TYPES;
|
|
|
3646
4062
|
/**
|
|
3647
4063
|
* @enum {BUBBLE_SCALE_TYPES}
|
|
3648
4064
|
*/
|
|
4065
|
+
|
|
4066
|
+
|
|
3649
4067
|
var BUBBLE_SCALE_TYPES;
|
|
4068
|
+
|
|
3650
4069
|
(function (BUBBLE_SCALE_TYPES) {
|
|
3651
4070
|
BUBBLE_SCALE_TYPES["RADIUS"] = "radius";
|
|
3652
4071
|
BUBBLE_SCALE_TYPES["AREA"] = "area";
|
|
@@ -3654,7 +4073,10 @@ var BUBBLE_SCALE_TYPES;
|
|
|
3654
4073
|
/**
|
|
3655
4074
|
* @enum {COLOR_MODE_TYPES}
|
|
3656
4075
|
*/
|
|
4076
|
+
|
|
4077
|
+
|
|
3657
4078
|
var COLOR_MODE_TYPES;
|
|
4079
|
+
|
|
3658
4080
|
(function (COLOR_MODE_TYPES) {
|
|
3659
4081
|
COLOR_MODE_TYPES["SEQUENTIAL"] = "sequential";
|
|
3660
4082
|
COLOR_MODE_TYPES["CATEGORICAL"] = "categorical";
|
|
@@ -3662,7 +4084,10 @@ var COLOR_MODE_TYPES;
|
|
|
3662
4084
|
/**
|
|
3663
4085
|
* @enum {BUBBLE_LABELS_TYPES}
|
|
3664
4086
|
*/
|
|
4087
|
+
|
|
4088
|
+
|
|
3665
4089
|
var BUBBLE_LABELS_TYPES;
|
|
4090
|
+
|
|
3666
4091
|
(function (BUBBLE_LABELS_TYPES) {
|
|
3667
4092
|
BUBBLE_LABELS_TYPES["ALL"] = "all";
|
|
3668
4093
|
BUBBLE_LABELS_TYPES["MAX"] = "max";
|
|
@@ -3671,6 +4096,8 @@ var BUBBLE_LABELS_TYPES;
|
|
|
3671
4096
|
/**
|
|
3672
4097
|
* @string GRAYSCALE_FILTER_ID
|
|
3673
4098
|
*/
|
|
4099
|
+
|
|
4100
|
+
|
|
3674
4101
|
exports.GRAYSCALE_FILTER_ID = "punchcard-grayscale-filter-id-".concat(Math.floor(Math.random() * 1000));
|
|
3675
4102
|
var X_AXIS_HEIGHT = 15;
|
|
3676
4103
|
var Y_AXIS_WIDTH = 77;
|
|
@@ -3686,15 +4113,19 @@ var HORIZONTAL_SPACE_FOR_SINGLE_CHAR = 6;
|
|
|
3686
4113
|
* @param {Array<String>} seriesColors
|
|
3687
4114
|
* @return {Function} colorCategoryMapping
|
|
3688
4115
|
*/
|
|
4116
|
+
|
|
3689
4117
|
var getColorCategoryMapping = function getColorCategoryMapping(_ref) {
|
|
3690
4118
|
var category = _ref.category,
|
|
3691
|
-
|
|
3692
|
-
|
|
4119
|
+
colorMode = _ref.colorMode,
|
|
4120
|
+
seriesColors = _ref.seriesColors;
|
|
4121
|
+
|
|
3693
4122
|
if (colorMode === COLOR_MODE_TYPES.SEQUENTIAL) {
|
|
3694
4123
|
return null;
|
|
3695
4124
|
}
|
|
4125
|
+
|
|
3696
4126
|
return (0, d3_scale_1.scaleOrdinal)().domain(category).range(seriesColors).unknown(seriesColors[0]);
|
|
3697
4127
|
};
|
|
4128
|
+
|
|
3698
4129
|
exports.getColorCategoryMapping = getColorCategoryMapping;
|
|
3699
4130
|
/**
|
|
3700
4131
|
* get punchcard dimensions given container width and height
|
|
@@ -3711,18 +4142,21 @@ exports.getColorCategoryMapping = getColorCategoryMapping;
|
|
|
3711
4142
|
* @return {Number} dimensions.chartAreaEndX
|
|
3712
4143
|
* @return {Number} dimensions.chartAreaEndY
|
|
3713
4144
|
*/
|
|
4145
|
+
|
|
3714
4146
|
var getChartAreaDimensions = function getChartAreaDimensions(_ref2) {
|
|
3715
4147
|
var containerWidth = _ref2.containerWidth,
|
|
3716
|
-
|
|
3717
|
-
|
|
4148
|
+
containerHeight = _ref2.containerHeight,
|
|
4149
|
+
displayLegend = _ref2.displayLegend;
|
|
3718
4150
|
var yAxisStartX = MARGIN;
|
|
3719
4151
|
var chartAreaStartX = yAxisStartX + Y_AXIS_WIDTH + MARGIN;
|
|
3720
4152
|
var chartAreaEndX = containerWidth - MARGIN;
|
|
3721
4153
|
var legendStartX = null;
|
|
4154
|
+
|
|
3722
4155
|
if (displayLegend) {
|
|
3723
4156
|
legendStartX = containerWidth - LEGEND_WIDTH;
|
|
3724
4157
|
chartAreaEndX = legendStartX - MARGIN;
|
|
3725
4158
|
}
|
|
4159
|
+
|
|
3726
4160
|
var chartAreaStartY = MARGIN;
|
|
3727
4161
|
var xAxisStartY = containerHeight - X_AXIS_HEIGHT - MARGIN;
|
|
3728
4162
|
var chartAreaEndY = xAxisStartY - MARGIN;
|
|
@@ -3736,6 +4170,7 @@ var getChartAreaDimensions = function getChartAreaDimensions(_ref2) {
|
|
|
3736
4170
|
legendStartX: legendStartX
|
|
3737
4171
|
};
|
|
3738
4172
|
};
|
|
4173
|
+
|
|
3739
4174
|
exports.getChartAreaDimensions = getChartAreaDimensions;
|
|
3740
4175
|
/**
|
|
3741
4176
|
* gets a scale used to map values to x or y plane
|
|
@@ -3748,20 +4183,23 @@ exports.getChartAreaDimensions = getChartAreaDimensions;
|
|
|
3748
4183
|
* @return {Function} scales.scale function to return beginning of band
|
|
3749
4184
|
* @return {Function} scales.positionScale function to return middle of band
|
|
3750
4185
|
*/
|
|
4186
|
+
|
|
3751
4187
|
var getScales = function getScales(_ref3) {
|
|
3752
4188
|
var values = _ref3.values,
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
var scale = (0, d3_scale_1.scaleBand)().domain(values).range([start, end]);
|
|
3756
|
-
|
|
4189
|
+
start = _ref3.start,
|
|
4190
|
+
end = _ref3.end;
|
|
4191
|
+
var scale = (0, d3_scale_1.scaleBand)().domain(values).range([start, end]); // Returns the middle of the band
|
|
4192
|
+
|
|
3757
4193
|
var positionScale = function positionScale(value) {
|
|
3758
4194
|
return scale(value) + scale.bandwidth() / 2;
|
|
3759
4195
|
};
|
|
4196
|
+
|
|
3760
4197
|
return {
|
|
3761
4198
|
scale: scale,
|
|
3762
4199
|
positionScale: positionScale
|
|
3763
4200
|
};
|
|
3764
4201
|
};
|
|
4202
|
+
|
|
3765
4203
|
exports.getScales = getScales;
|
|
3766
4204
|
/**
|
|
3767
4205
|
* Maps an array of values to a percentage
|
|
@@ -3770,6 +4208,7 @@ exports.getScales = getScales;
|
|
|
3770
4208
|
* @param {Array<Number>} values
|
|
3771
4209
|
* @return {Function} radiusScale
|
|
3772
4210
|
*/
|
|
4211
|
+
|
|
3773
4212
|
var createValueScale = function createValueScale(values) {
|
|
3774
4213
|
var absValuesWithoutZero = [];
|
|
3775
4214
|
values.forEach(function (value) {
|
|
@@ -3780,6 +4219,7 @@ var createValueScale = function createValueScale(values) {
|
|
|
3780
4219
|
});
|
|
3781
4220
|
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
4221
|
};
|
|
4222
|
+
|
|
3783
4223
|
exports.createValueScale = createValueScale;
|
|
3784
4224
|
/**
|
|
3785
4225
|
* Given a dataset, partition it by row and for each row:
|
|
@@ -3804,23 +4244,24 @@ exports.createValueScale = createValueScale;
|
|
|
3804
4244
|
* @param {Number} minBubbleRadius // Used when !isBubbleSizeDynamic
|
|
3805
4245
|
* @return {Object<String\|Number, RowData>} dataByRows
|
|
3806
4246
|
*/
|
|
4247
|
+
|
|
3807
4248
|
var getDataByRows = function getDataByRows(_ref4) {
|
|
3808
4249
|
var bubbleRowScale = _ref4.bubbleRowScale,
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
4250
|
+
bubbleScale = _ref4.bubbleScale,
|
|
4251
|
+
category = _ref4.category,
|
|
4252
|
+
colorCategoryMapping = _ref4.colorCategoryMapping,
|
|
4253
|
+
colorMode = _ref4.colorMode,
|
|
4254
|
+
bubbleColor = _ref4.bubbleColor,
|
|
4255
|
+
minBubbleColorIntensity = _ref4.minBubbleColorIntensity,
|
|
4256
|
+
size = _ref4.size,
|
|
4257
|
+
x = _ref4.x,
|
|
4258
|
+
y = _ref4.y,
|
|
4259
|
+
isBubbleSizeDynamic = _ref4.isBubbleSizeDynamic,
|
|
4260
|
+
minBubbleSize = _ref4.minBubbleSize,
|
|
4261
|
+
maxBubbleSize = _ref4.maxBubbleSize,
|
|
4262
|
+
minBand = _ref4.minBand,
|
|
4263
|
+
maxBubbleRadius = _ref4.maxBubbleRadius,
|
|
4264
|
+
minBubbleRadius = _ref4.minBubbleRadius;
|
|
3824
4265
|
var dataByRows = {};
|
|
3825
4266
|
var minRadius = isBubbleSizeDynamic ? minBand / 2 * minBubbleSize : minBubbleRadius;
|
|
3826
4267
|
var maxRadius = isBubbleSizeDynamic ? minBand / 2 * maxBubbleSize : maxBubbleRadius;
|
|
@@ -3828,25 +4269,30 @@ var getDataByRows = function getDataByRows(_ref4) {
|
|
|
3828
4269
|
var maxArea = Math.PI * Math.pow(maxRadius, 2);
|
|
3829
4270
|
var isBubbleColorAnArray = Array.isArray(bubbleColor);
|
|
3830
4271
|
var globalSizeScale = (0, exports.createValueScale)(size);
|
|
4272
|
+
|
|
3831
4273
|
var getRadiusValue = function getRadiusValue(value, sizeScale) {
|
|
3832
4274
|
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
4275
|
};
|
|
4276
|
+
|
|
3834
4277
|
var getColorValue = function getColorValue(c) {
|
|
3835
4278
|
return colorMode === COLOR_MODE_TYPES.CATEGORICAL ? colorCategoryMapping(c) : bubbleColor;
|
|
3836
4279
|
};
|
|
4280
|
+
|
|
3837
4281
|
var getOpacityValue = function getOpacityValue(value, sizeScale) {
|
|
3838
4282
|
return colorMode === COLOR_MODE_TYPES.CATEGORICAL || isBubbleColorAnArray ? 1 : sizeScale(Math.abs(value)) * (1 - minBubbleColorIntensity) + minBubbleColorIntensity;
|
|
3839
4283
|
};
|
|
4284
|
+
|
|
3840
4285
|
y.forEach(function (yValue, index) {
|
|
3841
4286
|
var xValue = x[index];
|
|
3842
4287
|
var sizeValue = size[index];
|
|
3843
4288
|
var categoryValue = category && category[index] ? category[index] : null;
|
|
3844
|
-
var bubbleColorValue = colorMode === COLOR_MODE_TYPES.SEQUENTIAL && isBubbleColorAnArray ? bubbleColor[index] : getColorValue(categoryValue);
|
|
3845
|
-
|
|
4289
|
+
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
|
|
4290
|
+
|
|
3846
4291
|
if (xValue == null || yValue == null || sizeValue == null) {
|
|
3847
4292
|
return;
|
|
3848
|
-
}
|
|
3849
|
-
|
|
4293
|
+
} // initialize rowData
|
|
4294
|
+
|
|
4295
|
+
|
|
3850
4296
|
if (!dataByRows[yValue]) {
|
|
3851
4297
|
dataByRows[yValue] = {
|
|
3852
4298
|
rowXValues: [],
|
|
@@ -3858,30 +4304,34 @@ var getDataByRows = function getDataByRows(_ref4) {
|
|
|
3858
4304
|
rowRadiusValues: []
|
|
3859
4305
|
};
|
|
3860
4306
|
}
|
|
4307
|
+
|
|
3861
4308
|
dataByRows[yValue].rowXValues.push(xValue);
|
|
3862
4309
|
dataByRows[yValue].rowSizeValues.push(sizeValue);
|
|
3863
4310
|
dataByRows[yValue].rowCategoryValues.push(categoryValue);
|
|
3864
4311
|
dataByRows[yValue].rowColorValues.push(bubbleColorValue);
|
|
3865
4312
|
dataByRows[yValue].rowFillOpacityValues.push(getOpacityValue(size[index], dataByRows[yValue].rowSizeScale));
|
|
3866
4313
|
dataByRows[yValue].rowRadiusValues.push(getRadiusValue(size[index], dataByRows[yValue].rowSizeScale));
|
|
3867
|
-
});
|
|
3868
|
-
|
|
4314
|
+
}); // If we are using row scaling we need to recalculate opacity, radius and size scale
|
|
4315
|
+
|
|
3869
4316
|
if (bubbleRowScale === BUBBLE_ROW_SCALE_TYPES.ROW) {
|
|
3870
4317
|
Object.entries(dataByRows).forEach(function (_ref5) {
|
|
3871
4318
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
3872
|
-
|
|
3873
|
-
|
|
4319
|
+
row = _ref6[0],
|
|
4320
|
+
rowData = _ref6[1];
|
|
4321
|
+
|
|
3874
4322
|
var rowSizeScale = (0, exports.createValueScale)(rowData.rowSizeValues);
|
|
3875
|
-
dataByRows[row].rowSizeScale = rowSizeScale;
|
|
3876
|
-
|
|
4323
|
+
dataByRows[row].rowSizeScale = rowSizeScale; // Fill in opacity and radius values based on row scale
|
|
4324
|
+
|
|
3877
4325
|
rowData.rowSizeValues.forEach(function (rowSizeValue, index) {
|
|
3878
4326
|
dataByRows[row].rowFillOpacityValues[index] = getOpacityValue(rowData.rowSizeValues[index], rowSizeScale);
|
|
3879
4327
|
dataByRows[row].rowRadiusValues[index] = getRadiusValue(rowData.rowSizeValues[index], rowSizeScale);
|
|
3880
4328
|
});
|
|
3881
4329
|
});
|
|
3882
4330
|
}
|
|
4331
|
+
|
|
3883
4332
|
return dataByRows;
|
|
3884
4333
|
};
|
|
4334
|
+
|
|
3885
4335
|
exports.getDataByRows = getDataByRows;
|
|
3886
4336
|
/**
|
|
3887
4337
|
* Given selected dimensions
|
|
@@ -3893,12 +4343,14 @@ exports.getDataByRows = getDataByRows;
|
|
|
3893
4343
|
* @param {String} selectedCategory
|
|
3894
4344
|
* @return {Boolean}
|
|
3895
4345
|
*/
|
|
4346
|
+
|
|
3896
4347
|
var isSomethingSelected = function isSomethingSelected(_ref7) {
|
|
3897
4348
|
var selectedX = _ref7.selectedX,
|
|
3898
|
-
|
|
3899
|
-
|
|
4349
|
+
selectedY = _ref7.selectedY,
|
|
4350
|
+
selectedCategory = _ref7.selectedCategory;
|
|
3900
4351
|
return selectedX !== null || selectedY !== null || selectedCategory !== null;
|
|
3901
4352
|
};
|
|
4353
|
+
|
|
3902
4354
|
exports.isSomethingSelected = isSomethingSelected;
|
|
3903
4355
|
/**
|
|
3904
4356
|
* Given selected dimensions and a specific bubble's values
|
|
@@ -3913,24 +4365,30 @@ exports.isSomethingSelected = isSomethingSelected;
|
|
|
3913
4365
|
* @param {Boolean} categoryValue
|
|
3914
4366
|
* @return {Boolean}
|
|
3915
4367
|
*/
|
|
4368
|
+
|
|
3916
4369
|
var isBubbleSelected = function isBubbleSelected(_ref8) {
|
|
3917
4370
|
var selectedX = _ref8.selectedX,
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
4371
|
+
selectedY = _ref8.selectedY,
|
|
4372
|
+
selectedCategory = _ref8.selectedCategory,
|
|
4373
|
+
xValue = _ref8.xValue,
|
|
4374
|
+
yValue = _ref8.yValue,
|
|
4375
|
+
categoryValue = _ref8.categoryValue;
|
|
4376
|
+
|
|
3923
4377
|
if (selectedX !== null && xValue !== selectedX) {
|
|
3924
4378
|
return false;
|
|
3925
4379
|
}
|
|
4380
|
+
|
|
3926
4381
|
if (selectedY !== null && yValue !== selectedY) {
|
|
3927
4382
|
return false;
|
|
3928
4383
|
}
|
|
4384
|
+
|
|
3929
4385
|
if (selectedCategory !== null && categoryValue !== selectedCategory) {
|
|
3930
4386
|
return false;
|
|
3931
4387
|
}
|
|
4388
|
+
|
|
3932
4389
|
return true;
|
|
3933
4390
|
};
|
|
4391
|
+
|
|
3934
4392
|
exports.isBubbleSelected = isBubbleSelected;
|
|
3935
4393
|
/**
|
|
3936
4394
|
* Given text and available width, the truncateAxisLabelText will ellipsize
|
|
@@ -3941,28 +4399,35 @@ exports.isBubbleSelected = isBubbleSelected;
|
|
|
3941
4399
|
* @param {Number} widthInPX - Available width to render the text
|
|
3942
4400
|
* @param {('ellipsisStart' | 'ellipsisEnd')} axisLabelOverflowMode - Truncate start or end of the text
|
|
3943
4401
|
*/
|
|
4402
|
+
|
|
3944
4403
|
var truncateAxisLabelText = function truncateAxisLabelText(_ref9) {
|
|
3945
4404
|
var label = _ref9.label,
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4405
|
+
_ref9$widthInPX = _ref9.widthInPX,
|
|
4406
|
+
widthInPX = _ref9$widthInPX === void 0 ? Y_AXIS_WIDTH : _ref9$widthInPX,
|
|
4407
|
+
_ref9$axisLabelOverfl = _ref9.axisLabelOverflowMode,
|
|
4408
|
+
axisLabelOverflowMode = _ref9$axisLabelOverfl === void 0 ? 'ellipsisEnd' : _ref9$axisLabelOverfl;
|
|
3950
4409
|
// convert available width to number of characters that can be rendered.
|
|
3951
4410
|
var availableLength = Math.floor(widthInPX / HORIZONTAL_SPACE_FOR_SINGLE_CHAR);
|
|
4411
|
+
|
|
3952
4412
|
if (label.length <= availableLength) {
|
|
3953
4413
|
return label;
|
|
3954
|
-
}
|
|
3955
|
-
// return empty string if available space cannot accomodate
|
|
4414
|
+
} // return empty string if available space cannot accomodate
|
|
3956
4415
|
// at least one label character
|
|
4416
|
+
|
|
4417
|
+
|
|
3957
4418
|
if (availableLength < 'X...'.length) {
|
|
3958
4419
|
return '';
|
|
3959
4420
|
}
|
|
4421
|
+
|
|
3960
4422
|
var endMarker = Math.max(0, availableLength - '...'.length);
|
|
4423
|
+
|
|
3961
4424
|
if (axisLabelOverflowMode === 'ellipsisStart') {
|
|
3962
4425
|
return "...".concat(label.slice(-endMarker));
|
|
3963
4426
|
}
|
|
4427
|
+
|
|
3964
4428
|
return "".concat(label.slice(0, endMarker), "...");
|
|
3965
4429
|
};
|
|
4430
|
+
|
|
3966
4431
|
exports.truncateAxisLabelText = truncateAxisLabelText;
|
|
3967
4432
|
|
|
3968
4433
|
/***/ })
|